Skip to content

Commit cd63d0f

Browse files
K8s agent as addon
1 parent e059bb5 commit cd63d0f

File tree

30 files changed

+691
-45
lines changed

30 files changed

+691
-45
lines changed

api/v1alpha1/addon_types.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ type NutanixAddons struct {
8585

8686
// +kubebuilder:validation:Optional
8787
COSI *NutanixCOSI `json:"cosi,omitempty"`
88+
89+
// +kubebuilder:validation:Optional
90+
K8sRegistrationAgent *NutanixK8sRegistrationAgent `json:"k8sRegistrationAgent,omitempty"`
8891
}
8992

9093
type GenericAddons struct {
@@ -359,3 +362,21 @@ type RegistryAddon struct {
359362
// +kubebuilder:validation:Enum="CNCF Distribution"
360363
Provider string `json:"provider"`
361364
}
365+
366+
type NutanixK8sRegistrationAgent struct {
367+
// A reference to the Secret for credential information for the target Prism Central instance
368+
// +kubebuilder:validation:Optional
369+
Credentials *NutanixK8sAgentCredentials `json:"credentials,omitempty"`
370+
371+
// Addon strategy used to deploy the Nutanix k8s-registration-agent to the k8s cluster.
372+
// +kubebuilder:default=HelmAddon
373+
// +kubebuilder:validation:Optional
374+
// +kubebuilder:validation:Enum=ClusterResourceSet;HelmAddon
375+
Strategy AddonStrategy `json:"strategy,omitzero"`
376+
}
377+
378+
type NutanixK8sAgentCredentials struct {
379+
// A reference to the Secret containing the credentials used by the CCM provider.
380+
// +kubebuilder:validation:Required
381+
SecretRef LocalObjectReference `json:"secretRef"`
382+
}

api/v1alpha1/constants.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const (
3232
ServiceLoadBalancerVariableName = "serviceLoadBalancer"
3333
// RegistryAddonVariableName is the OCI registry config patch variable name.
3434
RegistryAddonVariableName = "registry"
35+
// K8sRegistrationAgentVariableName is the Nutanix k8s-registration-agent addon config patch variable name.
36+
K8sRegistrationAgentVariableName = "k8sRegistrationAgent"
3537

3638
// GlobalMirrorVariableName is the global image registry mirror patch variable name.
3739
GlobalMirrorVariableName = "globalImageRegistryMirror"

api/v1alpha1/crds/caren.nutanix.com_nutanixclusterconfigs.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,35 @@ spec:
235235
- defaultStorage
236236
- providers
237237
type: object
238+
k8sRegistrationAgent:
239+
properties:
240+
credentials:
241+
description: A reference to the Secret for credential information for the target Prism Central instance
242+
properties:
243+
secretRef:
244+
description: A reference to the Secret containing the credentials used by the CCM provider.
245+
properties:
246+
name:
247+
description: |-
248+
Name of the referent.
249+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
250+
maxLength: 253
251+
minLength: 1
252+
type: string
253+
required:
254+
- name
255+
type: object
256+
required:
257+
- secretRef
258+
type: object
259+
strategy:
260+
default: HelmAddon
261+
description: Addon strategy used to deploy the Nutanix k8s-registration-agent to the k8s cluster.
262+
enum:
263+
- ClusterResourceSet
264+
- HelmAddon
265+
type: string
266+
type: object
238267
nfd:
239268
description: NFD tells us to enable or disable the node feature discovery addon.
240269
properties:

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/variables/aggregate_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ type Addons struct {
6666
CSI *CSI `json:"csi,omitempty"`
6767

6868
COSI *COSI `json:"cosi,omitempty"`
69+
70+
NutanixK8sRegistrationAgent *NutanixK8sRegistrationAgent `json:"k8sRegistrationAgent,omitempty"`
71+
}
72+
73+
type NutanixK8sRegistrationAgent struct {
74+
carenv1.NutanixK8sRegistrationAgent `json:",inline"`
6975
}
7076

7177
type CSI struct {

charts/cluster-api-runtime-extensions-nutanix/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ A Helm chart for cluster-api-runtime-extensions-nutanix
9696
| hooks.registrySyncer.defaultValueTemplateConfigMap.name | string | `"default-registry-syncer-helm-values-template"` | |
9797
| hooks.serviceLoadBalancer.metalLB.defaultValueTemplateConfigMap.create | bool | `true` | |
9898
| hooks.serviceLoadBalancer.metalLB.defaultValueTemplateConfigMap.name | string | `"default-metallb-helm-values-template"` | |
99+
| hooks.k8sRegistrationAgent.helmAddonStrategy.defaultValueTemplateConfigMap.create | bool | `true` | |
100+
| hooks.k8sRegistrationAgent.helmAddonStrategy.defaultValueTemplateConfigMap.name | string | `"default-k8s-registrationagent-helm-values-template"` | |
99101
| image.pullPolicy | string | `"IfNotPresent"` | |
100102
| image.repository | string | `"ghcr.io/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix"` | |
101103
| image.tag | string | `""` | |
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
agent:
2+
namespaceOverride: ntnx-system
3+
name: nutanix-agent
4+
port: 8080
5+
image:
6+
repository: docker.io/nutanix
7+
name: nke-k8s-agent
8+
pullPolicy: IfNotPresent
9+
tag: "688"
10+
privateRegistry: true
11+
imageCredentials:
12+
dockerconfig: replace_base64_encoded_creds
13+
updateConfigInMin: 10
14+
updateMetricsInMin: 360
15+
config:
16+
registration:
17+
delete:
18+
force: false
19+
kubeconfig:
20+
delete:
21+
force: false
22+
23+
pc:
24+
port: {{ .PrismCentralPort }}
25+
insecure: {{ .PrismCentralInsecure }} #set this to true if PC does not have https enabled
26+
endpoint: {{ .PrismCentralHost }} # eg: ip or fqdn
27+
username: "DCFSPpwNEOuG" # eg: admin or any other user with Kubernetes Infrastructure provision role
28+
password: "gHVU2vO64xwIt3Lz09aSQ85p1su7mKDr"
29+
k8sClusterName: {{ .ClusterName }}
30+
k8sDistribution: "CAPX" # eg: CAPX or NKE or OCP or EKSA or NKP
31+
categoryMappings: "" # "one or more comma separated key=value" eg: "key1=value1" or "key1=value1\,key2=value2"

charts/cluster-api-runtime-extensions-nutanix/templates/deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ spec:
4545
- --csi.snapshot-controller.helm-addon.default-values-template-configmap-name={{ (index .Values.hooks.csi "snapshot-controller").helmAddonStrategy.defaultValueTemplateConfigMap.name }}
4646
- --ccm.aws.helm-addon.default-values-template-configmap-name={{ .Values.hooks.ccm.aws.helmAddonStrategy.defaultValueTemplateConfigMap.name }}
4747
- --cosi.controller.helm-addon.default-values-template-configmap-name={{ .Values.hooks.cosi.controller.helmAddonStrategy.defaultValueTemplateConfigMap.name }}
48+
- --k8s-registration-agent.helm-addon.default-values-template-configmap-name={{ .Values.hooks.k8sRegistrationAgent.helmAddonStrategy.defaultValueTemplateConfigMap.name }}
4849
{{- range $k, $v := .Values.hooks.ccm.aws.k8sMinorVersionToCCMVersion }}
4950
- --ccm.aws.aws-ccm-versions={{ $k }}={{ $v }}
5051
{{- end }}

charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ data:
3131
ChartName: cosi
3232
ChartVersion: 0.0.1-alpha.5
3333
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://mesosphere.github.io/charts/stable/{{ end }}'
34+
k8s-registration-agent: |
35+
ChartName: nutanix-k8s-agent
36+
ChartVersion: 0.0.1-alpha.1
37+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}http://192.168.1.3:8080{{ end }}'
3438
local-path-provisioner-csi: |
3539
ChartName: local-path-provisioner
3640
ChartVersion: 0.0.31
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2025 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
{{- if .Values.hooks.k8sRegistrationAgent.helmAddonStrategy.defaultValueTemplateConfigMap.name }}
5+
apiVersion: v1
6+
kind: ConfigMap
7+
metadata:
8+
name: '{{ .Values.hooks.k8sRegistrationAgent.helmAddonStrategy.defaultValueTemplateConfigMap.name }}'
9+
data:
10+
values.yaml: |-
11+
{{- .Files.Get "addons/k8s-registration-agent/values-template.yaml" | nindent 4 }}
12+
{{- end -}}

0 commit comments

Comments
 (0)