diff --git a/README.md b/README.md index 589845333210c0b9cf53c628b75668a36e5da213..f0127efe95ad6dc85ec585db14a3c2ca8dfcfbf7 100644 --- a/README.md +++ b/README.md @@ -4,39 +4,24 @@ Work in progress umbrella package ## Usage -``` -# As a helm chart -helm install bigbang chart/ -n flux-system +The following examples expect a cluster with fluxv2 preinstalled. This can be done by [installing the flux cli](https://toolkit.fluxcd.io/get-started/#install-the-flux-cli) and running `flux install`. (TODO: Convert to IB images). -# If you don't like helm -helm template bigbang chart/ -n flux-system | kubectl apply -f - -``` +### Quickstart -You can also point a `HelmRelease` to this repository as so: - -```yaml ---- -apiVersion: source.toolkit.fluxcd.io/v1beta1 -kind: GitRepository -metadata: - name: umbrella - namespace: flux-system -spec: - url: https://repo1.dsop.io/platform-one/big-bang/apps/sandbox/umbrella.git ---- -apiVersion: helm.toolkit.fluxcd.io/v2beta1 -kind: HelmRelease -metadata: - name: bigbang - namespace: flux-system -spec: - chart: - spec: - chart: chart/ - sourceRef: - kind: GitRepository - name: umbrella - namespace: flux-system +A bare mininmum, simple quickstart is provided under `./examples/simple`: + +```bash +kubectl apply -f examples/simple ``` -The `umbrella` helm chart is configurable through a variety of means, please see [TODO]() for more info. \ No newline at end of file +### Multi Environment + +Most production deployments follow a traditional Dev, Acceptance, Staging, Test (DAST) workflow. This example demonstrates __one way__ of achieving multiple deployments with differing configurations. + +```bash +# Apply dev +kustomize build examples/multi-env/overlays/dev | kubectl apply -f - + +# Apply prod +kustomize build examples/multi-env/overlays/prod | kubectl apply -f - +``` diff --git a/examples/multi-env/base/gitrepository.yaml b/examples/multi-env/base/gitrepository.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e71daf7aa8674b3f04b8fb34b8e6b3cf6e3312c6 --- /dev/null +++ b/examples/multi-env/base/gitrepository.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: source.toolkit.fluxcd.io/v1beta1 +kind: GitRepository +metadata: + name: umbrella +spec: + interval: 1m0s + url: https://repo1.dsop.io/platform-one/big-bang/apps/sandbox/umbrella.git \ No newline at end of file diff --git a/examples/multi-env/base/helmrelease.yaml b/examples/multi-env/base/helmrelease.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a605eb4fe9081cfc7584be14ee84c6861ee8f8b2 --- /dev/null +++ b/examples/multi-env/base/helmrelease.yaml @@ -0,0 +1,20 @@ +apiVersion: helm.toolkit.fluxcd.io/v2beta1 +kind: HelmRelease +metadata: + name: bigbang +spec: + chart: + spec: + chart: chart + sourceRef: + kind: GitRepository + name: umbrella + namespace: flux-system + interval: 5m0s + valuesFrom: + - kind: ConfigMap + name: bigbang-values + optional: true + - kind: Secret + name: bigbang-values + optional: true diff --git a/examples/multi-env/base/kustomization.yaml b/examples/multi-env/base/kustomization.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f2d0dee41cec8214a2f2eff693c57f7b5c9c24ef --- /dev/null +++ b/examples/multi-env/base/kustomization.yaml @@ -0,0 +1,14 @@ +namespace: flux-system + +resources: + - gitrepository.yaml + - helmrelease.yaml + +configMapGenerator: + - name: bigbang-values + behavior: create + files: + - values.yaml + +generatorOptions: + disableNameSuffixHash: true \ No newline at end of file diff --git a/examples/multi-env/base/values.yaml b/examples/multi-env/base/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/examples/multi-env/overlays/dev/kustomization.yaml b/examples/multi-env/overlays/dev/kustomization.yaml new file mode 100644 index 0000000000000000000000000000000000000000..34865ecc90ed12104d7550da37a5e6a3fd9b423a --- /dev/null +++ b/examples/multi-env/overlays/dev/kustomization.yaml @@ -0,0 +1,17 @@ +namespace: flux-system + +resources: + - ../../base + +configMapGenerator: + - name: bigbang-values + behavior: merge + files: + - values.yaml + +generatorOptions: + disableNameSuffixHash: true + +patchesStrategicMerge: + - patch-gitrepository.yaml + - patch-helmrelease.yaml \ No newline at end of file diff --git a/examples/multi-env/overlays/dev/patch-gitrepository.yaml b/examples/multi-env/overlays/dev/patch-gitrepository.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1ee807f25a9a7d77546073db0b27077f4fc40e68 --- /dev/null +++ b/examples/multi-env/overlays/dev/patch-gitrepository.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: source.toolkit.fluxcd.io/v1beta1 +kind: GitRepository +metadata: + name: umbrella +#spec: +# # Patch to a development branch +# ref: +# branch: hel \ No newline at end of file diff --git a/examples/multi-env/overlays/dev/patch-helmrelease.yaml b/examples/multi-env/overlays/dev/patch-helmrelease.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b457cc51780c354aa30aa8ba9cfa7243b65ec837 --- /dev/null +++ b/examples/multi-env/overlays/dev/patch-helmrelease.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: helm.toolkit.fluxcd.io/v2beta1 +kind: HelmRelease +metadata: + name: bigbang +spec: + # Bump up refresh interval for dev + interval: 1m0s diff --git a/examples/multi-env/overlays/dev/values.yaml b/examples/multi-env/overlays/dev/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9a96c6a4c82ad35814ecc414b1582ab21fd003c1 --- /dev/null +++ b/examples/multi-env/overlays/dev/values.yaml @@ -0,0 +1 @@ +hostname: bigbang.dev \ No newline at end of file diff --git a/examples/multi-env/overlays/prod/kustomization.yaml b/examples/multi-env/overlays/prod/kustomization.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1b649bfc94fae67e89d819ab202d8c264c93836d --- /dev/null +++ b/examples/multi-env/overlays/prod/kustomization.yaml @@ -0,0 +1,13 @@ +namespace: flux-system + +resources: + - ../../base + +configMapGenerator: + - name: bigbang-values + behavior: merge + files: + - values.yaml + +generatorOptions: + disableNameSuffixHash: true \ No newline at end of file diff --git a/examples/multi-env/overlays/prod/values.yaml b/examples/multi-env/overlays/prod/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9a96c6a4c82ad35814ecc414b1582ab21fd003c1 --- /dev/null +++ b/examples/multi-env/overlays/prod/values.yaml @@ -0,0 +1 @@ +hostname: bigbang.dev \ No newline at end of file diff --git a/examples/simple/bigbang.yaml b/examples/simple/bigbang.yaml new file mode 100644 index 0000000000000000000000000000000000000000..14fdc3ce8e1c22e6fd92faba55a26995276307f0 --- /dev/null +++ b/examples/simple/bigbang.yaml @@ -0,0 +1,37 @@ +--- +apiVersion: source.toolkit.fluxcd.io/v1beta1 +kind: GitRepository +metadata: + name: umbrella-chart + namespace: flux-system +spec: + interval: 1m0s + url: https://repo1.dsop.io/platform-one/big-bang/apps/sandbox/umbrella +--- +apiVersion: helm.toolkit.fluxcd.io/v2beta1 +kind: HelmRelease +metadata: + name: bigbang + namespace: flux-system +spec: + chart: + spec: + chart: chart + sourceRef: + kind: GitRepository + name: umbrella-chart + interval: 10m0s + + # Add additional variables by using the ConfigMap and Secrets below + valuesFrom: + - kind: ConfigMap + name: bigbang-values + optional: true + - kind: Secret + name: bigbang-values + optional: true + + # Modify big bang variables in line with the values below + # NOTE: These will take precedence over the `spec.valuesFrom` above + values: + hostname: bigbang.io