ccluster-py 0.0.9.dev142__tar.gz → 0.0.9.dev144__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/PKG-INFO +29 -17
  2. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/README.md +28 -16
  3. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/pyproject.toml +1 -1
  4. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/pyproject.toml.orig +1 -1
  5. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/deployments/dynamo_deployment/__init__.py +6 -4
  6. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/deployments/inference_deployment/__init__.py +6 -4
  7. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/cli.py +12 -13
  8. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/client.py +38 -18
  9. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/cclclusterconfig.py +15 -1
  10. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/cclinfraplane.py +32 -24
  11. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/LICENSE +0 -0
  12. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/__init__.py +0 -0
  13. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/__init__.py +0 -0
  14. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/argo_rollouts/__init__.py +0 -0
  15. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/cert_manager/__init__.py +0 -0
  16. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/external_dns/__init__.py +0 -0
  17. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/final_stack/__init__.py +0 -0
  18. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/fluent_bit/__init__.py +0 -0
  19. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/gpu_operator/__init__.py +0 -0
  20. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/ingress_nginx/__init__.py +0 -0
  21. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/istio/__init__.py +0 -0
  22. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/keda/__init__.py +0 -0
  23. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/kube_prometheus_stack/__init__.py +0 -0
  24. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/longhorn/__init__.py +0 -0
  25. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/metrics_server/__init__.py +0 -0
  26. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/network_operator/__init__.py +0 -0
  27. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/opentelemetry_collector/__init__.py +0 -0
  28. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/prometheus_adapter/__init__.py +0 -0
  29. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/spire/__init__.py +0 -0
  30. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/spire_crds/__init__.py +0 -0
  31. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/deployments/compute_deployment/__init__.py +0 -0
  32. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/deployments/job_deployment/__init__.py +0 -0
  33. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/namespace_base/__init__.py +0 -0
  34. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/resources/kai_gpu_queues/__init__.py +0 -0
  35. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/resources/persistent_volume/__init__.py +0 -0
  36. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/py.typed +0 -0
  37. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/__init__.py +0 -0
  38. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/base.py +0 -0
  39. {ccluster_py-0.0.9.dev142 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/cclcomponentset.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ccluster-py
3
- Version: 0.0.9.dev142
3
+ Version: 0.0.9.dev144
4
4
  Summary: Pydantic models and a client for the ccluster.nvidia.com API and its Helm chart catalog
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -80,15 +80,22 @@ Every method takes the object's name by keyword.
80
80
 
81
81
  `apply_infraplane` applies a Secret named `<name>-credentials` in Argo CD's
82
82
  cluster-secret shape (`server`, and a `config` carrying the bearer token and the CA) and a
83
- `CCLInfraPlane` pointing at it, with the cluster's `domain`. The operator writes that
84
- domain to the infra-plane cluster's `CCLClusterConfig`, and it cannot be changed once the
85
- CCLInfraPlane exists;
83
+ `CCLInfraPlane` pointing at it. The operator derives the cluster's DNS domain from the
84
+ plane, `<name>.<namespace>.<base domain>` with the base domain its `--base-domain`, so the
85
+ name must be a DNS label. It writes that domain to the infra-plane cluster's
86
+ `CCLClusterConfig`. The plane's `status.domain` shows it once the control-plane operator
87
+ has reconciled the plane, and `status.clusterConfig.domain` once the infra-plane
88
+ operator has verified the cluster;
89
+ `check_infraplane` dry-runs the same CCLInfraPlane apply, so the API server checks it, its
90
+ name included, without writing anything; call it before creating credentials the plane
91
+ needs;
86
92
  `delete_infraplane` deletes the Secret and the CCLInfraPlane, the CCLInfraPlane first so
87
93
  the operator's finalizer removes the mirrored Argo CD Secret, and leaves the namespace.
88
94
  `ensure_namespace` creates the namespace, and is the only method that does: keeping it
89
95
  separate means a mistyped namespace fails against the API server rather than quietly
90
- gaining a working plane. Everything is server-side applied under the `ccluster-py` field
91
- manager, so re-registering a cluster rotates its token in place. Both `apply_infraplane`
96
+ gaining a working plane. Everything is server-side applied under the `ccluster` field
97
+ manager, the one the Go client in `pkg/cclclient` uses too, so re-registering a cluster
98
+ rotates its token in place, whichever client registered it. Both `apply_infraplane`
92
99
  and `apply_component_set` return the applied object, a `CCLInfraPlane` or
93
100
  `CCLComponentSet`, with the metadata the server filled in and the status the operator has
94
101
  written so far.
@@ -104,7 +111,6 @@ client = CCLClient("tenant-a", api_client=api_client)
104
111
  client.ensure_namespace()
105
112
  plane = client.apply_infraplane(
106
113
  name="edge-1",
107
- domain="edge-1.example.com",
108
114
  server="https://10.0.0.1:6443",
109
115
  bearer_token=open("token").read(),
110
116
  ca_cert=open("ca.crt").read(),
@@ -117,7 +123,7 @@ client.delete_infraplane(name="edge-1")
117
123
  Argo CD's special-cased in-cluster address, no ServiceAccount or token needed:
118
124
 
119
125
  ```python
120
- plane = client.apply_infraplane(name="ccluster-local", domain="local.example.com")
126
+ plane = client.apply_infraplane(name="ccluster-local")
121
127
  ```
122
128
 
123
129
  From a workstation, pass an `ApiClient` built from your kubeconfig:
@@ -139,7 +145,7 @@ from a list of components built with `catalogs.component`, each with a chart's t
139
145
  `Values` where the defaults are not wanted. Each component's `infraPlaneRef`
140
146
  names the registered cluster it deploys to, so one set may span several planes; those
141
147
  planes must be in the client's namespace and already `Available`. List order is rollout
142
- order. Because the set is applied under the same `ccluster-py` field manager, calling
148
+ order. Because the set is applied under the same `ccluster` field manager, calling
143
149
  `apply_component_set` again with a different list updates it in place. The client's
144
150
  namespace is the set's own, on the control plane; a component's own namespace is on its
145
151
  infra plane, created there by Argo CD from the `CreateNamespace=true` sync option the
@@ -152,7 +158,7 @@ from ccluster.client import CCLClient, component_set_current_conditions
152
158
 
153
159
  client = CCLClient("tenant-a", api_client=api_client) # api_client as above
154
160
  client.ensure_namespace()
155
- client.apply_infraplane(name="ccluster-local", domain="local.example.com")
161
+ client.apply_infraplane(name="ccluster-local")
156
162
  cs = client.apply_component_set(
157
163
  name="local-base",
158
164
  components=[
@@ -212,7 +218,11 @@ one has disappeared.
212
218
  ## Command line
213
219
 
214
220
  The package installs a `ccluster` command, built on click. Run without a subcommand, it
215
- prints its usage.
221
+ prints its usage. A Go build of the same command, taking the same long flags but not
222
+ `-cp` and `-ip`, is also released; see
223
+ [the main README](https://github.com/NVIDIA/ccluster#command-line). Both read the same
224
+ config file, but install only one of them: the two are both called `ccluster`, and the
225
+ first on your `PATH` wins.
216
226
 
217
227
  Start with `ccluster init`, which names the control plane by its kubeconfig context, checks
218
228
  that it serves the ccluster API, and saves the context name to
@@ -228,18 +238,20 @@ ccluster init -cp kind-ccluster-cp
228
238
  context, with that control plane:
229
239
 
230
240
  ```bash
231
- ccluster register edge-1 -n tenant-a -ip kind-ccluster-ip --domain edge-1.example.com \
241
+ ccluster register edge-1 -n tenant-a -ip kind-ccluster-ip \
232
242
  --server https://ccluster-ip-control-plane:6443
233
243
  ```
234
244
 
235
- On the infra plane it creates the ServiceAccount `kube-system/ccluster-manager`, binds it
245
+ It first creates the namespace on the control plane if needed and calls
246
+ `check_infraplane`, so a name the API server refuses fails before anything is created on
247
+ the infra plane. On the infra plane it then creates the ServiceAccount `kube-system/ccluster-manager`, binds it
236
248
  to `cluster-admin` (Argo CD installs CRDs and other cluster-scoped objects there, so it needs
237
249
  the same rights `argocd cluster add` grants), and reads the long-lived token the token
238
250
  controller writes into the Secret `kube-system/ccluster-manager-token`. On the control plane
239
- it creates the namespace if needed and calls `apply_infraplane` with that token, the
240
- cluster CA and `--domain`. The control-plane operator uses the same token to write the
241
- domain to the infra plane's `CCLClusterConfig`. Anyone who can read `<name>-credentials` there is cluster-admin on the infra
242
- plane, so keep read access to that namespace's Secrets tight. Running it again reuses the
251
+ it calls `apply_infraplane` with that token and the cluster CA. The control-plane operator uses the same token to write the plane's domain,
252
+ `edge-1.tenant-a.<base domain>`, to the infra plane's `CCLClusterConfig`. Anyone who can
253
+ read `<name>-credentials` there is cluster-admin on the infra plane, so keep read access to
254
+ that namespace's Secrets tight. Running it again reuses the
243
255
  same token.
244
256
 
245
257
  `--server` is the address Argo CD dials, and defaults to the infra-plane context's server in
@@ -58,15 +58,22 @@ Every method takes the object's name by keyword.
58
58
 
59
59
  `apply_infraplane` applies a Secret named `<name>-credentials` in Argo CD's
60
60
  cluster-secret shape (`server`, and a `config` carrying the bearer token and the CA) and a
61
- `CCLInfraPlane` pointing at it, with the cluster's `domain`. The operator writes that
62
- domain to the infra-plane cluster's `CCLClusterConfig`, and it cannot be changed once the
63
- CCLInfraPlane exists;
61
+ `CCLInfraPlane` pointing at it. The operator derives the cluster's DNS domain from the
62
+ plane, `<name>.<namespace>.<base domain>` with the base domain its `--base-domain`, so the
63
+ name must be a DNS label. It writes that domain to the infra-plane cluster's
64
+ `CCLClusterConfig`. The plane's `status.domain` shows it once the control-plane operator
65
+ has reconciled the plane, and `status.clusterConfig.domain` once the infra-plane
66
+ operator has verified the cluster;
67
+ `check_infraplane` dry-runs the same CCLInfraPlane apply, so the API server checks it, its
68
+ name included, without writing anything; call it before creating credentials the plane
69
+ needs;
64
70
  `delete_infraplane` deletes the Secret and the CCLInfraPlane, the CCLInfraPlane first so
65
71
  the operator's finalizer removes the mirrored Argo CD Secret, and leaves the namespace.
66
72
  `ensure_namespace` creates the namespace, and is the only method that does: keeping it
67
73
  separate means a mistyped namespace fails against the API server rather than quietly
68
- gaining a working plane. Everything is server-side applied under the `ccluster-py` field
69
- manager, so re-registering a cluster rotates its token in place. Both `apply_infraplane`
74
+ gaining a working plane. Everything is server-side applied under the `ccluster` field
75
+ manager, the one the Go client in `pkg/cclclient` uses too, so re-registering a cluster
76
+ rotates its token in place, whichever client registered it. Both `apply_infraplane`
70
77
  and `apply_component_set` return the applied object, a `CCLInfraPlane` or
71
78
  `CCLComponentSet`, with the metadata the server filled in and the status the operator has
72
79
  written so far.
@@ -82,7 +89,6 @@ client = CCLClient("tenant-a", api_client=api_client)
82
89
  client.ensure_namespace()
83
90
  plane = client.apply_infraplane(
84
91
  name="edge-1",
85
- domain="edge-1.example.com",
86
92
  server="https://10.0.0.1:6443",
87
93
  bearer_token=open("token").read(),
88
94
  ca_cert=open("ca.crt").read(),
@@ -95,7 +101,7 @@ client.delete_infraplane(name="edge-1")
95
101
  Argo CD's special-cased in-cluster address, no ServiceAccount or token needed:
96
102
 
97
103
  ```python
98
- plane = client.apply_infraplane(name="ccluster-local", domain="local.example.com")
104
+ plane = client.apply_infraplane(name="ccluster-local")
99
105
  ```
100
106
 
101
107
  From a workstation, pass an `ApiClient` built from your kubeconfig:
@@ -117,7 +123,7 @@ from a list of components built with `catalogs.component`, each with a chart's t
117
123
  `Values` where the defaults are not wanted. Each component's `infraPlaneRef`
118
124
  names the registered cluster it deploys to, so one set may span several planes; those
119
125
  planes must be in the client's namespace and already `Available`. List order is rollout
120
- order. Because the set is applied under the same `ccluster-py` field manager, calling
126
+ order. Because the set is applied under the same `ccluster` field manager, calling
121
127
  `apply_component_set` again with a different list updates it in place. The client's
122
128
  namespace is the set's own, on the control plane; a component's own namespace is on its
123
129
  infra plane, created there by Argo CD from the `CreateNamespace=true` sync option the
@@ -130,7 +136,7 @@ from ccluster.client import CCLClient, component_set_current_conditions
130
136
 
131
137
  client = CCLClient("tenant-a", api_client=api_client) # api_client as above
132
138
  client.ensure_namespace()
133
- client.apply_infraplane(name="ccluster-local", domain="local.example.com")
139
+ client.apply_infraplane(name="ccluster-local")
134
140
  cs = client.apply_component_set(
135
141
  name="local-base",
136
142
  components=[
@@ -190,7 +196,11 @@ one has disappeared.
190
196
  ## Command line
191
197
 
192
198
  The package installs a `ccluster` command, built on click. Run without a subcommand, it
193
- prints its usage.
199
+ prints its usage. A Go build of the same command, taking the same long flags but not
200
+ `-cp` and `-ip`, is also released; see
201
+ [the main README](https://github.com/NVIDIA/ccluster#command-line). Both read the same
202
+ config file, but install only one of them: the two are both called `ccluster`, and the
203
+ first on your `PATH` wins.
194
204
 
195
205
  Start with `ccluster init`, which names the control plane by its kubeconfig context, checks
196
206
  that it serves the ccluster API, and saves the context name to
@@ -206,18 +216,20 @@ ccluster init -cp kind-ccluster-cp
206
216
  context, with that control plane:
207
217
 
208
218
  ```bash
209
- ccluster register edge-1 -n tenant-a -ip kind-ccluster-ip --domain edge-1.example.com \
219
+ ccluster register edge-1 -n tenant-a -ip kind-ccluster-ip \
210
220
  --server https://ccluster-ip-control-plane:6443
211
221
  ```
212
222
 
213
- On the infra plane it creates the ServiceAccount `kube-system/ccluster-manager`, binds it
223
+ It first creates the namespace on the control plane if needed and calls
224
+ `check_infraplane`, so a name the API server refuses fails before anything is created on
225
+ the infra plane. On the infra plane it then creates the ServiceAccount `kube-system/ccluster-manager`, binds it
214
226
  to `cluster-admin` (Argo CD installs CRDs and other cluster-scoped objects there, so it needs
215
227
  the same rights `argocd cluster add` grants), and reads the long-lived token the token
216
228
  controller writes into the Secret `kube-system/ccluster-manager-token`. On the control plane
217
- it creates the namespace if needed and calls `apply_infraplane` with that token, the
218
- cluster CA and `--domain`. The control-plane operator uses the same token to write the
219
- domain to the infra plane's `CCLClusterConfig`. Anyone who can read `<name>-credentials` there is cluster-admin on the infra
220
- plane, so keep read access to that namespace's Secrets tight. Running it again reuses the
229
+ it calls `apply_infraplane` with that token and the cluster CA. The control-plane operator uses the same token to write the plane's domain,
230
+ `edge-1.tenant-a.<base domain>`, to the infra plane's `CCLClusterConfig`. Anyone who can
231
+ read `<name>-credentials` there is cluster-admin on the infra plane, so keep read access to
232
+ that namespace's Secrets tight. Running it again reuses the
221
233
  same token.
222
234
 
223
235
  `--server` is the address Argo CD dials, and defaults to the infra-plane context's server in
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "ccluster-py"
7
- version = "0.0.9.dev142"
7
+ version = "0.0.9.dev144"
8
8
  description = "Pydantic models and a client for the ccluster.nvidia.com API and its Helm chart catalog"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -9,7 +9,7 @@ build-backend = "uv_build"
9
9
  # `ccluster` (src/ccluster).
10
10
  name = "ccluster-py"
11
11
  # Placeholder: the release version is the git tag, stamped in by `make python-build`.
12
- version = "0.0.9.dev142"
12
+ version = "0.0.9.dev144"
13
13
  description = "Pydantic models and a client for the ccluster.nvidia.com API and its Helm chart catalog"
14
14
  readme = "README.md"
15
15
  license = "Apache-2.0"
@@ -362,10 +362,12 @@ class Values(BaseModel):
362
362
  """
363
363
  domain: str
364
364
  """
365
- Domain is the infra plane's domain. The Ingress host is <name>.ingress.<domain>,
366
- under the *.ingress.<domain> record the control-plane operator publishes for the
367
- cluster's ingress, unless DeploymentURL overrides it. The host does not include
368
- the namespace, so deployment names must be unique across the plane. Required.
365
+ Domain is the infra plane's domain, <plane>.<namespace>.<base domain>, which its
366
+ CCLInfraPlane shows as status.domain. The Ingress host is
367
+ <name>.nginx.<domain>, under the *.nginx.<domain> record the control-plane
368
+ operator publishes for the cluster's ingress, unless DeploymentURL overrides it. The
369
+ host does not include the namespace, so deployment names must be unique across the
370
+ plane. Required.
369
371
  """
370
372
  deployment_url: Annotated[str | None, Field(alias="deploymentUrl")] = None
371
373
  """
@@ -347,10 +347,12 @@ class Values(BaseModel):
347
347
  """
348
348
  domain: str
349
349
  """
350
- Domain is the infra plane's domain. The Ingress host is <name>.ingress.<domain>,
351
- under the *.ingress.<domain> record the control-plane operator publishes for the
352
- cluster's ingress, unless DeploymentURL overrides it. The host does not include
353
- the namespace, so deployment names must be unique across the plane. Required.
350
+ Domain is the infra plane's domain, <plane>.<namespace>.<base domain>, which its
351
+ CCLInfraPlane shows as status.domain. The Ingress host is
352
+ <name>.nginx.<domain>, under the *.nginx.<domain> record the control-plane
353
+ operator publishes for the cluster's ingress, unless DeploymentURL overrides it. The
354
+ host does not include the namespace, so deployment names must be unique across the
355
+ plane. Required.
354
356
  """
355
357
  deployment_url: Annotated[str | None, Field(alias="deploymentUrl")] = None
356
358
  """
@@ -111,12 +111,6 @@ def init(control_plane: str) -> None:
111
111
  required=True,
112
112
  help="Kubeconfig context of the infra-plane cluster to register.",
113
113
  )
114
- @click.option(
115
- "--domain",
116
- required=True,
117
- help="The infra-plane cluster's DNS domain, written to its CCLClusterConfig. "
118
- "Cannot be changed once registered.",
119
- )
120
114
  @click.option(
121
115
  "--server",
122
116
  default=None,
@@ -127,7 +121,6 @@ def register(
127
121
  name: str,
128
122
  namespace: str,
129
123
  infra_plane: str,
130
- domain: str,
131
124
  server: str | None,
132
125
  ) -> None:
133
126
  """Register a cluster with the control plane.
@@ -135,9 +128,11 @@ def register(
135
128
  The control plane is the one saved by ccluster init. On the infra plane, creates the
136
129
  ServiceAccount kube-system/ccluster-manager, binds it to cluster-admin, and reads its
137
130
  long-lived token. On the control plane, applies the Secret NAME-credentials carrying
138
- that token and the cluster CA, and the CCLInfraPlane NAME pointing at it with the given
139
- domain. The control-plane operator then writes the domain to the infra plane's
140
- CCLClusterConfig. Re-running reuses the same token.
131
+ that token and the cluster CA, and the CCLInfraPlane NAME pointing at it. The
132
+ control-plane operator then writes the plane's domain, NAME.NAMESPACE.<its base domain>,
133
+ to the infra plane's CCLClusterConfig, so NAME must be a DNS label. The control plane
134
+ checks the CCLInfraPlane first, so a NAME it refuses creates nothing on the infra plane.
135
+ Re-running reuses the same token.
141
136
 
142
137
  Pass --server when the kubeconfig's address is not reachable from the control plane,
143
138
  for example a kind cluster, whose kubeconfig points at 127.0.0.1.
@@ -147,13 +142,17 @@ def register(
147
142
  infra_api = k8s_config.new_client_from_config(context=infra_plane)
148
143
  control_api = k8s_config.new_client_from_config(context=control_plane)
149
144
 
145
+ # The API server checks the plane, NAME included, before anything is created on
146
+ # the infra plane, so a plane it would refuse leaves no cluster-admin token behind.
147
+ client = CCLClient(namespace, api_client=control_api)
148
+ client.ensure_namespace()
149
+ client.check_infraplane(name=name)
150
+
150
151
  token, ca_cert = _cluster_admin_token(infra_api)
151
152
  server = server or infra_api.configuration.host
152
153
 
153
- client = CCLClient(namespace, api_client=control_api)
154
- client.ensure_namespace()
155
154
  plane = client.apply_infraplane(
156
- name=name, domain=domain, server=server, bearer_token=token, ca_cert=ca_cert
155
+ name=name, server=server, bearer_token=token, ca_cert=ca_cert
157
156
  )
158
157
  click.echo(
159
158
  f"Registered CCLInfraPlane {plane.metadata.namespace}/{plane.metadata.name} "
@@ -39,7 +39,9 @@ __all__ = [
39
39
  # Server-side apply records, per field, which manager last set it. Applying under one
40
40
  # fixed name is what lets a later apply_infraplane update the Secret this client wrote
41
41
  # without conflicting with itself, and what marks the objects as ours in managedFields.
42
- _FIELD_MANAGER = "ccluster-py"
42
+ # The Go client (pkg/cclclient) and the `ccluster` command apply under the same name, so
43
+ # each can update or shrink what the other applied.
44
+ _FIELD_MANAGER = "ccluster"
43
45
 
44
46
  # Argo CD special-cases this exact server URL: it connects with its own ServiceAccount
45
47
  # rather than anything in the Secret's "config", so no token or CA is needed to register
@@ -180,22 +182,19 @@ class CCLClient:
180
182
  self,
181
183
  *,
182
184
  name: str,
183
- domain: str,
184
185
  server: str | None = None,
185
186
  bearer_token: str | None = None,
186
187
  ca_cert: str | bytes | None = None,
187
188
  ) -> CCLInfraPlane:
188
189
  """Create or update the CCLInfraPlane called name, for the cluster at server.
189
190
 
190
- domain is the cluster's DNS domain. The operator writes it to the cluster's
191
- CCLClusterConfig, and it cannot be changed once the CCLInfraPlane exists.
191
+ The operator derives the cluster's DNS domain, "<name>.<namespace>.<base domain>",
192
+ and writes it to the cluster's CCLClusterConfig, so name must be a DNS label.
192
193
 
193
194
  Server-side applies the CCLInfraPlane, then the Secret named "<name>-credentials"
194
195
  it points at, in Argo CD's cluster-secret shape. The plane goes first so that a
195
- domain the API server rejects - malformed, or changed on an existing plane - fails
196
- the call before the credentials are written: the operator acts on a changed
197
- Secret at once, so new credentials under the old domain would retarget the
198
- existing plane. ca_cert is the API server's CA certificate in PEM. The call
196
+ name the API server rejects fails the call before the credentials are written.
197
+ ca_cert is the API server's CA certificate in PEM. The call
199
198
  returns as soon as both objects are applied; it does not wait for the operator to
200
199
  report Available.
201
200
 
@@ -212,13 +211,7 @@ class CCLClient:
212
211
  ca_cert = ca_cert.encode()
213
212
  secret_name = _credentials_secret_name(name)
214
213
 
215
- plane = CCLInfraPlane(
216
- metadata=ObjectMeta(name=name, namespace=self.namespace),
217
- spec=CCLInfraPlaneSpec(
218
- cluster_credentials_ref=LocalObjectReference(name=secret_name),
219
- domain=domain,
220
- ),
221
- )
214
+ plane = self._infraplane(name)
222
215
  cluster_config = ClusterConfig(
223
216
  bearer_token=bearer_token,
224
217
  tls_client_config=TLSClientConfig(
@@ -243,6 +236,18 @@ class CCLClient:
243
236
  self._apply(self._discovery.secret_gvr, secret)
244
237
  return applied
245
238
 
239
+ def check_infraplane(self, *, name: str) -> None:
240
+ """Raise if the API server would refuse the CCLInfraPlane apply_infraplane(name=name) writes.
241
+
242
+ Dry-runs the server-side apply of the plane, so the API server checks it against
243
+ the CRD's own rules, such as name being a DNS label, and writes nothing. Call it
244
+ before creating anything the plane needs, such as the infra plane's credentials.
245
+ Like apply_infraplane, it needs the namespace to exist already.
246
+ """
247
+ self._apply_object(
248
+ self._discovery.infra_plane_gvr, self._infraplane(name), dry_run=True
249
+ )
250
+
246
251
  def delete_infraplane(self, *, name: str) -> None:
247
252
  """Remove the CCLInfraPlane called name and its credentials Secret.
248
253
 
@@ -320,7 +325,18 @@ class CCLClient:
320
325
  return False
321
326
  return True
322
327
 
323
- def _apply_object(self, gvr, obj: BaseModel) -> dict:
328
+ def _infraplane(self, name: str) -> CCLInfraPlane:
329
+ """The CCLInfraPlane called name, pointing at its "<name>-credentials" Secret."""
330
+ return CCLInfraPlane(
331
+ metadata=ObjectMeta(name=name, namespace=self.namespace),
332
+ spec=CCLInfraPlaneSpec(
333
+ cluster_credentials_ref=LocalObjectReference(
334
+ name=_credentials_secret_name(name)
335
+ ),
336
+ ),
337
+ )
338
+
339
+ def _apply_object(self, gvr, obj: BaseModel, *, dry_run: bool = False) -> dict:
324
340
  """Server-side apply one of this API's objects and return it as the server holds it.
325
341
 
326
342
  obj is a whole object from ccluster.v1alpha1.base; the returned dict carries the
@@ -328,7 +344,7 @@ class CCLClient:
328
344
  validates back into the same class.
329
345
  """
330
346
  body = obj.model_dump(mode="json", by_alias=True, exclude_none=True)
331
- return self._apply(gvr, body).to_dict()
347
+ return self._apply(gvr, body, dry_run=dry_run).to_dict()
332
348
 
333
349
  def delete_component_set(self, *, name: str) -> None:
334
350
  """Remove the CCLComponentSet called name.
@@ -348,13 +364,17 @@ class CCLClient:
348
364
  self._get(self._discovery.component_set_gvr, name)
349
365
  )
350
366
 
351
- def _apply(self, gvr, body):
367
+ def _apply(self, gvr, body, *, dry_run: bool = False):
368
+ # dry_run="All" has the API server validate and admit the object without
369
+ # persisting it.
370
+ extra = {"dry_run": "All"} if dry_run else {}
352
371
  return self._discovery.dynamic.server_side_apply(
353
372
  gvr,
354
373
  body=self._api.sanitize_for_serialization(body),
355
374
  namespace=self.namespace,
356
375
  field_manager=_FIELD_MANAGER,
357
376
  force_conflicts=True,
377
+ **extra,
358
378
  )
359
379
 
360
380
  def _delete(self, gvr, name: str) -> None:
@@ -30,7 +30,9 @@ class CCLClusterConfigSpec(BaseModel):
30
30
  """
31
31
  domain is the cluster's DNS domain, and its SPIFFE trust domain. Components such
32
32
  as spire, external-dns and final_stack must be configured with it; the infra-plane
33
- operator verifies that they are. It must be a lowercase DNS name of at least two
33
+ operator verifies that they are. For a cluster registered with a CCLInfraPlane, the
34
+ control-plane operator writes the plane's domain here:
35
+ "<name>.<namespace>.<base domain>". It must be a lowercase DNS name of at least two
34
36
  labels, each at most 63 characters.
35
37
  """
36
38
 
@@ -150,6 +152,18 @@ class CCLClusterConfigStatus(BaseModel):
150
152
 
151
153
  The status of each condition is one of True, False, or Unknown.
152
154
  """
155
+ domain: Annotated[
156
+ str | None,
157
+ Field(
158
+ max_length=253,
159
+ pattern="^[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)+$",
160
+ ),
161
+ ] = None
162
+ """
163
+ domain is the spec.domain the infra-plane operator last verified the cluster
164
+ against, in the same pass as observedGeneration. The control-plane operator copies
165
+ it, with the rest of this status, into the CCLInfraPlane that registers the cluster.
166
+ """
153
167
  load_balancers: Annotated[
154
168
  list[LoadBalancer] | None, Field(alias="loadBalancers")
155
169
  ] = None
@@ -64,24 +64,6 @@ class CCLInfraPlaneSpec(BaseModel):
64
64
  referenced Secret holds. See
65
65
  https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#clusters
66
66
  """
67
- domain: Annotated[
68
- str,
69
- Field(
70
- max_length=253,
71
- min_length=1,
72
- pattern="^[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)+$",
73
- ),
74
- ]
75
- """
76
- domain is the infra-plane cluster's DNS domain. The control-plane operator writes it
77
- to the CCLClusterConfig singleton on that cluster, which the infra-plane operator
78
- verifies the cluster against. When the operator publishes DNS, "*.<name>.<domain>"
79
- points at each of the cluster's LoadBalancers labelled
80
- ccluster.nvidia.com/loadbalancer: <name>, such as "*.ingress.<domain>" at its
81
- ingress, in whichever DNS zone the domain falls under. It must be a lowercase DNS
82
- name of at least two labels, each at most 63 characters, and it cannot be changed
83
- once set.
84
- """
85
67
 
86
68
 
87
69
  class Status(Enum):
@@ -185,7 +167,9 @@ class CCLClusterConfigStatus(BaseModel):
185
167
  cluster, copied verbatim whenever it changes there. It is what the infra-plane
186
168
  operator reports about the cluster; ClusterConfigApplied says whether the copy is
187
169
  current. Its conditions and observedGeneration are the infra-plane operator's, and
188
- refer to the CCLClusterConfig, not to this CCLInfraPlane.
170
+ refer to the CCLClusterConfig, not to this CCLInfraPlane. Its domain is the
171
+ plane's domain once the infra-plane operator has verified the cluster against it;
172
+ see domain.
189
173
  """
190
174
 
191
175
  model_config = ConfigDict(
@@ -203,6 +187,18 @@ class CCLClusterConfigStatus(BaseModel):
203
187
 
204
188
  The status of each condition is one of True, False, or Unknown.
205
189
  """
190
+ domain: Annotated[
191
+ str | None,
192
+ Field(
193
+ max_length=253,
194
+ pattern="^[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)+$",
195
+ ),
196
+ ] = None
197
+ """
198
+ domain is the spec.domain the infra-plane operator last verified the cluster
199
+ against, in the same pass as observedGeneration. The control-plane operator copies
200
+ it, with the rest of this status, into the CCLInfraPlane that registers the cluster.
201
+ """
206
202
  load_balancers: Annotated[
207
203
  list[LoadBalancer] | None, Field(alias="loadBalancers")
208
204
  ] = None
@@ -242,7 +238,9 @@ class CCLInfraPlaneStatus(BaseModel):
242
238
  cluster, copied verbatim whenever it changes there. It is what the infra-plane
243
239
  operator reports about the cluster; ClusterConfigApplied says whether the copy is
244
240
  current. Its conditions and observedGeneration are the infra-plane operator's, and
245
- refer to the CCLClusterConfig, not to this CCLInfraPlane.
241
+ refer to the CCLClusterConfig, not to this CCLInfraPlane. Its domain is the
242
+ plane's domain once the infra-plane operator has verified the cluster against it;
243
+ see domain.
246
244
  """
247
245
  conditions: list[Condition1] | None = None
248
246
  """
@@ -254,13 +252,23 @@ class CCLInfraPlaneStatus(BaseModel):
254
252
  - "ClusterConfigApplied": the CCLClusterConfig singleton on the infra-plane
255
253
  cluster carries this CCLInfraPlane's domain.
256
254
  - "DNSReady": external-dns has read the current records pointing
257
- "*.<name>.<domain>" at each of the cluster's labelled LoadBalancers, and every
258
- label value is a DNS label. external-dns marks the records read before it
259
- writes them, so True does not mean they were published: the provider may
260
- reject them, or external-dns may skip them.
255
+ "*.<lb>.<domain>" at each of the cluster's LoadBalancers labelled
256
+ ccluster.nvidia.com/loadbalancer: <lb>, and every label value is a DNS label.
257
+ external-dns marks the records read before it writes them, so True does not
258
+ mean they were published: the provider may reject them, or external-dns may
259
+ skip them.
261
260
 
262
261
  The status of each condition is one of True, False, or Unknown.
263
262
  """
263
+ domain: str | None = None
264
+ """
265
+ domain is the cluster's DNS domain, "<name>.<namespace>.<base domain>", derived by
266
+ the control-plane operator from its --base-domain and written on every status
267
+ update, whether or not the cluster is reachable. It is the domain the operator
268
+ writes to the cluster's CCLClusterConfig and publishes "*.<lb>.<domain>" records
269
+ under. clusterConfig.domain is the domain the infra-plane operator last verified
270
+ the cluster against; the two differ until it has verified the current one.
271
+ """
264
272
  observed_generation: Annotated[int | None, Field(alias="observedGeneration")] = None
265
273
  """
266
274
  observedGeneration is the .metadata.generation the conditions were computed from.