Skip to content

Commit

Permalink
Merge pull request #8 from electrocucaracha/add_oai_cluster-workload
Browse files Browse the repository at this point in the history
Add OAI cluster workload package
  • Loading branch information
nephio-prow[bot] authored Dec 5, 2023
2 parents 1bbf3f9 + 8194eee commit 05bb795
Show file tree
Hide file tree
Showing 14 changed files with 262 additions and 0 deletions.
12 changes: 12 additions & 0 deletions workloads/oai/workload-cluster/Kptfile
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions workloads/oai/workload-cluster/README.md
Original file line number Diff line number Diff line change
@@ -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"

30 changes: 30 additions & 0 deletions workloads/oai/workload-cluster/apply-replacements.yaml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions workloads/oai/workload-cluster/package-context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: kptfile.kpt.dev
annotations:
config.kubernetes.io/local-config: "true"
data:
name: example
22 changes: 22 additions & 0 deletions workloads/oai/workload-cluster/pv-cluster.yaml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions workloads/oai/workload-cluster/pv-configsync.yaml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions workloads/oai/workload-cluster/pv-kindnet.yaml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions workloads/oai/workload-cluster/pv-local-path-provisioner.yaml
Original file line number Diff line number Diff line change
@@ -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

19 changes: 19 additions & 0 deletions workloads/oai/workload-cluster/pv-metallb.yaml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions workloads/oai/workload-cluster/pv-multus.yaml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions workloads/oai/workload-cluster/pv-repo.yaml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions workloads/oai/workload-cluster/pv-rootsync.yaml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions workloads/oai/workload-cluster/pv-vlanindex.yaml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions workloads/oai/workload-cluster/workload-cluster.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 05bb795

Please sign in to comment.