Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyAWSLoadBalancerTargetNodesAnnotation(svc *corev1.Service, hcp *hyperv1.HostedControlPlane)
- func CollectLBMessageIfNotProvisioned(svc *corev1.Service, messageCollector events.MessageCollector) (string, error)
- func CopyConfigMap(cm, source *corev1.ConfigMap)
- func CreateTokenForServiceAccount(ctx context.Context, serviceAccount *corev1.ServiceAccount, ...) (string, error)
- func DeleteAllIfNeeded(ctx context.Context, c client.Client, o ...client.Object) error
- func DeleteIfNeeded(ctx context.Context, c client.Client, o client.Object) (exists bool, err error)
- func DeleteIfNeededWithOptions(ctx context.Context, c client.Client, o client.Object, ...) (exists bool, err error)
- func DeleteIfNeededWithPredicate[T client.Object](ctx context.Context, c client.Client, o T, predicate func(T) bool) (exists bool, err error)
- func DeserializeResource(data string, resource runtime.Object, objectTyper runtime.ObjectTyper) error
- func EnsureOwnerRef(resource client.Object, ownerRef *metav1.OwnerReference)
- func EnsurePullSecret(serviceAccount *corev1.ServiceAccount, secretName string)
- func ExtractHostedControlPlaneOwnerName(ownerRefs []metav1.OwnerReference) string
- func ExtractLoadBalancerIP(svc *corev1.Service) (string, bool)
- func FindJobCondition(object *batchv1.Job, conditionType batchv1.JobConditionType) *batchv1.JobCondition
- func GetHostedClusterManagedResources(platformsInstalled string) []client.Object
- func GetNodePoolManagedResources(platformsInstalled string) []client.Object
- func HasAnnotationWithValue(obj metav1.Object, key, expectedValue string) bool
- func HostedClusterFromAnnotation(ctx context.Context, reader client.Reader, obj client.Object) (*hyperv1.HostedCluster, error)
- func ParseNodeSelector(str string) map[string]string
- func SerializeResource(resource runtime.Object, objectTyper runtime.ObjectTyper) (string, error)
- func ServiceAccountClient(client kubernetes.Interface, namespace string) corev1client.ServiceAccountInterface
- func UpdateObject[T client.Object](ctx context.Context, c client.Client, obj T, mutate func() error) error
- type ServiceAccountTokenCreator
Constants ¶
const ( // DebugDeploymentsAnnotation contains a comma separated list of deployment names which should always be scaled to 0 // for development. DebugDeploymentsAnnotation = "hypershift.openshift.io/debug-deployments" // EnableHostedClustersAnnotationScopingEnv is the env var that enables annotation-based scoping for hosted clusters. EnableHostedClustersAnnotationScopingEnv = "ENABLE_HOSTEDCLUSTERS_ANNOTATION_SCOPING" // HostedClustersScopeAnnotationEnv is the env var that specifies the scope annotation value to match. HostedClustersScopeAnnotationEnv = "HOSTEDCLUSTERS_SCOPE_ANNOTATION" // HostedClustersScopeAnnotation is the annotation key used to scope hosted clusters to specific operators. HostedClustersScopeAnnotation = "hypershift.openshift.io/scope" // HostedClusterAnnotation is the annotation key that links a resource to its owning HostedCluster (namespace/name). HostedClusterAnnotation = "hypershift.openshift.io/cluster" // GCPLabelCluster is the GCP resource label key used to identify the HostedCluster name. GCPLabelCluster = "hypershift-openshift-io-cluster" // GCPLabelInfraID is the GCP resource label key used to identify the infrastructure ID. GCPLabelInfraID = "hypershift-openshift-io-infra-id" )
Variables ¶
var ( BaseResources = []client.Object{ &capiv1.Cluster{}, } AWSResources = []client.Object{ &capiaws.AWSCluster{}, &hyperv1.AWSEndpointService{}, } AzureResources = []client.Object{ &capiazure.AzureCluster{}, &capiazure.AzureClusterIdentity{}, } ManagedAzure = []client.Object{ &secretsstorev1.SecretProviderClass{}, } IBMCloudResources = []client.Object{ &capiibmv1.IBMVPCCluster{}, } KubevirtResources = []client.Object{ &capikubevirt.KubevirtCluster{}, } AgentResources = []client.Object{ &agentv1.AgentCluster{}, } OpenStackResources = []client.Object{ &capiopenstackv1beta1.OpenStackCluster{}, } AWSNodePoolResources = []client.Object{ &capiaws.AWSMachineTemplate{}, } AzureNodePoolResources = []client.Object{ &capiazure.AzureMachineTemplate{}, } AgentNodePoolResources = []client.Object{ &agentv1.AgentMachineTemplate{}, } OpenStackNodePoolResources = []client.Object{ &capiopenstackv1beta1.OpenStackMachineTemplate{}, } )
Functions ¶
func ApplyAWSLoadBalancerTargetNodesAnnotation ¶
func ApplyAWSLoadBalancerTargetNodesAnnotation(svc *corev1.Service, hcp *hyperv1.HostedControlPlane)
func CopyConfigMap ¶
CopyConfigMap copies the .Data field of configMap source into configmap cm.
func CreateTokenForServiceAccount ¶
func CreateTokenForServiceAccount(ctx context.Context, serviceAccount *corev1.ServiceAccount, saClient ServiceAccountTokenCreator) (string, error)
func DeleteAllIfNeeded ¶
func DeleteIfNeeded ¶
func DeserializeResource ¶
func EnsureOwnerRef ¶
func EnsureOwnerRef(resource client.Object, ownerRef *metav1.OwnerReference)
func EnsurePullSecret ¶
func EnsurePullSecret(serviceAccount *corev1.ServiceAccount, secretName string)
func ExtractHostedControlPlaneOwnerName ¶
func ExtractHostedControlPlaneOwnerName(ownerRefs []metav1.OwnerReference) string
ExtractHostedControlPlaneOwnerName finds the HostedControlPlane owner reference name from a list of OwnerReferences.
func ExtractLoadBalancerIP ¶
ExtractLoadBalancerIP extracts the LoadBalancer IP from a Service's status and returns whether it's valid.
func FindJobCondition ¶
func FindJobCondition(object *batchv1.Job, conditionType batchv1.JobConditionType) *batchv1.JobCondition
func HasAnnotationWithValue ¶
HasAnnotationWithValue checks if a Kubernetes object has a specific annotation with a given value.
func HostedClusterFromAnnotation ¶
func HostedClusterFromAnnotation(ctx context.Context, reader client.Reader, obj client.Object) (*hyperv1.HostedCluster, error)
HostedClusterFromAnnotation retrieves the HostedCluster referenced by the HostedClusterAnnotation on the given object. The annotation value must be in "namespace/name" format. This is a shared utility used by platform controllers (e.g. Azure PLS, GCP Private Service Connect) whose custom resources carry this annotation to link back to their owning HostedCluster.
func ParseNodeSelector ¶
ParseNodeSelector parses a comma separated string of key=value pairs into a map.
func SerializeResource ¶
func ServiceAccountClient ¶
func ServiceAccountClient(client kubernetes.Interface, namespace string) corev1client.ServiceAccountInterface
Types ¶
type ServiceAccountTokenCreator ¶
type ServiceAccountTokenCreator interface {
Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.ServiceAccount, error)
CreateToken(ctx context.Context, name string, tokenRequest *authenticationv1.TokenRequest, opts metav1.CreateOptions) (*authenticationv1.TokenRequest, error)
}