sigs.k8s.io/cluster-api@v1.7.1/cmd/clusterctl/api/v1alpha3/labels.go (about) 1 /* 2 Copyright 2019 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1alpha3 18 19 import "fmt" 20 21 const ( 22 // ClusterctlLabel is applied to all components managed by clusterctl. 23 ClusterctlLabel = "clusterctl.cluster.x-k8s.io" 24 25 // ClusterctlCoreLabel is applied to all the core objects managed by clusterctl. 26 ClusterctlCoreLabel = "clusterctl.cluster.x-k8s.io/core" 27 28 // ClusterctlCoreLabelInventoryValue define the value for ClusterctlCoreLabel to be used for inventory objects. 29 ClusterctlCoreLabelInventoryValue = "inventory" 30 31 // ClusterctlCoreLabelCertManagerValue define the value for ClusterctlCoreLabel to be used for cert-manager objects. 32 ClusterctlCoreLabelCertManagerValue = "cert-manager" 33 34 // ClusterctlMoveLabel can be set on CRDs that providers wish to move but that are not part of a Cluster. 35 ClusterctlMoveLabel = "clusterctl.cluster.x-k8s.io/move" 36 37 // ClusterctlMoveHierarchyLabel can be set on CRDs that providers wish to move with their entire hierarchy, but that are not part of a Cluster. 38 ClusterctlMoveHierarchyLabel = "clusterctl.cluster.x-k8s.io/move-hierarchy" 39 ) 40 41 // ManifestLabel returns the cluster.x-k8s.io/provider label value for a provider/type. 42 // 43 // Note: the label uniquely describes the provider type and its kind (e.g. bootstrap-kubeadm); 44 // it's not meant to be used to describe each instance of a particular provider. 45 func ManifestLabel(name string, providerType ProviderType) string { 46 switch providerType { 47 case BootstrapProviderType: 48 return fmt.Sprintf("bootstrap-%s", name) 49 case ControlPlaneProviderType: 50 return fmt.Sprintf("control-plane-%s", name) 51 case InfrastructureProviderType: 52 return fmt.Sprintf("infrastructure-%s", name) 53 case IPAMProviderType: 54 return fmt.Sprintf("ipam-%s", name) 55 case RuntimeExtensionProviderType: 56 return fmt.Sprintf("runtime-extension-%s", name) 57 case AddonProviderType: 58 return fmt.Sprintf("addon-%s", name) 59 default: 60 return name 61 } 62 }