8
8
9
9
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
10
10
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
11
- "k8s.io/apimachinery/pkg/runtime"
12
11
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
13
12
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
14
13
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"
@@ -21,6 +20,7 @@ import (
21
20
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/patches"
22
21
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/patches/selectors"
23
22
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/variables"
23
+ "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/utils"
24
24
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/clusterconfig"
25
25
)
26
26
@@ -35,10 +35,6 @@ type extraAPIServerCertSANsPatchHandler struct {
35
35
}
36
36
37
37
func NewPatch () * extraAPIServerCertSANsPatchHandler {
38
- scheme := runtime .NewScheme ()
39
- _ = clusterv1 .AddToScheme (scheme )
40
- _ = bootstrapv1 .AddToScheme (scheme )
41
- _ = controlplanev1 .AddToScheme (scheme )
42
38
return newExtraAPIServerCertSANsPatchHandler (clusterconfig .MetaVariableName , VariableName )
43
39
}
44
40
@@ -118,13 +114,10 @@ func (h *extraAPIServerCertSANsPatchHandler) Mutate(
118
114
}
119
115
120
116
func getDefaultAPIServerSANs (cluster * clusterv1.Cluster ) []string {
121
- if cluster == nil {
122
- return nil
123
- }
124
- switch cluster .GetLabels ()[clusterv1 .ProviderNameLabel ] {
117
+ switch utils .GetProvider (cluster ) {
125
118
case "docker" :
126
119
return v1alpha1 .DefaultDockerCertSANs
127
120
default :
128
- return [] string {}
121
+ return nil
129
122
}
130
123
}
0 commit comments