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
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7f6b387
add: prod base
piontec Jun 2, 2022
ec5d7e4
wip: prod cluster
piontec Jun 2, 2022
58712c2
move prod clsuter template to app specific folder
piontec Jun 3, 2022
9df3628
staging cluster
piontec Jun 3, 2022
45d9020
add: dev environment
piontec Jun 6, 2022
f053324
fix: unfortunately, both cluster_id and cluster_name are needed
piontec Jun 6, 2022
0f5c4e1
Merge branch 'main' into feature/environments
piontec Jun 7, 2022
116e862
Merge branch 'main' into feature/environments
uvegla Jun 15, 2022
3a27e9f
Fix typos
uvegla Jun 20, 2022
39e0ba4
Add base for environment workload cluster docs
uvegla Jun 20, 2022
f8ec529
Merge branch 'main' into feature/environments
piontec Jun 20, 2022
b07b866
renamed 'deployments' to 'stages'
piontec Jun 20, 2022
342a2fe
Add docs on environment cluster bases
uvegla Jun 20, 2022
9f01e80
Merge branch 'feature/environments' of github.com:giantswarm/gitops-t…
uvegla Jun 20, 2022
662d9c3
Add docs on setting up workload clusters based on environment bases
uvegla Jun 20, 2022
5f169a5
Add table of content to environment cluster bases and some tips devel…
uvegla Jun 20, 2022
5982c30
Add tools used by `test-all-ffb` script to Appendices
uvegla Jun 20, 2022
07fe15a
add note about problems when using multiple bases
piontec Jun 20, 2022
e60cc87
set cluster names in YAML to same values as suggested by file names
piontec Jun 20, 2022
e3c1047
Format note on merging yamls and fix pre-commit hook warnings
uvegla Jun 20, 2022
71abd1c
Update docs/add_wc_environments.md
uvegla Jun 20, 2022
c5d7f88
Update docs/add_wc_environments.md
uvegla Jun 20, 2022
f5d58eb
Update docs/add_wc_environments.md
uvegla Jun 20, 2022
897e87c
Update docs/add_wc_environments.md
uvegla Jun 20, 2022
d66aa9a
Update docs/add_wc_environments.md
uvegla Jun 20, 2022
8139c20
Correct title based on code review and fix pre-commit warnings
uvegla Jun 20, 2022
6499cef
Replace kubeval with kubeconform
uvegla Jun 20, 2022
bc8260b
Make kubeconform check output similar to yamllint check output
uvegla Jun 20, 2022
a797827
Format warning about multiple layer merges for environments
uvegla Jun 20, 2022
8688694
Merge branch 'main' into feature/environments
uvegla Jun 20, 2022
5c0a9fd
improve environments docs
piontec Jun 21, 2022
f91e411
Update docs/add_wc_environments.md
piontec Jun 22, 2022
267a70e
Update docs/add_wc_environments.md
piontec Jun 22, 2022
1348830
Update docs/add_wc_environments.md
piontec Jun 22, 2022
a0343bc
Merge branch 'main' into feature/environments
piontec Jun 23, 2022
305feb0
Fix some typos
uvegla Jun 28, 2022
3dd6596
Add example commands to recreate the cluster environment templates
uvegla Jun 28, 2022
6f773fc
Add example commands to create and instance of an envrionment cluster…
uvegla Jun 28, 2022
0fb3745
Fix kubeconform validation errors
uvegla Jun 28, 2022
89c73a0
Merge branch 'main' into feature/environments
piontec Jun 29, 2022
31fffe9
added changelog
piontec Jun 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.

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/
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
buildMetadata: [originAnnotations]
kind: Kustomization
resources:
- cluster/
- app_sets/hello-web-app/
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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: [email protected]
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
thread_pool_size: 16
Original file line number Diff line number Diff line change
@@ -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'
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
thread_pool_size: 256
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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: [email protected]
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
thread_pool_size: 64
Original file line number Diff line number Diff line change
@@ -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'
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions docs/add_wc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Loading