diff options
author | Eric Multanen <eric.w.multanen@intel.com> | 2021-06-24 20:45:24 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-06-24 20:45:24 +0000 |
commit | cec17f07ca594b45e9781438f0d9b9f9d60f2961 (patch) | |
tree | 86fad4b7b5b22311604b01fb585e5e35a1406ff3 /kud/deployment_infra/emco/examples | |
parent | 3c09e032b06c18426e59ec38d925e2b4ace24abc (diff) | |
parent | 741d0b2bf25ee68eab05c5a768f60515131bb852 (diff) |
Merge "Refactor EMCO deploy of addons"
Diffstat (limited to 'kud/deployment_infra/emco/examples')
9 files changed, 380 insertions, 156 deletions
diff --git a/kud/deployment_infra/emco/examples/00-controllers.yaml b/kud/deployment_infra/emco/examples/00-controllers.yaml new file mode 100644 index 00000000..c023ab87 --- /dev/null +++ b/kud/deployment_infra/emco/examples/00-controllers.yaml @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2020 Intel Corporation + +--- +#creating controller entries +version: emco/v2 +resourceContext: + anchor: controllers +metadata : + name: rsync +spec: + host: {{ .HostIP }} + port: {{ .RsyncPort }} + +--- +#creating controller entries +version: emco/v2 +resourceContext: + anchor: controllers +metadata : + name: gac +spec: + host: {{ .HostIP }} + port: {{ .GacPort }} + type: "action" + priority: 1 + +--- +#creating controller entries +version: emco/v2 +resourceContext: + anchor: controllers +metadata : + name: ovnaction +spec: + host: {{ .HostIP }} + port: {{ .OvnPort }} + type: "action" + priority: 1 + +--- +#creating controller entries +version: emco/v2 +resourceContext: + anchor: controllers +metadata : + name: dtc +spec: + host: {{ .HostIP }} + port: {{ .DtcPort }} + type: "action" + priority: 1 diff --git a/kud/deployment_infra/emco/examples/01-cluster.yaml b/kud/deployment_infra/emco/examples/01-cluster.yaml new file mode 100644 index 00000000..6f7ce4ba --- /dev/null +++ b/kud/deployment_infra/emco/examples/01-cluster.yaml @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2020 Intel Corporation + +--- +#creating cluster provider +version: emco/v2 +resourceContext: + anchor: cluster-providers +metadata : + name: {{ .ClusterProvider }} + +{{- range $index, $cluster := .Clusters }} +--- +#creating cluster +version: emco/v2 +resourceContext: + anchor: cluster-providers/{{ $.ClusterProvider }}/clusters +metadata : + name: {{ $cluster.Name }} +file: + {{ $cluster.KubeConfig }} + +--- +#Add label cluster +version: emco/v2 +resourceContext: + anchor: cluster-providers/{{ $.ClusterProvider }}/clusters/{{ $cluster.Name }}/labels +label-name: {{ $.ClustersLabel }} +{{- end }}
\ No newline at end of file diff --git a/kud/deployment_infra/emco/examples/02-project.yaml b/kud/deployment_infra/emco/examples/02-project.yaml new file mode 100644 index 00000000..98ecfdb4 --- /dev/null +++ b/kud/deployment_infra/emco/examples/02-project.yaml @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2020 Intel Corporation + +--- +#create project +version: emco/v2 +resourceContext: + anchor: projects +metadata : + name: {{ .ProjectName }} + +--- +#create default logical cloud with admin permissions +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/logical-clouds +metadata: + name: {{ .LogicalCloud }} +spec: + level: "0" + +{{- range $index, $cluster := .Clusters }} +--- +#add cluster reference to logical cloud +version: emco/v2 +resourceContext: + anchor: projects/{{ $.ProjectName }}/logical-clouds/{{ $.LogicalCloud }}/cluster-references +metadata: + name: {{ $cluster.Name }} +spec: + cluster-provider: {{ $.ClusterProvider }} + cluster-name: {{ $cluster.Name }} + loadbalancer-ip: "0.0.0.0" +{{- end }} + +--- +#instantiate logical cloud +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/logical-clouds/{{ .LogicalCloud }}/instantiate diff --git a/kud/deployment_infra/emco/examples/03-addons-app.yaml b/kud/deployment_infra/emco/examples/03-addons-app.yaml new file mode 100644 index 00000000..0fd15e0f --- /dev/null +++ b/kud/deployment_infra/emco/examples/03-addons-app.yaml @@ -0,0 +1,110 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2020 Intel Corporation + +--- +#creating composite app entry +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps +metadata : + name: {{ .AddonsApp }} + description: "KUD addons" +spec: + version: v1 + +{{- range $index, $addon := .Addons }} +--- +#adding app to the composite app +version: emco/v2 +resourceContext: + anchor: projects/{{ $.ProjectName }}/composite-apps/{{ $.AddonsApp }}/v1/apps +metadata : + name: {{ $addon }} +file: + {{ $.PackagesPath }}/{{ $addon }}.tar.gz +{{- end }} + +--- +#creating composite profile entry +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonsApp }}/v1/composite-profiles +metadata : + name: {{ .AddonsProfile }} + +{{- range $index, $addon := .Addons }} +--- +#adding app profiles to the composite profile +version: emco/v2 +resourceContext: + anchor: projects/{{ $.ProjectName }}/composite-apps/{{ $.AddonsApp }}/v1/composite-profiles/{{ $.AddonsProfile }}/profiles +metadata : + name: {{ $addon }}-profile +spec: + app-name: {{ $addon }} +file: + {{ $.PackagesPath }}/{{ $addon }}_profile.tar.gz +{{- end }} + +--- +#create deployment intent group +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonsApp }}/v1/deployment-intent-groups +metadata : + name: {{ .AddonsDeploymentIntentGroup }} + description: "description" +spec: + profile: {{ .AddonsProfile }} + version: r1 + logical-cloud: {{ .LogicalCloud }} + override-values: [] + +--- +#create intent in deployment intent group +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonsApp }}/v1/deployment-intent-groups/{{ .AddonsDeploymentIntentGroup }}/intents +metadata : + name: {{ .AddonsDeploymentIntent }} +spec: + intent: + genericPlacementIntent: {{ .AddonsPlacementIntent }} + +--- +#create the generic placement intent +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonsApp }}/v1/deployment-intent-groups/{{ .AddonsDeploymentIntentGroup }}/generic-placement-intents +metadata : + name: {{ .AddonsPlacementIntent }} +spec: + logical-cloud: {{ .LogicalCloud }} + +{{- range $index, $addon := .Addons }} +--- +#add the app placement intent to the generic placement intent +version: emco/v2 +resourceContext: + anchor: projects/{{ $.ProjectName }}/composite-apps/{{ $.AddonsApp }}/v1/deployment-intent-groups/{{ $.AddonsDeploymentIntentGroup }}/generic-placement-intents/{{ $.AddonsPlacementIntent }}/app-intents +metadata: + name: {{ $addon }}-placement-intent +spec: + app-name: {{ $addon }} + intent: + allOf: + - provider-name: {{ $.ClusterProvider }} + cluster-label-name: {{ $.ClustersLabel }} +{{- end }} + +--- +#Approve +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonsApp }}/v1/deployment-intent-groups/{{ .AddonsDeploymentIntentGroup }}/approve + +--- +#Instantiate +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonsApp }}/v1/deployment-intent-groups/{{ .AddonsDeploymentIntentGroup }}/instantiate diff --git a/kud/deployment_infra/emco/examples/04-addon-resources-app.yaml b/kud/deployment_infra/emco/examples/04-addon-resources-app.yaml new file mode 100644 index 00000000..92fd9539 --- /dev/null +++ b/kud/deployment_infra/emco/examples/04-addon-resources-app.yaml @@ -0,0 +1,110 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2020 Intel Corporation + +--- +#creating composite app entry +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps +metadata : + name: {{ .AddonResourcesApp }} + description: "KUD addons" +spec: + version: v1 + +{{- range $index, $addon := .AddonResources }} +--- +#adding app to the composite app +version: emco/v2 +resourceContext: + anchor: projects/{{ $.ProjectName }}/composite-apps/{{ $.AddonResourcesApp }}/v1/apps +metadata : + name: {{ $addon }} +file: + {{ $.PackagesPath }}/{{ $addon }}.tar.gz +{{- end }} + +--- +#creating composite profile entry +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonResourcesApp }}/v1/composite-profiles +metadata : + name: {{ .AddonResourcesProfile }} + +{{- range $index, $addon := .AddonResources }} +--- +#adding app profiles to the composite profile +version: emco/v2 +resourceContext: + anchor: projects/{{ $.ProjectName }}/composite-apps/{{ $.AddonResourcesApp }}/v1/composite-profiles/{{ $.AddonResourcesProfile }}/profiles +metadata : + name: {{ $addon }}-profile +spec: + app-name: {{ $addon }} +file: + {{ $.PackagesPath }}/{{ $addon }}_profile.tar.gz +{{- end }} + +--- +#create deployment intent group +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonResourcesApp }}/v1/deployment-intent-groups +metadata : + name: {{ .AddonResourcesDeploymentIntentGroup }} + description: "description" +spec: + profile: {{ .AddonResourcesProfile }} + version: r1 + logical-cloud: {{ .LogicalCloud }} + override-values: [] + +--- +#create intent in deployment intent group +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonResourcesApp }}/v1/deployment-intent-groups/{{ .AddonResourcesDeploymentIntentGroup }}/intents +metadata : + name: {{ .AddonResourcesDeploymentIntent }} +spec: + intent: + genericPlacementIntent: {{ .AddonResourcesPlacementIntent }} + +--- +#create the generic placement intent +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonResourcesApp }}/v1/deployment-intent-groups/{{ .AddonResourcesDeploymentIntentGroup }}/generic-placement-intents +metadata : + name: {{ .AddonResourcesPlacementIntent }} +spec: + logical-cloud: {{ .LogicalCloud }} + +{{- range $index, $addon := .AddonResources }} +--- +#add the app placement intent to the generic placement intent +version: emco/v2 +resourceContext: + anchor: projects/{{ $.ProjectName }}/composite-apps/{{ $.AddonResourcesApp }}/v1/deployment-intent-groups/{{ $.AddonResourcesDeploymentIntentGroup }}/generic-placement-intents/{{ $.AddonResourcesPlacementIntent }}/app-intents +metadata: + name: {{ $addon }}-placement-intent +spec: + app-name: {{ $addon }} + intent: + allOf: + - provider-name: {{ $.ClusterProvider }} + cluster-label-name: {{ $.ClustersLabel }} +{{- end }} + +--- +#Approve +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonResourcesApp }}/v1/deployment-intent-groups/{{ .AddonResourcesDeploymentIntentGroup }}/approve + +--- +#Instantiate +version: emco/v2 +resourceContext: + anchor: projects/{{ .ProjectName }}/composite-apps/{{ .AddonResourcesApp }}/v1/deployment-intent-groups/{{ .AddonResourcesDeploymentIntentGroup }}/instantiate diff --git a/kud/deployment_infra/emco/examples/README.md b/kud/deployment_infra/emco/examples/README.md index b91cce10..203b83fd 100644 --- a/kud/deployment_infra/emco/examples/README.md +++ b/kud/deployment_infra/emco/examples/README.md @@ -27,33 +27,36 @@ needs to be installed and configured for the edge cluster. 2. Customize values.yaml. `$ envsubst < values.yaml.example > values.yaml` - `$ envsubst < values-resources.yaml.example > values-resources.yaml` ## Create prerequisites to deploy addons -Apply prerequisites.yaml. This creates controllers, one project, one -cluster, and default logical cloud. This step is required to be done -only once. +Apply the prerequisites. This creates the controllers, one or more +clusters, one project, and one default logical cloud. This step is +required to be done only once. - `$ emcoctl apply -f prerequisites.yaml -v values.yaml` + `$ emcoctl apply -f 00-controllers.yaml -v values.yaml` + `$ emcoctl apply -f 01-cluster.yaml -v values.yaml` + `$ emcoctl apply -f 02-project.yaml -v values.yaml` ## Deploying addons -Apply composite-app.yaml. This deploys the addons listed in the `Apps` -value. +This deploys the applications listed in the `Addons` and +`AddonResources` values. - `$ emcoctl apply -f ../output/composite-app.yaml -v values.yaml` - `$ emcoctl apply -f ../output/composite-app.yaml -v values-resources.yaml` + `$ emcoctl apply -f 03-addons-app.yaml -v values.yaml` + `$ emcoctl apply -f 04-addon-resources-app.yaml -v values.yaml` ## Cleanup 1. Delete addons. - `$ emcoctl delete -f ../output/composite-app.yaml -v values-resources.yaml` - `$ emcoctl delete -f ../output/composite-app.yaml -v values.yaml` + `$ emcoctl delete -f 04-addon-resources-app.yaml -v values.yaml` + `$ emcoctl delete -f 03-addons-app.yaml -v values.yaml` 2. Cleanup prerequisites. - `$ emcoctl delete -f prerequisites.yaml -v values.yaml` + `$ emcoctl delete -f 02-project.yaml -v values.yaml` + `$ emcoctl delete -f 01-cluster.yaml -v values.yaml` + `$ emcoctl delete -f 00-controllers.yaml -v values.yaml` #### NOTE: Known issue: Deletion of the resources fails sometimes as some resources can't be deleted before others are deleted. This can happen due to timing issue. In that case try deleting again and the deletion should succeed. diff --git a/kud/deployment_infra/emco/examples/prerequisites.yaml b/kud/deployment_infra/emco/examples/prerequisites.yaml deleted file mode 100644 index a44546e0..00000000 --- a/kud/deployment_infra/emco/examples/prerequisites.yaml +++ /dev/null @@ -1,113 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2020 Intel Corporation - ---- -#create project -version: emco/v2 -resourceContext: - anchor: projects -metadata : - name: {{ .ProjectName }} ---- -#creating controller entries -version: emco/v2 -resourceContext: - anchor: controllers -metadata : - name: rsync -spec: - host: {{ .HostIP }} - port: {{ .RsyncPort }} - ---- -#creating controller entries -version: emco/v2 -resourceContext: - anchor: controllers -metadata : - name: gac -spec: - host: {{ .HostIP }} - port: {{ .GacPort }} - type: "action" - priority: 1 - ---- -#creating controller entries -version: emco/v2 -resourceContext: - anchor: controllers -metadata : - name: ovnaction -spec: - host: {{ .HostIP }} - port: {{ .OvnPort }} - type: "action" - priority: 1 - ---- -#creating controller entries -version: emco/v2 -resourceContext: - anchor: controllers -metadata : - name: dtc -spec: - host: {{ .HostIP }} - port: {{ .DtcPort }} - type: "action" - priority: 1 - ---- -#creating cluster provider -version: emco/v2 -resourceContext: - anchor: cluster-providers -metadata : - name: {{ .ClusterProvider }} - ---- -#creating cluster -version: emco/v2 -resourceContext: - anchor: cluster-providers/{{ .ClusterProvider }}/clusters -metadata : - name: {{ .Cluster1 }} -file: - {{ .KubeConfig }} - ---- -#Add label cluster -version: emco/v2 -resourceContext: - anchor: cluster-providers/{{ .ClusterProvider }}/clusters/{{ .Cluster1 }}/labels -label-name: {{ .ClusterLabel }} - ---- -#create default logical cloud with admin permissions -version: emco/v2 -resourceContext: - anchor: projects/{{ .ProjectName }}/logical-clouds -metadata: - name: {{ .LogicalCloud }} -spec: - level: "0" - ---- -#add cluster reference to logical cloud -version: emco/v2 -resourceContext: - anchor: projects/{{ .ProjectName }}/logical-clouds/{{ .LogicalCloud }}/cluster-references -metadata: - name: lc-cl-1 -spec: - cluster-provider: {{ .ClusterProvider }} - cluster-name: {{ .Cluster1 }} - loadbalancer-ip: "0.0.0.0" - ---- -#instantiate logical cloud -version: emco/v2 -resourceContext: - anchor: projects/{{ .ProjectName }}/logical-clouds/{{ .LogicalCloud }}/instantiate - diff --git a/kud/deployment_infra/emco/examples/values-resources.yaml.example b/kud/deployment_infra/emco/examples/values-resources.yaml.example deleted file mode 100644 index acfd903c..00000000 --- a/kud/deployment_infra/emco/examples/values-resources.yaml.example +++ /dev/null @@ -1,19 +0,0 @@ -HostIP: $HOST_IP -KubeConfig: $KUBE_PATH -PackagesPath: $PWD/../output/packages -ProjectName: proj1 -RsyncPort: 30441 -GacPort: 30493 -OvnPort: 30473 -DtcPort: 30483 -ClusterProvider: provider1 -Cluster1: cluster1 -ClusterLabel: edge-cluster -LogicalCloud: default -CompositeApp: addon-resources -CompositeProfile: addon-resources-profile -DeploymentIntentGroup: addon-resources-deployment-intent-group -DeploymentIntent: addon-resources-deployment-intent -GenericPlacementIntent: addon-resources-placement-intent -Apps: -- sriov-network diff --git a/kud/deployment_infra/emco/examples/values.yaml.example b/kud/deployment_infra/emco/examples/values.yaml.example index 37ddacf6..4f5e45ed 100644 --- a/kud/deployment_infra/emco/examples/values.yaml.example +++ b/kud/deployment_infra/emco/examples/values.yaml.example @@ -1,24 +1,36 @@ HostIP: $HOST_IP -KubeConfig: $KUBE_PATH -PackagesPath: $PWD/../output/packages -ProjectName: proj1 RsyncPort: 30441 GacPort: 30493 OvnPort: 30473 DtcPort: 30483 -ClusterProvider: provider1 -Cluster1: cluster1 -ClusterLabel: edge-cluster + +ClusterProvider: kud +ClustersLabel: kud-cluster +Clusters: +- KubeConfig: $KUBE_PATH + Name: cluster + +ProjectName: kud LogicalCloud: default -CompositeApp: addons -CompositeProfile: addons-profile -DeploymentIntentGroup: addons-deployment-intent-group -DeploymentIntent: addons-deployment-intent -GenericPlacementIntent: addons-placement-intent -Apps: + +PackagesPath: $PWD/../output/packages +AddonsApp: addons +AddonsProfile: addons-profile +AddonsDeploymentIntentGroup: addons-deployment-intent-group +AddonsDeploymentIntent: addons-deployment-intent +AddonsPlacementIntent: addons-placement-intent +Addons: - multus-cni - ovn4nfv - node-feature-discovery - sriov-network-operator - qat-device-plugin - cpu-manager + +AddonResourcesApp: addon-resources +AddonResourcesProfile: addon-resources-profile +AddonResourcesDeploymentIntentGroup: addon-resources-deployment-intent-group +AddonResourcesDeploymentIntent: addon-resources-deployment-intent +AddonResourcesPlacementIntent: addon-resources-placement-intent +AddonResources: +- sriov-network |