From 3820f98ee15eeaa1eab5a2ea56c996bc0a9a505a Mon Sep 17 00:00:00 2001 From: achimweigel Date: Thu, 19 Sep 2024 19:37:56 +0200 Subject: [PATCH] Generation commands (#1186) --- .../chart/echo-server/Chart.yaml | 6 + .../echo-server/templates/deployment.yaml | 23 +++ .../chart/echo-server/templates/service.yaml | 12 ++ .../chart/echo-server/values.yaml | 2 + .../create-blueprint-command/command.md | 3 + .../create-blueprint-command/config.yaml | 20 +++ .../blueprint.yaml | 34 +++++ .../deploy-execution.yaml | 19 +++ .../blueprints/blueprint-root/blueprint.yaml | 23 +++ .../subinstallation-echo-server-extended.yaml | 18 +++ .../result/component-constructor.yaml | 32 +++++ .../create-installation-command/command.md | 3 + .../result/context.yaml | 9 ++ .../result/dataobject-release.yaml | 8 ++ .../result/dataobject-values.yaml | 7 + .../result/installation.yaml | 32 +++++ .../result/target.yaml | 10 ++ .../create-installation-command/settings.yaml | 16 +++ .../chart/echo-server-extended/Chart.yaml | 6 + .../templates/deployment.yaml | 23 +++ .../templates/service.yaml | 12 ++ .../chart/echo-server-extended/values.yaml | 2 + .../create-blueprint-command/command.md | 2 + .../create-blueprint-command/config.yaml | 76 ++++++++++ .../blueprint.yaml | 40 ++++++ .../deploy-execution.yaml | 29 ++++ .../export-execution.yaml | 2 + .../blueprint-next-chart/blueprint.yaml | 40 ++++++ .../deploy-execution.yaml | 19 +++ .../blueprints/blueprint-root/blueprint.yaml | 47 ++++++ .../subinstallation-echo-server-extended.yaml | 23 +++ .../subinstallation-next-chart.yaml | 21 +++ .../result/component-constructor.yaml | 51 +++++++ .../create-installation-command/command.md | 2 + .../result/context.yaml | 9 ++ .../result/dataobject-release.yaml | 8 ++ .../result/dataobject-values.yaml | 7 + .../result/installation.yaml | 32 +++++ .../result/target.yaml | 10 ++ .../create-installation-command/settings.yaml | 25 ++++ .../create-blueprint-command/command.md | 2 + .../create-blueprint-command/config.yaml | 70 +++++++++ .../blueprint.yaml | 40 ++++++ .../deploy-execution.yaml | 29 ++++ .../export-execution.yaml | 2 + .../blueprint-next-chart/blueprint.yaml | 40 ++++++ .../deploy-execution.yaml | 19 +++ .../blueprints/blueprint-root/blueprint.yaml | 47 ++++++ .../subinstallation-echo-server-extended.yaml | 23 +++ .../subinstallation-next-chart.yaml | 21 +++ .../result/component-constructor.yaml | 51 +++++++ .../create-installation-command/command.md | 2 + .../result/context.yaml | 9 ++ .../result/dataobject-release.yaml | 8 ++ .../result/dataobject-values.yaml | 7 + .../result/installation.yaml | 32 +++++ .../result/target.yaml | 10 ++ .../create-installation-command/settings.yaml | 54 +++++++ docs/proposals/generation-command/README.md | 134 ++++++++++++++++++ 59 files changed, 1363 insertions(+) create mode 100644 docs/proposals/generation-command/01-single-helm/chart/echo-server/Chart.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/chart/echo-server/templates/deployment.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/chart/echo-server/templates/service.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/chart/echo-server/values.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-blueprint-command/command.md create mode 100644 docs/proposals/generation-command/01-single-helm/create-blueprint-command/config.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/component-constructor.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-installation-command/command.md create mode 100644 docs/proposals/generation-command/01-single-helm/create-installation-command/result/context.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-installation-command/result/dataobject-release.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-installation-command/result/dataobject-values.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-installation-command/result/installation.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-installation-command/result/target.yaml create mode 100644 docs/proposals/generation-command/01-single-helm/create-installation-command/settings.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/Chart.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/templates/deployment.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/templates/service.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/values.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-blueprint-command/command.md create mode 100644 docs/proposals/generation-command/02-double-helm/create-blueprint-command/config.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/export-execution.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-next-chart/blueprint.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-next-chart/deploy-execution.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-next-chart.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/component-constructor.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-installation-command/command.md create mode 100644 docs/proposals/generation-command/02-double-helm/create-installation-command/result/context.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-installation-command/result/dataobject-release.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-installation-command/result/dataobject-values.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-installation-command/result/installation.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-installation-command/result/target.yaml create mode 100644 docs/proposals/generation-command/02-double-helm/create-installation-command/settings.yaml create mode 100644 docs/proposals/generation-command/03-units/create-blueprint-command/command.md create mode 100644 docs/proposals/generation-command/03-units/create-blueprint-command/config.yaml create mode 100644 docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml create mode 100644 docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml create mode 100644 docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/export-execution.yaml create mode 100644 docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-next-chart/blueprint.yaml create mode 100644 docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-next-chart/deploy-execution.yaml create mode 100644 docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml create mode 100644 docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml create mode 100644 docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-next-chart.yaml create mode 100644 docs/proposals/generation-command/03-units/create-blueprint-command/result/component-constructor.yaml create mode 100644 docs/proposals/generation-command/03-units/create-installation-command/command.md create mode 100644 docs/proposals/generation-command/03-units/create-installation-command/result/context.yaml create mode 100644 docs/proposals/generation-command/03-units/create-installation-command/result/dataobject-release.yaml create mode 100644 docs/proposals/generation-command/03-units/create-installation-command/result/dataobject-values.yaml create mode 100644 docs/proposals/generation-command/03-units/create-installation-command/result/installation.yaml create mode 100644 docs/proposals/generation-command/03-units/create-installation-command/result/target.yaml create mode 100644 docs/proposals/generation-command/03-units/create-installation-command/settings.yaml create mode 100644 docs/proposals/generation-command/README.md diff --git a/docs/proposals/generation-command/01-single-helm/chart/echo-server/Chart.yaml b/docs/proposals/generation-command/01-single-helm/chart/echo-server/Chart.yaml new file mode 100644 index 000000000..22a165bc2 --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/chart/echo-server/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +appVersion: 1.0.0 +description: Echo server chart +name: echo-server +type: application +version: 1.0.0 diff --git a/docs/proposals/generation-command/01-single-helm/chart/echo-server/templates/deployment.yaml b/docs/proposals/generation-command/01-single-helm/chart/echo-server/templates/deployment.yaml new file mode 100644 index 000000000..1aea10e6f --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/chart/echo-server/templates/deployment.yaml @@ -0,0 +1,23 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} +spec: + replicas: 1 + selector: + matchLabels: + app: echo + template: + metadata: + labels: + app: echo + spec: + containers: + - image: {{ .Values.image }} + imagePullPolicy: IfNotPresent + name: echo + args: + - -text="{{ .Values.text }}" + ports: + - containerPort: 5678 diff --git a/docs/proposals/generation-command/01-single-helm/chart/echo-server/templates/service.yaml b/docs/proposals/generation-command/01-single-helm/chart/echo-server/templates/service.yaml new file mode 100644 index 000000000..7b8f9b54f --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/chart/echo-server/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} +spec: + selector: + app: echo + ports: + - protocol: TCP + port: 80 + targetPort: 5678 diff --git a/docs/proposals/generation-command/01-single-helm/chart/echo-server/values.yaml b/docs/proposals/generation-command/01-single-helm/chart/echo-server/values.yaml new file mode 100644 index 000000000..d080e9c1b --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/chart/echo-server/values.yaml @@ -0,0 +1,2 @@ +image: hashicorp/http-echo:1.0.0 +text: hello world diff --git a/docs/proposals/generation-command/01-single-helm/create-blueprint-command/command.md b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/command.md new file mode 100644 index 000000000..8eb823f5d --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/command.md @@ -0,0 +1,3 @@ +```shell +landscaper-cli blueprint create ./config.yaml result +``` diff --git a/docs/proposals/generation-command/01-single-helm/create-blueprint-command/config.yaml b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/config.yaml new file mode 100644 index 000000000..416056be6 --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/config.yaml @@ -0,0 +1,20 @@ +component: + repositoryBaseUrl: eu.gcr.io/gardener-project/landscaper/examples + name: github.com/gardener/landscaper-examples/guided-tour/automation/simple-helm + version: 1.0.0 + +items: + echo-server: + type: helm + createNamespace: true + chart: + name: echo-server-chart + access: + type: ociArtifact + imageReference: eu.gcr.io/gardener-project/landscaper/examples/charts/guided-tour/echo-server:1.0.0 + images: + echo-server-image: hashicorp/http-echo:0.2.3 + additionalValues: | + foo: + img: {{ $images.echo-server-image }} + bar: 42 diff --git a/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml new file mode 100644 index 000000000..216d15808 --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml @@ -0,0 +1,34 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Blueprint +jsonSchema: "https://json-schema.org/draft/2019-09/schema" + +imports: + - name: cluster + type: target + targetType: landscaper.gardener.cloud/kubernetes-cluster + + - name: release + type: data + schema: + type: object + + - name: values + type: data + schema: + type: object + +importExecutions: + - name: additionalValues + type: GoTemplate + template: + {{ $imageResource := getResource .cd "name" "echo-server-echo-server-image" }} + {{ $images := dict "echo-server-image" $imageResource.access.imageReference }} + + foo: + ima: {{ $images.echo-server-image }} + bar: 42 + +deployExecutions: + - name: default + type: GoTemplate + file: /deploy-execution.yaml diff --git a/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml new file mode 100644 index 000000000..1622e1b16 --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml @@ -0,0 +1,19 @@ +deployItems: + - name: item-echo-server + type: landscaper.gardener.cloud/helm + + target: + import: cluster + + config: + apiVersion: helm.deployer.landscaper.gardener.cloud/v1alpha1 + kind: ProviderConfiguration + name: {{ .imports.release.name }} + namespace: {{ .imports.release.namespace }} + createNamespace: true + + chart: + resourceRef: {{ getResourceKey `cd://resources/echo-server-chart` }} + + values: + {{- mergeOverwrite .imports.values .imports.additionalValues | toYaml | nindent 8 }} diff --git a/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml new file mode 100644 index 000000000..8a925045a --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml @@ -0,0 +1,23 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Blueprint +jsonSchema: "https://json-schema.org/draft/2019-09/schema" + +imports: + - name: cluster-echo-server + type: target + targetType: landscaper.gardener.cloud/kubernetes-cluster + + - name: release-echo-server + type: data + schema: + type: object + + - name: values-echo-server + type: data + schema: + type: object + +subinstallationExecutions: + - name: subinstallation-echo-server + type: GoTemplate + file: /subinstallation-echo-server.yaml diff --git a/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml new file mode 100644 index 000000000..28f645e3f --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml @@ -0,0 +1,18 @@ +subinstallations: + - apiVersion: landscaper.gardener.cloud/v1alpha1 + kind: InstallationTemplate + name: subinstallation-echo-server + blueprint: + ref: cd://resources/blueprint-echo-server + + imports: + targets: + - name: cluster + target: cluster-echo-server + + data: + - name: release + dataRef: release-echo-server + + - name: values + dataRef: values-echo-server diff --git a/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/component-constructor.yaml b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/component-constructor.yaml new file mode 100644 index 000000000..d3c2ab978 --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-blueprint-command/result/component-constructor.yaml @@ -0,0 +1,32 @@ +components: + - name: github.com/gardener/landscaper-examples/guided-tour/automation/simple-helm + version: 1.0.0 + provider: + name: internal + resources: + - name: blueprint-root + type: landscaper.gardener.cloud/blueprint + input: + type: dir + path: ./blueprints/blueprint-root + compress: true + mediaType: application/vnd.gardener.landscaper.blueprint.v1+tar+gzip + - name: blueprint-echo-server + type: landscaper.gardener.cloud/blueprint + input: + type: dir + path: ./blueprints/blueprint-echo-server + compress: true + mediaType: application/vnd.gardener.landscaper.blueprint.v1+tar+gzip + - name: echo-server-echo-server-chart + type: helmChart + version: 1.0.0 + access: + type: ociArtifact + imageReference: eu.gcr.io/gardener-project/landscaper/examples/charts/guided-tour/echo-server:1.0.0 + - name: echo-server-echo-server-image + type: ociImage + version: v0.2.3 + access: + type: ociArtifact + imageReference: hashicorp/http-echo:0.2.3 diff --git a/docs/proposals/generation-command/01-single-helm/create-installation-command/command.md b/docs/proposals/generation-command/01-single-helm/create-installation-command/command.md new file mode 100644 index 000000000..4f1ec980d --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-installation-command/command.md @@ -0,0 +1,3 @@ +```shell +landscaper-cli component installation ../create-blueprint-command/config.yaml ./settings.yaml ./result +``` diff --git a/docs/proposals/generation-command/01-single-helm/create-installation-command/result/context.yaml b/docs/proposals/generation-command/01-single-helm/create-installation-command/result/context.yaml new file mode 100644 index 000000000..236b729bc --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-installation-command/result/context.yaml @@ -0,0 +1,9 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Context +metadata: + name: automation-simple-helm + namespace: cu-example + +repositoryContext: + baseUrl: eu.gcr.io/gardener-project/landscaper/examples + type: ociRegistry diff --git a/docs/proposals/generation-command/01-single-helm/create-installation-command/result/dataobject-release.yaml b/docs/proposals/generation-command/01-single-helm/create-installation-command/result/dataobject-release.yaml new file mode 100644 index 000000000..321056d58 --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-installation-command/result/dataobject-release.yaml @@ -0,0 +1,8 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: DataObject +metadata: + name: automation-simple-helm-release + namespace: cu-example +data: + name: echo + namespace: example diff --git a/docs/proposals/generation-command/01-single-helm/create-installation-command/result/dataobject-values.yaml b/docs/proposals/generation-command/01-single-helm/create-installation-command/result/dataobject-values.yaml new file mode 100644 index 000000000..05915ec80 --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-installation-command/result/dataobject-values.yaml @@ -0,0 +1,7 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: DataObject +metadata: + name: automation-simple-helm-values + namespace: cu-example +data: + text: Hello, Landscaper! \ No newline at end of file diff --git a/docs/proposals/generation-command/01-single-helm/create-installation-command/result/installation.yaml b/docs/proposals/generation-command/01-single-helm/create-installation-command/result/installation.yaml new file mode 100644 index 000000000..94772abb6 --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-installation-command/result/installation.yaml @@ -0,0 +1,32 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Installation +metadata: + name: automation-simple-helm + namespace: cu-example + annotations: + landscaper.gardener.cloud/operation: reconcile + +spec: + context: automation-simple-helm + + componentDescriptor: + ref: + componentName: github.com/gardener/landscaper-examples/guided-tour/automation/simple-helm + version: 1.0.0 + + blueprint: + ref: + resourceName: blueprint-echo-server + + # Set values for the import parameters of the blueprint + imports: + targets: + - name: cluster + target: automation-simple-helm + + data: + - name: release + dataRef: automation-simple-helm-release + + - name: values + dataRef: automation-simple-helm-values diff --git a/docs/proposals/generation-command/01-single-helm/create-installation-command/result/target.yaml b/docs/proposals/generation-command/01-single-helm/create-installation-command/result/target.yaml new file mode 100644 index 000000000..11f851ed3 --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-installation-command/result/target.yaml @@ -0,0 +1,10 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Target +metadata: + name: automation-simple-helm + namespace: cu-example +spec: + type: landscaper.gardener.cloud/kubernetes-cluster + config: + kubeconfig: | + ... diff --git a/docs/proposals/generation-command/01-single-helm/create-installation-command/settings.yaml b/docs/proposals/generation-command/01-single-helm/create-installation-command/settings.yaml new file mode 100644 index 000000000..b1ca2e34d --- /dev/null +++ b/docs/proposals/generation-command/01-single-helm/create-installation-command/settings.yaml @@ -0,0 +1,16 @@ +charts: + echo-server: + installation-name: automation-simple-helm + installation-namespace: cu-example + + release-name: automation-simple + release-namespace: example + + target: my-cluster + + values: + text: first example + +targets: + - name: my-cluster + kubeconfig-path: ... diff --git a/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/Chart.yaml b/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/Chart.yaml new file mode 100644 index 000000000..a846ff375 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +appVersion: 1.0.0 +description: Echo server chart extended +name: echo-server-extended +type: application +version: 1.0.0 diff --git a/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/templates/deployment.yaml b/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/templates/deployment.yaml new file mode 100644 index 000000000..1aea10e6f --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/templates/deployment.yaml @@ -0,0 +1,23 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} +spec: + replicas: 1 + selector: + matchLabels: + app: echo + template: + metadata: + labels: + app: echo + spec: + containers: + - image: {{ .Values.image }} + imagePullPolicy: IfNotPresent + name: echo + args: + - -text="{{ .Values.text }}" + ports: + - containerPort: 5678 diff --git a/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/templates/service.yaml b/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/templates/service.yaml new file mode 100644 index 000000000..7b8f9b54f --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} +spec: + selector: + app: echo + ports: + - protocol: TCP + port: 80 + targetPort: 5678 diff --git a/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/values.yaml b/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/values.yaml new file mode 100644 index 000000000..d080e9c1b --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/chart/echo-server-extended/values.yaml @@ -0,0 +1,2 @@ +image: hashicorp/http-echo:1.0.0 +text: hello world diff --git a/docs/proposals/generation-command/02-double-helm/create-blueprint-command/command.md b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/command.md new file mode 100644 index 000000000..b3d6fc72d --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/command.md @@ -0,0 +1,2 @@ + +ls-cli component create ../config.yaml result \ No newline at end of file diff --git a/docs/proposals/generation-command/02-double-helm/create-blueprint-command/config.yaml b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/config.yaml new file mode 100644 index 000000000..a70db29b8 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/config.yaml @@ -0,0 +1,76 @@ +component: + repositoryBaseUrl: eu.gcr.io/gardener-project/landscaper/examples + name: github.com/gardener/landscaper-examples/guided-tour/automation/simple-helm + version: 1.0.0 + +items: + echo-server-extended: + type: helm + createNamespace: true + chart: + name: echo-server-chart + access: + type: ociArtifact + imageReference: eu.gcr.io/gardener-project/landscaper/examples/charts/guided-tour/echo-server-extended:1.0.0 + images: + echo-server-image: hashicorp/http-echo:0.2.3 + additionalValues: + sub1: + ima: {{ $images.echo-server-image }} + sub3: 42 + readinessChecks: + ... + exports: + token: + schema: + type: string + fromResource: + apiVersion: v1 + kind: Secret + name: test-secret + isNamespaced: true + # namespace: example #optional: if isNamespaced==true and not set use the relase namespace + jsonPath: .data.token + + next-chart: + type: helm + createNamespace: true + chart: + name: next-chart + access: + type: ociArtifact + imageReference: eu.gcr.io/gardener-project/landscaper/examples/charts/guided-tour/next-chart:1.0.0 + images: + next-chart-image: guided-tour/next-image:0.2.3 + imports: + imported-token: + schema: + type: string + from-item: echo-server-extended + from-export: token + additionalValues: + sub1: + image: {{ $images.next-chart-image }} + sub2: {{ $imports.imported-token }} + +# next-manifest: +# type: manifest +# createNamespace: true +# imports: +# imported-token: +# schema: +# type: string +# from-item: echo-server-extended +# from-export: token +# manifests: +# - policy: manage +# manifest: +# apiVersion: v1 +# kind: ConfigMap +# metadata: +# name: hello-world +# namespace: example +# data: +# testData: {{ $imports.imported-token }} +# testData2: {{ $imports.values.someValue }} + diff --git a/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml new file mode 100644 index 000000000..a68bc533e --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml @@ -0,0 +1,40 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Blueprint +jsonSchema: "https://json-schema.org/draft/2019-09/schema" + +imports: + - name: cluster + type: target + targetType: landscaper.gardener.cloud/kubernetes-cluster + + - name: release + type: data + schema: + type: object + + - name: values + type: data + schema: + type: object + +importExecutions: + - name: additionalValues + type: GoTemplate + template: + {{ $imageResource := getResource .cd "name" "echo-server-extended--echo-server-image" }} + {{ $images := dict "echo-server-image" $imageResource.access.imageReference }} + + sub1: + ima: {{ $images.echo-server-image }} + sub3: 42 + +exports: + - name: token + type: data + schema: + type: string + +deployExecutions: + - name: default + type: GoTemplate + file: /deploy-execution.yaml diff --git a/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml new file mode 100644 index 000000000..7c6b8b15b --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml @@ -0,0 +1,29 @@ +deployItems: + - name: item-echo-server-extended + type: landscaper.gardener.cloud/helm + + target: + import: cluster + + config: + apiVersion: helm.deployer.landscaper.gardener.cloud/v1alpha1 + kind: ProviderConfiguration + name: {{ .imports.release.name }} + namespace: {{ .imports.release.namespace }} + createNamespace: true + + chart: + resourceRef: {{ getResourceKey `cd://resources/echo-server-chart` }} + + values: + {{- mergeOverwrite .imports.values .imports.additionalValues | toYaml | nindent 8 }} + + exports: + exports: + - key: token + fromResource: + apiVersion: v1 + kind: Secret + name: test-secret + namespace: {{ .imports.release.namespace }} + jsonPath: .data.token diff --git a/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/export-execution.yaml b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/export-execution.yaml new file mode 100644 index 000000000..d248177c6 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/export-execution.yaml @@ -0,0 +1,2 @@ +exports: + token: {{ index .deployitems "item-echo-server-extended" "token" }} diff --git a/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-next-chart/blueprint.yaml b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-next-chart/blueprint.yaml new file mode 100644 index 000000000..56e93fed7 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-next-chart/blueprint.yaml @@ -0,0 +1,40 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Blueprint +jsonSchema: "https://json-schema.org/draft/2019-09/schema" + +imports: + - name: cluster + type: target + targetType: landscaper.gardener.cloud/kubernetes-cluster + + - name: release + type: data + schema: + type: object + + - name: values + type: data + schema: + type: object + + - name: imported-token + type: data + schema: + type: string + +importExecutions: + - name: additionalValues + type: GoTemplate + template: + {{ $imageResource := getResource .cd "name" "next-chart--next-chart-image" }} + {{ $images := dict "next-chart-image" $imageResource.access.imageReference }} + {{ $imports := .imports }} + + sub1: + image: {{ $images.next-chart-image }} + sub2: {{ $imports.imported-token }} + +deployExecutions: + - name: default + type: GoTemplate + file: /deploy-execution.yaml diff --git a/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-next-chart/deploy-execution.yaml b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-next-chart/deploy-execution.yaml new file mode 100644 index 000000000..1da706ccd --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-next-chart/deploy-execution.yaml @@ -0,0 +1,19 @@ +deployItems: + - name: item-next-chart + type: landscaper.gardener.cloud/helm + + target: + import: cluster + + config: + apiVersion: helm.deployer.landscaper.gardener.cloud/v1alpha1 + kind: ProviderConfiguration + name: {{ .imports.release.name }} + namespace: {{ .imports.release.namespace }} + createNamespace: true + + chart: + resourceRef: {{ getResourceKey `cd://resources/next-chart` }} + + values: + {{- mergeOverwrite .imports.values .imports.additionalValues | toYaml | nindent 8 }} diff --git a/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml new file mode 100644 index 000000000..c16c38648 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml @@ -0,0 +1,47 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Blueprint +jsonSchema: "https://json-schema.org/draft/2019-09/schema" + +imports: + - name: cluster-echo-server-extended + type: target + targetType: landscaper.gardener.cloud/kubernetes-cluster + + - name: release-echo-server-extended + type: data + schema: + type: object + + - name: values-echo-server-extended + type: data + schema: + type: object + + - name: cluster-next-chart + type: target + targetType: landscaper.gardener.cloud/kubernetes-cluster + + - name: release-next-chart + type: data + schema: + type: object + + - name: values-next-chart + type: data + schema: + type: object + +importExecutions: + - name: images + type: GoTemplate + template: + {{ $imageResource := getResource .cd "name" "next-chart--next-chart-image" }} + next-chart-image: {{ $imageResource.access.imageReference }} + +subinstallationExecutions: + - name: subinstallation-echo-server-extended + type: GoTemplate + file: /subinstallation-echo-server-extended.yaml + - name: subinstallation-next-chart + type: GoTemplate + file: /subinstallation-next-chart.yaml diff --git a/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml new file mode 100644 index 000000000..8cf2dfb08 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml @@ -0,0 +1,23 @@ +subinstallations: + - apiVersion: landscaper.gardener.cloud/v1alpha1 + kind: InstallationTemplate + name: subinstallation-echo-server-extended + blueprint: + ref: cd://resources/blueprint-echo-server-extended + + imports: + targets: + - name: cluster + target: cluster-echo-server-extended + + data: + - name: release + dataRef: release-echo-server-extended + + - name: values + dataRef: values-echo-server-extended + + exports: + data: + - name: token + dataRef: token-echo-server-extended diff --git a/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-next-chart.yaml b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-next-chart.yaml new file mode 100644 index 000000000..be263c730 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-next-chart.yaml @@ -0,0 +1,21 @@ +subinstallations: + - apiVersion: landscaper.gardener.cloud/v1alpha1 + kind: InstallationTemplate + name: subinstallation-next-chart + blueprint: + ref: cd://resources/blueprint-next-chart + + imports: + targets: + - name: cluster + target: cluster-next-chart + + data: + - name: release + dataRef: release-next-chart + + - name: values + dataRef: values-next-chart + + - name: imported-token + dataRef: token-echo-server-extended diff --git a/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/component-constructor.yaml b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/component-constructor.yaml new file mode 100644 index 000000000..0257f6270 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-blueprint-command/result/component-constructor.yaml @@ -0,0 +1,51 @@ +components: + - name: github.com/gardener/landscaper-examples/guided-tour/automation/simple-helm + version: 1.0.0 + provider: + name: internal + resources: + - name: blueprint-root + type: landscaper.gardener.cloud/blueprint + input: + type: dir + path: ./blueprints/blueprint-root + compress: true + mediaType: application/vnd.gardener.landscaper.blueprint.v1+tar+gzip + - name: blueprint-echo-server-extended + type: landscaper.gardener.cloud/blueprint + input: + type: dir + path: ./blueprints/blueprint-echo-server-extended + compress: true + mediaType: application/vnd.gardener.landscaper.blueprint.v1+tar+gzip + - name: blueprint-next-chart + type: landscaper.gardener.cloud/blueprint + input: + type: dir + path: ./blueprints/blueprint-next-chart + compress: true + mediaType: application/vnd.gardener.landscaper.blueprint.v1+tar+gzip + - name: echo-server-extended-echo-server-chart + type: helmChart + version: 1.0.0 + access: + type: ociArtifact + imageReference: eu.gcr.io/gardener-project/landscaper/examples/charts/guided-tour/echo-server-extended:1.0.0 + - name: echo-server-extended-echo-server-image + type: ociImage + version: v0.2.3 + access: + type: ociArtifact + imageReference: hashicorp/http-echo:0.2.3 + - name: next-chart-next-chart + type: helmChart + version: 1.0.0 + access: + type: ociArtifact + imageReference: eu.gcr.io/gardener-project/landscaper/examples/charts/guided-tour/next-chart:1.0.0 + - name: next-chart-next-chart-image + type: ociImage + version: v0.2.3 + access: + type: ociArtifact + imageReference: guided-tour/next-image:0.2.3 diff --git a/docs/proposals/generation-command/02-double-helm/create-installation-command/command.md b/docs/proposals/generation-command/02-double-helm/create-installation-command/command.md new file mode 100644 index 000000000..0e7345182 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-installation-command/command.md @@ -0,0 +1,2 @@ + +ls-cli component installation ../01-create-component/config.yaml ./settings.yaml ./result \ No newline at end of file diff --git a/docs/proposals/generation-command/02-double-helm/create-installation-command/result/context.yaml b/docs/proposals/generation-command/02-double-helm/create-installation-command/result/context.yaml new file mode 100644 index 000000000..236b729bc --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-installation-command/result/context.yaml @@ -0,0 +1,9 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Context +metadata: + name: automation-simple-helm + namespace: cu-example + +repositoryContext: + baseUrl: eu.gcr.io/gardener-project/landscaper/examples + type: ociRegistry diff --git a/docs/proposals/generation-command/02-double-helm/create-installation-command/result/dataobject-release.yaml b/docs/proposals/generation-command/02-double-helm/create-installation-command/result/dataobject-release.yaml new file mode 100644 index 000000000..321056d58 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-installation-command/result/dataobject-release.yaml @@ -0,0 +1,8 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: DataObject +metadata: + name: automation-simple-helm-release + namespace: cu-example +data: + name: echo + namespace: example diff --git a/docs/proposals/generation-command/02-double-helm/create-installation-command/result/dataobject-values.yaml b/docs/proposals/generation-command/02-double-helm/create-installation-command/result/dataobject-values.yaml new file mode 100644 index 000000000..05915ec80 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-installation-command/result/dataobject-values.yaml @@ -0,0 +1,7 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: DataObject +metadata: + name: automation-simple-helm-values + namespace: cu-example +data: + text: Hello, Landscaper! \ No newline at end of file diff --git a/docs/proposals/generation-command/02-double-helm/create-installation-command/result/installation.yaml b/docs/proposals/generation-command/02-double-helm/create-installation-command/result/installation.yaml new file mode 100644 index 000000000..2d1537eec --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-installation-command/result/installation.yaml @@ -0,0 +1,32 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Installation +metadata: + name: automation-simple-helm + namespace: cu-example + annotations: + landscaper.gardener.cloud/operation: reconcile + +spec: + context: automation-simple-helm + + componentDescriptor: + ref: + componentName: github.com/gardener/landscaper-examples/guided-tour/automation/simple-helm + version: 1.0.0 + + blueprint: + ref: + resourceName: blueprint-echo-server-extended + + # Set values for the import parameters of the blueprint + imports: + targets: + - name: cluster + target: automation-simple-helm + + data: + - name: release + dataRef: automation-simple-helm-release + + - name: values + dataRef: automation-simple-helm-values diff --git a/docs/proposals/generation-command/02-double-helm/create-installation-command/result/target.yaml b/docs/proposals/generation-command/02-double-helm/create-installation-command/result/target.yaml new file mode 100644 index 000000000..11f851ed3 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-installation-command/result/target.yaml @@ -0,0 +1,10 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Target +metadata: + name: automation-simple-helm + namespace: cu-example +spec: + type: landscaper.gardener.cloud/kubernetes-cluster + config: + kubeconfig: | + ... diff --git a/docs/proposals/generation-command/02-double-helm/create-installation-command/settings.yaml b/docs/proposals/generation-command/02-double-helm/create-installation-command/settings.yaml new file mode 100644 index 000000000..56533c207 --- /dev/null +++ b/docs/proposals/generation-command/02-double-helm/create-installation-command/settings.yaml @@ -0,0 +1,25 @@ +charts: + echo-server-extended: + installation-name: automation-simple-helm + installation-namespace: cu-example + + release-name: automation-simple + release-namespace: example + + # This target need not necessarily occur in the targets section, + target: my-cluster + + # optional + values: + text: first example + + next-chart: + ... + +targets: + - name: my-cluster + kubeconfig-path: ... + ... + +credentials: + # credentials to read resources (helm chart, component version, ...) diff --git a/docs/proposals/generation-command/03-units/create-blueprint-command/command.md b/docs/proposals/generation-command/03-units/create-blueprint-command/command.md new file mode 100644 index 000000000..b3d6fc72d --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-blueprint-command/command.md @@ -0,0 +1,2 @@ + +ls-cli component create ../config.yaml result \ No newline at end of file diff --git a/docs/proposals/generation-command/03-units/create-blueprint-command/config.yaml b/docs/proposals/generation-command/03-units/create-blueprint-command/config.yaml new file mode 100644 index 000000000..f4e843034 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-blueprint-command/config.yaml @@ -0,0 +1,70 @@ +component: + repositoryBaseUrl: eu.gcr.io/gardener-project/landscaper/examples + name: github.com/gardener/landscaper-examples/guided-tour/automation/simple-helm + version: 1.0.0 + +externalImports: + imported-token: + schema: + type: string + +externalExports: + public-token: + type: string + value: | + {{ $exports.echo-server-extended.token }} + +items: + echo-server-extended: + type: helm + createNamespace: true + chart: + name: echo-server-chart + type: helmChart + version: 1.0.0 + access: + type: ociArtifact + imageReference: eu.gcr.io/gardener-project/landscaper/examples/charts/guided-tour/echo-server-extended:1.0.0 + images: + echo-server-image: hashicorp/http-echo:0.2.3 + additionalValues: | + sub1: + ima: {{ $images.echo-server-image }} + sub3: 42 + readinessChecks: + ... + exports: + token: + schema: + type: string + fromResource: + apiVersion: v1 + kind: Secret + name: test-secret + isNamespaces: true + # namespace: example #optional: if isNamespaced==true and not set use the relase namespace + jsonPath: .data.token + + next-chart: + type: helm + createNamespace: true + chart: + name: next-chart + type: helmChart + version: 1.0.0 + access: + type: ociArtifact + imageReference: eu.gcr.io/gardener-project/landscaper/examples/charts/guided-tour/next-chart:1.0.0 + images: + next-chart-image: guided-tour/next-image:0.2.3 + imports: + imported-token: + schema: + type: string + from-item: echo-server-extended + from-export: token + additionalValues: | + sub1: + image: {{ $images.next-chart-image }} + sub2: {{ $imports.imported-token }} + sub3: {{ $externalImports.imported-token }} diff --git a/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml new file mode 100644 index 000000000..a68bc533e --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/blueprint.yaml @@ -0,0 +1,40 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Blueprint +jsonSchema: "https://json-schema.org/draft/2019-09/schema" + +imports: + - name: cluster + type: target + targetType: landscaper.gardener.cloud/kubernetes-cluster + + - name: release + type: data + schema: + type: object + + - name: values + type: data + schema: + type: object + +importExecutions: + - name: additionalValues + type: GoTemplate + template: + {{ $imageResource := getResource .cd "name" "echo-server-extended--echo-server-image" }} + {{ $images := dict "echo-server-image" $imageResource.access.imageReference }} + + sub1: + ima: {{ $images.echo-server-image }} + sub3: 42 + +exports: + - name: token + type: data + schema: + type: string + +deployExecutions: + - name: default + type: GoTemplate + file: /deploy-execution.yaml diff --git a/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml new file mode 100644 index 000000000..7c6b8b15b --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/deploy-execution.yaml @@ -0,0 +1,29 @@ +deployItems: + - name: item-echo-server-extended + type: landscaper.gardener.cloud/helm + + target: + import: cluster + + config: + apiVersion: helm.deployer.landscaper.gardener.cloud/v1alpha1 + kind: ProviderConfiguration + name: {{ .imports.release.name }} + namespace: {{ .imports.release.namespace }} + createNamespace: true + + chart: + resourceRef: {{ getResourceKey `cd://resources/echo-server-chart` }} + + values: + {{- mergeOverwrite .imports.values .imports.additionalValues | toYaml | nindent 8 }} + + exports: + exports: + - key: token + fromResource: + apiVersion: v1 + kind: Secret + name: test-secret + namespace: {{ .imports.release.namespace }} + jsonPath: .data.token diff --git a/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/export-execution.yaml b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/export-execution.yaml new file mode 100644 index 000000000..d248177c6 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-echo-server-extended/export-execution.yaml @@ -0,0 +1,2 @@ +exports: + token: {{ index .deployitems "item-echo-server-extended" "token" }} diff --git a/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-next-chart/blueprint.yaml b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-next-chart/blueprint.yaml new file mode 100644 index 000000000..56e93fed7 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-next-chart/blueprint.yaml @@ -0,0 +1,40 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Blueprint +jsonSchema: "https://json-schema.org/draft/2019-09/schema" + +imports: + - name: cluster + type: target + targetType: landscaper.gardener.cloud/kubernetes-cluster + + - name: release + type: data + schema: + type: object + + - name: values + type: data + schema: + type: object + + - name: imported-token + type: data + schema: + type: string + +importExecutions: + - name: additionalValues + type: GoTemplate + template: + {{ $imageResource := getResource .cd "name" "next-chart--next-chart-image" }} + {{ $images := dict "next-chart-image" $imageResource.access.imageReference }} + {{ $imports := .imports }} + + sub1: + image: {{ $images.next-chart-image }} + sub2: {{ $imports.imported-token }} + +deployExecutions: + - name: default + type: GoTemplate + file: /deploy-execution.yaml diff --git a/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-next-chart/deploy-execution.yaml b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-next-chart/deploy-execution.yaml new file mode 100644 index 000000000..1da706ccd --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-next-chart/deploy-execution.yaml @@ -0,0 +1,19 @@ +deployItems: + - name: item-next-chart + type: landscaper.gardener.cloud/helm + + target: + import: cluster + + config: + apiVersion: helm.deployer.landscaper.gardener.cloud/v1alpha1 + kind: ProviderConfiguration + name: {{ .imports.release.name }} + namespace: {{ .imports.release.namespace }} + createNamespace: true + + chart: + resourceRef: {{ getResourceKey `cd://resources/next-chart` }} + + values: + {{- mergeOverwrite .imports.values .imports.additionalValues | toYaml | nindent 8 }} diff --git a/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml new file mode 100644 index 000000000..c16c38648 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/blueprint.yaml @@ -0,0 +1,47 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Blueprint +jsonSchema: "https://json-schema.org/draft/2019-09/schema" + +imports: + - name: cluster-echo-server-extended + type: target + targetType: landscaper.gardener.cloud/kubernetes-cluster + + - name: release-echo-server-extended + type: data + schema: + type: object + + - name: values-echo-server-extended + type: data + schema: + type: object + + - name: cluster-next-chart + type: target + targetType: landscaper.gardener.cloud/kubernetes-cluster + + - name: release-next-chart + type: data + schema: + type: object + + - name: values-next-chart + type: data + schema: + type: object + +importExecutions: + - name: images + type: GoTemplate + template: + {{ $imageResource := getResource .cd "name" "next-chart--next-chart-image" }} + next-chart-image: {{ $imageResource.access.imageReference }} + +subinstallationExecutions: + - name: subinstallation-echo-server-extended + type: GoTemplate + file: /subinstallation-echo-server-extended.yaml + - name: subinstallation-next-chart + type: GoTemplate + file: /subinstallation-next-chart.yaml diff --git a/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml new file mode 100644 index 000000000..8cf2dfb08 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-echo-server-extended.yaml @@ -0,0 +1,23 @@ +subinstallations: + - apiVersion: landscaper.gardener.cloud/v1alpha1 + kind: InstallationTemplate + name: subinstallation-echo-server-extended + blueprint: + ref: cd://resources/blueprint-echo-server-extended + + imports: + targets: + - name: cluster + target: cluster-echo-server-extended + + data: + - name: release + dataRef: release-echo-server-extended + + - name: values + dataRef: values-echo-server-extended + + exports: + data: + - name: token + dataRef: token-echo-server-extended diff --git a/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-next-chart.yaml b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-next-chart.yaml new file mode 100644 index 000000000..be263c730 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-blueprint-command/result/blueprints/blueprint-root/subinstallation-next-chart.yaml @@ -0,0 +1,21 @@ +subinstallations: + - apiVersion: landscaper.gardener.cloud/v1alpha1 + kind: InstallationTemplate + name: subinstallation-next-chart + blueprint: + ref: cd://resources/blueprint-next-chart + + imports: + targets: + - name: cluster + target: cluster-next-chart + + data: + - name: release + dataRef: release-next-chart + + - name: values + dataRef: values-next-chart + + - name: imported-token + dataRef: token-echo-server-extended diff --git a/docs/proposals/generation-command/03-units/create-blueprint-command/result/component-constructor.yaml b/docs/proposals/generation-command/03-units/create-blueprint-command/result/component-constructor.yaml new file mode 100644 index 000000000..0257f6270 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-blueprint-command/result/component-constructor.yaml @@ -0,0 +1,51 @@ +components: + - name: github.com/gardener/landscaper-examples/guided-tour/automation/simple-helm + version: 1.0.0 + provider: + name: internal + resources: + - name: blueprint-root + type: landscaper.gardener.cloud/blueprint + input: + type: dir + path: ./blueprints/blueprint-root + compress: true + mediaType: application/vnd.gardener.landscaper.blueprint.v1+tar+gzip + - name: blueprint-echo-server-extended + type: landscaper.gardener.cloud/blueprint + input: + type: dir + path: ./blueprints/blueprint-echo-server-extended + compress: true + mediaType: application/vnd.gardener.landscaper.blueprint.v1+tar+gzip + - name: blueprint-next-chart + type: landscaper.gardener.cloud/blueprint + input: + type: dir + path: ./blueprints/blueprint-next-chart + compress: true + mediaType: application/vnd.gardener.landscaper.blueprint.v1+tar+gzip + - name: echo-server-extended-echo-server-chart + type: helmChart + version: 1.0.0 + access: + type: ociArtifact + imageReference: eu.gcr.io/gardener-project/landscaper/examples/charts/guided-tour/echo-server-extended:1.0.0 + - name: echo-server-extended-echo-server-image + type: ociImage + version: v0.2.3 + access: + type: ociArtifact + imageReference: hashicorp/http-echo:0.2.3 + - name: next-chart-next-chart + type: helmChart + version: 1.0.0 + access: + type: ociArtifact + imageReference: eu.gcr.io/gardener-project/landscaper/examples/charts/guided-tour/next-chart:1.0.0 + - name: next-chart-next-chart-image + type: ociImage + version: v0.2.3 + access: + type: ociArtifact + imageReference: guided-tour/next-image:0.2.3 diff --git a/docs/proposals/generation-command/03-units/create-installation-command/command.md b/docs/proposals/generation-command/03-units/create-installation-command/command.md new file mode 100644 index 000000000..0e7345182 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-installation-command/command.md @@ -0,0 +1,2 @@ + +ls-cli component installation ../01-create-component/config.yaml ./settings.yaml ./result \ No newline at end of file diff --git a/docs/proposals/generation-command/03-units/create-installation-command/result/context.yaml b/docs/proposals/generation-command/03-units/create-installation-command/result/context.yaml new file mode 100644 index 000000000..236b729bc --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-installation-command/result/context.yaml @@ -0,0 +1,9 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Context +metadata: + name: automation-simple-helm + namespace: cu-example + +repositoryContext: + baseUrl: eu.gcr.io/gardener-project/landscaper/examples + type: ociRegistry diff --git a/docs/proposals/generation-command/03-units/create-installation-command/result/dataobject-release.yaml b/docs/proposals/generation-command/03-units/create-installation-command/result/dataobject-release.yaml new file mode 100644 index 000000000..321056d58 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-installation-command/result/dataobject-release.yaml @@ -0,0 +1,8 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: DataObject +metadata: + name: automation-simple-helm-release + namespace: cu-example +data: + name: echo + namespace: example diff --git a/docs/proposals/generation-command/03-units/create-installation-command/result/dataobject-values.yaml b/docs/proposals/generation-command/03-units/create-installation-command/result/dataobject-values.yaml new file mode 100644 index 000000000..05915ec80 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-installation-command/result/dataobject-values.yaml @@ -0,0 +1,7 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: DataObject +metadata: + name: automation-simple-helm-values + namespace: cu-example +data: + text: Hello, Landscaper! \ No newline at end of file diff --git a/docs/proposals/generation-command/03-units/create-installation-command/result/installation.yaml b/docs/proposals/generation-command/03-units/create-installation-command/result/installation.yaml new file mode 100644 index 000000000..2d1537eec --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-installation-command/result/installation.yaml @@ -0,0 +1,32 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Installation +metadata: + name: automation-simple-helm + namespace: cu-example + annotations: + landscaper.gardener.cloud/operation: reconcile + +spec: + context: automation-simple-helm + + componentDescriptor: + ref: + componentName: github.com/gardener/landscaper-examples/guided-tour/automation/simple-helm + version: 1.0.0 + + blueprint: + ref: + resourceName: blueprint-echo-server-extended + + # Set values for the import parameters of the blueprint + imports: + targets: + - name: cluster + target: automation-simple-helm + + data: + - name: release + dataRef: automation-simple-helm-release + + - name: values + dataRef: automation-simple-helm-values diff --git a/docs/proposals/generation-command/03-units/create-installation-command/result/target.yaml b/docs/proposals/generation-command/03-units/create-installation-command/result/target.yaml new file mode 100644 index 000000000..11f851ed3 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-installation-command/result/target.yaml @@ -0,0 +1,10 @@ +apiVersion: landscaper.gardener.cloud/v1alpha1 +kind: Target +metadata: + name: automation-simple-helm + namespace: cu-example +spec: + type: landscaper.gardener.cloud/kubernetes-cluster + config: + kubeconfig: | + ... diff --git a/docs/proposals/generation-command/03-units/create-installation-command/settings.yaml b/docs/proposals/generation-command/03-units/create-installation-command/settings.yaml new file mode 100644 index 000000000..8f7756cf7 --- /dev/null +++ b/docs/proposals/generation-command/03-units/create-installation-command/settings.yaml @@ -0,0 +1,54 @@ +dataImports: + imported-val-1: + fromResource: + apiVersion: v1 + kind: Secret + name: test-secret-1 + isNamespaces: true + # namespace: example #optional: if isNamespaced==true and not set use the relase namespace + jsonPath: .data.token + imported-val-2: + fromResource: + apiVersion: v1 + kind: Secret + name: test-secret-2 + isNamespaces: true + # namespace: example #optional: if isNamespaced==true and not set use the relase namespace + jsonPath: .data.token + +mappedImports: + imported-token: | + tik: {{ $dataImports.imported-val-1.data.token }} + tok: {{ $dataImports.imported-val-2.data.token }} + +dataExports: + public-token: + toConfigMap: + name: ... + key: ... + +charts: + echo-server-extended: + installation-name: automation-simple-helm + installation-namespace: cu-example + + release-name: automation-simple + release-namespace: example + + # This target need not necessarily occur in the targets section, + target: my-cluster + + # optional + values: + text: first example + + next-chart: + ... + +targets: + - name: my-cluster + kubeconfig-path: ... + ... + +credentials: + # credentials to read resources (helm chart, component version, ...) diff --git a/docs/proposals/generation-command/README.md b/docs/proposals/generation-command/README.md new file mode 100644 index 000000000..02924d95b --- /dev/null +++ b/docs/proposals/generation-command/README.md @@ -0,0 +1,134 @@ +# Generation Command for Helm Chart Use-Cases + +We propose new Landscaper CLI commands to generate the resources for simple Landscaper scenarios. +Supported scenarios are the deployment of one or more Helm charts. Moreover, we support a data flow between these charts. + + +## Examples + +Example [01-single-helm-chart](./01-single-helm) discusses the deployment of a single helm chart using the +proposed commands. + +Example [02-double-helm](./02-double-helm) discusses the deployment of two helm charts. +The first of them exports values which are then imported by the second. + +Example [03-units](./03-units) adds "external" imports and exports, so that there is not only a dataflow between the +charts, but moreover data can also be imported from outside, resp. exported. + + +## Command to generate blueprints and component constructor + +```shell +landscaper-cli blueprint create [CONFIG_FILE_PATH] [RESULT_DIRECTORY_PATH] +``` + +The command uses a [config file](#the-config-file) which contains all necessary data for the generation. +The command generates several blueprints into the given result directory: one for each Helm deployment, plus a root +blueprint. In addition, it generates a component constructor, that will contain the blueprints, charts, and images as +resources. Thus, the result directory will look like this: + +```shell +[result directory] +├── blueprints +│ ├── blueprint-root +│ │ └── blueprint.yaml +│ ├── blueprint-my-first-item +│ │ └── blueprint.yaml +│ ├── blueprint-my-second-item +│ │ └── blueprint.yaml +│ ... +└── component-constructor.yaml +``` + +### The config file + +The config file specifies: +- the OCM component name and version. +- the base URL of the OCM repository (just needed to generate an upload command). +- a map of item names to item definitions. Each item defines the deployment of a Helm chart. + +```yaml +component: + repositoryBaseUrl: eu.gcr.io/gardener-project/landscaper/examples + name: github.com/gardener/landscaper-examples/guided-tour/automation/simple-helm + version: 1.0.0 + +items: + my-first-item: # item name + ... # item definition + + my-second-item: + ... + + ... +``` + +An item definition specifies the chart and the image(s): + +```yaml +items: + my-first-item: + type: helm + createNamespace: true + chart: + name: echo-server-chart + access: + type: ociArtifact + imageReference: eu.gcr.io/gardener-project/landscaper/examples/charts/guided-tour/echo-server-extended:1.0.0 + images: + echo-server-image: hashicorp/http-echo:0.2.3 + additionalValues: | + path: + to: + image: {{ $images.echo-server-image }} + foo: bar +``` + +Chart and images will be added to the component constructor. + +Helm values are usually provided by the Installation. However, an item definition has a field `additionalValues`, where +one can specify Helm values which are Installation independent. They are merged with the values from the Installation. + +Images can be set in the `additionalValues`. +The value of field `additionalValues` is a GoTemplate. In this template one can use a predefined variable `$images`, +which contains the `images` map of the item definition. + +There is an [example of a config.yaml](../guided-tour/automation/simple-helm/01-create-component/config.yaml) +in the guided tour. + +### Data flow + +To allow a dataflow between the helm deployments, each item definition has + +```yaml +items: + my-first-item: + ... + exports: + token: + schema: + type: string + fromResource: + apiVersion: v1 + kind: Secret + name: test-secret + isNamespaced: true + # namespace: example #optional: if isNamespaced==true and namespace is not set, use the release namespace + jsonPath: .data.token +``` + + +### Further features + +- Exporting values +- Using exports of other items in the `additionalValues` (predefined variable `$imports`) +- Readiness checks +- Timeout +- Atomic (helm) + + +## Command to generate an Installation and Targets + +```shell +landscaper-cli installation create [SETTINGS_FILE_PATH] [CONFIG_FILE_PATH] [RESULT_DIRECTORY_PATH] +```