Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 8a70cfc

Browse files
committed
now added placeholder in NutanixClusterTemplate for cre patches to find
1 parent ab9506d commit 8a70cfc

File tree

9 files changed

+99
-55
lines changed

9 files changed

+99
-55
lines changed

charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/nutanix-cluster-class.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,20 @@ metadata:
252252
spec:
253253
template:
254254
spec:
255+
controlPlaneEndpoint:
256+
host: ""
257+
port: 6443
255258
failureDomains: []
259+
prismCentral:
260+
additionalTrustBundle:
261+
kind: ConfigMap
262+
name: ""
263+
address: ""
264+
credentialRef:
265+
kind: Secret
266+
name: replace-me-creds
267+
insecure: true
268+
port: 9440
256269
---
257270
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
258271
kind: NutanixMachineTemplate

examples/capi-quick-start/nutanix-cluster-calico-crs.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -333,42 +333,42 @@ spec:
333333
machineDetails:
334334
bootType: legacy
335335
cluster:
336-
name: $${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
336+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
337337
type: name
338338
image:
339-
name: $${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
339+
name: ${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
340340
type: name
341341
memorySize: 4Gi
342342
subnet:
343-
- name: $${NUTANIX_SUBNET_NAME}
343+
- name: ${NUTANIX_SUBNET_NAME}
344344
type: name
345345
systemDiskSize: 40Gi
346346
vcpuSockets: 2
347347
vcpusPerSocket: 1
348348
nutanix:
349349
controlPlaneEndpoint:
350-
host: $${CONTROL_PLANE_ENDPOINT_IP}
351-
port: $${CONTROL_PLANE_ENDPOINT_PORT}
350+
host: ${CONTROL_PLANE_ENDPOINT_IP}
351+
port: ${CONTROL_PLANE_ENDPOINT_PORT}
352352
prismCentralEndpoint:
353-
additionalTrustBundle: $${CLUSTER_NAME}-pc-trusted-ca-bundle
354-
credentialSecret: $${CLUSTER_NAME}-pc-creds
355-
host: $${NUTANIX_ENDPOINT}
356-
insecure: $${NUTANIX_INSECURE}
353+
additionalTrustBundle: ${CLUSTER_NAME}-pc-trusted-ca-bundle
354+
credentialSecret: ${CLUSTER_NAME}-pc-creds
355+
host: ${NUTANIX_ENDPOINT}
356+
insecure: ${NUTANIX_INSECURE}
357357
port: 9440
358358
- name: workerConfig
359359
value:
360360
nutanix:
361361
machineDetails:
362362
bootType: legacy
363363
cluster:
364-
name: $${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
364+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
365365
type: name
366366
image:
367-
name: $${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
367+
name: ${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
368368
type: name
369369
memorySize: 4Gi
370370
subnet:
371-
- name: $${NUTANIX_SUBNET_NAME}
371+
- name: ${NUTANIX_SUBNET_NAME}
372372
type: name
373373
systemDiskSize: 40Gi
374374
vcpuSockets: 2

examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -333,42 +333,42 @@ spec:
333333
machineDetails:
334334
bootType: legacy
335335
cluster:
336-
name: $${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
336+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
337337
type: name
338338
image:
339-
name: $${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
339+
name: ${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
340340
type: name
341341
memorySize: 4Gi
342342
subnet:
343-
- name: $${NUTANIX_SUBNET_NAME}
343+
- name: ${NUTANIX_SUBNET_NAME}
344344
type: name
345345
systemDiskSize: 40Gi
346346
vcpuSockets: 2
347347
vcpusPerSocket: 1
348348
nutanix:
349349
controlPlaneEndpoint:
350-
host: $${CONTROL_PLANE_ENDPOINT_IP}
351-
port: $${CONTROL_PLANE_ENDPOINT_PORT}
350+
host: ${CONTROL_PLANE_ENDPOINT_IP}
351+
port: ${CONTROL_PLANE_ENDPOINT_PORT}
352352
prismCentralEndpoint:
353-
additionalTrustBundle: $${CLUSTER_NAME}-pc-trusted-ca-bundle
354-
credentialSecret: $${CLUSTER_NAME}-pc-creds
355-
host: $${NUTANIX_ENDPOINT}
356-
insecure: $${NUTANIX_INSECURE}
353+
additionalTrustBundle: ${CLUSTER_NAME}-pc-trusted-ca-bundle
354+
credentialSecret: ${CLUSTER_NAME}-pc-creds
355+
host: ${NUTANIX_ENDPOINT}
356+
insecure: ${NUTANIX_INSECURE}
357357
port: 9440
358358
- name: workerConfig
359359
value:
360360
nutanix:
361361
machineDetails:
362362
bootType: legacy
363363
cluster:
364-
name: $${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
364+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
365365
type: name
366366
image:
367-
name: $${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
367+
name: ${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
368368
type: name
369369
memorySize: 4Gi
370370
subnet:
371-
- name: $${NUTANIX_SUBNET_NAME}
371+
- name: ${NUTANIX_SUBNET_NAME}
372372
type: name
373373
systemDiskSize: 40Gi
374374
vcpuSockets: 2

examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -333,42 +333,42 @@ spec:
333333
machineDetails:
334334
bootType: legacy
335335
cluster:
336-
name: $${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
336+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
337337
type: name
338338
image:
339-
name: $${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
339+
name: ${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
340340
type: name
341341
memorySize: 4Gi
342342
subnet:
343-
- name: $${NUTANIX_SUBNET_NAME}
343+
- name: ${NUTANIX_SUBNET_NAME}
344344
type: name
345345
systemDiskSize: 40Gi
346346
vcpuSockets: 2
347347
vcpusPerSocket: 1
348348
nutanix:
349349
controlPlaneEndpoint:
350-
host: $${CONTROL_PLANE_ENDPOINT_IP}
351-
port: $${CONTROL_PLANE_ENDPOINT_PORT}
350+
host: ${CONTROL_PLANE_ENDPOINT_IP}
351+
port: ${CONTROL_PLANE_ENDPOINT_PORT}
352352
prismCentralEndpoint:
353-
additionalTrustBundle: $${CLUSTER_NAME}-pc-trusted-ca-bundle
354-
credentialSecret: $${CLUSTER_NAME}-pc-creds
355-
host: $${NUTANIX_ENDPOINT}
356-
insecure: $${NUTANIX_INSECURE}
353+
additionalTrustBundle: ${CLUSTER_NAME}-pc-trusted-ca-bundle
354+
credentialSecret: ${CLUSTER_NAME}-pc-creds
355+
host: ${NUTANIX_ENDPOINT}
356+
insecure: ${NUTANIX_INSECURE}
357357
port: 9440
358358
- name: workerConfig
359359
value:
360360
nutanix:
361361
machineDetails:
362362
bootType: legacy
363363
cluster:
364-
name: $${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
364+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
365365
type: name
366366
image:
367-
name: $${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
367+
name: ${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
368368
type: name
369369
memorySize: 4Gi
370370
subnet:
371-
- name: $${NUTANIX_SUBNET_NAME}
371+
- name: ${NUTANIX_SUBNET_NAME}
372372
type: name
373373
systemDiskSize: 40Gi
374374
vcpuSockets: 2

examples/capi-quick-start/nutanix-cluster-cilium-helm-addon.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -333,42 +333,42 @@ spec:
333333
machineDetails:
334334
bootType: legacy
335335
cluster:
336-
name: $${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
336+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
337337
type: name
338338
image:
339-
name: $${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
339+
name: ${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
340340
type: name
341341
memorySize: 4Gi
342342
subnet:
343-
- name: $${NUTANIX_SUBNET_NAME}
343+
- name: ${NUTANIX_SUBNET_NAME}
344344
type: name
345345
systemDiskSize: 40Gi
346346
vcpuSockets: 2
347347
vcpusPerSocket: 1
348348
nutanix:
349349
controlPlaneEndpoint:
350-
host: $${CONTROL_PLANE_ENDPOINT_IP}
351-
port: $${CONTROL_PLANE_ENDPOINT_PORT}
350+
host: ${CONTROL_PLANE_ENDPOINT_IP}
351+
port: ${CONTROL_PLANE_ENDPOINT_PORT}
352352
prismCentralEndpoint:
353-
additionalTrustBundle: $${CLUSTER_NAME}-pc-trusted-ca-bundle
354-
credentialSecret: $${CLUSTER_NAME}-pc-creds
355-
host: $${NUTANIX_ENDPOINT}
356-
insecure: $${NUTANIX_INSECURE}
353+
additionalTrustBundle: ${CLUSTER_NAME}-pc-trusted-ca-bundle
354+
credentialSecret: ${CLUSTER_NAME}-pc-creds
355+
host: ${NUTANIX_ENDPOINT}
356+
insecure: ${NUTANIX_INSECURE}
357357
port: 9440
358358
- name: workerConfig
359359
value:
360360
nutanix:
361361
machineDetails:
362362
bootType: legacy
363363
cluster:
364-
name: $${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
364+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
365365
type: name
366366
image:
367-
name: $${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
367+
name: ${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}
368368
type: name
369369
memorySize: 4Gi
370370
subnet:
371-
- name: $${NUTANIX_SUBNET_NAME}
371+
- name: ${NUTANIX_SUBNET_NAME}
372372
type: name
373373
systemDiskSize: 40Gi
374374
vcpuSockets: 2

hack/examples/bases/nutanix/clusterclass/kustomization.yaml.tmpl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,24 @@ patches:
2929
path: "/spec/patches"
3030
- op: "remove"
3131
path: "/spec/variables"
32+
# TODO: Temp added patches for NutanixClusterTemplate
33+
- target:
34+
kind: NutanixClusterTemplate
35+
patch: |-
36+
- op: "add"
37+
path: "/spec/template/spec/controlPlaneEndpoint"
38+
value:
39+
host: ""
40+
port: 6443
41+
- op: "add"
42+
path: "/spec/template/spec/prismCentral"
43+
value:
44+
address: ''
45+
port: 9440
46+
insecure: true
47+
credentialRef:
48+
name: 'replace-me-creds'
49+
kind: Secret
50+
additionalTrustBundle:
51+
name: ''
52+
kind: ConfigMap

pkg/handlers/nutanix/mutation/machinedetails/inject_control_plane.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,14 @@ func (h *nutanixMachineDetailsControlPlanePatchHandler) Mutate(
128128
nutanixMachineDetailsVar.SystemDiskSize,
129129
)
130130

131-
subnets := make([]capxv1.NutanixResourceIdentifier, len(nutanixMachineDetailsVar.Subnets))
131+
subnets := make(
132+
[]capxv1.NutanixResourceIdentifier,
133+
len(nutanixMachineDetailsVar.Subnets),
134+
)
132135
for _, subnetCRE := range nutanixMachineDetailsVar.Subnets {
133-
subnet := capxv1.NutanixResourceIdentifier{Type: capxv1.NutanixIdentifierType(subnetCRE.Type)}
136+
subnet := capxv1.NutanixResourceIdentifier{
137+
Type: capxv1.NutanixIdentifierType(subnetCRE.Type),
138+
}
134139
if subnetCRE.Type == v1alpha1.NutanixIdentifierName {
135140
subnet.Name = subnetCRE.Name
136141
} else {
@@ -140,7 +145,7 @@ func (h *nutanixMachineDetailsControlPlanePatchHandler) Mutate(
140145
}
141146

142147
obj.Spec.Template.Spec.Subnets = subnets
143-
// TODO
148+
// TODO:deepakm-ntnx uncomment this once we are ready
144149
// obj.Spec.Template.Spec.Project = nutanixMachineDetailsVar.Project
145150
// obj.Spec.Template.Spec.AdditionalCategories = nutanixMachineDetailsVar.AdditionalCategories
146151
// obj.Spec.Template.Spec.GPUs = nutanixMachineDetailsVar.GPUs

pkg/handlers/nutanix/mutation/machinedetails/inject_worker.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,14 @@ func (h *nutanixMachineDetailsWorkerPatchHandler) Mutate(
122122
nutanixMachineDetailsVar.SystemDiskSize,
123123
)
124124

125-
subnets := make([]capxv1.NutanixResourceIdentifier, len(nutanixMachineDetailsVar.Subnets))
125+
subnets := make(
126+
[]capxv1.NutanixResourceIdentifier,
127+
len(nutanixMachineDetailsVar.Subnets),
128+
)
126129
for _, subnetCRE := range nutanixMachineDetailsVar.Subnets {
127-
subnet := capxv1.NutanixResourceIdentifier{Type: capxv1.NutanixIdentifierType(subnetCRE.Type)}
130+
subnet := capxv1.NutanixResourceIdentifier{
131+
Type: capxv1.NutanixIdentifierType(subnetCRE.Type),
132+
}
128133
if subnetCRE.Type == v1alpha1.NutanixIdentifierName {
129134
subnet.Name = subnetCRE.Name
130135
} else {
@@ -134,7 +139,7 @@ func (h *nutanixMachineDetailsWorkerPatchHandler) Mutate(
134139
}
135140

136141
obj.Spec.Template.Spec.Subnets = subnets
137-
// TODO
142+
// TODO:deepakm-ntnx uncomment this once we are ready
138143
// obj.Spec.Template.Spec.Project = nutanixMachineDetailsVar.Project
139144
// obj.Spec.Template.Spec.AdditionalCategories = nutanixMachineDetailsVar.AdditionalCategories
140145
// obj.Spec.Template.Spec.GPUs = nutanixMachineDetailsVar.GPUs

pkg/handlers/nutanix/mutation/prismcentralendpoint/inject.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package prismcentralendpoint
66
import (
77
"context"
88

9+
"github.com/nutanix-cloud-native/prism-go-client/environment/credentials"
910
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
1011
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1112
runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1"
@@ -18,7 +19,6 @@ import (
1819
"github.com/d2iq-labs/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/patches/selectors"
1920
"github.com/d2iq-labs/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/variables"
2021
"github.com/d2iq-labs/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/clusterconfig"
21-
"github.com/nutanix-cloud-native/prism-go-client/environment/credentials"
2222
)
2323

2424
const (

0 commit comments

Comments
 (0)