diff --git a/.gitignore b/.gitignore index 0d3561be1..f52f6a230 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ lerna-debug.log* # NotifyBC **/*.local.* +!/helm/values.local.yaml /server/database/** !/server/database/.keep /server/certs/** diff --git a/helm/README.md b/helm/README.md index 11d2b044b..2a20f00b1 100644 --- a/helm/README.md +++ b/helm/README.md @@ -4,6 +4,16 @@ 3. Move the new `.tgz` file to the `docs/` directory (`mv notify-bc-[version].tgz ../docs/helm`). 4. Update `docs/helm/index.yaml` to list the new package (`helm repo index ../docs/helm`). +## Deploying to local Kubernetes cluster (Docker Desktop) +1. Ensure Docker Desktop has Kubernetes enabled (Settings > Kubernetes > Enable Kubernetes). +2. Ensure you are on the `docker-desktop` context (should be the current context when running `kubectl config get-contexts`). +3. From project root, deploy to the Kubernetes cluster using the Helm command `helm install local -f ./helm/values.local.yaml ./helm/`. + - `local` in the example is the release name and can be changed to any name you want. + - `values.local.yaml` is a values file that changes configurations so the deployment will work locally. + - To add any other custom values (to change the image version, for example), add another `-f` flag pointing to your values yaml file. +4. To undo a deployment, run the command `helm delete local`. + - If you used a different release name in the previous step, replace `local` with that release name. + ## Deploying to OpenShift 1. In this example we will be deploying to `dev`, so a file named `values.dev.local.yaml` should exist and contain values specific to the `dev` instance. 1. Run `helm install dev -f platform-specific/openshift.yaml -f values.yaml -f values.dev.local.yaml ./` diff --git a/helm/values.local.yaml b/helm/values.local.yaml new file mode 100644 index 000000000..b80028bdd --- /dev/null +++ b/helm/values.local.yaml @@ -0,0 +1,12 @@ +image: + repository: ghcr.io/bcgov/des-notify-bc + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: 'latest' +fluentbit: + persistence: + # Overrides netapp-file-backup which is only valid in OpenShift. + storageClassName: hostpath +cronJob: + # Overrides netapp-file-backup which is only valid in OpenShift. + storageClassName: hostpath diff --git a/helm/values.yaml b/helm/values.yaml index 6021aad54..77879dc75 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -202,14 +202,25 @@ fluentbit: service: "" inputs: | [INPUT] - Name tail - Path /tmp/logs/*.log - Tag app.access.log - Mem_Buf_Limit 5MB + Name tail + Path /tmp/logs/*.log + Tag app.access.log + Mem_Buf_Limit 5MB Skip_Long_Lines Off - filters: "" + filters: | + [FILTER] + Name Lua + Match * + call append_tag + code function append_tag(tag, timestamp, record) new_record = record new_record["datestamp"] = os.date("%Y%m%d", timestamp) return 1, timestamp, new_record end + + [FILTER] + Name rewrite_tag + Match app.access.log + Rule $datestamp ^(.*)$ $datestamp.app.access.log false + Emitter_Name re_emitted outputs: | [OUTPUT] - Name file + Name file Match * - Path /tmp/pvc/ + Path /tmp/pvc/