55 "fmt"
66
77 "github.com/asaskevich/govalidator"
8+ "github.com/openshift/api/features"
89 appsv1 "k8s.io/api/apps/v1"
910 rbacv1 "k8s.io/api/rbac/v1"
1011 "sigs.k8s.io/controller-runtime/pkg/client"
@@ -18,6 +19,8 @@ const (
1819
1920 // see manifests/0000_26_cloud-controller-manager-operator_16_credentialsrequest-vsphere.yaml
2021 globalCredsSecretName = "vsphere-cloud-credentials"
22+
23+ vSpherePlatformTypeLabel = "node.openshift.io/platform-type=vsphere"
2124)
2225
2326var (
@@ -45,6 +48,7 @@ var templateValuesValidationMap = map[string]interface{}{
4548 "globalCredsSecretName" : "required,type(string)" ,
4649 "cloudproviderName" : "required,type(string)" ,
4750 "featureGates" : "type(string)" ,
51+ "additionalLabels" : "type(string)" ,
4852}
4953
5054type vsphereAssets struct {
@@ -57,13 +61,20 @@ func (assets *vsphereAssets) GetRenderedResources() []client.Object {
5761}
5862
5963func getTemplateValues (images * imagesReference , operatorConfig config.OperatorConfig ) (common.TemplateValues , error ) {
64+ additionalLabels := ""
65+
66+ // We are only going to set the new platform-type node labels if the featuregate is enabled.
67+ if operatorConfig .OCPFeatureGates != nil && operatorConfig .OCPFeatureGates .Enabled (features .FeatureGateVSphereMixedNodeEnv ) {
68+ additionalLabels = vSpherePlatformTypeLabel
69+ }
6070 values := common.TemplateValues {
6171 "images" : images ,
6272 "infrastructureName" : operatorConfig .InfrastructureName ,
6373 "globalCredsSecretNamespace" : operatorConfig .ManagedNamespace ,
6474 "globalCredsSecretName" : globalCredsSecretName ,
6575 "cloudproviderName" : operatorConfig .GetPlatformNameString (),
6676 "featureGates" : operatorConfig .FeatureGates ,
77+ "additionalLabels" : additionalLabels ,
6778 }
6879 _ , err := govalidator .ValidateMap (values , templateValuesValidationMap )
6980 if err != nil {
0 commit comments