-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add: environments management
- Loading branch information
Showing
35 changed files
with
1,010 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
12 changes: 12 additions & 0 deletions
12
bases/cluster_templates/hello_app_cluster/app_sets/hello-web-app/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/ |
6 changes: 6 additions & 0 deletions
6
...uster_templates/hello_app_cluster/app_sets/hello-web-app/override_config_hello_world.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
10 changes: 10 additions & 0 deletions
10
bases/cluster_templates/hello_app_cluster/cluster/cluster_user_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
10 changes: 10 additions & 0 deletions
10
bases/cluster_templates/hello_app_cluster/cluster/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
10 changes: 10 additions & 0 deletions
10
bases/cluster_templates/hello_app_cluster/cluster/patch_user_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
17 changes: 17 additions & 0 deletions
17
bases/environments/stages/dev/hello_app_cluster/automatic_updates/catalog.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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" | ||
repositories: | ||
- URL: oci://giantswarmpublic.azurecr.io/giantswarm-catalog/ | ||
type: helm | ||
storage: | ||
URL: oci://giantswarmpublic.azurecr.io/giantswarm-catalog/ | ||
type: helm | ||
title: giantswarm-catalog-oci |
28 changes: 28 additions & 0 deletions
28
bases/environments/stages/dev/hello_app_cluster/automatic_updates/imageupdate.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
8 changes: 8 additions & 0 deletions
8
bases/environments/stages/dev/hello_app_cluster/automatic_updates/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
1 change: 1 addition & 0 deletions
1
bases/environments/stages/dev/hello_app_cluster/hello_world_app_user_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
thread_pool_size: 16 |
24 changes: 24 additions & 0 deletions
24
bases/environments/stages/dev/hello_app_cluster/imagepolicies.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
16 changes: 16 additions & 0 deletions
16
bases/environments/stages/dev/hello_app_cluster/imagerepositories.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
32 changes: 32 additions & 0 deletions
32
bases/environments/stages/dev/hello_app_cluster/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
10 changes: 10 additions & 0 deletions
10
bases/environments/stages/prod/hello_app_cluster/cluster_user_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
1 change: 1 addition & 0 deletions
1
bases/environments/stages/prod/hello_app_cluster/hello_world_app_user_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
thread_pool_size: 256 |
34 changes: 34 additions & 0 deletions
34
bases/environments/stages/prod/hello_app_cluster/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
17 changes: 17 additions & 0 deletions
17
bases/environments/stages/staging/hello_app_cluster/automatic_updates/catalog.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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" | ||
repositories: | ||
- URL: oci://giantswarmpublic.azurecr.io/giantswarm-catalog/ | ||
type: helm | ||
storage: | ||
URL: oci://giantswarmpublic.azurecr.io/giantswarm-catalog/ | ||
type: helm | ||
title: giantswarm-catalog-oci |
28 changes: 28 additions & 0 deletions
28
bases/environments/stages/staging/hello_app_cluster/automatic_updates/imageupdate.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
8 changes: 8 additions & 0 deletions
8
bases/environments/stages/staging/hello_app_cluster/automatic_updates/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
1 change: 1 addition & 0 deletions
1
bases/environments/stages/staging/hello_app_cluster/hello_world_app_user_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
thread_pool_size: 64 |
22 changes: 22 additions & 0 deletions
22
bases/environments/stages/staging/hello_app_cluster/imagepolicies.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
16 changes: 16 additions & 0 deletions
16
bases/environments/stages/staging/hello_app_cluster/imagerepositories.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
32 changes: 32 additions & 0 deletions
32
bases/environments/stages/staging/hello_app_cluster/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.