From 8194eee55d447a79202681bb60b6d91b14ce0731 Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Mon, 4 Dec 2023 12:00:42 -0800 Subject: [PATCH] Create OAI cluster workload package Signed-off-by: Victor Morales --- workloads/oai/workload-cluster/Kptfile | 12 ++++++++ workloads/oai/workload-cluster/README.md | 15 ++++++++++ .../workload-cluster/apply-replacements.yaml | 30 +++++++++++++++++++ .../oai/workload-cluster/package-context.yaml | 8 +++++ .../oai/workload-cluster/pv-cluster.yaml | 22 ++++++++++++++ .../oai/workload-cluster/pv-configsync.yaml | 19 ++++++++++++ .../oai/workload-cluster/pv-kindnet.yaml | 19 ++++++++++++ .../pv-local-path-provisioner.yaml | 20 +++++++++++++ .../oai/workload-cluster/pv-metallb.yaml | 19 ++++++++++++ workloads/oai/workload-cluster/pv-multus.yaml | 19 ++++++++++++ workloads/oai/workload-cluster/pv-repo.yaml | 22 ++++++++++++++ .../oai/workload-cluster/pv-rootsync.yaml | 22 ++++++++++++++ .../oai/workload-cluster/pv-vlanindex.yaml | 22 ++++++++++++++ .../workload-cluster/workload-cluster.yaml | 13 ++++++++ 14 files changed, 262 insertions(+) create mode 100644 workloads/oai/workload-cluster/Kptfile create mode 100644 workloads/oai/workload-cluster/README.md create mode 100644 workloads/oai/workload-cluster/apply-replacements.yaml create mode 100644 workloads/oai/workload-cluster/package-context.yaml create mode 100644 workloads/oai/workload-cluster/pv-cluster.yaml create mode 100644 workloads/oai/workload-cluster/pv-configsync.yaml create mode 100644 workloads/oai/workload-cluster/pv-kindnet.yaml create mode 100644 workloads/oai/workload-cluster/pv-local-path-provisioner.yaml create mode 100644 workloads/oai/workload-cluster/pv-metallb.yaml create mode 100644 workloads/oai/workload-cluster/pv-multus.yaml create mode 100644 workloads/oai/workload-cluster/pv-repo.yaml create mode 100644 workloads/oai/workload-cluster/pv-rootsync.yaml create mode 100644 workloads/oai/workload-cluster/pv-vlanindex.yaml create mode 100644 workloads/oai/workload-cluster/workload-cluster.yaml diff --git a/workloads/oai/workload-cluster/Kptfile b/workloads/oai/workload-cluster/Kptfile new file mode 100644 index 0000000..3b4b1fd --- /dev/null +++ b/workloads/oai/workload-cluster/Kptfile @@ -0,0 +1,12 @@ +apiVersion: kpt.dev/v1 +kind: Kptfile +metadata: + name: workload-cluster + annotations: + config.kubernetes.io/local-config: "true" +info: + description: nephio workload cluster package +pipeline: + mutators: + - image: gcr.io/kpt-fn/apply-replacements:v0.1.1 + configPath: apply-replacements.yaml diff --git a/workloads/oai/workload-cluster/README.md b/workloads/oai/workload-cluster/README.md new file mode 100644 index 0000000..7fdd2fc --- /dev/null +++ b/workloads/oai/workload-cluster/README.md @@ -0,0 +1,15 @@ +# workload-cluster + +## Description + +Deploying this package to the Nephio management cluster will result in the +provisioning of a workload cluster, associated repository, tokens, secrets, +and other resources needed to fully register the new cluster with Nephio. + +To accomplish this, the package will deploy two additional packages to the management +cluster repo (one for the cluster and one for the repository) and two additional packages +to the management staging repo (one for configsync and one for rootsync). +The names of those packages will be based on the name of the cluster-name. So, if this package +is cloned to the name "cluster-01", it will deploy two additional packages, +"cluster-01-cluster", "cluster-01-repo", "cluster-01-rootsync" and "cluster-01-configsync" + diff --git a/workloads/oai/workload-cluster/apply-replacements.yaml b/workloads/oai/workload-cluster/apply-replacements.yaml new file mode 100644 index 0000000..04bf9bd --- /dev/null +++ b/workloads/oai/workload-cluster/apply-replacements.yaml @@ -0,0 +1,30 @@ +apiVersion: fn.kpt.dev/v1alpha1 +kind: ApplyReplacements +metadata: + name: propagate-name + annotations: + config.kubernetes.io/local-config: "true" +replacements: +- source: + kind: ConfigMap + name: kptfile.kpt.dev + fieldPath: data.name + targets: + - select: + kind: PackageVariant + fieldPaths: + - metadata.name + - spec.downstream.package + options: + delimiter: '-' + index: 0 + - select: + kind: PackageVariant + fieldPaths: + - spec.injectors.[kind=WorkloadCluster].name + - spec.pipeline.mutators.[image=gcr.io/kpt-fn/set-annotations:v0.1.4].configMap.[nephio.org/cluster-name] + - select: + kind: WorkloadCluster + fieldPaths: + - metadata.name + - spec.clusterName diff --git a/workloads/oai/workload-cluster/package-context.yaml b/workloads/oai/workload-cluster/package-context.yaml new file mode 100644 index 0000000..6c33d9e --- /dev/null +++ b/workloads/oai/workload-cluster/package-context.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: kptfile.kpt.dev + annotations: + config.kubernetes.io/local-config: "true" +data: + name: example diff --git a/workloads/oai/workload-cluster/pv-cluster.yaml b/workloads/oai/workload-cluster/pv-cluster.yaml new file mode 100644 index 0000000..2e02afa --- /dev/null +++ b/workloads/oai/workload-cluster/pv-cluster.yaml @@ -0,0 +1,22 @@ +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: example-cluster +spec: + annotations: + approval.nephio.org/policy: initial + upstream: + package: cluster-capi-kind + repo: nephio-example-packages + revision: v5 + downstream: + package: example-cluster + repo: mgmt + injectors: + - kind: WorkloadCluster + name: example + pipeline: + mutators: + - image: gcr.io/kpt-fn/set-annotations:v0.1.4 + configMap: + nephio.org/cluster-name: example diff --git a/workloads/oai/workload-cluster/pv-configsync.yaml b/workloads/oai/workload-cluster/pv-configsync.yaml new file mode 100644 index 0000000..724a2e1 --- /dev/null +++ b/workloads/oai/workload-cluster/pv-configsync.yaml @@ -0,0 +1,19 @@ +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: example-configsync +spec: + annotations: + approval.nephio.org/policy: initial + upstream: + package: configsync + repo: nephio-example-packages + revision: v1 + downstream: + package: example-configsync + repo: mgmt-staging + pipeline: + mutators: + - image: gcr.io/kpt-fn/set-annotations:v0.1.4 + configMap: + nephio.org/cluster-name: example diff --git a/workloads/oai/workload-cluster/pv-kindnet.yaml b/workloads/oai/workload-cluster/pv-kindnet.yaml new file mode 100644 index 0000000..ff1ee96 --- /dev/null +++ b/workloads/oai/workload-cluster/pv-kindnet.yaml @@ -0,0 +1,19 @@ +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: example-kindnet +spec: + annotations: + approval.nephio.org/policy: initial + upstream: + package: kindnet + repo: nephio-example-packages + revision: v1 + downstream: + package: example-kindnet + repo: mgmt-staging + pipeline: + mutators: + - image: gcr.io/kpt-fn/set-annotations:v0.1.4 + configMap: + nephio.org/cluster-name: example diff --git a/workloads/oai/workload-cluster/pv-local-path-provisioner.yaml b/workloads/oai/workload-cluster/pv-local-path-provisioner.yaml new file mode 100644 index 0000000..18dd226 --- /dev/null +++ b/workloads/oai/workload-cluster/pv-local-path-provisioner.yaml @@ -0,0 +1,20 @@ +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: example-local-path-provisioner +spec: + annotations: + approval.nephio.org/policy: initial + upstream: + package: local-path-provisioner + repo: nephio-example-packages + revision: v1 + downstream: + package: example-local-path-provisioner + repo: mgmt-staging + pipeline: + mutators: + - image: gcr.io/kpt-fn/set-annotations:v0.1.4 + configMap: + nephio.org/cluster-name: example + diff --git a/workloads/oai/workload-cluster/pv-metallb.yaml b/workloads/oai/workload-cluster/pv-metallb.yaml new file mode 100644 index 0000000..b6693d6 --- /dev/null +++ b/workloads/oai/workload-cluster/pv-metallb.yaml @@ -0,0 +1,19 @@ +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: example-metallb +spec: + annotations: + approval.nephio.org/policy: initial + upstream: + package: metallb + repo: nephio-example-packages + revision: v1 + downstream: + package: example-metallb + repo: mgmt-staging + pipeline: + mutators: + - image: gcr.io/kpt-fn/set-annotations:v0.1.4 + configMap: + nephio.org/cluster-name: example diff --git a/workloads/oai/workload-cluster/pv-multus.yaml b/workloads/oai/workload-cluster/pv-multus.yaml new file mode 100644 index 0000000..792c8a2 --- /dev/null +++ b/workloads/oai/workload-cluster/pv-multus.yaml @@ -0,0 +1,19 @@ +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: example-multus +spec: + annotations: + approval.nephio.org/policy: initial + upstream: + package: multus + repo: nephio-example-packages + revision: v1 + downstream: + package: example-multus + repo: mgmt-staging + pipeline: + mutators: + - image: gcr.io/kpt-fn/set-annotations:v0.1.4 + configMap: + nephio.org/cluster-name: example diff --git a/workloads/oai/workload-cluster/pv-repo.yaml b/workloads/oai/workload-cluster/pv-repo.yaml new file mode 100644 index 0000000..5572b2b --- /dev/null +++ b/workloads/oai/workload-cluster/pv-repo.yaml @@ -0,0 +1,22 @@ +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: example-repo +spec: + annotations: + approval.nephio.org/policy: initial + upstream: + package: repository + repo: nephio-example-packages + revision: v3 + downstream: + package: example-repo + repo: mgmt + injectors: + - kind: WorkloadCluster + name: example + pipeline: + mutators: + - image: gcr.io/kpt-fn/set-annotations:v0.1.4 + configMap: + nephio.org/cluster-name: example diff --git a/workloads/oai/workload-cluster/pv-rootsync.yaml b/workloads/oai/workload-cluster/pv-rootsync.yaml new file mode 100644 index 0000000..d7b85ba --- /dev/null +++ b/workloads/oai/workload-cluster/pv-rootsync.yaml @@ -0,0 +1,22 @@ +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: example-rootsync +spec: + annotations: + approval.nephio.org/policy: initial + upstream: + package: rootsync + repo: nephio-example-packages + revision: v3 + downstream: + package: example-rootsync + repo: mgmt-staging + injectors: + - kind: WorkloadCluster + name: example + pipeline: + mutators: + - image: gcr.io/kpt-fn/set-annotations:v0.1.4 + configMap: + nephio.org/cluster-name: example diff --git a/workloads/oai/workload-cluster/pv-vlanindex.yaml b/workloads/oai/workload-cluster/pv-vlanindex.yaml new file mode 100644 index 0000000..b7e912c --- /dev/null +++ b/workloads/oai/workload-cluster/pv-vlanindex.yaml @@ -0,0 +1,22 @@ +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: example-vlanindex +spec: + annotations: + approval.nephio.org/policy: initial + upstream: + package: vlanindex + repo: nephio-example-packages + revision: v1 + downstream: + package: example-vlanindex + repo: mgmt + injectors: + - kind: WorkloadCluster + name: example + pipeline: + mutators: + - image: gcr.io/kpt-fn/set-annotations:v0.1.4 + configMap: + nephio.org/cluster-name: example diff --git a/workloads/oai/workload-cluster/workload-cluster.yaml b/workloads/oai/workload-cluster/workload-cluster.yaml new file mode 100644 index 0000000..247e818 --- /dev/null +++ b/workloads/oai/workload-cluster/workload-cluster.yaml @@ -0,0 +1,13 @@ +apiVersion: infra.nephio.org/v1alpha1 +kind: WorkloadCluster +metadata: + name: example +spec: + # Since injection only injects the spec, we need the name here as + # well as in metadata. + clusterName: example + cnis: + - macvlan + - ipvlan + - sriov + masterInterface: eth1