ccluster-py 0.0.9.dev143__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.
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/PKG-INFO +20 -13
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/README.md +19 -12
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/pyproject.toml +1 -1
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/pyproject.toml.orig +1 -1
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/deployments/dynamo_deployment/__init__.py +6 -4
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/deployments/inference_deployment/__init__.py +6 -4
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/cli.py +12 -13
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/client.py +35 -17
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/cclclusterconfig.py +15 -1
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/cclinfraplane.py +32 -24
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/LICENSE +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/argo_rollouts/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/cert_manager/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/external_dns/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/final_stack/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/fluent_bit/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/gpu_operator/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/ingress_nginx/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/istio/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/keda/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/kube_prometheus_stack/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/longhorn/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/metrics_server/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/network_operator/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/opentelemetry_collector/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/prometheus_adapter/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/spire/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/cluster_base/spire_crds/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/deployments/compute_deployment/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/deployments/job_deployment/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/namespace_base/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/resources/kai_gpu_queues/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/catalogs/resources/persistent_volume/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/py.typed +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/__init__.py +0 -0
- {ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/base.py +0 -0
- {ccluster_py-0.0.9.dev143 → 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.
|
|
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,9 +80,15 @@ 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
|
|
84
|
-
domain
|
|
85
|
-
|
|
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
|
|
@@ -105,7 +111,6 @@ client = CCLClient("tenant-a", api_client=api_client)
|
|
|
105
111
|
client.ensure_namespace()
|
|
106
112
|
plane = client.apply_infraplane(
|
|
107
113
|
name="edge-1",
|
|
108
|
-
domain="edge-1.example.com",
|
|
109
114
|
server="https://10.0.0.1:6443",
|
|
110
115
|
bearer_token=open("token").read(),
|
|
111
116
|
ca_cert=open("ca.crt").read(),
|
|
@@ -118,7 +123,7 @@ client.delete_infraplane(name="edge-1")
|
|
|
118
123
|
Argo CD's special-cased in-cluster address, no ServiceAccount or token needed:
|
|
119
124
|
|
|
120
125
|
```python
|
|
121
|
-
plane = client.apply_infraplane(name="ccluster-local"
|
|
126
|
+
plane = client.apply_infraplane(name="ccluster-local")
|
|
122
127
|
```
|
|
123
128
|
|
|
124
129
|
From a workstation, pass an `ApiClient` built from your kubeconfig:
|
|
@@ -153,7 +158,7 @@ from ccluster.client import CCLClient, component_set_current_conditions
|
|
|
153
158
|
|
|
154
159
|
client = CCLClient("tenant-a", api_client=api_client) # api_client as above
|
|
155
160
|
client.ensure_namespace()
|
|
156
|
-
client.apply_infraplane(name="ccluster-local"
|
|
161
|
+
client.apply_infraplane(name="ccluster-local")
|
|
157
162
|
cs = client.apply_component_set(
|
|
158
163
|
name="local-base",
|
|
159
164
|
components=[
|
|
@@ -233,18 +238,20 @@ ccluster init -cp kind-ccluster-cp
|
|
|
233
238
|
context, with that control plane:
|
|
234
239
|
|
|
235
240
|
```bash
|
|
236
|
-
ccluster register edge-1 -n tenant-a -ip kind-ccluster-ip
|
|
241
|
+
ccluster register edge-1 -n tenant-a -ip kind-ccluster-ip \
|
|
237
242
|
--server https://ccluster-ip-control-plane:6443
|
|
238
243
|
```
|
|
239
244
|
|
|
240
|
-
|
|
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
|
|
241
248
|
to `cluster-admin` (Argo CD installs CRDs and other cluster-scoped objects there, so it needs
|
|
242
249
|
the same rights `argocd cluster add` grants), and reads the long-lived token the token
|
|
243
250
|
controller writes into the Secret `kube-system/ccluster-manager-token`. On the control plane
|
|
244
|
-
it
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
|
248
255
|
same token.
|
|
249
256
|
|
|
250
257
|
`--server` is the address Argo CD dials, and defaults to the infra-plane context's server in
|
|
@@ -58,9 +58,15 @@ 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
|
|
62
|
-
domain
|
|
63
|
-
|
|
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
|
|
@@ -83,7 +89,6 @@ client = CCLClient("tenant-a", api_client=api_client)
|
|
|
83
89
|
client.ensure_namespace()
|
|
84
90
|
plane = client.apply_infraplane(
|
|
85
91
|
name="edge-1",
|
|
86
|
-
domain="edge-1.example.com",
|
|
87
92
|
server="https://10.0.0.1:6443",
|
|
88
93
|
bearer_token=open("token").read(),
|
|
89
94
|
ca_cert=open("ca.crt").read(),
|
|
@@ -96,7 +101,7 @@ client.delete_infraplane(name="edge-1")
|
|
|
96
101
|
Argo CD's special-cased in-cluster address, no ServiceAccount or token needed:
|
|
97
102
|
|
|
98
103
|
```python
|
|
99
|
-
plane = client.apply_infraplane(name="ccluster-local"
|
|
104
|
+
plane = client.apply_infraplane(name="ccluster-local")
|
|
100
105
|
```
|
|
101
106
|
|
|
102
107
|
From a workstation, pass an `ApiClient` built from your kubeconfig:
|
|
@@ -131,7 +136,7 @@ from ccluster.client import CCLClient, component_set_current_conditions
|
|
|
131
136
|
|
|
132
137
|
client = CCLClient("tenant-a", api_client=api_client) # api_client as above
|
|
133
138
|
client.ensure_namespace()
|
|
134
|
-
client.apply_infraplane(name="ccluster-local"
|
|
139
|
+
client.apply_infraplane(name="ccluster-local")
|
|
135
140
|
cs = client.apply_component_set(
|
|
136
141
|
name="local-base",
|
|
137
142
|
components=[
|
|
@@ -211,18 +216,20 @@ ccluster init -cp kind-ccluster-cp
|
|
|
211
216
|
context, with that control plane:
|
|
212
217
|
|
|
213
218
|
```bash
|
|
214
|
-
ccluster register edge-1 -n tenant-a -ip kind-ccluster-ip
|
|
219
|
+
ccluster register edge-1 -n tenant-a -ip kind-ccluster-ip \
|
|
215
220
|
--server https://ccluster-ip-control-plane:6443
|
|
216
221
|
```
|
|
217
222
|
|
|
218
|
-
|
|
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
|
|
219
226
|
to `cluster-admin` (Argo CD installs CRDs and other cluster-scoped objects there, so it needs
|
|
220
227
|
the same rights `argocd cluster add` grants), and reads the long-lived token the token
|
|
221
228
|
controller writes into the Secret `kube-system/ccluster-manager-token`. On the control plane
|
|
222
|
-
it
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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
|
|
226
233
|
same token.
|
|
227
234
|
|
|
228
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.
|
|
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.
|
|
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
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
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
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
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
|
|
139
|
-
|
|
140
|
-
CCLClusterConfig
|
|
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,
|
|
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} "
|
|
@@ -182,22 +182,19 @@ class CCLClient:
|
|
|
182
182
|
self,
|
|
183
183
|
*,
|
|
184
184
|
name: str,
|
|
185
|
-
domain: str,
|
|
186
185
|
server: str | None = None,
|
|
187
186
|
bearer_token: str | None = None,
|
|
188
187
|
ca_cert: str | bytes | None = None,
|
|
189
188
|
) -> CCLInfraPlane:
|
|
190
189
|
"""Create or update the CCLInfraPlane called name, for the cluster at server.
|
|
191
190
|
|
|
192
|
-
|
|
193
|
-
CCLClusterConfig,
|
|
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.
|
|
194
193
|
|
|
195
194
|
Server-side applies the CCLInfraPlane, then the Secret named "<name>-credentials"
|
|
196
195
|
it points at, in Argo CD's cluster-secret shape. The plane goes first so that a
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
Secret at once, so new credentials under the old domain would retarget the
|
|
200
|
-
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
|
|
201
198
|
returns as soon as both objects are applied; it does not wait for the operator to
|
|
202
199
|
report Available.
|
|
203
200
|
|
|
@@ -214,13 +211,7 @@ class CCLClient:
|
|
|
214
211
|
ca_cert = ca_cert.encode()
|
|
215
212
|
secret_name = _credentials_secret_name(name)
|
|
216
213
|
|
|
217
|
-
plane =
|
|
218
|
-
metadata=ObjectMeta(name=name, namespace=self.namespace),
|
|
219
|
-
spec=CCLInfraPlaneSpec(
|
|
220
|
-
cluster_credentials_ref=LocalObjectReference(name=secret_name),
|
|
221
|
-
domain=domain,
|
|
222
|
-
),
|
|
223
|
-
)
|
|
214
|
+
plane = self._infraplane(name)
|
|
224
215
|
cluster_config = ClusterConfig(
|
|
225
216
|
bearer_token=bearer_token,
|
|
226
217
|
tls_client_config=TLSClientConfig(
|
|
@@ -245,6 +236,18 @@ class CCLClient:
|
|
|
245
236
|
self._apply(self._discovery.secret_gvr, secret)
|
|
246
237
|
return applied
|
|
247
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
|
+
|
|
248
251
|
def delete_infraplane(self, *, name: str) -> None:
|
|
249
252
|
"""Remove the CCLInfraPlane called name and its credentials Secret.
|
|
250
253
|
|
|
@@ -322,7 +325,18 @@ class CCLClient:
|
|
|
322
325
|
return False
|
|
323
326
|
return True
|
|
324
327
|
|
|
325
|
-
def
|
|
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:
|
|
326
340
|
"""Server-side apply one of this API's objects and return it as the server holds it.
|
|
327
341
|
|
|
328
342
|
obj is a whole object from ccluster.v1alpha1.base; the returned dict carries the
|
|
@@ -330,7 +344,7 @@ class CCLClient:
|
|
|
330
344
|
validates back into the same class.
|
|
331
345
|
"""
|
|
332
346
|
body = obj.model_dump(mode="json", by_alias=True, exclude_none=True)
|
|
333
|
-
return self._apply(gvr, body).to_dict()
|
|
347
|
+
return self._apply(gvr, body, dry_run=dry_run).to_dict()
|
|
334
348
|
|
|
335
349
|
def delete_component_set(self, *, name: str) -> None:
|
|
336
350
|
"""Remove the CCLComponentSet called name.
|
|
@@ -350,13 +364,17 @@ class CCLClient:
|
|
|
350
364
|
self._get(self._discovery.component_set_gvr, name)
|
|
351
365
|
)
|
|
352
366
|
|
|
353
|
-
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 {}
|
|
354
371
|
return self._discovery.dynamic.server_side_apply(
|
|
355
372
|
gvr,
|
|
356
373
|
body=self._api.sanitize_for_serialization(body),
|
|
357
374
|
namespace=self.namespace,
|
|
358
375
|
field_manager=_FIELD_MANAGER,
|
|
359
376
|
force_conflicts=True,
|
|
377
|
+
**extra,
|
|
360
378
|
)
|
|
361
379
|
|
|
362
380
|
def _delete(self, gvr, name: str) -> None:
|
{ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/cclclusterconfig.py
RENAMED
|
@@ -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.
|
|
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
|
{ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/cclinfraplane.py
RENAMED
|
@@ -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
|
-
"*.<
|
|
258
|
-
label value is a DNS label.
|
|
259
|
-
writes them, so True does not
|
|
260
|
-
reject them, or external-dns may
|
|
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.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ccluster_py-0.0.9.dev143 → ccluster_py-0.0.9.dev144}/src/ccluster/v1alpha1/cclcomponentset.py
RENAMED
|
File without changes
|