You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: install-guide/package-transformations.md
+88-1Lines changed: 88 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -374,21 +374,108 @@ triggered configsync to apply the `PackageVariant` configurations in the
374
374
`mgmt/regional` package. Let's examine those `PackageVariant` configurations one
375
375
by one.
376
376
377
+
In the text below, let's assume we are creating a workload cluster called `lambda`.
378
+
377
379
## pv-cluster.yaml: creates the Workload cluster
378
380
381
+
In the text below, let's assume we are creating a workload cluster called `lambda`.
382
+
383
+
This package variant transformation results in a package variant of the `cluster-capi-kind` package called `lambda-package`. The `lambda-package` contains the definition of a pair custom resources that are created when the package is applied. The custom resource pair are instances of the CRDs below
384
+
385
+
Custom Resource Definition | Controller | Function |
clusters.cluster.x-k8s.io | capi-system.capi-controller-manager | Trigger creation and start of the kind cluster |
388
+
workloadclusters.infra.nephio.org | nephio-system.nephio-controller | Trigger addition of nephio-specific configuration to the kind cluster |
389
+
390
+
The `PackageVariant` specified in `pv-cluster.yaml` is executed and:
391
+
1. Produces a package variant of the [cluster-capi-kind](https://github.com/nephio-project/nephio-example-packages/tree/main/cluster-capi-kind) package called `lambda-cluster` in the gitea `mgmt` repo on your management cluster.
392
+
2. Applies the `lambda-cluster` kpt package to create the kind cluster for the workload cluster
393
+
394
+
### Package transformations
395
+
396
+
During creation of the package variant kpt package, the following transformations occur:
397
+
398
+
1. It creates a `drafts/lambda-cluster/v1` branch on the `mgmt` repo
399
+
2. It does the equivalent of a [kpt pkg get](#kpt-pkg-get) on the `cluster-capi-kind` package into a directory called `lambda-cluster` on that branch, with the same transformations on package files carried out as the [kpt pkg get](#kpt-pkg-get) command above, this content is checked into the new branch in the initial commit
400
+
3. The pipeline specified in the `Kptfile`of the `cluster-capi-kind` package specifies an `apply-replacements` specified in the `apply-replacements.yaml` file in the package and uses the value of the `workload-cluster.yaml:spec.clusterName` field set in 2. above (which is the workload cluster name). This has the value of `example` in the `workload-cluster.yaml` file. This means that in the `cluster.yaml` file the value of field `metadata.name` is changed from `workload` to `example`.
401
+
4. The package variant `spec.injectors` changes specified in the `pv-cluster.yaml` file are applied.<br>
402
+
a. The relevant `pv-cluster.yaml` fields are:
403
+
```
404
+
spec:
405
+
injectors:
406
+
- kind: WorkloadCluster
407
+
name: example
408
+
pipeline:
409
+
mutators:
410
+
- image: gcr.io/kpt-fn/set-annotations:v0.1.4
411
+
configMap:
412
+
nephio.org/cluster-name: example
413
+
```
414
+
415
+
b. The following `PackageVariant` changes are made to the `lambda-cluster` package:
416
+
1. The field `info.readinessGates.conditionType` is added to the `Kptfile` with the value `config.injection.WorkloadCluster.workload-cluster`.
417
+
2. An extra `pipeline.mutators` entry is inserted in the `Kptfile`. This mutator is the mutator specified in the `pv-cluster.yaml` package variant specification, which specifies that the annotation `nephio.org/cluster-name: lambda` should be set on teh resources in the package:
418
+
419
+
```
420
+
pipeline:
421
+
mutators:
422
+
- name: PackageVariant.lambda-cluster..0
423
+
image: gcr.io/kpt-fn/set-annotations:v0.1.4
424
+
configMap:
425
+
nephio.org/cluster-name: lambda
426
+
```
427
+
3. The field `status.conditions` is added to the `Kptfile` with the values below. This condition means that the kpt package is not considered to be applied until the condition `config.injection.WorkloadCluster.workload-cluster` is `True`:
4. The `spec` in the WorkloadCluster file `workload-cluster.yaml` is set. This is the specification of the extra configuration that will be carried out on the workload cluster once kind has brought it up:
437
+
438
+
```
439
+
clusterName: lambda
440
+
cnis:
441
+
- macvlan
442
+
- ipvlan
443
+
- sriov
444
+
masterInterface: eth1
445
+
```
446
+
5. The amended pipeline specified in the `Kptfile`of the `lambda-cluster` is now re-executed. It was previously executed in step 3 above but there is now an extra mutator added by the package variant. The following changes result:<br>
447
+
a. The new mutator added to the `Kptfile` by the package variant adds the annotation `nephio.org/cluster-name: lambda` is added to every resource in the package.
448
+
b. The existing annotation in the `Kptfile` (coming from the Kptfile in the parent `cluster-capi-kind` package) sets the value `lambda` of the `spec.clusterName` field in `workload-cluster.yaml` as the value of the `metadata.name` field in the `cluster.yaml` file.
449
+
450
+
6. The `lambda-cluster` package is now ready to go. It is proposed and approved and the process of cluster creation commences.
451
+
452
+
### Cluster Creation
453
+
TBD.
454
+
455
+
379
456
## pv-rootsync.yaml:
380
457
381
-
## pv-repo.yaml: creates the Workload cluster repository
0 commit comments