Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: environments #41

Merged
merged 41 commits into from
Jun 29, 2022
Merged

Feature: environments #41

merged 41 commits into from
Jun 29, 2022

Conversation

piontec
Copy link
Contributor

@piontec piontec commented Jun 6, 2022

This PR introduces the concept of environments with a mono-repo directory-separated layout. I think we need to propose branch separated envs as well.

A few notes about this PR:

  • In top level cluster files both cluster_id and cluster_name are needed, as some definitions include a base using one var, some the other. We have to unify that.
  • It is assumed that there are not many clusters, so there's no need to further group them in workload-clusters dir. Should we change that already and make prod/dev/stage subdirs there?

@piontec piontec requested a review from a team June 6, 2022 13:34
@piontec piontec self-assigned this Jun 6, 2022
@@ -0,0 +1,28 @@
apiVersion: image.toolkit.fluxcd.io/v1beta1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why deployments in the directory path? I don't understand what that subfolder is for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, we want more critera than just 'deployment stage', like for example region. That's what I'm preparing here: imagine that there's 1 more folder region there, with east and west subfolders, carrying some infra specific configs. That way you can create a dev cluster in DC east by inheriting from both these labels (but here we have that config merging shit...).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deployments just feels like the wrong name to me then stage could be more descriptive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had exactly the same idea, but figured stage/stageing sounds stupid :P Still, I'm open for suggestions. I was also thinking about release.WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think stage/staging is fine. Just my current believe that users immediately know what stage means and nearly none will intuitively understand deployment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to stage for now and then continue on here? I still think it will be easier to explain to customers / use.

postBuild:
substitute:
cluster_domain: "MY_DOMAIN"
cluster_id: "HELLO_DEV_1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming here is really inconsistent. HELLO_APP_DEV and HELLO_DEV are used interchangeably.

@@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are changes in the app_sets subfolder needed in this PR? It seems like a separate area to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change in cluster_templates, not base app_sets. Tunes the app_set for this clsuter_template.

docs/add_wc_environments.md Outdated Show resolved Hide resolved
docs/add_wc_environments.md Outdated Show resolved Hide resolved
docs/add_wc_environments.md Outdated Show resolved Hide resolved
docs/add_wc_environments.md Outdated Show resolved Hide resolved
docs/add_wc_environments.md Outdated Show resolved Hide resolved
docs/add_wc_environments.md Outdated Show resolved Hide resolved
docs/add_wc_environments.md Outdated Show resolved Hide resolved
@uvegla
Copy link
Contributor

uvegla commented Jun 20, 2022

Example kubeconform output (after sed-ing the stdin - from the beginning):

Deployment nginx-deployment is invalid: For field spec: selector is required - For field spec: template is required

This is the example output for kubeval for the same file for reference:

WARN - Set to ignore missing schemas
WARN - stdin contains an invalid Deployment (nginx-deployment) - selector: selector is required
WARN - stdin contains an invalid Deployment (nginx-deployment) - template: template is required

@uvegla
Copy link
Contributor

uvegla commented Jun 20, 2022

I think it i s nice that kubeconform supports different machine parsable formats like json and common test output formats like tap and junit.

The kubeval tool does not seem to be maintained anymore.
@uvegla
Copy link
Contributor

uvegla commented Jun 20, 2022

The kubeval replacement with kubeconform was move to a separate PR and got merged to main from there than merged back to this branch.

@piontec piontec marked this pull request as ready for review June 21, 2022 09:32
docs/add_wc_environments.md Outdated Show resolved Hide resolved
docs/add_wc_environments.md Outdated Show resolved Hide resolved
docs/add_wc_environments.md Outdated Show resolved Hide resolved

### Stages

We have 3 example clusters under [/bases/environments/stages](/bases/environments/stages):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other docs follow an instruction format of "this is what you need to do to have environments". Here we now have a mix of "look at these files & this is what you can do". Should there be a clear guide of "this is how you add a stage"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make sense and I would love it. I was pondering that myself as well while writing docs.

Copy link
Contributor

@uvegla uvegla Jun 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcelMue Created a ticket for this to discuss async. Also addes topic/documentation as it might make sense for sig/docs as well. See: https://github.com/giantswarm/giantswarm/issues/22611

@uvegla
Copy link
Contributor

uvegla commented Jun 28, 2022

@piontec @giantswarm/team-honeybadger Updated the docs with the code examples. Please check!

@piontec
Copy link
Contributor Author

piontec commented Jun 29, 2022

Thanks @uvegla!

@github-actions
Copy link

Rendered manifest diff output log

(file level)
    ---
    apiVersion: v1
    data:
      values: |
        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
        
    kind: ConfigMap
    metadata:
      name: HELLO_APP_STAGING_1-hello-world-values
      namespace: hello-web
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
    apiVersion: v1
    data:
      values: |
        port: 5433 # has to be in sync with config in default_config_hello_world.yaml
        user: hello-web-app # has to be in sync with config in default_config_hello_world.yaml
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/app_sets/hello-web-app/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
      name: HELLO_APP_STAGING_1-simple-db-values
      namespace: hello-web
    apiVersion: v1
    data:
      values: |
        bastion:
          bootFromVolume: true
          diskSize: 10
          flavor: n1.tiny
          image: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
        cloudConfig: cloud-config
        cloudName: openstack
        clusterName: HELLO_APP_STAGING_1
        controlPlane:
          availabilityZones:
          - demo_az_1
          - demo_az_2
          - demo_az_3
          bootFromVolume: true
          diskSize: 50
          flavor: n1.small
          image: bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
          replicas: 3
        externalNetworkID: cccccccc-cccc-cccc-cccc-cccccccccccc
        kubernetesVersion: v1.20.9
        nodeCIDR: 10.6.0.0/24
        nodeClasses:
        - bootFromVolume: true
          diskSize: 50
          flavor: n1.small
          image: dddddddd-dddd-dddd-dddd-dddddddddddd
          name: default
        nodePools:
        - class: default
          failureDomain: demo_az_1
          name: demo_az_1
          replicas: 1
        - class: default
          failureDomain: demo_az_2
          name: demo_az_2
          replicas: 1
        - class: default
          failureDomain: demo_az_3
          name: demo_az_3
          replicas: 1
        organization: ORG_NAME
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/clusters/capo/>=v0.6.0/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        giantswarm.io/managed-by: flux
      name: HELLO_APP_STAGING_1-config
      namespace: org-ORG_NAME
    apiVersion: v1
    data:
      values: |
        clusterName: HELLO_APP_STAGING_1
        organization: ORG_NAME
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/clusters/capo/template/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        giantswarm.io/managed-by: flux
      name: HELLO_APP_STAGING_1-default-apps-config
      namespace: org-ORG_NAME
    apiVersion: v1
    data:
      values: |
        cloudConfig: cloud-config-giantswarm-2
        cloudName: openstack
        externalNetworkID: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/cluster_templates/hello_app_cluster/cluster/cluster_user_config.yaml
          
      labels:
        giantswarm.io/managed-by: flux
      name: HELLO_APP_STAGING_1-user-config
      namespace: org-ORG_NAME
    apiVersion: v1
    data:
      values: |
        thread_pool_size: 64
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/environments/stages/staging/hello_app_cluster/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      name: HELLO_APP_STAGING_1-hello-world-user-config
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/apps/hello-world/appcr.yaml
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
      name: HELLO_APP_STAGING_1-hello-world
      namespace: hello-web
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_STAGING_1-hello-world-values
          namespace: hello-world-app
      kubeConfig:
        inCluster: false
      name: hello-world-app
      namespace: hello-world-app
      version: "0.1.8 # {"": "org-ORG_NAME:HELLO_APP_STAGING_1-hello-app"}"
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/apps/simple-db/appcr.yaml
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
      name: HELLO_APP_STAGING_1-simple-db
      namespace: hello-web
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_STAGING_1-simple-db-values
          namespace: simple-db-app
      kubeConfig:
        inCluster: false
      name: simple-db-app
      namespace: simple-db-app
      version: "0.1.0 # {"": "org-ORG_NAME:HELLO_APP_STAGING_1-simple-db-app"}"
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/clusters/capo/template/cluster.yaml
          
      labels:
        app-operator.giantswarm.io/version: 0.0.0
        giantswarm.io/managed-by: flux
      name: HELLO_APP_STAGING_1
      namespace: org-ORG_NAME
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_STAGING_1-config
          namespace: org-ORG_NAME
      kubeConfig:
        inCluster: true
      name: cluster-openstack
      namespace: org-ORG_NAME
      userConfig:
        configMap:
          name: HELLO_APP_STAGING_1-user-config
          namespace: org-ORG_NAME
      version: 0.8.1
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/clusters/capo/template/default_apps.yaml
          
      labels:
        app-operator.giantswarm.io/version: 0.0.0
        giantswarm.io/managed-by: flux
      name: HELLO_APP_STAGING_1-default-apps
      namespace: org-ORG_NAME
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_STAGING_1-default-apps-config
          namespace: org-ORG_NAME
      kubeConfig:
        inCluster: true
      name: default-apps-openstack
      namespace: org-ORG_NAME
      version: "${default_apps_release:=0.1.0}"
    apiVersion: application.giantswarm.io/v1alpha1
    kind: Catalog
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/dev/hello_app_cluster/automatic_updates/catalog.yaml
          
      labels:
        application.giantswarm.io/catalog-visibility: internal
        giantswarm.io/managed-by: flux
      name: giantswarm-catalog-oci
      namespace: org-ORG_NAME
    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
      title: giantswarm-catalog-oci
    apiVersion: image.toolkit.fluxcd.io/v1beta1
    kind: ImagePolicy
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/staging/hello_app_cluster/imagepolicies.yaml
          
      name: HELLO_APP_STAGING_1-hello-app
    spec:
      imageRepositoryRef:
        name: HELLO_APP_STAGING_1-hello-app
      policy:
        semver:
          range: ">=0.1.0 <1.0.0"
    apiVersion: image.toolkit.fluxcd.io/v1beta1
    kind: ImagePolicy
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/staging/hello_app_cluster/imagepolicies.yaml
          
      name: HELLO_APP_STAGING_1-simple-db-app
    spec:
      imageRepositoryRef:
        name: HELLO_APP_STAGING_1-simple-db
      policy:
        semver:
          range: ">=0.1.0 <0.2.0"
    apiVersion: image.toolkit.fluxcd.io/v1beta1
    kind: ImageRepository
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/staging/hello_app_cluster/imagerepositories.yaml
          
      name: HELLO_APP_STAGING_1-hello-app
    spec:
      image: giantswarmpublic.azurecr.io/giantswarm-catalog/hello-world-app
      interval: 10m0s
    apiVersion: image.toolkit.fluxcd.io/v1beta1
    kind: ImageRepository
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/staging/hello_app_cluster/imagerepositories.yaml
          
      name: HELLO_APP_STAGING_1-simple-db-app
    spec:
      image: giantswarmpublic.azurecr.io/giantswarm-catalog/simple-db-app
      interval: 10m0s
    apiVersion: image.toolkit.fluxcd.io/v1beta1
    kind: ImageUpdateAutomation
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/staging/hello_app_cluster/automatic_updates/imageupdate.yaml
          
      labels:
        giantswarm.io/managed-by: flux
      name: HELLO_APP_STAGING_1-image-updates
      namespace: org-ORG_NAME
    spec:
      git:
        checkout:
          ref:
            branch: main
        commit:
          author:
            email: [email protected]
            name: fluxcdbot
          messageTemplate: |
            automated app upgrades:
            {{ range , /usr/bin/envsubst := .Updated.Images -}}
            - {{ .Repository }} to {{ .Identifier }}
            {{ end -}}
            
        push:
          branch: main
      interval: 1m0s
      sourceRef:
        kind: GitRepository
        name: YOUR_GIT_REPO
      update:
        path: ./management-clusters/MC_NAME
        strategy: Setters
    apiVersion: v1
    data:
      values: |
        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
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
      name: HELLO_APP_PROD_1-hello-world-values
      namespace: hello-web
    apiVersion: v1
    data:
      values: |
        port: 5433 # has to be in sync with config in default_config_hello_world.yaml
        user: hello-web-app # has to be in sync with config in default_config_hello_world.yaml
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/app_sets/hello-web-app/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
      name: HELLO_APP_PROD_1-simple-db-values
      namespace: hello-web
    apiVersion: v1
    data:
      values: |
        bastion:
          bootFromVolume: true
          diskSize: 10
          flavor: n1.tiny
          image: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
        cloudConfig: cloud-config
        cloudName: openstack
        clusterName: HELLO_APP_PROD_1
        controlPlane:
          availabilityZones:
          - demo_az_1
          - demo_az_2
          - demo_az_3
          bootFromVolume: true
          diskSize: 50
          flavor: n1.small
          image: bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
          replicas: 3
        externalNetworkID: cccccccc-cccc-cccc-cccc-cccccccccccc
        kubernetesVersion: v1.20.9
        nodeCIDR: 10.6.0.0/24
        nodeClasses:
        - bootFromVolume: true
          diskSize: 50
          flavor: n1.small
          image: dddddddd-dddd-dddd-dddd-dddddddddddd
          name: default
        nodePools:
        - class: default
          failureDomain: demo_az_1
          name: demo_az_1
          replicas: 1
        - class: default
          failureDomain: demo_az_2
          name: demo_az_2
          replicas: 1
        - class: default
          failureDomain: demo_az_3
          name: demo_az_3
          replicas: 1
        organization: ORG_NAME
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/clusters/capo/>=v0.6.0/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        giantswarm.io/managed-by: flux
      name: HELLO_APP_PROD_1-config
      namespace: org-ORG_NAME
    apiVersion: v1
    data:
      values: |
        clusterName: HELLO_APP_PROD_1
        organization: ORG_NAME
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/clusters/capo/template/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        giantswarm.io/managed-by: flux
      name: HELLO_APP_PROD_1-default-apps-config
      namespace: org-ORG_NAME
    apiVersion: v1
    data:
      values: |
        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
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/environments/stages/prod/hello_app_cluster/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        giantswarm.io/managed-by: flux
      name: HELLO_APP_PROD_1-user-config
      namespace: org-ORG_NAME
    apiVersion: v1
    data:
      values: |
        thread_pool_size: 256
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/environments/stages/prod/hello_app_cluster/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      name: HELLO_APP_PROD_1-hello-world-user-config
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/apps/hello-world/appcr.yaml
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
      name: HELLO_APP_PROD_1-hello-world
      namespace: hello-web
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_PROD_1-hello-world-values
          namespace: hello-world-app
      kubeConfig:
        inCluster: false
      name: hello-world-app
      namespace: hello-world-app
      version: 0.1.8
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/apps/simple-db/appcr.yaml
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
      name: HELLO_APP_PROD_1-simple-db
      namespace: hello-web
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_PROD_1-simple-db-values
          namespace: simple-db-app
      kubeConfig:
        inCluster: false
      name: simple-db-app
      namespace: simple-db-app
      version: 0.1.0
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/clusters/capo/template/cluster.yaml
          
      labels:
        app-operator.giantswarm.io/version: 0.0.0
        giantswarm.io/managed-by: flux
      name: HELLO_APP_PROD_1
      namespace: org-ORG_NAME
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_PROD_1-config
          namespace: org-ORG_NAME
      kubeConfig:
        inCluster: true
      name: cluster-openstack
      namespace: org-ORG_NAME
      userConfig:
        configMap:
          name: HELLO_APP_PROD_1-user-config
          namespace: org-ORG_NAME
      version: 0.8.1
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/clusters/capo/template/default_apps.yaml
          
      labels:
        app-operator.giantswarm.io/version: 0.0.0
        giantswarm.io/managed-by: flux
      name: HELLO_APP_PROD_1-default-apps
      namespace: org-ORG_NAME
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_PROD_1-default-apps-config
          namespace: org-ORG_NAME
      kubeConfig:
        inCluster: true
      name: default-apps-openstack
      namespace: org-ORG_NAME
      version: "${default_apps_release:=0.1.0}"
    apiVersion: v1
    data:
      values: |
        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
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
      name: HELLO_APP_DEV_1-hello-world-values
      namespace: hello-web
    apiVersion: v1
    data:
      values: |
        port: 5433 # has to be in sync with config in default_config_hello_world.yaml
        user: hello-web-app # has to be in sync with config in default_config_hello_world.yaml
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/app_sets/hello-web-app/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
      name: HELLO_APP_DEV_1-simple-db-values
      namespace: hello-web
    apiVersion: v1
    data:
      values: |
        bastion:
          bootFromVolume: true
          diskSize: 10
          flavor: n1.tiny
          image: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
        cloudConfig: cloud-config
        cloudName: openstack
        clusterName: HELLO_APP_DEV_1
        controlPlane:
          availabilityZones:
          - demo_az_1
          - demo_az_2
          - demo_az_3
          bootFromVolume: true
          diskSize: 50
          flavor: n1.small
          image: bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
          replicas: 3
        externalNetworkID: cccccccc-cccc-cccc-cccc-cccccccccccc
        kubernetesVersion: v1.20.9
        nodeCIDR: 10.6.0.0/24
        nodeClasses:
        - bootFromVolume: true
          diskSize: 50
          flavor: n1.small
          image: dddddddd-dddd-dddd-dddd-dddddddddddd
          name: default
        nodePools:
        - class: default
          failureDomain: demo_az_1
          name: demo_az_1
          replicas: 1
        - class: default
          failureDomain: demo_az_2
          name: demo_az_2
          replicas: 1
        - class: default
          failureDomain: demo_az_3
          name: demo_az_3
          replicas: 1
        organization: ORG_NAME
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/clusters/capo/>=v0.6.0/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        giantswarm.io/managed-by: flux
      name: HELLO_APP_DEV_1-config
      namespace: org-ORG_NAME
    apiVersion: v1
    data:
      values: |
        clusterName: HELLO_APP_DEV_1
        organization: ORG_NAME
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/clusters/capo/template/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      labels:
        giantswarm.io/managed-by: flux
      name: HELLO_APP_DEV_1-default-apps-config
      namespace: org-ORG_NAME
    apiVersion: v1
    data:
      values: |
        cloudConfig: cloud-config-giantswarm-2
        cloudName: openstack
        externalNetworkID: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/cluster_templates/hello_app_cluster/cluster/cluster_user_config.yaml
          
      labels:
        giantswarm.io/managed-by: flux
      name: HELLO_APP_DEV_1-user-config
      namespace: org-ORG_NAME
    apiVersion: v1
    data:
      values: |
        thread_pool_size: 16
        
    kind: ConfigMap
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          configuredIn: ../../../../../../bases/environments/stages/dev/hello_app_cluster/kustomization.yaml
          configuredBy:
            apiVersion: builtin
            kind: ConfigMapGenerator
          
      name: HELLO_APP_DEV_1-hello-world-user-config
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/apps/hello-world/appcr.yaml
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
      name: HELLO_APP_DEV_1-hello-world
      namespace: hello-web
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_DEV_1-hello-world-values
          namespace: hello-world-app
      kubeConfig:
        inCluster: false
      name: hello-world-app
      namespace: hello-world-app
      version: "0.1.8 # {"": "org-ORG_NAME:HELLO_APP_DEV_1-hello-app"}"
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/apps/simple-db/appcr.yaml
          
      labels:
        gitops.giantswarm.io/appSet: hello-web-app
      name: HELLO_APP_DEV_1-simple-db
      namespace: hello-web
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_DEV_1-simple-db-values
          namespace: simple-db-app
      kubeConfig:
        inCluster: false
      name: simple-db-app
      namespace: simple-db-app
      version: "0.1.0 # {"": "org-ORG_NAME:HELLO_APP_DEV_1-simple-db-app"}"
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/clusters/capo/template/cluster.yaml
          
      labels:
        app-operator.giantswarm.io/version: 0.0.0
        giantswarm.io/managed-by: flux
      name: HELLO_APP_DEV_1
      namespace: org-ORG_NAME
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_DEV_1-config
          namespace: org-ORG_NAME
      kubeConfig:
        inCluster: true
      name: cluster-openstack
      namespace: org-ORG_NAME
      userConfig:
        configMap:
          name: HELLO_APP_DEV_1-user-config
          namespace: org-ORG_NAME
      version: 0.8.1
    apiVersion: application.giantswarm.io/v1alpha1
    kind: App
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/clusters/capo/template/default_apps.yaml
          
      labels:
        app-operator.giantswarm.io/version: 0.0.0
        giantswarm.io/managed-by: flux
      name: HELLO_APP_DEV_1-default-apps
      namespace: org-ORG_NAME
    spec:
      catalog: giantswarm
      config:
        configMap:
          name: HELLO_APP_DEV_1-default-apps-config
          namespace: org-ORG_NAME
      kubeConfig:
        inCluster: true
      name: default-apps-openstack
      namespace: org-ORG_NAME
      version: "${default_apps_release:=0.1.0}"
    apiVersion: application.giantswarm.io/v1alpha1
    kind: Catalog
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/dev/hello_app_cluster/automatic_updates/catalog.yaml
          
      labels:
        application.giantswarm.io/catalog-visibility: internal
        giantswarm.io/managed-by: flux
      name: giantswarm-catalog-oci
      namespace: org-ORG_NAME
    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
      title: giantswarm-catalog-oci
    apiVersion: image.toolkit.fluxcd.io/v1beta1
    kind: ImagePolicy
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/dev/hello_app_cluster/imagepolicies.yaml
          
      name: HELLO_APP_DEV_1-hello-app
    spec:
      filterTags:
        pattern: ".*-dev.*"
      imageRepositoryRef:
        name: HELLO_APP_DEV_1-hello-app
      policy:
        semver:
          range: >=0.1.0
    apiVersion: image.toolkit.fluxcd.io/v1beta1
    kind: ImagePolicy
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/dev/hello_app_cluster/imagepolicies.yaml
          
      name: HELLO_APP_DEV_1-simple-db-app
    spec:
      imageRepositoryRef:
        name: HELLO_APP_DEV_1-simple-db
      policy:
        semver:
          range: ">=0.1.0 <0.2.0"
    apiVersion: image.toolkit.fluxcd.io/v1beta1
    kind: ImageRepository
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/dev/hello_app_cluster/imagerepositories.yaml
          
      name: HELLO_APP_DEV_1-hello-app
    spec:
      image: giantswarmpublic.azurecr.io/giantswarm-catalog/hello-world-app
      interval: 10m0s
    apiVersion: image.toolkit.fluxcd.io/v1beta1
    kind: ImageRepository
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/dev/hello_app_cluster/imagerepositories.yaml
          
      name: HELLO_APP_DEV_1-simple-db-app
    spec:
      image: giantswarmpublic.azurecr.io/giantswarm-catalog/simple-db-app
      interval: 10m0s
    apiVersion: image.toolkit.fluxcd.io/v1beta1
    kind: ImageUpdateAutomation
    metadata:
      annotations:
        config.kubernetes.io/origin: |
          path: ../../../../../../bases/environments/stages/dev/hello_app_cluster/automatic_updates/imageupdate.yaml
          
      labels:
        giantswarm.io/managed-by: flux
      name: HELLO_APP_DEV_1-image-updates
      namespace: org-ORG_NAME
    spec:
      git:
        checkout:
          ref:
            branch: main
        commit:
          author:
            email: [email protected]
            name: fluxcdbot
          messageTemplate: |
            automated app upgrades:
            {{ range , /usr/bin/envsubst := .Updated.Images -}}
            - {{ .Repository }} to {{ .Identifier }}
            {{ end -}}
            
        push:
          branch: main
      interval: 1m0s
      sourceRef:
        kind: GitRepository
        name: YOUR_GIT_REPO
      update:
        path: ./management-clusters/MC_NAME
        strategy: Setters
    
  


@github-actions
Copy link

Validation output log
Testing: MC_NAME ORG_NAME WC_NAME_NO_OUT_OF_BAND apps
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME WC_NAME_NO_OUT_OF_BAND automatic-updates
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME WC_NAME_NO_OUT_OF_BAND cluster
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME WC_NAME_NO_OUT_OF_BAND app_sets
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME FROM_TEMPLATE_WC_NAME /
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME HELLO_APP_STAGING_CLUSTER_1 /
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME HELLO_APP_PROD_CLUSTER_1 /
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME WC_NAME_OUT_OF_BAND_NO_FLUX_APP mapi
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME WC_NAME_OUT_OF_BAND_NO_FLUX_APP out-of-band
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME HELLO_APP_DEV_CLUSTER_1 /
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME WC_NAME_OUT_OF_BAND_FLUX_APP mapi
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME WC_NAME_OUT_OF_BAND_FLUX_APP out-of-band
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME CAPI_WC_NAME apps
yamllint: OK
kubeconform: OK

Testing: MC_NAME ORG_NAME CAPI_WC_NAME cluster
yamllint: OK
kubeconform: OK


@piontec piontec merged commit 77bfee8 into main Jun 29, 2022
@piontec piontec deleted the feature/environments branch June 29, 2022 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants