Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Dec 5, 2023
1 parent 5decb0e commit faa6fb6
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 77 deletions.
4 changes: 2 additions & 2 deletions packaging/flavorgen/flavors/clusterclass_generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func getWorkersClass() clusterv1.WorkersClass {

func getClusterClassPatches() []clusterv1.ClusterClassPatch {
return []clusterv1.ClusterClassPatch{
createFilesArrayPatch(),
enableSSHPatch(),
infraClusterPatch(),
kubeVipEnabledPatch(),
Expand Down Expand Up @@ -223,7 +224,6 @@ func newVSphereClusterTemplate() infrav1.VSphereClusterTemplate {
}

func newKubeadmControlPlaneTemplate(templateName string) controlplanev1.KubeadmControlPlaneTemplate {
files := []bootstrapv1.File{}
return controlplanev1.KubeadmControlPlaneTemplate{
TypeMeta: metav1.TypeMeta{
Kind: util.TypeToKind(&controlplanev1.KubeadmControlPlaneTemplate{}),
Expand All @@ -236,7 +236,7 @@ func newKubeadmControlPlaneTemplate(templateName string) controlplanev1.KubeadmC
Spec: controlplanev1.KubeadmControlPlaneTemplateSpec{
Template: controlplanev1.KubeadmControlPlaneTemplateResource{
Spec: controlplanev1.KubeadmControlPlaneTemplateResourceSpec{
KubeadmConfigSpec: defaultKubeadmInitSpec(files),
KubeadmConfigSpec: defaultKubeadmInitSpec([]bootstrapv1.File{}),
},
},
},
Expand Down
47 changes: 47 additions & 0 deletions packaging/flavorgen/flavors/patches.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package flavors
import (
"fmt"

apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/utils/pointer"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
Expand All @@ -29,6 +30,52 @@ import (
"sigs.k8s.io/cluster-api-provider-vsphere/packaging/flavorgen/flavors/util"
)

func createFilesArrayPatch() clusterv1.ClusterClassPatch {
return clusterv1.ClusterClassPatch{
Name: "createFilesArray",
Definitions: []clusterv1.PatchDefinition{
{
Selector: clusterv1.PatchSelector{
APIVersion: controlplanev1.GroupVersion.String(),
Kind: util.TypeToKind(&controlplanev1.KubeadmControlPlaneTemplate{}),
MatchResources: clusterv1.PatchSelectorMatch{
ControlPlane: true,
},
},
JSONPatches: []clusterv1.JSONPatch{
{
Op: "add",
Path: "/spec/template/spec/kubeadmConfigSpec/files",
Value: &apiextensionsv1.JSON{
Raw: []byte("[]"),
},
},
},
},
{
Selector: clusterv1.PatchSelector{
APIVersion: controlplanev1.GroupVersion.String(),
Kind: util.TypeToKind(&bootstrapv1.KubeadmConfigTemplate{}),
MatchResources: clusterv1.PatchSelectorMatch{
MachineDeploymentClass: &clusterv1.PatchSelectorMatchMachineDeploymentClass{
Names: []string{fmt.Sprintf("%s-worker", env.ClusterClassNameVar)},
},
},
},
JSONPatches: []clusterv1.JSONPatch{
{
Op: "add",
Path: "/spec/template/spec/files",
Value: &apiextensionsv1.JSON{
Raw: []byte("[]"),
},
},
},
},
},
}
}

func enableSSHPatch() clusterv1.ClusterClassPatch {
return clusterv1.ClusterClassPatch{
Name: "enableSSHIntoNodes",
Expand Down
22 changes: 22 additions & 0 deletions templates/clusterclass-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@ spec:
name: '${CLUSTER_CLASS_NAME}'
namespace: '${NAMESPACE}'
patches:
- definitions:
- jsonPatches:
- op: add
path: /spec/template/spec/kubeadmConfigSpec/files
value: []
selector:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
matchResources:
controlPlane: true
- jsonPatches:
- op: add
path: /spec/template/spec/files
value: []
selector:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
matchResources:
machineDeploymentClass:
names:
- ${CLUSTER_CLASS_NAME}-worker
name: createFilesArray
- definitions:
- jsonPatches:
- op: add
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit faa6fb6

Please sign in to comment.