common

package
v0.1.0-alpha.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LabelAppNameKey is a key of a label which sets the name of the resource.
	LabelAppNameKey = "app.kubernetes.io/name"
	// LabelManagedByKey is a key of a label which sets the operator which manages this resource.
	LabelManagedByKey = "app.kubernetes.io/managed-by"
	// LabelPartOfKey is a key of a label which sets the type of the resource.
	LabelPartOfKey = "app.kubernetes.io/part-of"
	// LabelManagedByValue is the value for LabelManagedByKey
	LabelManagedByValue = "grove-operator"
	// LabelComponentKey is a key for a label that sets the component type on resources provisioned for a PodCliqueSet.
	LabelComponentKey = "app.kubernetes.io/component"
	// LabelPodClique is a key for a label that sets the PodClique name.
	LabelPodClique = "grove.io/podclique"
	// LabelPodGang is a key for a label that sets the PodGang name.
	LabelPodGang = "grove.io/podgang"
	// LabelBasePodGang is a key for a label that sets the base PodGang name for scaled PodGangs.
	// This label is present on scaled PodGangs (beyond MinAvailable) and points to their base PodGang.
	LabelBasePodGang = "grove.io/base-podgang"
	// LabelPodCliqueSetReplicaIndex is a key for a label that sets the replica index of a PodCliqueSet.
	LabelPodCliqueSetReplicaIndex = "grove.io/podcliqueset-replica-index"
	// LabelPodCliqueScalingGroup is a key for a label that sets the PodCliqueScalingGroup name.
	LabelPodCliqueScalingGroup = "grove.io/podcliquescalinggroup"
	// LabelPodCliqueScalingGroupReplicaIndex is a key for a label that sets the replica index of a PodCliqueScalingGroup within PodCliqueSet.
	LabelPodCliqueScalingGroupReplicaIndex = "grove.io/podcliquescalinggroup-replica-index"
	// LabelPodTemplateHash is a key for a label that sets the hash of the PodSpec. This label will be set on a PodClique and will be shared by all pods in the PodClique.
	LabelPodTemplateHash = "grove.io/pod-template-hash"
)

Common label keys to be placed on all resources managed by grove operator.

View Source
const (
	// LabelComponentNamePodCliqueSetReplicaHeadlessService is the label key representing the component name for a
	// Headless service for a PodCliqueSet replica.
	LabelComponentNamePodCliqueSetReplicaHeadlessService = "pcs-headless-service"
	// LabelComponentNamePodRole is the label key representing the component name for a role that is associated to all
	// Pods that are created for a PodCliqueSet.
	LabelComponentNamePodRole = "pod-role"
	// LabelComponentNamePodRoleBinding is the label key representing the component name for a RoleBinding to a Role
	// that is associated to all Pods that are created for a PodCliqueSet.
	LabelComponentNamePodRoleBinding = "pod-role-binding"
	// LabelComponentNamePodServiceAccount is the label key representing the component name  for a ServiceAccount that
	// is used by all Pods that are created for a PodCliqueSet.
	LabelComponentNamePodServiceAccount = "pod-service-account"
	// LabelComponentNameServiceAccountTokenSecret is the label key representing the component name for a Secret for
	// generating service account token that is used by an init container responsible for enforcing start-up ordering in
	// each Pod for a PodCliqueSet.
	LabelComponentNameServiceAccountTokenSecret = "pod-sa-token-secret"
	// LabelComponentNamePodCliqueScalingGroup is the label key representing the component name for a
	// PodCliqueScalingGroup resource.
	LabelComponentNamePodCliqueScalingGroup = "pcs-podcliquescalinggroup"
	// LabelComponentNameHorizontalPodAutoscaler is the label key representing the component name for
	// a HorizontalPodAutoscaler that is created for every PodClique and/or PodCliqueScalingGroup that has
	// ScaleConfig defined.
	LabelComponentNameHorizontalPodAutoscaler = "pcs-hpa"
	// LabelComponentNamePodGang is the label key representing the component name for a PodGang resource.
	LabelComponentNamePodGang = "podgang"
	// LabelComponentNamePodCliqueSetPodClique is the label key representing the component name for a PodClique
	// whose owner is PodCliqueSet. These PodCliques do not belong to any PodCliqueScalingGroup.
	LabelComponentNamePodCliqueSetPodClique = "pcs-podclique"
	// LabelComponentNamePodCliqueScalingGroupPodClique is the label key representing the component name
	// for a PodClique whose owner is a PodCliqueScalingGroup.
	LabelComponentNamePodCliqueScalingGroupPodClique = "pcsg-podclique"
)

Labels for setting component names for all managed resources whose lifecycle is managed by grove operator and are provisioned as part of a PodCliqueSet These component names will be set against LabelComponentKey label key on respective components.

Variables

This section is empty.

Functions

func CreatePodGangNameFromPCSGFQN

func CreatePodGangNameFromPCSGFQN(pcsgFQN string, scaledPodGangIndex int) string

CreatePodGangNameFromPCSGFQN generates the PodGang name for a replica of a PodCliqueScalingGroup when the PCSG name is already fully qualified.

func ExtractScalingGroupNameFromPCSGFQN

func ExtractScalingGroupNameFromPCSGFQN(pcsgFQN string, pcsNameReplica ResourceNameReplica) string

ExtractScalingGroupNameFromPCSGFQN extracts the scaling group name from a PodCliqueScalingGroup FQN. For example, "simple1-0-sga" with pcsNameReplica="simple1-0" returns "sga".

func GenerateBasePodGangName

func GenerateBasePodGangName(pcsNameReplica ResourceNameReplica) string

GenerateBasePodGangName generates a base PodGang name for a PodCliqueSet replica. This is used for PodGangs that are not part of scaled scaling group replicas.

func GenerateHeadlessServiceAddress

func GenerateHeadlessServiceAddress(pcsNameReplica ResourceNameReplica, namespace string) string

GenerateHeadlessServiceAddress generates a headless service address based on the PodCliqueSet name, replica index, and namespace. The address is in the format: <headless-service-name>.<namespace>.svc.cluster.local

func GenerateHeadlessServiceName

func GenerateHeadlessServiceName(pcsNameReplica ResourceNameReplica) string

GenerateHeadlessServiceName generates a headless service name based on the PodCliqueSet name and replica index.

func GenerateInitContainerSATokenSecretName

func GenerateInitContainerSATokenSecretName(pcsName string) string

GenerateInitContainerSATokenSecretName generates a Secret name containing a service account token that will be mounted onto the init container responsible for ensuring start-up order amongst PodCliques.

func GeneratePodCliqueName

func GeneratePodCliqueName(ownerNameReplica ResourceNameReplica, pclqTemplateName string) string

GeneratePodCliqueName generates a PodClique name based on the PodCliqueSet name, replica index, and PodCliqueTemplate name.

func GeneratePodCliqueScalingGroupName

func GeneratePodCliqueScalingGroupName(pcsNameReplica ResourceNameReplica, pclqScalingGroupName string) string

GeneratePodCliqueScalingGroupName generates a PodCliqueScalingGroup name based on the PodCliqueSet name, replica index and PodCliqueScalingGroup name. PodCliqueScalingGroup name is only guaranteed to be unique within the PodCliqueSet, so it is prefixed with the PodCliqueSet name and its replica index.

func GeneratePodGangNameForPodCliqueOwnedByPCSG

func GeneratePodGangNameForPodCliqueOwnedByPCSG(pcs *v1alpha1.PodCliqueSet, pcsReplicaIndex int, pcsg *v1alpha1.PodCliqueScalingGroup, pcsgReplicaIndex int) string

GeneratePodGangNameForPodCliqueOwnedByPCSG generates the PodGang name for a PodClique that is owned by a PodCliqueScalingGroup, using the PCSG object directly (no config lookup needed).

func GeneratePodGangNameForPodCliqueOwnedByPodCliqueSet

func GeneratePodGangNameForPodCliqueOwnedByPodCliqueSet(pcs *v1alpha1.PodCliqueSet, pcsReplicaIndex int) string

GeneratePodGangNameForPodCliqueOwnedByPodCliqueSet generates the PodGang name for a PodClique that is directly owned by a PodCliqueSet.

func GeneratePodRoleBindingName

func GeneratePodRoleBindingName(pcsName string) string

GeneratePodRoleBindingName generates a role binding name. The role binding will bind the role to the service account that are created for the init container responsible for ensuring start-up order amongst PodCliques.

func GeneratePodRoleName

func GeneratePodRoleName(pcsName string) string

GeneratePodRoleName generates a Pod role name. This role will be associated to an init container within each Pod for a PodCliqueSet. The init container is created by the operator and is responsible for ensuring start-up order amongst PodCliques.

func GeneratePodServiceAccountName

func GeneratePodServiceAccountName(pcsName string) string

GeneratePodServiceAccountName generates a Pod service account used by all the init containers within the PodCliqueSet (one per pod) that are responsible for ensuring start-up order amongst PodCliques.

func GetDefaultLabelsForPodCliqueSetManagedResources

func GetDefaultLabelsForPodCliqueSetManagedResources(pcsName string) map[string]string

GetDefaultLabelsForPodCliqueSetManagedResources gets the default labels for resources managed by PodCliqueSet.

Types

type ResourceNameReplica

type ResourceNameReplica struct {
	// Name is the name of the resource.
	Name string
	// Replica is the index of the replica within the resource.
	Replica int
}

ResourceNameReplica is a type that holds a resource name and its replica index.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL