Skip to content

Commit 848bd20

Browse files
authored
feat: add support for DataStoreUsername (#243)
1 parent 3dc509b commit 848bd20

File tree

7 files changed

+195
-34
lines changed

7 files changed

+195
-34
lines changed

api/v1alpha1/kamajicontrolplane_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ type KamajiControlPlaneFields struct {
143143
DataStoreName string `json:"dataStoreName,omitempty"`
144144
// DataStoreSchema allows to specify the name of the database (for relational DataStores) or the key prefix (for etcd)
145145
DataStoreSchema string `json:"dataStoreSchema,omitempty"`
146+
// DataStoreUsername allows to specify the username of the database (for relational DataStores). This
147+
// value is optional and immutable. Note that Kamaji currently doesn't ensure that DataStoreUsername values are unique. It's up
148+
// to the user to avoid clashes between different TenantControlPlanes. If not set upon creation, Kamaji will default the
149+
// DataStoreUsername by concatenating the namespace and name of the TenantControlPlane.
150+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="changing the dataStoreUsername is not supported"
151+
DataStoreUsername string `json:"dataStoreUsername,omitempty"`
146152
// The addons that must be managed by Kamaji, such as CoreDNS, kube-proxy, and konnectivity.
147153
Addons AddonsSpec `json:"addons,omitempty"`
148154
// List of the admission controllers to configure for the TenantControlPlane kube-apiserver.

config/control-plane-components.yaml

Lines changed: 78 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ spec:
109109
agent:
110110
default:
111111
image: registry.k8s.io/kas-network-proxy/proxy-agent
112+
mode: DaemonSet
112113
version: v0.28.6
113114
properties:
114115
extraArgs:
@@ -120,10 +121,31 @@ spec:
120121
items:
121122
type: string
122123
type: array
124+
hostNetwork:
125+
default: false
126+
description: |-
127+
HostNetwork enables the konnectivity agent to use the Host network namespace.
128+
By enabling this mode, the Agent doesn't need to wait for the CNI initialisation,
129+
enabling a sort of out-of-band access to nodes for troubleshooting scenarios,
130+
or when the agent needs direct access to the host network.
131+
type: boolean
123132
image:
124133
default: registry.k8s.io/kas-network-proxy/proxy-agent
125134
description: AgentImage defines the container image for Konnectivity's agent.
126135
type: string
136+
mode:
137+
default: DaemonSet
138+
description: 'Mode allows specifying the Agent deployment mode: Deployment, or DaemonSet (default).'
139+
enum:
140+
- DaemonSet
141+
- Deployment
142+
type: string
143+
replicas:
144+
description: |-
145+
Replicas defines the number of replicas when Mode is Deployment.
146+
Must be 0 if Mode is DaemonSet.
147+
format: int32
148+
type: integer
127149
tolerations:
128150
default:
129151
- key: CriticalAddonsOnly
@@ -173,6 +195,9 @@ spec:
173195
description: Version for Konnectivity agent.
174196
type: string
175197
type: object
198+
x-kubernetes-validations:
199+
- message: replicas must be 0 when mode is DaemonSet, and greater than 0 when mode is Deployment
200+
rule: '!(self.mode == ''DaemonSet'' && has(self.replicas) && self.replicas != 0) && !(self.mode == ''Deployment'' && self.replicas == 0)'
176201
server:
177202
default:
178203
image: registry.k8s.io/kas-network-proxy/proxy-server
@@ -620,6 +645,16 @@ spec:
620645
dataStoreSchema:
621646
description: DataStoreSchema allows to specify the name of the database (for relational DataStores) or the key prefix (for etcd)
622647
type: string
648+
dataStoreUsername:
649+
description: |-
650+
DataStoreUsername allows to specify the username of the database (for relational DataStores). This
651+
value is optional and immutable. Note that Kamaji currently doesn't ensure that DataStoreUsername values are unique. It's up
652+
to the user to avoid clashes between different TenantControlPlanes. If not set upon creation, Kamaji will default the
653+
DataStoreUsername by concatenating the namespace and name of the TenantControlPlane.
654+
type: string
655+
x-kubernetes-validations:
656+
- message: changing the dataStoreUsername is not supported
657+
rule: self == oldSelf
623658
deployment:
624659
description: Configure how the TenantControlPlane Deployment object should be configured.
625660
properties:
@@ -6335,20 +6370,20 @@ spec:
63356370
properties:
63366371
cgroupfs:
63376372
description: |-
6338-
CGroupFS defines the cgroup driver for Kubelet
6373+
CGroupFS defines the cgroup driver for Kubelet
63396374
https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/
63406375
enum:
63416376
- systemd
63426377
- cgroupfs
63436378
type: string
63446379
preferredAddressTypes:
63456380
default:
6346-
- Hostname
63476381
- InternalIP
63486382
- ExternalIP
6383+
- Hostname
63496384
description: |-
63506385
Ordered list of the preferred NodeAddressTypes to use for kubelet connections.
6351-
Default to Hostname, InternalIP, ExternalIP.
6386+
Default to InternalIP, ExternalIP, Hostname.
63526387
items:
63536388
enum:
63546389
- Hostname
@@ -6359,6 +6394,7 @@ spec:
63596394
type: string
63606395
minItems: 1
63616396
type: array
6397+
x-kubernetes-list-type: set
63626398
type: object
63636399
network:
63646400
default:
@@ -6846,6 +6882,7 @@ spec:
68466882
agent:
68476883
default:
68486884
image: registry.k8s.io/kas-network-proxy/proxy-agent
6885+
mode: DaemonSet
68496886
version: v0.28.6
68506887
properties:
68516888
extraArgs:
@@ -6857,10 +6894,31 @@ spec:
68576894
items:
68586895
type: string
68596896
type: array
6897+
hostNetwork:
6898+
default: false
6899+
description: |-
6900+
HostNetwork enables the konnectivity agent to use the Host network namespace.
6901+
By enabling this mode, the Agent doesn't need to wait for the CNI initialisation,
6902+
enabling a sort of out-of-band access to nodes for troubleshooting scenarios,
6903+
or when the agent needs direct access to the host network.
6904+
type: boolean
68606905
image:
68616906
default: registry.k8s.io/kas-network-proxy/proxy-agent
68626907
description: AgentImage defines the container image for Konnectivity's agent.
68636908
type: string
6909+
mode:
6910+
default: DaemonSet
6911+
description: 'Mode allows specifying the Agent deployment mode: Deployment, or DaemonSet (default).'
6912+
enum:
6913+
- DaemonSet
6914+
- Deployment
6915+
type: string
6916+
replicas:
6917+
description: |-
6918+
Replicas defines the number of replicas when Mode is Deployment.
6919+
Must be 0 if Mode is DaemonSet.
6920+
format: int32
6921+
type: integer
68646922
tolerations:
68656923
default:
68666924
- key: CriticalAddonsOnly
@@ -6910,6 +6968,9 @@ spec:
69106968
description: Version for Konnectivity agent.
69116969
type: string
69126970
type: object
6971+
x-kubernetes-validations:
6972+
- message: replicas must be 0 when mode is DaemonSet, and greater than 0 when mode is Deployment
6973+
rule: '!(self.mode == ''DaemonSet'' && has(self.replicas) && self.replicas != 0) && !(self.mode == ''Deployment'' && self.replicas == 0)'
69136974
server:
69146975
default:
69156976
image: registry.k8s.io/kas-network-proxy/proxy-server
@@ -7342,6 +7403,16 @@ spec:
73427403
dataStoreSchema:
73437404
description: DataStoreSchema allows to specify the name of the database (for relational DataStores) or the key prefix (for etcd)
73447405
type: string
7406+
dataStoreUsername:
7407+
description: |-
7408+
DataStoreUsername allows to specify the username of the database (for relational DataStores). This
7409+
value is optional and immutable. Note that Kamaji currently doesn't ensure that DataStoreUsername values are unique. It's up
7410+
to the user to avoid clashes between different TenantControlPlanes. If not set upon creation, Kamaji will default the
7411+
DataStoreUsername by concatenating the namespace and name of the TenantControlPlane.
7412+
type: string
7413+
x-kubernetes-validations:
7414+
- message: changing the dataStoreUsername is not supported
7415+
rule: self == oldSelf
73457416
deployment:
73467417
description: Configure how the TenantControlPlane Deployment object should be configured.
73477418
properties:
@@ -13057,20 +13128,20 @@ spec:
1305713128
properties:
1305813129
cgroupfs:
1305913130
description: |-
13060-
CGroupFS defines the cgroup driver for Kubelet
13131+
CGroupFS defines the cgroup driver for Kubelet
1306113132
https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/
1306213133
enum:
1306313134
- systemd
1306413135
- cgroupfs
1306513136
type: string
1306613137
preferredAddressTypes:
1306713138
default:
13068-
- Hostname
1306913139
- InternalIP
1307013140
- ExternalIP
13141+
- Hostname
1307113142
description: |-
1307213143
Ordered list of the preferred NodeAddressTypes to use for kubelet connections.
13073-
Default to Hostname, InternalIP, ExternalIP.
13144+
Default to InternalIP, ExternalIP, Hostname.
1307413145
items:
1307513146
enum:
1307613147
- Hostname
@@ -13081,6 +13152,7 @@ spec:
1308113152
type: string
1308213153
minItems: 1
1308313154
type: array
13155+
x-kubernetes-list-type: set
1308413156
type: object
1308513157
network:
1308613158
default:

config/crd/bases/controlplane.cluster.x-k8s.io_kamajicontrolplanes.yaml

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ spec:
9696
agent:
9797
default:
9898
image: registry.k8s.io/kas-network-proxy/proxy-agent
99+
mode: DaemonSet
99100
version: v0.28.6
100101
properties:
101102
extraArgs:
@@ -107,11 +108,33 @@ spec:
107108
items:
108109
type: string
109110
type: array
111+
hostNetwork:
112+
default: false
113+
description: |-
114+
HostNetwork enables the konnectivity agent to use the Host network namespace.
115+
By enabling this mode, the Agent doesn't need to wait for the CNI initialisation,
116+
enabling a sort of out-of-band access to nodes for troubleshooting scenarios,
117+
or when the agent needs direct access to the host network.
118+
type: boolean
110119
image:
111120
default: registry.k8s.io/kas-network-proxy/proxy-agent
112121
description: AgentImage defines the container image for
113122
Konnectivity's agent.
114123
type: string
124+
mode:
125+
default: DaemonSet
126+
description: 'Mode allows specifying the Agent deployment
127+
mode: Deployment, or DaemonSet (default).'
128+
enum:
129+
- DaemonSet
130+
- Deployment
131+
type: string
132+
replicas:
133+
description: |-
134+
Replicas defines the number of replicas when Mode is Deployment.
135+
Must be 0 if Mode is DaemonSet.
136+
format: int32
137+
type: integer
115138
tolerations:
116139
default:
117140
- key: CriticalAddonsOnly
@@ -161,6 +184,12 @@ spec:
161184
description: Version for Konnectivity agent.
162185
type: string
163186
type: object
187+
x-kubernetes-validations:
188+
- message: replicas must be 0 when mode is DaemonSet, and
189+
greater than 0 when mode is Deployment
190+
rule: '!(self.mode == ''DaemonSet'' && has(self.replicas)
191+
&& self.replicas != 0) && !(self.mode == ''Deployment''
192+
&& self.replicas == 0)'
164193
server:
165194
default:
166195
image: registry.k8s.io/kas-network-proxy/proxy-server
@@ -621,6 +650,16 @@ spec:
621650
description: DataStoreSchema allows to specify the name of the database
622651
(for relational DataStores) or the key prefix (for etcd)
623652
type: string
653+
dataStoreUsername:
654+
description: |-
655+
DataStoreUsername allows to specify the username of the database (for relational DataStores). This
656+
value is optional and immutable. Note that Kamaji currently doesn't ensure that DataStoreUsername values are unique. It's up
657+
to the user to avoid clashes between different TenantControlPlanes. If not set upon creation, Kamaji will default the
658+
DataStoreUsername by concatenating the namespace and name of the TenantControlPlane.
659+
type: string
660+
x-kubernetes-validations:
661+
- message: changing the dataStoreUsername is not supported
662+
rule: self == oldSelf
624663
deployment:
625664
description: Configure how the TenantControlPlane Deployment object
626665
should be configured.
@@ -6617,20 +6656,20 @@ spec:
66176656
properties:
66186657
cgroupfs:
66196658
description: |-
6620-
CGroupFS defines the cgroup driver for Kubelet
6659+
CGroupFS defines the cgroup driver for Kubelet
66216660
https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/
66226661
enum:
66236662
- systemd
66246663
- cgroupfs
66256664
type: string
66266665
preferredAddressTypes:
66276666
default:
6628-
- Hostname
66296667
- InternalIP
66306668
- ExternalIP
6669+
- Hostname
66316670
description: |-
66326671
Ordered list of the preferred NodeAddressTypes to use for kubelet connections.
6633-
Default to Hostname, InternalIP, ExternalIP.
6672+
Default to InternalIP, ExternalIP, Hostname.
66346673
items:
66356674
enum:
66366675
- Hostname
@@ -6641,6 +6680,7 @@ spec:
66416680
type: string
66426681
minItems: 1
66436682
type: array
6683+
x-kubernetes-list-type: set
66446684
type: object
66456685
network:
66466686
default:

0 commit comments

Comments
 (0)