From 7f6b387dbc7c0ff107b49d2c5042054e4a21bba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pi=C4=85tkowski?= Date: Thu, 2 Jun 2022 15:38:58 +0200 Subject: [PATCH 01/34] add: prod base --- .../app_sets/hello-web-app/kustomization.yaml | 12 +++++++ .../override_config_hello_world.yaml | 6 ++++ .../cluster/cluster_user_config.yaml | 10 ++++++ .../cluster/kustomization.yaml | 10 ++++++ .../cluster/patch_user_config.yaml | 10 ++++++ .../hello_app_cluster/kustomization.yaml | 6 ++++ .../deployments/prod/cluster_user_config.yaml | 10 ++++++ .../prod/hello_world_app_user_config.yaml | 1 + .../deployments/prod/kustomization.yaml | 34 +++++++++++++++++++ 9 files changed, 99 insertions(+) create mode 100644 bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/kustomization.yaml create mode 100644 bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/override_config_hello_world.yaml create mode 100644 bases/cluster_templates/hello_app_cluster/cluster/cluster_user_config.yaml create mode 100644 bases/cluster_templates/hello_app_cluster/cluster/kustomization.yaml create mode 100644 bases/cluster_templates/hello_app_cluster/cluster/patch_user_config.yaml create mode 100644 bases/cluster_templates/hello_app_cluster/kustomization.yaml create mode 100644 bases/environments/deployments/prod/cluster_user_config.yaml create mode 100644 bases/environments/deployments/prod/hello_world_app_user_config.yaml create mode 100644 bases/environments/deployments/prod/kustomization.yaml diff --git a/bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/kustomization.yaml b/bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/kustomization.yaml new file mode 100644 index 00000000..db77125b --- /dev/null +++ b/bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +configMapGenerator: + - behavior: replace + files: + - values=override_config_hello_world.yaml + name: ${cluster_id}-hello-world-values +generatorOptions: + disableNameSuffixHash: true +kind: Kustomization +resources: + - ../../../../app_sets/hello-web-app/ diff --git a/bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/override_config_hello_world.yaml b/bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/override_config_hello_world.yaml new file mode 100644 index 00000000..42ba79da --- /dev/null +++ b/bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/override_config_hello_world.yaml @@ -0,0 +1,6 @@ +admin_login: hello-admin-in-cluster-template +db_config: + db_port: 5433 # has to be in sync with config in default_config_simple_db.yaml + db_user: hello-web-app # has to be in sync with config in default_config_simple_db.yaml + host: simple-db.simple-web.svc # has to be in sync with 'namespace:' set in kustomization.yaml +thread_pool_size: 64 diff --git a/bases/cluster_templates/hello_app_cluster/cluster/cluster_user_config.yaml b/bases/cluster_templates/hello_app_cluster/cluster/cluster_user_config.yaml new file mode 100644 index 00000000..7a3ae0f7 --- /dev/null +++ b/bases/cluster_templates/hello_app_cluster/cluster/cluster_user_config.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +data: + values: | + cloudConfig: cloud-config-giantswarm-2 + cloudName: openstack + externalNetworkID: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee +kind: ConfigMap +metadata: + name: ${cluster_name}-user-config + namespace: org-${organization} diff --git a/bases/cluster_templates/hello_app_cluster/cluster/kustomization.yaml b/bases/cluster_templates/hello_app_cluster/cluster/kustomization.yaml new file mode 100644 index 00000000..faac0a3e --- /dev/null +++ b/bases/cluster_templates/hello_app_cluster/cluster/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +commonLabels: + giantswarm.io/managed-by: flux +kind: Kustomization +patchesStrategicMerge: + - patch_user_config.yaml +resources: + - ../../../clusters/capo/>=v0.6.0 + - cluster_user_config.yaml diff --git a/bases/cluster_templates/hello_app_cluster/cluster/patch_user_config.yaml b/bases/cluster_templates/hello_app_cluster/cluster/patch_user_config.yaml new file mode 100644 index 00000000..0143eae2 --- /dev/null +++ b/bases/cluster_templates/hello_app_cluster/cluster/patch_user_config.yaml @@ -0,0 +1,10 @@ +apiVersion: application.giantswarm.io/v1alpha1 +kind: App +metadata: + name: ${cluster_name} + namespace: org-${organization} +spec: + userConfig: + configMap: + name: ${cluster_name}-user-config + namespace: org-${organization} diff --git a/bases/cluster_templates/hello_app_cluster/kustomization.yaml b/bases/cluster_templates/hello_app_cluster/kustomization.yaml new file mode 100644 index 00000000..9e9f7c81 --- /dev/null +++ b/bases/cluster_templates/hello_app_cluster/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +kind: Kustomization +resources: + - cluster/ + - app_sets/hello-web-app/ diff --git a/bases/environments/deployments/prod/cluster_user_config.yaml b/bases/environments/deployments/prod/cluster_user_config.yaml new file mode 100644 index 00000000..ba7779d1 --- /dev/null +++ b/bases/environments/deployments/prod/cluster_user_config.yaml @@ -0,0 +1,10 @@ +values: | + cloudConfig: cloud-config-giantswarm-2 + cloudName: openstack + externalNetworkID: prod-bbbb-cccc-dddd-eeeeeeeeeeee + nodeClasses: + - bootFromVolume: true + diskSize: 150 + flavor: n1.large + image: dddddddd-dddd-dddd-dddd-dddddddddddd + name: default diff --git a/bases/environments/deployments/prod/hello_world_app_user_config.yaml b/bases/environments/deployments/prod/hello_world_app_user_config.yaml new file mode 100644 index 00000000..c8dc14ac --- /dev/null +++ b/bases/environments/deployments/prod/hello_world_app_user_config.yaml @@ -0,0 +1 @@ +thread_pool_size: 256 diff --git a/bases/environments/deployments/prod/kustomization.yaml b/bases/environments/deployments/prod/kustomization.yaml new file mode 100644 index 00000000..ab419145 --- /dev/null +++ b/bases/environments/deployments/prod/kustomization.yaml @@ -0,0 +1,34 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +configMapGenerator: + - behavior: create + files: + - values=hello_world_app_user_config.yaml + name: ${cluster_id}-hello-world-user-config + - behavior: replace + files: + - values=cluster_user_config.yaml + name: ${cluster_name}-user-config + namespace: org-${organization} +generatorOptions: + disableNameSuffixHash: true +kind: Kustomization +# (optional) here we can enforce versions for both component of the app that we want in prod +patches: + - patch: |- + - op: replace + path: /spec/version + value: 0.1.8 + target: + kind: App + name: \${cluster_id}-hello-world + - patch: |- + - op: replace + path: /spec/version + value: 0.1.0 + target: + kind: App + name: \${cluster_id}-simple-db +# block end +resources: + - ../../../cluster_templates/hello_app_cluster From ec5d7e408f52d116c9eec90440473d7200316fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pi=C4=85tkowski?= Date: Thu, 2 Jun 2022 16:02:14 +0200 Subject: [PATCH 02/34] wip: prod cluster --- .../workload-clusters/HELLO_APP_PROD_1/kustomization.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_1/kustomization.yaml diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_1/kustomization.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_1/kustomization.yaml new file mode 100644 index 00000000..24d7f5a0 --- /dev/null +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_1/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +kind: Kustomization +resources: + - ../../../../../../bases/environments/deployments/prod/ From 58712c2da38898f105c90fe17aed5332b5e14f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pi=C4=85tkowski?= Date: Fri, 3 Jun 2022 13:39:42 +0200 Subject: [PATCH 03/34] move prod clsuter template to app specific folder --- .../cluster_user_config.yaml | 0 .../hello_world_app_user_config.yaml | 0 .../kustomization.yaml | 2 +- .../HELLO_APP_PROD_CLUSTER_1.yaml | 21 +++++++++++++++++++ .../kustomization.yaml | 2 +- 5 files changed, 23 insertions(+), 2 deletions(-) rename bases/environments/deployments/prod/{ => hello_app_cluster}/cluster_user_config.yaml (100%) rename bases/environments/deployments/prod/{ => hello_app_cluster}/hello_world_app_user_config.yaml (100%) rename bases/environments/deployments/prod/{ => hello_app_cluster}/kustomization.yaml (94%) create mode 100644 management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml rename management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/{HELLO_APP_PROD_1 => HELLO_APP_PROD_CLUSTER_1}/kustomization.yaml (59%) diff --git a/bases/environments/deployments/prod/cluster_user_config.yaml b/bases/environments/deployments/prod/hello_app_cluster/cluster_user_config.yaml similarity index 100% rename from bases/environments/deployments/prod/cluster_user_config.yaml rename to bases/environments/deployments/prod/hello_app_cluster/cluster_user_config.yaml diff --git a/bases/environments/deployments/prod/hello_world_app_user_config.yaml b/bases/environments/deployments/prod/hello_app_cluster/hello_world_app_user_config.yaml similarity index 100% rename from bases/environments/deployments/prod/hello_world_app_user_config.yaml rename to bases/environments/deployments/prod/hello_app_cluster/hello_world_app_user_config.yaml diff --git a/bases/environments/deployments/prod/kustomization.yaml b/bases/environments/deployments/prod/hello_app_cluster/kustomization.yaml similarity index 94% rename from bases/environments/deployments/prod/kustomization.yaml rename to bases/environments/deployments/prod/hello_app_cluster/kustomization.yaml index ab419145..0d213177 100644 --- a/bases/environments/deployments/prod/kustomization.yaml +++ b/bases/environments/deployments/prod/hello_app_cluster/kustomization.yaml @@ -31,4 +31,4 @@ patches: name: \${cluster_id}-simple-db # block end resources: - - ../../../cluster_templates/hello_app_cluster + - ../../../../cluster_templates/hello_app_cluster diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml new file mode 100644 index 00000000..629194b8 --- /dev/null +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml @@ -0,0 +1,21 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +kind: Kustomization +metadata: + name: clusters-CAPI_WC_NAME + namespace: default +spec: + interval: 1m + path: "./management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1" + postBuild: + substitute: + cluster_domain: "MY_DOMAIN" + cluster_name: "CAPI_WC_NAME" + cluster_release: "0.8.1" + default_apps_release: "0.2.0" + organization: "ORG_NAME" + prune: false + serviceAccountName: automation + sourceRef: + kind: GitRepository + name: REPO_NAME + timeout: 2m diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_1/kustomization.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1/kustomization.yaml similarity index 59% rename from management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_1/kustomization.yaml rename to management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1/kustomization.yaml index 24d7f5a0..e8cc3263 100644 --- a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_1/kustomization.yaml +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1/kustomization.yaml @@ -2,4 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 buildMetadata: [originAnnotations] kind: Kustomization resources: - - ../../../../../../bases/environments/deployments/prod/ + - ../../../../../../bases/environments/deployments/prod/hello_app_cluster From 9df3628894220e2995fb7abd10f9a3135cdbb77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pi=C4=85tkowski?= Date: Fri, 3 Jun 2022 22:03:07 +0200 Subject: [PATCH 04/34] staging cluster --- .../automatic_updates/catalog.yaml | 14 ++++++++ .../automatic_updates/imageupdate.yaml | 28 ++++++++++++++++ .../automatic_updates/kustomization.yaml | 8 +++++ .../hello_world_app_user_config.yaml | 1 + .../hello_app_cluster/imagepolicies.yaml | 22 +++++++++++++ .../hello_app_cluster/imagerepositories.yaml | 16 ++++++++++ .../hello_app_cluster/kustomization.yaml | 32 +++++++++++++++++++ .../HELLO_APP_STAGING_CLUSTER_1.yaml | 21 ++++++++++++ .../kustomization.yaml | 5 +++ 9 files changed, 147 insertions(+) create mode 100644 bases/environments/deployments/staging/hello_app_cluster/automatic_updates/catalog.yaml create mode 100644 bases/environments/deployments/staging/hello_app_cluster/automatic_updates/imageupdate.yaml create mode 100644 bases/environments/deployments/staging/hello_app_cluster/automatic_updates/kustomization.yaml create mode 100644 bases/environments/deployments/staging/hello_app_cluster/hello_world_app_user_config.yaml create mode 100644 bases/environments/deployments/staging/hello_app_cluster/imagepolicies.yaml create mode 100644 bases/environments/deployments/staging/hello_app_cluster/imagerepositories.yaml create mode 100644 bases/environments/deployments/staging/hello_app_cluster/kustomization.yaml create mode 100644 management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml create mode 100644 management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1/kustomization.yaml diff --git a/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/catalog.yaml b/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/catalog.yaml new file mode 100644 index 00000000..37008da1 --- /dev/null +++ b/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/catalog.yaml @@ -0,0 +1,14 @@ +apiVersion: application.giantswarm.io/v1alpha1 +kind: Catalog +metadata: + labels: + application.giantswarm.io/catalog-visibility: internal + name: giantswarm-catalog-oci + namespace: org-${organization} +spec: + description: giantswarm-catalog-oci + logoURL: "https://avatars.githubusercontent.com/u/7556340?s=60&v=4" + storage: + URL: oci://giantswarmpublic.azurecr.io/giantswarm-catalog/ + type: helm + title: giantswarm-catalog-oci diff --git a/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/imageupdate.yaml b/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/imageupdate.yaml new file mode 100644 index 00000000..3183a7c5 --- /dev/null +++ b/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/imageupdate.yaml @@ -0,0 +1,28 @@ +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImageUpdateAutomation +metadata: + name: ${cluster_id}-image-updates + namespace: org-${organization} +spec: + git: + checkout: + ref: + branch: main + commit: + author: + email: fluxcdbot@users.noreply.github.com + name: fluxcdbot + messageTemplate: | + automated app upgrades: + {{ range $image, $_ := .Updated.Images -}} + - {{ $image.Repository }} to {{ $image.Identifier }} + {{ end -}} + push: + branch: main + interval: 1m0s + sourceRef: + kind: GitRepository + name: YOUR_GIT_REPO + update: + path: ./management-clusters/MC_NAME + strategy: Setters diff --git a/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/kustomization.yaml b/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/kustomization.yaml new file mode 100644 index 00000000..9c92d9cd --- /dev/null +++ b/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +commonLabels: + giantswarm.io/managed-by: flux +kind: Kustomization +resources: +- catalog.yaml +- imageupdate.yaml diff --git a/bases/environments/deployments/staging/hello_app_cluster/hello_world_app_user_config.yaml b/bases/environments/deployments/staging/hello_app_cluster/hello_world_app_user_config.yaml new file mode 100644 index 00000000..17249927 --- /dev/null +++ b/bases/environments/deployments/staging/hello_app_cluster/hello_world_app_user_config.yaml @@ -0,0 +1 @@ +thread_pool_size: 64 diff --git a/bases/environments/deployments/staging/hello_app_cluster/imagepolicies.yaml b/bases/environments/deployments/staging/hello_app_cluster/imagepolicies.yaml new file mode 100644 index 00000000..f7437788 --- /dev/null +++ b/bases/environments/deployments/staging/hello_app_cluster/imagepolicies.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImagePolicy +metadata: + name: ${cluster_id}-hello-app +spec: + imageRepositoryRef: + name: ${cluster_id}-hello-app + policy: + semver: + range: '>=0.1.0 <1.0.0' +--- +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImagePolicy +metadata: + name: ${cluster_id}-simple-db-app +spec: + imageRepositoryRef: + name: ${cluster_id}-simple-db + policy: + semver: + range: '>=0.1.0 <0.2.0' diff --git a/bases/environments/deployments/staging/hello_app_cluster/imagerepositories.yaml b/bases/environments/deployments/staging/hello_app_cluster/imagerepositories.yaml new file mode 100644 index 00000000..94bcb4ce --- /dev/null +++ b/bases/environments/deployments/staging/hello_app_cluster/imagerepositories.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImageRepository +metadata: + name: ${cluster_id}-hello-app +spec: + image: giantswarmpublic.azurecr.io/giantswarm-catalog/hello-world-app + interval: 10m0s +--- +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImageRepository +metadata: + name: ${cluster_id}-simple-db-app +spec: + image: giantswarmpublic.azurecr.io/giantswarm-catalog/simple-db-app + interval: 10m0s diff --git a/bases/environments/deployments/staging/hello_app_cluster/kustomization.yaml b/bases/environments/deployments/staging/hello_app_cluster/kustomization.yaml new file mode 100644 index 00000000..b7ef4a2c --- /dev/null +++ b/bases/environments/deployments/staging/hello_app_cluster/kustomization.yaml @@ -0,0 +1,32 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +configMapGenerator: + - behavior: create + files: + - values=hello_world_app_user_config.yaml + name: ${cluster_id}-hello-world-user-config +generatorOptions: + disableNameSuffixHash: true +kind: Kustomization +# (optional) here we can enforce versions for both component of the app that we want in prod +patches: + - patch: |- + - op: replace + path: /spec/version + value: '0.1.8 # {"$imagepolicy": "org-${organization}:${cluster_id}-hello-app"}' + target: + kind: App + name: \${cluster_id}-hello-world + - patch: |- + - op: replace + path: /spec/version + value: '0.1.0 # {"$imagepolicy": "org-${organization}:${cluster_id}-simple-db-app"}' + target: + kind: App + name: \${cluster_id}-simple-db +# block end +resources: + - automatic_updates/ + - imagepolicies.yaml + - imagerepositories.yaml + - ../../../../cluster_templates/hello_app_cluster diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml new file mode 100644 index 00000000..1d808db1 --- /dev/null +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml @@ -0,0 +1,21 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +kind: Kustomization +metadata: + name: clusters-CAPI_WC_NAME + namespace: default +spec: + interval: 1m + path: "./management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1" + postBuild: + substitute: + cluster_domain: "MY_DOMAIN" + cluster_name: "CAPI_WC_NAME" + cluster_release: "0.8.1" + default_apps_release: "0.2.0" + organization: "ORG_NAME" + prune: false + serviceAccountName: automation + sourceRef: + kind: GitRepository + name: REPO_NAME + timeout: 2m diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1/kustomization.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1/kustomization.yaml new file mode 100644 index 00000000..d377ff96 --- /dev/null +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +kind: Kustomization +resources: + - ../../../../../../bases/environments/deployments/staging/hello_app_cluster From 45d9020135fbeafbceabfeab8a077d0cd521e3f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pi=C4=85tkowski?= Date: Mon, 6 Jun 2022 15:12:02 +0200 Subject: [PATCH 05/34] add: dev environment --- .../automatic_updates/catalog.yaml | 14 ++++++++ .../automatic_updates/imageupdate.yaml | 28 ++++++++++++++++ .../automatic_updates/kustomization.yaml | 8 +++++ .../hello_world_app_user_config.yaml | 1 + .../dev/hello_app_cluster/imagepolicies.yaml | 24 ++++++++++++++ .../hello_app_cluster/imagerepositories.yaml | 16 ++++++++++ .../dev/hello_app_cluster/kustomization.yaml | 32 +++++++++++++++++++ .../HELLO_APP_DEV_CLUSTER_1.yaml | 21 ++++++++++++ .../kustomization.yaml | 5 +++ .../workload-clusters/kustomization.yaml | 3 ++ 10 files changed, 152 insertions(+) create mode 100644 bases/environments/deployments/dev/hello_app_cluster/automatic_updates/catalog.yaml create mode 100644 bases/environments/deployments/dev/hello_app_cluster/automatic_updates/imageupdate.yaml create mode 100644 bases/environments/deployments/dev/hello_app_cluster/automatic_updates/kustomization.yaml create mode 100644 bases/environments/deployments/dev/hello_app_cluster/hello_world_app_user_config.yaml create mode 100644 bases/environments/deployments/dev/hello_app_cluster/imagepolicies.yaml create mode 100644 bases/environments/deployments/dev/hello_app_cluster/imagerepositories.yaml create mode 100644 bases/environments/deployments/dev/hello_app_cluster/kustomization.yaml create mode 100644 management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml create mode 100644 management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1/kustomization.yaml diff --git a/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/catalog.yaml b/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/catalog.yaml new file mode 100644 index 00000000..37008da1 --- /dev/null +++ b/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/catalog.yaml @@ -0,0 +1,14 @@ +apiVersion: application.giantswarm.io/v1alpha1 +kind: Catalog +metadata: + labels: + application.giantswarm.io/catalog-visibility: internal + name: giantswarm-catalog-oci + namespace: org-${organization} +spec: + description: giantswarm-catalog-oci + logoURL: "https://avatars.githubusercontent.com/u/7556340?s=60&v=4" + storage: + URL: oci://giantswarmpublic.azurecr.io/giantswarm-catalog/ + type: helm + title: giantswarm-catalog-oci diff --git a/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/imageupdate.yaml b/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/imageupdate.yaml new file mode 100644 index 00000000..3183a7c5 --- /dev/null +++ b/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/imageupdate.yaml @@ -0,0 +1,28 @@ +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImageUpdateAutomation +metadata: + name: ${cluster_id}-image-updates + namespace: org-${organization} +spec: + git: + checkout: + ref: + branch: main + commit: + author: + email: fluxcdbot@users.noreply.github.com + name: fluxcdbot + messageTemplate: | + automated app upgrades: + {{ range $image, $_ := .Updated.Images -}} + - {{ $image.Repository }} to {{ $image.Identifier }} + {{ end -}} + push: + branch: main + interval: 1m0s + sourceRef: + kind: GitRepository + name: YOUR_GIT_REPO + update: + path: ./management-clusters/MC_NAME + strategy: Setters diff --git a/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/kustomization.yaml b/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/kustomization.yaml new file mode 100644 index 00000000..9c92d9cd --- /dev/null +++ b/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +commonLabels: + giantswarm.io/managed-by: flux +kind: Kustomization +resources: +- catalog.yaml +- imageupdate.yaml diff --git a/bases/environments/deployments/dev/hello_app_cluster/hello_world_app_user_config.yaml b/bases/environments/deployments/dev/hello_app_cluster/hello_world_app_user_config.yaml new file mode 100644 index 00000000..0c601685 --- /dev/null +++ b/bases/environments/deployments/dev/hello_app_cluster/hello_world_app_user_config.yaml @@ -0,0 +1 @@ +thread_pool_size: 16 diff --git a/bases/environments/deployments/dev/hello_app_cluster/imagepolicies.yaml b/bases/environments/deployments/dev/hello_app_cluster/imagepolicies.yaml new file mode 100644 index 00000000..25a7028a --- /dev/null +++ b/bases/environments/deployments/dev/hello_app_cluster/imagepolicies.yaml @@ -0,0 +1,24 @@ +--- +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImagePolicy +metadata: + name: ${cluster_id}-hello-app +spec: + filterTags: + pattern: '.*-dev.*' + imageRepositoryRef: + name: ${cluster_id}-hello-app + policy: + semver: + range: '>=0.1.0' +--- +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImagePolicy +metadata: + name: ${cluster_id}-simple-db-app +spec: + imageRepositoryRef: + name: ${cluster_id}-simple-db + policy: + semver: + range: '>=0.1.0 <0.2.0' diff --git a/bases/environments/deployments/dev/hello_app_cluster/imagerepositories.yaml b/bases/environments/deployments/dev/hello_app_cluster/imagerepositories.yaml new file mode 100644 index 00000000..94bcb4ce --- /dev/null +++ b/bases/environments/deployments/dev/hello_app_cluster/imagerepositories.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImageRepository +metadata: + name: ${cluster_id}-hello-app +spec: + image: giantswarmpublic.azurecr.io/giantswarm-catalog/hello-world-app + interval: 10m0s +--- +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImageRepository +metadata: + name: ${cluster_id}-simple-db-app +spec: + image: giantswarmpublic.azurecr.io/giantswarm-catalog/simple-db-app + interval: 10m0s diff --git a/bases/environments/deployments/dev/hello_app_cluster/kustomization.yaml b/bases/environments/deployments/dev/hello_app_cluster/kustomization.yaml new file mode 100644 index 00000000..b7ef4a2c --- /dev/null +++ b/bases/environments/deployments/dev/hello_app_cluster/kustomization.yaml @@ -0,0 +1,32 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +configMapGenerator: + - behavior: create + files: + - values=hello_world_app_user_config.yaml + name: ${cluster_id}-hello-world-user-config +generatorOptions: + disableNameSuffixHash: true +kind: Kustomization +# (optional) here we can enforce versions for both component of the app that we want in prod +patches: + - patch: |- + - op: replace + path: /spec/version + value: '0.1.8 # {"$imagepolicy": "org-${organization}:${cluster_id}-hello-app"}' + target: + kind: App + name: \${cluster_id}-hello-world + - patch: |- + - op: replace + path: /spec/version + value: '0.1.0 # {"$imagepolicy": "org-${organization}:${cluster_id}-simple-db-app"}' + target: + kind: App + name: \${cluster_id}-simple-db +# block end +resources: + - automatic_updates/ + - imagepolicies.yaml + - imagerepositories.yaml + - ../../../../cluster_templates/hello_app_cluster diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml new file mode 100644 index 00000000..dac821be --- /dev/null +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml @@ -0,0 +1,21 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +kind: Kustomization +metadata: + name: clusters-CAPI_WC_NAME + namespace: default +spec: + interval: 1m + path: "./management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1" + postBuild: + substitute: + cluster_domain: "MY_DOMAIN" + cluster_name: "CAPI_WC_NAME" + cluster_release: "0.8.1" + default_apps_release: "0.2.0" + organization: "ORG_NAME" + prune: false + serviceAccountName: automation + sourceRef: + kind: GitRepository + name: REPO_NAME + timeout: 2m diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1/kustomization.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1/kustomization.yaml new file mode 100644 index 00000000..02e6c0af --- /dev/null +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +kind: Kustomization +resources: + - ../../../../../../bases/environments/deployments/dev/hello_app_cluster diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/kustomization.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/kustomization.yaml index 8760565a..f3ace5c8 100644 --- a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/kustomization.yaml +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/kustomization.yaml @@ -7,3 +7,6 @@ resources: - FROM_TEMPLATE_WC_NAME.yaml - CAPI_WC_NAME.yaml - WC_NAME.yaml +- HELLO_APP_PROD_CLUSTER_1.yaml +- HELLO_APP_STAGING_CLUSTER_1.yaml +- HELLO_APP_DEV_CLUSTER_1.yaml From f053324d8f57c410338dd2af2542f463b498bcbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pi=C4=85tkowski?= Date: Mon, 6 Jun 2022 15:29:28 +0200 Subject: [PATCH 06/34] fix: unfortunately, both cluster_id and cluster_name are needed --- .../ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml | 3 ++- .../ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml | 3 ++- .../workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml index dac821be..87e88793 100644 --- a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml @@ -9,7 +9,8 @@ spec: postBuild: substitute: cluster_domain: "MY_DOMAIN" - cluster_name: "CAPI_WC_NAME" + cluster_id: "HELLO_DEV_1" + cluster_name: "HELLO_DEV_1" cluster_release: "0.8.1" default_apps_release: "0.2.0" organization: "ORG_NAME" diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml index 629194b8..e2a093ba 100644 --- a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml @@ -9,7 +9,8 @@ spec: postBuild: substitute: cluster_domain: "MY_DOMAIN" - cluster_name: "CAPI_WC_NAME" + cluster_id: "HELLO_PROD_1" + cluster_name: "HELLO_PROD_1" cluster_release: "0.8.1" default_apps_release: "0.2.0" organization: "ORG_NAME" diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml index 1d808db1..9d19b35c 100644 --- a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml @@ -9,7 +9,8 @@ spec: postBuild: substitute: cluster_domain: "MY_DOMAIN" - cluster_name: "CAPI_WC_NAME" + cluster_id: "HELLO_STAGING_1" + cluster_name: "HELLO_STAGING_1" cluster_release: "0.8.1" default_apps_release: "0.2.0" organization: "ORG_NAME" From 3a27e9fcb7f5aa40ebd50f45ebe096df11c6e5bf Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 09:53:47 +0200 Subject: [PATCH 07/34] Fix typos --- docs/add_wc_template.md | 2 +- docs/appendices.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/add_wc_template.md b/docs/add_wc_template.md index 0ff2070c..c1f66815 100644 --- a/docs/add_wc_template.md +++ b/docs/add_wc_template.md @@ -7,7 +7,7 @@ a [Vintage cluster template](./add_wc_template_vintage.md) or the new [CAPI based cluster template](./add_wc_template_capi.md). Please check these docs about how to add a template in each of the cases. -If the template you need already exists, you can skip this step and continue to recommended next steps: +If the template you need already exists, you can skip this step and continue to the recommended next steps: - [Add a new Workload Cluster repository structure](./add_wc_structure.md) - [Add Workload Cluster instance](./add_wc_instance.md) diff --git a/docs/appendices.md b/docs/appendices.md index 82a17fe0..250481ba 100644 --- a/docs/appendices.md +++ b/docs/appendices.md @@ -11,7 +11,7 @@ This section contains the list of tools used thought the code examples in this r ### Core utilities -For core utilties like `base64`, `sed`, `tr`, etc. GNU compatible versions are assumed in the code examples. +For core utilities like `base64`, `sed`, `tr`, etc. GNU compatible versions are assumed in the code examples. ### Working with YAML files From 39e0ba47f7fe3bc446e8ab6dced4dcaec8aee84f Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 09:56:28 +0200 Subject: [PATCH 08/34] Add base for environment workload cluster docs --- docs/add_wc.md | 1 + docs/add_wc_environments.md | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 docs/add_wc_environments.md diff --git a/docs/add_wc.md b/docs/add_wc.md index aaf0531f..303d56cf 100644 --- a/docs/add_wc.md +++ b/docs/add_wc.md @@ -5,6 +5,7 @@ understand and follow all of them to produce a valid configuration. These steps 1. [Preparing a cluster definition template](./add_wc_template.md) you want to use for your cluster (if it doesn't already exist). +1. [Preparing multiple environments](./add_wc_environments.md) 1. [Preparing GitOps repository structure, encryption secrets and dedicated Flux Kustomization](./add_wc_structure.md). 1. [Providing actual instance of a cluster, a definition of infrastructure required to run it](./add_wc_instance.md). 1. [Configuring Apps to be deployed in the new cluster](./apps/README.md). diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md new file mode 100644 index 00000000..e2ca1a18 --- /dev/null +++ b/docs/add_wc_environments.md @@ -0,0 +1,5 @@ +# Add Workload Cluster environments + +You might want to set up multiple, similar Workload Clusters that serve as for example development, +staging and production environments. You can utilize `bases` and [cluster_templates](./add_wc_template.md) +to achieve that. From b07b8665324f932f9ef0ce2d33d834c0b67665c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pi=C4=85tkowski?= Date: Mon, 20 Jun 2022 13:39:31 +0200 Subject: [PATCH 09/34] renamed 'deployments' to 'stages' --- .../dev/hello_app_cluster/automatic_updates/catalog.yaml | 0 .../dev/hello_app_cluster/automatic_updates/imageupdate.yaml | 0 .../dev/hello_app_cluster/automatic_updates/kustomization.yaml | 0 .../dev/hello_app_cluster/hello_world_app_user_config.yaml | 0 .../dev/hello_app_cluster/imagepolicies.yaml | 0 .../dev/hello_app_cluster/imagerepositories.yaml | 0 .../dev/hello_app_cluster/kustomization.yaml | 0 .../prod/hello_app_cluster/cluster_user_config.yaml | 0 .../prod/hello_app_cluster/hello_world_app_user_config.yaml | 0 .../prod/hello_app_cluster/kustomization.yaml | 0 .../staging/hello_app_cluster/automatic_updates/catalog.yaml | 0 .../hello_app_cluster/automatic_updates/imageupdate.yaml | 0 .../hello_app_cluster/automatic_updates/kustomization.yaml | 0 .../staging/hello_app_cluster/hello_world_app_user_config.yaml | 0 .../staging/hello_app_cluster/imagepolicies.yaml | 0 .../staging/hello_app_cluster/imagerepositories.yaml | 0 .../staging/hello_app_cluster/kustomization.yaml | 0 .../HELLO_APP_DEV_CLUSTER_1/kustomization.yaml | 2 +- .../HELLO_APP_PROD_CLUSTER_1/kustomization.yaml | 2 +- .../HELLO_APP_STAGING_CLUSTER_1/kustomization.yaml | 2 +- 20 files changed, 3 insertions(+), 3 deletions(-) rename bases/environments/{deployments => stages}/dev/hello_app_cluster/automatic_updates/catalog.yaml (100%) rename bases/environments/{deployments => stages}/dev/hello_app_cluster/automatic_updates/imageupdate.yaml (100%) rename bases/environments/{deployments => stages}/dev/hello_app_cluster/automatic_updates/kustomization.yaml (100%) rename bases/environments/{deployments => stages}/dev/hello_app_cluster/hello_world_app_user_config.yaml (100%) rename bases/environments/{deployments => stages}/dev/hello_app_cluster/imagepolicies.yaml (100%) rename bases/environments/{deployments => stages}/dev/hello_app_cluster/imagerepositories.yaml (100%) rename bases/environments/{deployments => stages}/dev/hello_app_cluster/kustomization.yaml (100%) rename bases/environments/{deployments => stages}/prod/hello_app_cluster/cluster_user_config.yaml (100%) rename bases/environments/{deployments => stages}/prod/hello_app_cluster/hello_world_app_user_config.yaml (100%) rename bases/environments/{deployments => stages}/prod/hello_app_cluster/kustomization.yaml (100%) rename bases/environments/{deployments => stages}/staging/hello_app_cluster/automatic_updates/catalog.yaml (100%) rename bases/environments/{deployments => stages}/staging/hello_app_cluster/automatic_updates/imageupdate.yaml (100%) rename bases/environments/{deployments => stages}/staging/hello_app_cluster/automatic_updates/kustomization.yaml (100%) rename bases/environments/{deployments => stages}/staging/hello_app_cluster/hello_world_app_user_config.yaml (100%) rename bases/environments/{deployments => stages}/staging/hello_app_cluster/imagepolicies.yaml (100%) rename bases/environments/{deployments => stages}/staging/hello_app_cluster/imagerepositories.yaml (100%) rename bases/environments/{deployments => stages}/staging/hello_app_cluster/kustomization.yaml (100%) diff --git a/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/catalog.yaml b/bases/environments/stages/dev/hello_app_cluster/automatic_updates/catalog.yaml similarity index 100% rename from bases/environments/deployments/dev/hello_app_cluster/automatic_updates/catalog.yaml rename to bases/environments/stages/dev/hello_app_cluster/automatic_updates/catalog.yaml diff --git a/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/imageupdate.yaml b/bases/environments/stages/dev/hello_app_cluster/automatic_updates/imageupdate.yaml similarity index 100% rename from bases/environments/deployments/dev/hello_app_cluster/automatic_updates/imageupdate.yaml rename to bases/environments/stages/dev/hello_app_cluster/automatic_updates/imageupdate.yaml diff --git a/bases/environments/deployments/dev/hello_app_cluster/automatic_updates/kustomization.yaml b/bases/environments/stages/dev/hello_app_cluster/automatic_updates/kustomization.yaml similarity index 100% rename from bases/environments/deployments/dev/hello_app_cluster/automatic_updates/kustomization.yaml rename to bases/environments/stages/dev/hello_app_cluster/automatic_updates/kustomization.yaml diff --git a/bases/environments/deployments/dev/hello_app_cluster/hello_world_app_user_config.yaml b/bases/environments/stages/dev/hello_app_cluster/hello_world_app_user_config.yaml similarity index 100% rename from bases/environments/deployments/dev/hello_app_cluster/hello_world_app_user_config.yaml rename to bases/environments/stages/dev/hello_app_cluster/hello_world_app_user_config.yaml diff --git a/bases/environments/deployments/dev/hello_app_cluster/imagepolicies.yaml b/bases/environments/stages/dev/hello_app_cluster/imagepolicies.yaml similarity index 100% rename from bases/environments/deployments/dev/hello_app_cluster/imagepolicies.yaml rename to bases/environments/stages/dev/hello_app_cluster/imagepolicies.yaml diff --git a/bases/environments/deployments/dev/hello_app_cluster/imagerepositories.yaml b/bases/environments/stages/dev/hello_app_cluster/imagerepositories.yaml similarity index 100% rename from bases/environments/deployments/dev/hello_app_cluster/imagerepositories.yaml rename to bases/environments/stages/dev/hello_app_cluster/imagerepositories.yaml diff --git a/bases/environments/deployments/dev/hello_app_cluster/kustomization.yaml b/bases/environments/stages/dev/hello_app_cluster/kustomization.yaml similarity index 100% rename from bases/environments/deployments/dev/hello_app_cluster/kustomization.yaml rename to bases/environments/stages/dev/hello_app_cluster/kustomization.yaml diff --git a/bases/environments/deployments/prod/hello_app_cluster/cluster_user_config.yaml b/bases/environments/stages/prod/hello_app_cluster/cluster_user_config.yaml similarity index 100% rename from bases/environments/deployments/prod/hello_app_cluster/cluster_user_config.yaml rename to bases/environments/stages/prod/hello_app_cluster/cluster_user_config.yaml diff --git a/bases/environments/deployments/prod/hello_app_cluster/hello_world_app_user_config.yaml b/bases/environments/stages/prod/hello_app_cluster/hello_world_app_user_config.yaml similarity index 100% rename from bases/environments/deployments/prod/hello_app_cluster/hello_world_app_user_config.yaml rename to bases/environments/stages/prod/hello_app_cluster/hello_world_app_user_config.yaml diff --git a/bases/environments/deployments/prod/hello_app_cluster/kustomization.yaml b/bases/environments/stages/prod/hello_app_cluster/kustomization.yaml similarity index 100% rename from bases/environments/deployments/prod/hello_app_cluster/kustomization.yaml rename to bases/environments/stages/prod/hello_app_cluster/kustomization.yaml diff --git a/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/catalog.yaml b/bases/environments/stages/staging/hello_app_cluster/automatic_updates/catalog.yaml similarity index 100% rename from bases/environments/deployments/staging/hello_app_cluster/automatic_updates/catalog.yaml rename to bases/environments/stages/staging/hello_app_cluster/automatic_updates/catalog.yaml diff --git a/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/imageupdate.yaml b/bases/environments/stages/staging/hello_app_cluster/automatic_updates/imageupdate.yaml similarity index 100% rename from bases/environments/deployments/staging/hello_app_cluster/automatic_updates/imageupdate.yaml rename to bases/environments/stages/staging/hello_app_cluster/automatic_updates/imageupdate.yaml diff --git a/bases/environments/deployments/staging/hello_app_cluster/automatic_updates/kustomization.yaml b/bases/environments/stages/staging/hello_app_cluster/automatic_updates/kustomization.yaml similarity index 100% rename from bases/environments/deployments/staging/hello_app_cluster/automatic_updates/kustomization.yaml rename to bases/environments/stages/staging/hello_app_cluster/automatic_updates/kustomization.yaml diff --git a/bases/environments/deployments/staging/hello_app_cluster/hello_world_app_user_config.yaml b/bases/environments/stages/staging/hello_app_cluster/hello_world_app_user_config.yaml similarity index 100% rename from bases/environments/deployments/staging/hello_app_cluster/hello_world_app_user_config.yaml rename to bases/environments/stages/staging/hello_app_cluster/hello_world_app_user_config.yaml diff --git a/bases/environments/deployments/staging/hello_app_cluster/imagepolicies.yaml b/bases/environments/stages/staging/hello_app_cluster/imagepolicies.yaml similarity index 100% rename from bases/environments/deployments/staging/hello_app_cluster/imagepolicies.yaml rename to bases/environments/stages/staging/hello_app_cluster/imagepolicies.yaml diff --git a/bases/environments/deployments/staging/hello_app_cluster/imagerepositories.yaml b/bases/environments/stages/staging/hello_app_cluster/imagerepositories.yaml similarity index 100% rename from bases/environments/deployments/staging/hello_app_cluster/imagerepositories.yaml rename to bases/environments/stages/staging/hello_app_cluster/imagerepositories.yaml diff --git a/bases/environments/deployments/staging/hello_app_cluster/kustomization.yaml b/bases/environments/stages/staging/hello_app_cluster/kustomization.yaml similarity index 100% rename from bases/environments/deployments/staging/hello_app_cluster/kustomization.yaml rename to bases/environments/stages/staging/hello_app_cluster/kustomization.yaml diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1/kustomization.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1/kustomization.yaml index 02e6c0af..6775fcf7 100644 --- a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1/kustomization.yaml +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1/kustomization.yaml @@ -2,4 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 buildMetadata: [originAnnotations] kind: Kustomization resources: - - ../../../../../../bases/environments/deployments/dev/hello_app_cluster + - ../../../../../../bases/environments/stages/dev/hello_app_cluster diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1/kustomization.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1/kustomization.yaml index e8cc3263..af315ebb 100644 --- a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1/kustomization.yaml +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1/kustomization.yaml @@ -2,4 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 buildMetadata: [originAnnotations] kind: Kustomization resources: - - ../../../../../../bases/environments/deployments/prod/hello_app_cluster + - ../../../../../../bases/environments/stages/prod/hello_app_cluster diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1/kustomization.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1/kustomization.yaml index d377ff96..f4fca841 100644 --- a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1/kustomization.yaml +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1/kustomization.yaml @@ -2,4 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 buildMetadata: [originAnnotations] kind: Kustomization resources: - - ../../../../../../bases/environments/deployments/staging/hello_app_cluster + - ../../../../../../bases/environments/stages/staging/hello_app_cluster From 342a2fe132d22911be194c1d333525b97c89b8b1 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 13:56:03 +0200 Subject: [PATCH 10/34] Add docs on environment cluster bases --- docs/add_wc_environments.md | 193 +++++++++++++++++++++++++++++++++++- 1 file changed, 191 insertions(+), 2 deletions(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index e2ca1a18..369e4302 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -1,5 +1,194 @@ # Add Workload Cluster environments You might want to set up multiple, similar Workload Clusters that serve as for example development, -staging and production environments. You can utilize `bases` and [cluster_templates](./add_wc_template.md) -to achieve that. +staging and production environments. You can utilize [bases](/bases) to achieve that. Let's take a look at the +[/bases/environments](/bases/environments) folder structure. + +## Environments + +The `deployments` folder is a convenient wrapper to group our environment specifications. +There is a good reason for this additional layer of grouping. Think of the use case of having multiple +different clusters - like the dev, staging, production example - but also having multiple different +regions or data centers where you want to spin these clusters up. + +Think that these cluster should in many regards look the same wherever they are. But also whatever cluster +is hosted in a given region or data center should use a specific IP range, certificates or ingresses. + +In that cases we recommend putting region or data center specific configurations into for example +`/bases/environments/regions` folder and under there create a let's say `ap-east-1`, `eu-central-1`, +`us-west-2` folders. + +Later you will reference all these layers in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( +/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters) + +### Deployments + +We have 3 example clusters under [/bases/environments/deployments](/bases/environments/deployments): + +- [dev](/bases/environments/deployments/dev) +- [staging](/bases/environments/deployments/staging) +- [prod](/bases/environments/deployments/prod) + +Each of these contain a `hello_app_cluster` example. +This name might already be familiar to you from [Preparing a cluster definition template](./add_wc_template.md) section. + +By checking each `kustomization.yaml` files - the [dev]( +/bases/environments/deployments/dev/hello_app_cluster/kustomization.yaml) one for example - you will notice that they +all reference our [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) template base. + +```yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +# ... +resources: + # ... + - ../../../../cluster_templates/hello_app_cluster +``` + +You can put additional configuration under these folders that should be same for each instances of these clusters. +Let's take a closer look at our examples. + +#### The dev cluster + +In [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) base cluster template defines that the +[hello-web-app app set](/bases/app_sets/hello-web-app) should be installed in all of these clusters. +We can provide overrides to the settings via the [hello_world_app_user_config.yaml]( +/bases/environments/deployments/dev/hello_app_cluster/hello_world_app_user_config.yaml) file, for example +setting a lower thread pool size. + +```yaml +thread_pool_size: 16 +``` + +It also makes sense to configure `Automatic Updates` for our development cluster. We store these configurations under +the [/bases/environments/deployments/dev/hello_app_cluster/automatic_updates]( +/bases/environments/deployments/dev/hello_app_cluster/automatic_updates) folder. You can read more about how +`Automatic Updates` work [here](/docs/apps/automatic_updates_appcr.md) + +Now that we have automation set up around `Automatic Updates` we can set up our rules for the development cluster +on how it should update `Apps`. We need 2 things to achieve that, and we recommend setting up one multi-document YAML +files to store all these in a single place. + +The [ImageRepository](https://fluxcd.io/docs/components/image/imagerepositories/) definitions to tell Flux +where to look for updates stored in: [imagerepositories.yaml]( +/bases/environments/deployments/dev/hello_app_cluster/imagerepositories.yaml). + +Let's tell Flux to look for available images for the `hello-world-app` +in the `giantswarmpublic.azurecr.io/giantswarm-catalog` registry every 10 minutes. + +```yaml +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImageRepository +metadata: + name: ${cluster_id}-hello-app +spec: + image: giantswarmpublic.azurecr.io/giantswarm-catalog/hello-world-app + interval: 10m0s +``` + +The second half are the [ImagePolicy](https://fluxcd.io/docs/components/image/imagepolicies/) definitions to tell Flux +which versions it should automatically apply stored in: [imagepolicies.yaml]( +/bases/environments/deployments/dev/hello_app_cluster/imagepolicies.yaml). + +Let's have Flux automatically roll out all `-dev` releases that are of at least version `0.1.0` or above. + +```yaml +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImagePolicy +metadata: + name: ${cluster_id}-hello-app +spec: + filterTags: + pattern: '.*-dev.*' + imageRepositoryRef: + name: ${cluster_id}-hello-app + policy: + semver: + range: '>=0.1.0' +``` + +And pretty much that is it for the development cluster. Let's look at the staging cluster next to the minor differences. + +#### The staging cluster + +It is similar to the development cluster in the following manners: + +- it is based on the [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) template base +- it has automatic updated set up + +It also provides overrides to the [hello-web-app app set](/bases/app_sets/hello-web-app) via +[hello_world_app_user_config.yaml]( +/bases/environments/deployments/staging/hello_app_cluster/hello_world_app_user_config.yaml). +We want this environment to be more close to production so let's say we set a larger thread pool size. + +```yaml +thread_pool_size: 64 +``` + +We also want the images automatically rolled out here to be more stable, so we have a slightly different +[imagepolicies.yaml](/bases/environments/deployments/staging/hello_app_cluster/imagepolicies.yaml) here where +we tell Flux to automatically install all stable versions that are at least version `0.1.0` but we do not want +to automatically introduce possibly breaking changes in major version bump, so let's stay below `1.0.0`. + +```yaml +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImagePolicy +metadata: + name: ${cluster_id}-hello-app +spec: + imageRepositoryRef: + name: ${cluster_id}-hello-app + policy: + semver: + range: '>=0.1.0 <1.0.0' +``` + +So basically our staging cluster in our example is a smaller scale cluster carrying stable versions of our applications. + +Now, let's take a look at the production cluster example. + +#### The production cluster + +It is similar to the staging cluster in the following manners: + +- it is based on the [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) template base + +Then it provides some overrides to the [hello-web-app app set](/bases/app_sets/hello-web-app) via +[hello_world_app_user_config.yaml]( +/bases/environments/deployments/prod/hello_app_cluster/hello_world_app_user_config.yaml). + +```yaml +thread_pool_size: 256 +``` + +Notice however that we decided not to set up `Automatic Updates` for this cluster. + +Instead, we use the `Kustomization` in the cluster's [kustomization.yaml]( +/bases/environments/deployments/prod/hello_app_cluster/kustomization.yaml) to patch the exact versions to use +in out App CRs. + +```yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +# ... +patches: + - patch: |- + - op: replace + path: /spec/version + value: 0.1.8 + target: + kind: App + name: \${cluster_id}-hello-world + - patch: |- + - op: replace + path: /spec/version + value: 0.1.0 + target: + kind: App + name: \${cluster_id}-simple-db +``` + +We tell Flux to use version `0.1.8` of `hello-world-app` and version `0.1.0` of `simple-db-app`. + +In this example when we sufficiently validated our released changes in the staging environment we update the versions +in the `Kustomization`, merge the change and let Flux do the work. From 662d9c3cb8ce43e6c1b255b6feadad2f4603f119 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 14:22:55 +0200 Subject: [PATCH 11/34] Add docs on setting up workload clusters based on environment bases --- docs/add_wc_environments.md | 74 +++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 16 deletions(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 369e4302..78155fe6 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -6,7 +6,7 @@ staging and production environments. You can utilize [bases](/bases) to achieve ## Environments -The `deployments` folder is a convenient wrapper to group our environment specifications. +The `stages` folder is a convenient wrapper to group our environment specifications. There is a good reason for this additional layer of grouping. Think of the use case of having multiple different clusters - like the dev, staging, production example - but also having multiple different regions or data centers where you want to spin these clusters up. @@ -21,19 +21,19 @@ In that cases we recommend putting region or data center specific configurations Later you will reference all these layers in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( /management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters) -### Deployments +### Stages -We have 3 example clusters under [/bases/environments/deployments](/bases/environments/deployments): +We have 3 example clusters under [/bases/environments/stages](/bases/environments/stages): -- [dev](/bases/environments/deployments/dev) -- [staging](/bases/environments/deployments/staging) -- [prod](/bases/environments/deployments/prod) +- [dev](/bases/environments/stages/dev) +- [staging](/bases/environments/stages/staging) +- [prod](/bases/environments/stages/prod) Each of these contain a `hello_app_cluster` example. This name might already be familiar to you from [Preparing a cluster definition template](./add_wc_template.md) section. By checking each `kustomization.yaml` files - the [dev]( -/bases/environments/deployments/dev/hello_app_cluster/kustomization.yaml) one for example - you will notice that they +/bases/environments/stages/dev/hello_app_cluster/kustomization.yaml) one for example - you will notice that they all reference our [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) template base. ```yaml @@ -53,7 +53,7 @@ Let's take a closer look at our examples. In [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) base cluster template defines that the [hello-web-app app set](/bases/app_sets/hello-web-app) should be installed in all of these clusters. We can provide overrides to the settings via the [hello_world_app_user_config.yaml]( -/bases/environments/deployments/dev/hello_app_cluster/hello_world_app_user_config.yaml) file, for example +/bases/environments/stages/dev/hello_app_cluster/hello_world_app_user_config.yaml) file, for example setting a lower thread pool size. ```yaml @@ -61,8 +61,8 @@ thread_pool_size: 16 ``` It also makes sense to configure `Automatic Updates` for our development cluster. We store these configurations under -the [/bases/environments/deployments/dev/hello_app_cluster/automatic_updates]( -/bases/environments/deployments/dev/hello_app_cluster/automatic_updates) folder. You can read more about how +the [/bases/environments/stages/dev/hello_app_cluster/automatic_updates]( +/bases/environments/stages/dev/hello_app_cluster/automatic_updates) folder. You can read more about how `Automatic Updates` work [here](/docs/apps/automatic_updates_appcr.md) Now that we have automation set up around `Automatic Updates` we can set up our rules for the development cluster @@ -71,7 +71,7 @@ files to store all these in a single place. The [ImageRepository](https://fluxcd.io/docs/components/image/imagerepositories/) definitions to tell Flux where to look for updates stored in: [imagerepositories.yaml]( -/bases/environments/deployments/dev/hello_app_cluster/imagerepositories.yaml). +/bases/environments/stages/dev/hello_app_cluster/imagerepositories.yaml). Let's tell Flux to look for available images for the `hello-world-app` in the `giantswarmpublic.azurecr.io/giantswarm-catalog` registry every 10 minutes. @@ -88,7 +88,7 @@ spec: The second half are the [ImagePolicy](https://fluxcd.io/docs/components/image/imagepolicies/) definitions to tell Flux which versions it should automatically apply stored in: [imagepolicies.yaml]( -/bases/environments/deployments/dev/hello_app_cluster/imagepolicies.yaml). +/bases/environments/stages/dev/hello_app_cluster/imagepolicies.yaml). Let's have Flux automatically roll out all `-dev` releases that are of at least version `0.1.0` or above. @@ -118,7 +118,7 @@ It is similar to the development cluster in the following manners: It also provides overrides to the [hello-web-app app set](/bases/app_sets/hello-web-app) via [hello_world_app_user_config.yaml]( -/bases/environments/deployments/staging/hello_app_cluster/hello_world_app_user_config.yaml). +/bases/environments/stages/staging/hello_app_cluster/hello_world_app_user_config.yaml). We want this environment to be more close to production so let's say we set a larger thread pool size. ```yaml @@ -126,7 +126,7 @@ thread_pool_size: 64 ``` We also want the images automatically rolled out here to be more stable, so we have a slightly different -[imagepolicies.yaml](/bases/environments/deployments/staging/hello_app_cluster/imagepolicies.yaml) here where +[imagepolicies.yaml](/bases/environments/stages/staging/hello_app_cluster/imagepolicies.yaml) here where we tell Flux to automatically install all stable versions that are at least version `0.1.0` but we do not want to automatically introduce possibly breaking changes in major version bump, so let's stay below `1.0.0`. @@ -155,7 +155,7 @@ It is similar to the staging cluster in the following manners: Then it provides some overrides to the [hello-web-app app set](/bases/app_sets/hello-web-app) via [hello_world_app_user_config.yaml]( -/bases/environments/deployments/prod/hello_app_cluster/hello_world_app_user_config.yaml). +/bases/environments/stages/prod/hello_app_cluster/hello_world_app_user_config.yaml). ```yaml thread_pool_size: 256 @@ -164,7 +164,7 @@ thread_pool_size: 256 Notice however that we decided not to set up `Automatic Updates` for this cluster. Instead, we use the `Kustomization` in the cluster's [kustomization.yaml]( -/bases/environments/deployments/prod/hello_app_cluster/kustomization.yaml) to patch the exact versions to use +/bases/environments/stages/prod/hello_app_cluster/kustomization.yaml) to patch the exact versions to use in out App CRs. ```yaml @@ -192,3 +192,45 @@ We tell Flux to use version `0.1.8` of `hello-world-app` and version `0.1.0` of In this example when we sufficiently validated our released changes in the staging environment we update the versions in the `Kustomization`, merge the change and let Flux do the work. + +## Add Workload Clusters based on the environment cluster bases + +Just as any other Workload Clusters we define them in +[/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( +/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters). + +In our example we create one instance from each cluster environment base: + +- from the dev environment we create [HELLO_APP_DEV_CLUSTER_1]( +/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1/kustomization.yaml) +- from the staging environment we create [HELLO_APP_STAGING_CLUSTER_1]( + /management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1/kustomization.yaml) +- from the dev environment we create [HELLO_APP_PROD_CLUSTER_1]( + /management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1/kustomization.yaml) + +All of their `kustomization.yaml` look very similar. Let's take a look at the development environment instance. + +```yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +kind: Kustomization +resources: + - ../../../../../../bases/environments/stages/dev/hello_app_cluster +``` + +It basically just references our environment base. But in more complex examples it could do more. + +Think back on the example of having multiple regions or data centers where you need to set specific +configurations. In such a case you would end upt with something like the below setup. + +You have workload cluster for each of them as `HELLO_APP_DEV_CLUSTER_AP_EAST_1`, `HELLO_APP_DEV_CLUSTER_EU_CENTRAL_1` +and `HELLO_APP_DEV_CLUSTER_US_WEST_2`. Their `kustomization.yaml` would look something like this. + +```yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +kind: Kustomization +resources: + - ../../../../../../bases/environments/stages/dev/hello_app_cluster + - ../../../../../../bases/environments/regions/[[ REGION_NAME ]] +``` From 5f169a55fa2aca8b0c87cd65f73a7666a0ccc538 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 14:44:38 +0200 Subject: [PATCH 12/34] Add table of content to environment cluster bases and some tips developing them --- docs/add_wc_environments.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 78155fe6..e7e3055f 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -1,5 +1,14 @@ # Add Workload Cluster environments +- [Add Workload Cluster environments](#add-workload-cluster-environments) + - [Environments](#environments) + - [Stages](#stages) + - [The development cluster](#the-development-cluster) + - [The staging cluster](#the-staging-cluster) + - [The production cluster](#the-production-cluster) + - [Add Workload Clusters based on the environment cluster bases](#add-workload-clusters-based-on-the-environment-cluster-bases) + - [Tips for developing environments](#tips-for-developing-environments) + You might want to set up multiple, similar Workload Clusters that serve as for example development, staging and production environments. You can utilize [bases](/bases) to achieve that. Let's take a look at the [/bases/environments](/bases/environments) folder structure. @@ -48,7 +57,7 @@ resources: You can put additional configuration under these folders that should be same for each instances of these clusters. Let's take a closer look at our examples. -#### The dev cluster +#### The development cluster In [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) base cluster template defines that the [hello-web-app app set](/bases/app_sets/hello-web-app) should be installed in all of these clusters. @@ -234,3 +243,9 @@ resources: - ../../../../../../bases/environments/stages/dev/hello_app_cluster - ../../../../../../bases/environments/regions/[[ REGION_NAME ]] ``` + +## Tips for developing environments + +For complex clusters, you can end up merging a lot of layers of templates and configurations. +Under `tools` folder in this repository you can find the `fake-flux-build` script that helps +you render and inspect the final result. For more information check [tools/README.md](/tools/README.md). From 5982c30e09d50dcd3047d82b5d80042edaec6ece Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 14:45:01 +0200 Subject: [PATCH 13/34] Add tools used by `test-all-ffb` script to Appendices --- docs/appendices.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/appendices.md b/docs/appendices.md index 250481ba..45bba2ae 100644 --- a/docs/appendices.md +++ b/docs/appendices.md @@ -16,3 +16,10 @@ For core utilities like `base64`, `sed`, `tr`, etc. GNU compatible versions are ### Working with YAML files For `yq` the [github.com/mikefarah/yq](https://github.com/mikefarah/yq/) version is assumed in the code examples. + +### Validating yaml files in the repository + +You need the following tools installed to use [test-all-ffb](/tools/test-all-ffb) script. + +- `yamllint` of [github.com/adrienverge/yamllint](https://github.com/adrienverge/yamllint) +- `kubeval` of [github.com/instrumenta/kubeval](https://github.com/instrumenta/kubeval) From 07fe15a4f372fe6aee4845935d19610e60562500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pi=C4=85tkowski?= Date: Mon, 20 Jun 2022 16:00:54 +0200 Subject: [PATCH 14/34] add note about problems when using multiple bases --- docs/add_wc_environments.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index e7e3055f..d308564b 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -1,13 +1,12 @@ # Add Workload Cluster environments -- [Add Workload Cluster environments](#add-workload-cluster-environments) - - [Environments](#environments) - - [Stages](#stages) - - [The development cluster](#the-development-cluster) - - [The staging cluster](#the-staging-cluster) - - [The production cluster](#the-production-cluster) - - [Add Workload Clusters based on the environment cluster bases](#add-workload-clusters-based-on-the-environment-cluster-bases) - - [Tips for developing environments](#tips-for-developing-environments) +- [Environments](#environments) + - [Stages](#stages) + - [The development cluster](#the-development-cluster) + - [The staging cluster](#the-staging-cluster) + - [The production cluster](#the-production-cluster) +- [Add Workload Clusters based on the environment cluster bases](#add-workload-clusters-based-on-the-environment-cluster-bases) +- [Tips for developing environments](#tips-for-developing-environments) You might want to set up multiple, similar Workload Clusters that serve as for example development, staging and production environments. You can utilize [bases](/bases) to achieve that. Let's take a look at the @@ -30,6 +29,13 @@ In that cases we recommend putting region or data center specific configurations Later you will reference all these layers in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( /management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters) +*Note* +Please note that if you want to use multiple environment templates to create a single cluster that uses `App CR`s for deployments, +like you would like to use `dev` out of `staging` layout to set app configuration and then use `east` from the `data-centers` +to set the IP ranges, you will run into issues +around merging configurations, as currently one configuration source (ie. `ConfigMap` in `spec.config.configMap`) completely +overrides the whole value of the same attribute coming from the other base. We're working to remove this limitation. + ### Stages We have 3 example clusters under [/bases/environments/stages](/bases/environments/stages): From e60cc87d1f287ed8b251a80f505439c67a7616b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pi=C4=85tkowski?= Date: Mon, 20 Jun 2022 16:03:06 +0200 Subject: [PATCH 15/34] set cluster names in YAML to same values as suggested by file names --- .../ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml | 4 ++-- .../ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml | 4 ++-- .../workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml index 87e88793..9e9f6c06 100644 --- a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_DEV_CLUSTER_1.yaml @@ -9,8 +9,8 @@ spec: postBuild: substitute: cluster_domain: "MY_DOMAIN" - cluster_id: "HELLO_DEV_1" - cluster_name: "HELLO_DEV_1" + cluster_id: "HELLO_APP_DEV_1" + cluster_name: "HELLO_APP_DEV_1" cluster_release: "0.8.1" default_apps_release: "0.2.0" organization: "ORG_NAME" diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml index e2a093ba..c4e1ccc4 100644 --- a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_PROD_CLUSTER_1.yaml @@ -9,8 +9,8 @@ spec: postBuild: substitute: cluster_domain: "MY_DOMAIN" - cluster_id: "HELLO_PROD_1" - cluster_name: "HELLO_PROD_1" + cluster_id: "HELLO_APP_PROD_1" + cluster_name: "HELLO_APP_PROD_1" cluster_release: "0.8.1" default_apps_release: "0.2.0" organization: "ORG_NAME" diff --git a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml index 9d19b35c..9f7aeaaf 100644 --- a/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml +++ b/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters/HELLO_APP_STAGING_CLUSTER_1.yaml @@ -9,8 +9,8 @@ spec: postBuild: substitute: cluster_domain: "MY_DOMAIN" - cluster_id: "HELLO_STAGING_1" - cluster_name: "HELLO_STAGING_1" + cluster_id: "HELLO_APP_STAGING_1" + cluster_name: "HELLO_APP_STAGING_1" cluster_release: "0.8.1" default_apps_release: "0.2.0" organization: "ORG_NAME" From e3c1047b5cca8befd759f3dde77e0040e91e46d6 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 16:13:47 +0200 Subject: [PATCH 16/34] Format note on merging yamls and fix pre-commit hook warnings --- docs/add_wc_environments.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index d308564b..34a8457e 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -29,11 +29,10 @@ In that cases we recommend putting region or data center specific configurations Later you will reference all these layers in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( /management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters) -*Note* -Please note that if you want to use multiple environment templates to create a single cluster that uses `App CR`s for deployments, -like you would like to use `dev` out of `staging` layout to set app configuration and then use `east` from the `data-centers` -to set the IP ranges, you will run into issues -around merging configurations, as currently one configuration source (ie. `ConfigMap` in `spec.config.configMap`) completely +> :warning: :construction: Please note that if you want to use multiple environment templates to create a single cluster +that uses `App CR`s for deployments, like you would like to use `dev` out of `staging` layout to set app configuration +and then use `east` from the `data-centers` to set the IP ranges, you will run into issues around merging +configurations, as currently one configuration source (ie. `ConfigMap` in `spec.config.configMap`) completely overrides the whole value of the same attribute coming from the other base. We're working to remove this limitation. ### Stages From 71abd1c1d95450dca1541b1d5a4a2da14da36f1b Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 16:32:01 +0200 Subject: [PATCH 17/34] Update docs/add_wc_environments.md Co-authored-by: Lukasz Piatkowski --- docs/add_wc_environments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 34a8457e..2549ca88 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -15,7 +15,7 @@ staging and production environments. You can utilize [bases](/bases) to achieve ## Environments The `stages` folder is a convenient wrapper to group our environment specifications. -There is a good reason for this additional layer of grouping. Think of the use case of having multiple +There is a good reason for this additional layer of grouping. You can use this approach to have multiple different clusters - like the dev, staging, production example - but also having multiple different regions or data centers where you want to spin these clusters up. From c5d7f8894a48d58c39bd28853aa19cb879e1b414 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 16:32:18 +0200 Subject: [PATCH 18/34] Update docs/add_wc_environments.md Co-authored-by: Lukasz Piatkowski --- docs/add_wc_environments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 2549ca88..7b1a1de2 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -19,7 +19,7 @@ There is a good reason for this additional layer of grouping. You can use this a different clusters - like the dev, staging, production example - but also having multiple different regions or data centers where you want to spin these clusters up. -Think that these cluster should in many regards look the same wherever they are. But also whatever cluster +We're assuming that all the clusters using this environaments pattern should in many regards look the same wherever they are. But also whatever cluster is hosted in a given region or data center should use a specific IP range, certificates or ingresses. In that cases we recommend putting region or data center specific configurations into for example From f5d58eb7873912ad1dac3aa4a4e04ea586831199 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 16:32:32 +0200 Subject: [PATCH 19/34] Update docs/add_wc_environments.md Co-authored-by: Lukasz Piatkowski --- docs/add_wc_environments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 7b1a1de2..5a02fcc8 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -26,7 +26,7 @@ In that cases we recommend putting region or data center specific configurations `/bases/environments/regions` folder and under there create a let's say `ap-east-1`, `eu-central-1`, `us-west-2` folders. -Later you will reference all these layers in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( +Later you will reference your environment templates in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( /management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters) > :warning: :construction: Please note that if you want to use multiple environment templates to create a single cluster From 897e87c31a8b9159fe9551acf775b8d678ae08d8 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 16:32:53 +0200 Subject: [PATCH 20/34] Update docs/add_wc_environments.md Co-authored-by: Lukasz Piatkowski --- docs/add_wc_environments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 5a02fcc8..ec898167 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -128,7 +128,7 @@ And pretty much that is it for the development cluster. Let's look at the stagin It is similar to the development cluster in the following manners: - it is based on the [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) template base -- it has automatic updated set up +- it has automatic updates set up It also provides overrides to the [hello-web-app app set](/bases/app_sets/hello-web-app) via [hello_world_app_user_config.yaml]( From d66aa9a5a40bb4e9fef51bc0d66217b996528897 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 16:33:09 +0200 Subject: [PATCH 21/34] Update docs/add_wc_environments.md Co-authored-by: Lukasz Piatkowski --- docs/add_wc_environments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index ec898167..671361ca 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -133,7 +133,7 @@ It is similar to the development cluster in the following manners: It also provides overrides to the [hello-web-app app set](/bases/app_sets/hello-web-app) via [hello_world_app_user_config.yaml]( /bases/environments/stages/staging/hello_app_cluster/hello_world_app_user_config.yaml). -We want this environment to be more close to production so let's say we set a larger thread pool size. +We want this environment to be closer to production so let's say we set a larger thread pool size. ```yaml thread_pool_size: 64 From 8139c207bb1c58c85352d4005117b9f5a1935189 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 16:36:11 +0200 Subject: [PATCH 22/34] Correct title based on code review and fix pre-commit warnings --- docs/add_wc_environments.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 671361ca..f482ec4c 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -5,7 +5,7 @@ - [The development cluster](#the-development-cluster) - [The staging cluster](#the-staging-cluster) - [The production cluster](#the-production-cluster) -- [Add Workload Clusters based on the environment cluster bases](#add-workload-clusters-based-on-the-environment-cluster-bases) +- [Add Workload Clusters based on the environment cluster templates](#add-workload-clusters-based-on-the-environment-cluster-templates) - [Tips for developing environments](#tips-for-developing-environments) You might want to set up multiple, similar Workload Clusters that serve as for example development, @@ -19,8 +19,9 @@ There is a good reason for this additional layer of grouping. You can use this a different clusters - like the dev, staging, production example - but also having multiple different regions or data centers where you want to spin these clusters up. -We're assuming that all the clusters using this environaments pattern should in many regards look the same wherever they are. But also whatever cluster -is hosted in a given region or data center should use a specific IP range, certificates or ingresses. +We're assuming that all the clusters using this environments pattern should in many regards look the same +wherever they are. But also whatever cluster is hosted in a given region or data center should use a specific IP range, +certificates or ingresses. In that cases we recommend putting region or data center specific configurations into for example `/bases/environments/regions` folder and under there create a let's say `ap-east-1`, `eu-central-1`, @@ -207,7 +208,7 @@ We tell Flux to use version `0.1.8` of `hello-world-app` and version `0.1.0` of In this example when we sufficiently validated our released changes in the staging environment we update the versions in the `Kustomization`, merge the change and let Flux do the work. -## Add Workload Clusters based on the environment cluster bases +## Add Workload Clusters based on the environment cluster templates Just as any other Workload Clusters we define them in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( From 6499cef5a1a44d4e434da2192e92e0a1a160bb00 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 17:40:03 +0200 Subject: [PATCH 23/34] Replace kubeval with kubeconform The kubeval tool does not seem to be maintained anymore. --- .github/workflows/diff-preview.yaml | 12 ++++++------ .github/workflows/validate.yaml | 10 +++++----- docs/appendices.md | 2 +- tools/test-all-ffb | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/diff-preview.yaml b/.github/workflows/diff-preview.yaml index 12f323bb..5d21f01c 100644 --- a/.github/workflows/diff-preview.yaml +++ b/.github/workflows/diff-preview.yaml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest env: dyff_ver: 1.5.4 - kubeval_ver: 0.16.1 + kubeconform_ver: 0.4.13 steps: - run: sudo apt-get install -y yamllint - name: install dyff @@ -24,12 +24,12 @@ jobs: - run: which dyff - uses: giantswarm/install-binary-action@v1 with: - binary: kubeval - download_url: "https://github.com/instrumenta/kubeval/releases/download/v${version}/kubeval-linux-amd64.tar.gz" - smoke_test: "${binary} --version" + binary: kubeconform + download_url: "https://github.com/yannh/kubeconform/releases/download/v${version}/kubeconform-linux-amd64.tar.gz" + smoke_test: "${binary} -v" tarball_binary_path: "${binary}" - version: ${{ env.kubeval_ver }} - - run: which kubeval + version: ${{ env.kubeconform_ver }} + - run: which kubeconform - run: ls -la /opt/hostedtoolcache - uses: actions/checkout@v3 - name: template all for the new branch diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 0d9f9559..76807fd8 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -22,16 +22,16 @@ jobs: needs: pre-commit runs-on: ubuntu-latest env: - kubeval_ver: 0.16.1 + kubeconform_ver: 0.4.13 steps: - run: sudo apt-get install -y yamllint - uses: giantswarm/install-binary-action@v1 with: - binary: kubeval - download_url: "https://github.com/instrumenta/kubeval/releases/download/v${version}/kubeval-linux-amd64.tar.gz" - smoke_test: "${binary} --version" + binary: kubeconform + download_url: "https://github.com/yannh/kubeconform/releases/download/v${version}/kubeconform-linux-amd64.tar.gz" + smoke_test: "${binary} -v" tarball_binary_path: "${binary}" - version: ${{ env.kubeval_ver }} + version: ${{ env.kubeconform_ver }} - name: cache validation tools uses: actions/cache@v3 with: diff --git a/docs/appendices.md b/docs/appendices.md index 45bba2ae..c2b45b4e 100644 --- a/docs/appendices.md +++ b/docs/appendices.md @@ -22,4 +22,4 @@ For `yq` the [github.com/mikefarah/yq](https://github.com/mikefarah/yq/) version You need the following tools installed to use [test-all-ffb](/tools/test-all-ffb) script. - `yamllint` of [github.com/adrienverge/yamllint](https://github.com/adrienverge/yamllint) -- `kubeval` of [github.com/instrumenta/kubeval](https://github.com/instrumenta/kubeval) +- `kubeconform` of [github.com/yannh/kubeconform](https://github.com/yannh/kubeconform) diff --git a/tools/test-all-ffb b/tools/test-all-ffb index 81490c65..0d65bb58 100755 --- a/tools/test-all-ffb +++ b/tools/test-all-ffb @@ -39,8 +39,8 @@ test() { echo "Testing: $mc_name $org_name $wc_name $dir_name" echo -n "yamllint: " ./tools/fake-flux-build build "$mc_name" "$org_name" "$wc_name" "$dir_name" | yamllint - && echo "OK" - echo "kubeval: " - ./tools/fake-flux-build build "$mc_name" "$org_name" "$wc_name" "$dir_name" | kubeval --ignore-missing-schemas + echo "kubeconform: " + ./tools/fake-flux-build build "$mc_name" "$org_name" "$wc_name" "$dir_name" | kubeconform -ignore-missing-schemas -output text | sed s/stdin\ -\ //g echo "" else echo "---" From bc8260b5edd03814f4ea0065c9771b8247bdb276 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 17:50:12 +0200 Subject: [PATCH 24/34] Make kubeconform check output similar to yamllint check output --- tools/test-all-ffb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-all-ffb b/tools/test-all-ffb index 0d65bb58..6a3fdc14 100755 --- a/tools/test-all-ffb +++ b/tools/test-all-ffb @@ -40,7 +40,7 @@ test() { echo -n "yamllint: " ./tools/fake-flux-build build "$mc_name" "$org_name" "$wc_name" "$dir_name" | yamllint - && echo "OK" echo "kubeconform: " - ./tools/fake-flux-build build "$mc_name" "$org_name" "$wc_name" "$dir_name" | kubeconform -ignore-missing-schemas -output text | sed s/stdin\ -\ //g + ./tools/fake-flux-build build "$mc_name" "$org_name" "$wc_name" "$dir_name" | kubeconform -ignore-missing-schemas -output text && echo "OK" echo "" else echo "---" From a797827a6e50c0014d859f086a9fa6488dc47f7d Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Mon, 20 Jun 2022 17:53:58 +0200 Subject: [PATCH 25/34] Format warning about multiple layer merges for environments --- docs/add_wc_environments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index f482ec4c..8ba0b4ac 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -30,7 +30,7 @@ In that cases we recommend putting region or data center specific configurations Later you will reference your environment templates in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( /management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters) -> :warning: :construction: Please note that if you want to use multiple environment templates to create a single cluster +> :construction: Please note that if you want to use multiple environment templates to create a single cluster that uses `App CR`s for deployments, like you would like to use `dev` out of `staging` layout to set app configuration and then use `east` from the `data-centers` to set the IP ranges, you will run into issues around merging configurations, as currently one configuration source (ie. `ConfigMap` in `spec.config.configMap`) completely From 5c0a9fd263f73f20b18fa25db6584a42814d3d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pi=C4=85tkowski?= Date: Tue, 21 Jun 2022 12:13:43 +0200 Subject: [PATCH 26/34] improve environments docs --- docs/add_wc_environments.md | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 8ba0b4ac..2f60eff1 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -1,5 +1,6 @@ # Add Workload Cluster environments +- [General note](#general-note) - [Environments](#environments) - [Stages](#stages) - [The development cluster](#the-development-cluster) @@ -12,22 +13,40 @@ You might want to set up multiple, similar Workload Clusters that serve as for e staging and production environments. You can utilize [bases](/bases) to achieve that. Let's take a look at the [/bases/environments](/bases/environments) folder structure. +## General note + +It is possible to solve the environment and environment propagation problem in multiple ways, notably by: + +- using a multi-directory structure, where each environment is represented as a directory in a `main` branch of a single + repository +- using a multi-branch approach, where each branch corresponds to one environment, but they are in the same repo +- using a multi-repo setup, where there's one root repository providing all the necessary templates, then there is one another + repository per each environment. + +Each of these approaches has pros and cons. Over here, we're proposing the multi-directory approach. The pros of it are: +a single repo and branch serving as the source of truth for all the environments, very easy template sharing and +relatively easy way to compare and promote configuration across environments. On the other hand, it might not be the +best solution for access control, templates versioning and also easy comparing of environments. + ## Environments -The `stages` folder is a convenient wrapper to group our environment specifications. +The `stages` folder is how we propose to group environment specifications. There is a good reason for this additional layer of grouping. You can use this approach to have multiple -different clusters - like the dev, staging, production example - but also having multiple different +different clusters - like the dev, staging, production - but also to have multiple different regions or data centers where you want to spin these clusters up. We're assuming that all the clusters using this environments pattern should in many regards look the same -wherever they are. But also whatever cluster is hosted in a given region or data center should use a specific IP range, -certificates or ingresses. +across all the environments. Still, each environment layer introduces some key differences, like app version being deployed +for `dev/staging/prod` environments or a specific IP range, certificate or ingresses config for data center related environments +like `us-east-1/us-west-2`. -In that cases we recommend putting region or data center specific configurations into for example -`/bases/environments/regions` folder and under there create a let's say `ap-east-1`, `eu-central-1`, -`us-west-2` folders. +To create an environment template, you need to make a directory in `environments` that describes the best the +differentating factor for that kind of environment, then you should create subfolder there for different possible values. +For example, for multiple data centers, we recommend putting region specific configuration into +`/bases/environments/regions` folder and under there create `ap-east-1`, `eu-central-1` and `us-west-2` folders. -Later you will reference your environment templates in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( +Once your environment templates are ready, you can use them to create new clusters by placing cluster definitions in +in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( /management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters) > :construction: Please note that if you want to use multiple environment templates to create a single cluster From f91e4118697a852d5322a13e634f2a21de1f59da Mon Sep 17 00:00:00 2001 From: Lukasz Piatkowski Date: Wed, 22 Jun 2022 17:16:45 +0200 Subject: [PATCH 27/34] Update docs/add_wc_environments.md Co-authored-by: Bricktop --- docs/add_wc_environments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 2f60eff1..77e7b0d8 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -21,7 +21,7 @@ It is possible to solve the environment and environment propagation problem in m repository - using a multi-branch approach, where each branch corresponds to one environment, but they are in the same repo - using a multi-repo setup, where there's one root repository providing all the necessary templates, then there is one another - repository per each environment. + repository per environment. Each of these approaches has pros and cons. Over here, we're proposing the multi-directory approach. The pros of it are: a single repo and branch serving as the source of truth for all the environments, very easy template sharing and From 267a70e15190b01b96423e832867c08aed3b3fca Mon Sep 17 00:00:00 2001 From: Lukasz Piatkowski Date: Wed, 22 Jun 2022 17:16:54 +0200 Subject: [PATCH 28/34] Update docs/add_wc_environments.md Co-authored-by: Bricktop --- docs/add_wc_environments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 77e7b0d8..936b3b2e 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -23,7 +23,7 @@ It is possible to solve the environment and environment propagation problem in m - using a multi-repo setup, where there's one root repository providing all the necessary templates, then there is one another repository per environment. -Each of these approaches has pros and cons. Over here, we're proposing the multi-directory approach. The pros of it are: +Each of these approaches has pros and cons. We propose the multi-directory approach. The pros of it are: a single repo and branch serving as the source of truth for all the environments, very easy template sharing and relatively easy way to compare and promote configuration across environments. On the other hand, it might not be the best solution for access control, templates versioning and also easy comparing of environments. From 1348830b1eed9b9f520640174bd77e39aed4774b Mon Sep 17 00:00:00 2001 From: Lukasz Piatkowski Date: Wed, 22 Jun 2022 17:17:02 +0200 Subject: [PATCH 29/34] Update docs/add_wc_environments.md Co-authored-by: Bricktop --- docs/add_wc_environments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 936b3b2e..fec05c26 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -26,7 +26,7 @@ It is possible to solve the environment and environment propagation problem in m Each of these approaches has pros and cons. We propose the multi-directory approach. The pros of it are: a single repo and branch serving as the source of truth for all the environments, very easy template sharing and relatively easy way to compare and promote configuration across environments. On the other hand, it might not be the -best solution for access control, templates versioning and also easy comparing of environments. +best solution for access control, template versioning and also easy comparing of environments. ## Environments From 305feb05d5d3a50854553097337cb30943c3472e Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Tue, 28 Jun 2022 13:26:37 +0200 Subject: [PATCH 30/34] Fix some typos --- docs/add_wc_environments.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index fec05c26..48d71179 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -41,7 +41,7 @@ for `dev/staging/prod` environments or a specific IP range, certificate or ingre like `us-east-1/us-west-2`. To create an environment template, you need to make a directory in `environments` that describes the best the -differentating factor for that kind of environment, then you should create subfolder there for different possible values. +differentiating factor for that kind of environment, then you should create sub folder there for different possible values. For example, for multiple data centers, we recommend putting region specific configuration into `/bases/environments/regions` folder and under there create `ap-east-1`, `eu-central-1` and `us-west-2` folders. @@ -52,7 +52,7 @@ in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( > :construction: Please note that if you want to use multiple environment templates to create a single cluster that uses `App CR`s for deployments, like you would like to use `dev` out of `staging` layout to set app configuration and then use `east` from the `data-centers` to set the IP ranges, you will run into issues around merging -configurations, as currently one configuration source (ie. `ConfigMap` in `spec.config.configMap`) completely +configurations, as currently one configuration source (i.e. `ConfigMap` in `spec.config.configMap`) completely overrides the whole value of the same attribute coming from the other base. We're working to remove this limitation. ### Stages From 3dd6596f409ca5b8d7adee9f9f530a0bd0516f22 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Tue, 28 Jun 2022 14:28:41 +0200 Subject: [PATCH 31/34] Add example commands to recreate the cluster environment templates --- docs/add_wc_environments.md | 282 +++++++++++++++++++++++++++++++++--- 1 file changed, 264 insertions(+), 18 deletions(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index 48d71179..f866d962 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -35,6 +35,10 @@ There is a good reason for this additional layer of grouping. You can use this a different clusters - like the dev, staging, production - but also to have multiple different regions or data centers where you want to spin these clusters up. +```sh +mkdir -p bases/environments/stages +``` + We're assuming that all the clusters using this environments pattern should in many regards look the same across all the environments. Still, each environment layer introduces some key differences, like app version being deployed for `dev/staging/prod` environments or a specific IP range, certificate or ingresses config for data center related environments @@ -45,7 +49,7 @@ differentiating factor for that kind of environment, then you should create sub For example, for multiple data centers, we recommend putting region specific configuration into `/bases/environments/regions` folder and under there create `ap-east-1`, `eu-central-1` and `us-west-2` folders. -Once your environment templates are ready, you can use them to create new clusters by placing cluster definitions in +Once your environment templates are ready, you can use them to create new clusters by placing cluster definitions in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( /management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters) @@ -63,9 +67,21 @@ We have 3 example clusters under [/bases/environments/stages](/bases/environment - [staging](/bases/environments/stages/staging) - [prod](/bases/environments/stages/prod) +```sh +mkdir -p bases/environments/stages/dev +mkdir -p bases/environments/stages/staging +mkdir -p bases/environments/stages/prod +``` + Each of these contain a `hello_app_cluster` example. This name might already be familiar to you from [Preparing a cluster definition template](./add_wc_template.md) section. +```sh +mkdir -p bases/environments/stages/dev/hello_app_cluster +mkdir -p bases/environments/stages/staging/hello_app_cluster +mkdir -p bases/environments/stages/prod/hello_app_cluster +``` + By checking each `kustomization.yaml` files - the [dev]( /bases/environments/stages/dev/hello_app_cluster/kustomization.yaml) one for example - you will notice that they all reference our [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) template base. @@ -84,14 +100,52 @@ Let's take a closer look at our examples. #### The development cluster +Set up our environment first. + +```sh +export WC_NAME=CLUSTER_NAME +export ORG_NAME=ORGANIZATION +export GIT_REPOSITORY_NAME=REPOSITORY_NAME +``` + +Change our working directory to the `hello_app_cluster` development cluster environment base. + +```sh +cd bases/environments/stages/dev/hello_app_cluster +``` + +Let's crete the `kustomization.yaml` file for the development cluster. + +```sh +cat < kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +configMapGenerator: + - behavior: create + files: + - values=hello_world_app_user_config.yaml + name: ${WC_NAME}-hello-world-user-config +generatorOptions: + disableNameSuffixHash: true +kind: Kustomization +resources: + - automatic_updates/ + - imagepolicies.yaml + - imagerepositories.yaml + - ../../../../cluster_templates/hello_app_cluster +EOF +``` + In [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) base cluster template defines that the [hello-web-app app set](/bases/app_sets/hello-web-app) should be installed in all of these clusters. We can provide overrides to the settings via the [hello_world_app_user_config.yaml]( /bases/environments/stages/dev/hello_app_cluster/hello_world_app_user_config.yaml) file, for example setting a lower thread pool size. -```yaml +```sh +cat < hello_world_app_user_config.yaml thread_pool_size: 16 +EOF ``` It also makes sense to configure `Automatic Updates` for our development cluster. We store these configurations under @@ -99,6 +153,72 @@ the [/bases/environments/stages/dev/hello_app_cluster/automatic_updates]( /bases/environments/stages/dev/hello_app_cluster/automatic_updates) folder. You can read more about how `Automatic Updates` work [here](/docs/apps/automatic_updates_appcr.md) +```sh +mkdir automatic_updates + +# Let's create the Kustomization for automatic updates +cat < automatic_updates/kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +commonLabels: + giantswarm.io/managed-by: flux +kind: Kustomization +resources: +- catalog.yaml +- imageupdate.yaml +EOF + +# Let's create the catalog +cat < automatic_updates/catalog.yaml +apiVersion: application.giantswarm.io/v1alpha1 +kind: Catalog +metadata: + labels: + application.giantswarm.io/catalog-visibility: internal + name: giantswarm-catalog-oci + namespace: org-${ORG_NAME} +spec: + description: giantswarm-catalog-oci + logoURL: "https://avatars.githubusercontent.com/u/7556340?s=60&v=4" + storage: + URL: oci://giantswarmpublic.azurecr.io/giantswarm-catalog/ + type: helm + title: giantswarm-catalog-oci +EOF + +# Let' create the image update automation for Flux +cat < automatic_updates/imageupdate.yaml +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImageUpdateAutomation +metadata: + name: ${cluster_id}-image-updates + namespace: org-${ORG_NAME} +spec: + git: + checkout: + ref: + branch: main + commit: + author: + email: fluxcdbot@users.noreply.github.com + name: fluxcdbot + messageTemplate: | + automated app upgrades: + {{ range $image, $_ := .Updated.Images -}} + - {{ $image.Repository }} to {{ $image.Identifier }} + {{ end -}} + push: + branch: main + interval: 1m0s + sourceRef: + kind: GitRepository + name: ${GIT_REPOSITORY_NAME} + update: + path: ./management-clusters/MC_NAME + strategy: Setters +EOF +``` + Now that we have automation set up around `Automatic Updates` we can set up our rules for the development cluster on how it should update `Apps`. We need 2 things to achieve that, and we recommend setting up one multi-document YAML files to store all these in a single place. @@ -110,14 +230,25 @@ where to look for updates stored in: [imagerepositories.yaml]( Let's tell Flux to look for available images for the `hello-world-app` in the `giantswarmpublic.azurecr.io/giantswarm-catalog` registry every 10 minutes. -```yaml +```sh +cat < imagerepositories.yaml +--- apiVersion: image.toolkit.fluxcd.io/v1beta1 kind: ImageRepository metadata: - name: ${cluster_id}-hello-app + name: ${WC_NAME}-hello-app spec: image: giantswarmpublic.azurecr.io/giantswarm-catalog/hello-world-app interval: 10m0s +--- +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImageRepository +metadata: + name: ${WC_NAME}-simple-db-app +spec: + image: giantswarmpublic.azurecr.io/giantswarm-catalog/simple-db-app + interval: 10m0s +EOF ``` The second half are the [ImagePolicy](https://fluxcd.io/docs/components/image/imagepolicies/) definitions to tell Flux @@ -126,25 +257,70 @@ which versions it should automatically apply stored in: [imagepolicies.yaml]( Let's have Flux automatically roll out all `-dev` releases that are of at least version `0.1.0` or above. -```yaml +```sh +cat < imagepolicies.yaml +--- apiVersion: image.toolkit.fluxcd.io/v1beta1 kind: ImagePolicy metadata: - name: ${cluster_id}-hello-app + name: ${WC_NAME}-hello-app spec: filterTags: pattern: '.*-dev.*' imageRepositoryRef: - name: ${cluster_id}-hello-app + name: ${WC_NAME}-hello-app policy: semver: range: '>=0.1.0' +--- +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImagePolicy +metadata: + name: ${WC_NAME}-simple-db-app +spec: + imageRepositoryRef: + name: ${WC_NAME}-simple-db + policy: + semver: + range: '>=0.1.0 <0.2.0' +EOF +``` + +We can also use `Kustomization` patches to set exact versions to use in the cluster's `kustomization.yaml` file. + +```sh +cat <> kustomization.yaml +patches: + - patch: |- + - op: replace + path: /spec/version + value: '0.1.8 + target: + kind: App + name: ${WC_NAME}-hello-world + - patch: |- + - op: replace + path: /spec/version + value: '0.1.0' + target: + kind: App + name: ${WC_NAME}-simple-db +EOF ``` And pretty much that is it for the development cluster. Let's look at the staging cluster next to the minor differences. #### The staging cluster +Let's change our working directory to the staging cluster. + +```sh +cd ../../staging/hello_app_cluster +``` + +We will use the same environment variables and `kustomization.yaml` for this cluster template as we did for the +development cluster. + It is similar to the development cluster in the following manners: - it is based on the [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) template base @@ -155,26 +331,45 @@ It also provides overrides to the [hello-web-app app set](/bases/app_sets/hello- /bases/environments/stages/staging/hello_app_cluster/hello_world_app_user_config.yaml). We want this environment to be closer to production so let's say we set a larger thread pool size. -```yaml +```sh +cat < hello_world_app_user_config.yaml thread_pool_size: 64 +EOF ``` +Setting up the `automatic_updates` folder and the `imagerepositories.yaml` files requires exactly the same steps +as we did above for the development cluster. + We also want the images automatically rolled out here to be more stable, so we have a slightly different [imagepolicies.yaml](/bases/environments/stages/staging/hello_app_cluster/imagepolicies.yaml) here where we tell Flux to automatically install all stable versions that are at least version `0.1.0` but we do not want to automatically introduce possibly breaking changes in major version bump, so let's stay below `1.0.0`. -```yaml +```sh +cat < imagepolicies.yaml +--- apiVersion: image.toolkit.fluxcd.io/v1beta1 kind: ImagePolicy metadata: - name: ${cluster_id}-hello-app + name: ${WC_NAME}-hello-app spec: imageRepositoryRef: - name: ${cluster_id}-hello-app + name: ${WC_NAME}-hello-app policy: semver: range: '>=0.1.0 <1.0.0' +--- +apiVersion: image.toolkit.fluxcd.io/v1beta1 +kind: ImagePolicy +metadata: + name: ${WC_NAME}-simple-db-app +spec: + imageRepositoryRef: + name: ${WC_NAME}-simple-db + policy: + semver: + range: '>=0.1.0 <0.2.0' +EOF ``` So basically our staging cluster in our example is a smaller scale cluster carrying stable versions of our applications. @@ -183,16 +378,68 @@ Now, let's take a look at the production cluster example. #### The production cluster +Let's change our working directory to the staging cluster. + +```sh +cd ../../prod/hello_app_cluster +``` + +We will use the same environment variables for this cluster template as we did for the development cluster. + +Let's create the `Kustomization` for the production cluster environment template. + +```sh +cat < kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +buildMetadata: [originAnnotations] +configMapGenerator: + - behavior: create + files: + - values=hello_world_app_user_config.yaml + name: ${WC_NAME}-hello-world-user-config + - behavior: replace + files: + - values=cluster_user_config.yaml + name: ${WC_NAME}-user-config + namespace: org-${ORG_NAME} +generatorOptions: + disableNameSuffixHash: true +kind: Kustomization +resources: + - ../../../../cluster_templates/hello_app_cluster +EOF +``` + It is similar to the staging cluster in the following manners: - it is based on the [hello_app_cluster](/bases/cluster_templates/hello_app_cluster) template base -Then it provides some overrides to the [hello-web-app app set](/bases/app_sets/hello-web-app) via +Note in the `kustomization.yaml` above that we create another `ConfigMap` for the production cluster +that contains some extra settings for our cluster. + +```sh +cat < cluster_user_config.yaml +values: | + cloudConfig: cloud-config-giantswarm-2 + cloudName: openstack + externalNetworkID: prod-bbbb-cccc-dddd-eeeeeeeeeeee + nodeClasses: + - bootFromVolume: true + diskSize: 150 + flavor: n1.large + image: dddddddd-dddd-dddd-dddd-dddddddddddd + name: default +EOF +``` + +Then we provide some overrides to the [hello-web-app app set](/bases/app_sets/hello-web-app) via [hello_world_app_user_config.yaml]( /bases/environments/stages/prod/hello_app_cluster/hello_world_app_user_config.yaml). ```yaml +cat < hello_world_app_user_config.yaml thread_pool_size: 256 +EOF ``` Notice however that we decided not to set up `Automatic Updates` for this cluster. @@ -201,10 +448,8 @@ Instead, we use the `Kustomization` in the cluster's [kustomization.yaml]( /bases/environments/stages/prod/hello_app_cluster/kustomization.yaml) to patch the exact versions to use in out App CRs. -```yaml -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -# ... +```sh +cat <> kustomization.yaml patches: - patch: |- - op: replace @@ -212,14 +457,15 @@ patches: value: 0.1.8 target: kind: App - name: \${cluster_id}-hello-world + name: ${WC_NAME}-hello-world - patch: |- - op: replace path: /spec/version value: 0.1.0 target: kind: App - name: \${cluster_id}-simple-db + name: ${WC_NAME}-simple-db +EOF ``` We tell Flux to use version `0.1.8` of `hello-world-app` and version `0.1.0` of `simple-db-app`. From 6f773fcac304f38e9d9f5a38f8908b12045cdb93 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Tue, 28 Jun 2022 14:58:01 +0200 Subject: [PATCH 32/34] Add example commands to create and instance of an envrionment cluster template --- docs/add_wc_environments.md | 43 ++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/docs/add_wc_environments.md b/docs/add_wc_environments.md index f866d962..d8100e82 100644 --- a/docs/add_wc_environments.md +++ b/docs/add_wc_environments.md @@ -103,6 +103,7 @@ Let's take a closer look at our examples. Set up our environment first. ```sh +export MC_NAME=CODENAME export WC_NAME=CLUSTER_NAME export ORG_NAME=ORGANIZATION export GIT_REPOSITORY_NAME=REPOSITORY_NAME @@ -479,6 +480,42 @@ Just as any other Workload Clusters we define them in [/management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters]( /management-clusters/MC_NAME/organizations/ORG_NAME/workload-clusters). +Relative to the root of the repository, let's change our working directory to our `workload-clusters` folder. + +```sh +cd management-clusters/${MC_NAME}/organizations/${ORG_NAME}/workload-clusters +``` + +Then let's tell Flux to manage our cluster instance. + +```sh +cat < HELLO_APP_DEV_CLUSTER_1.yaml +apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +kind: Kustomization +metadata: + name: clusters-${WC_NAME} + namespace: default +spec: + interval: 1m + path: "./management-clusters/${MC_NAME}/organizations/${ORG_NAME}/workload-clusters/HELLO_APP_DEV_CLUSTER_1" + postBuild: + substitute: + cluster_domain: "MY_DOMAIN" + cluster_id: "HELLO_APP_DEV_1" + cluster_name: "HELLO_APP_DEV_1" + cluster_release: "0.8.1" + default_apps_release: "0.2.0" + organization: "${ORG_NAME}" + prune: false + serviceAccountName: automation + sourceRef: + kind: GitRepository + name: ${GIT_REPOSITORY_NAME} + timeout: 2m + +EOF +``` + In our example we create one instance from each cluster environment base: - from the dev environment we create [HELLO_APP_DEV_CLUSTER_1]( @@ -490,12 +527,16 @@ In our example we create one instance from each cluster environment base: All of their `kustomization.yaml` look very similar. Let's take a look at the development environment instance. -```yaml +```sh +mkdir HELLO_APP_DEV_CLUSTER_1 + +cat < HELLO_APP_DEV_CLUSTER_1/kustomization.yaml apiVersion: kustomize.config.k8s.io/v1beta1 buildMetadata: [originAnnotations] kind: Kustomization resources: - ../../../../../../bases/environments/stages/dev/hello_app_cluster +EOF ``` It basically just references our environment base. But in more complex examples it could do more. From 0fb37450692680a95b324138722e51f0148ce585 Mon Sep 17 00:00:00 2001 From: Laszlo Uveges Date: Tue, 28 Jun 2022 15:02:54 +0200 Subject: [PATCH 33/34] Fix kubeconform validation errors --- .../dev/hello_app_cluster/automatic_updates/catalog.yaml | 3 +++ .../staging/hello_app_cluster/automatic_updates/catalog.yaml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bases/environments/stages/dev/hello_app_cluster/automatic_updates/catalog.yaml b/bases/environments/stages/dev/hello_app_cluster/automatic_updates/catalog.yaml index 37008da1..1172539a 100644 --- a/bases/environments/stages/dev/hello_app_cluster/automatic_updates/catalog.yaml +++ b/bases/environments/stages/dev/hello_app_cluster/automatic_updates/catalog.yaml @@ -8,6 +8,9 @@ metadata: spec: description: giantswarm-catalog-oci logoURL: "https://avatars.githubusercontent.com/u/7556340?s=60&v=4" + repositories: + - URL: oci://giantswarmpublic.azurecr.io/giantswarm-catalog/ + type: helm storage: URL: oci://giantswarmpublic.azurecr.io/giantswarm-catalog/ type: helm diff --git a/bases/environments/stages/staging/hello_app_cluster/automatic_updates/catalog.yaml b/bases/environments/stages/staging/hello_app_cluster/automatic_updates/catalog.yaml index 37008da1..1172539a 100644 --- a/bases/environments/stages/staging/hello_app_cluster/automatic_updates/catalog.yaml +++ b/bases/environments/stages/staging/hello_app_cluster/automatic_updates/catalog.yaml @@ -8,6 +8,9 @@ metadata: spec: description: giantswarm-catalog-oci logoURL: "https://avatars.githubusercontent.com/u/7556340?s=60&v=4" + repositories: + - URL: oci://giantswarmpublic.azurecr.io/giantswarm-catalog/ + type: helm storage: URL: oci://giantswarmpublic.azurecr.io/giantswarm-catalog/ type: helm From 31fffe9af5c229885720d746ae05662d5738d928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pi=C4=85tkowski?= Date: Wed, 29 Jun 2022 11:12:26 +0200 Subject: [PATCH 34/34] added changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..7efa9a8c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog + +Based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +following [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +- Added + - Description and examples for environment management + - Initail release with basic fnunctionality and docs in place