Skip to content

Commit

Permalink
Added release labels (#7246)
Browse files Browse the repository at this point in the history
  • Loading branch information
jslay-excella authored Sep 21, 2022
1 parent 3e7a558 commit e85f7a6
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 16 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/helm_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ jobs:
- name: Set up chart-testing
uses: helm/[email protected]

- name: Set up Helm chart dependencies
id: helm-chart-dependencies
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add elastic https://helm.elastic.co/
helm repo add opensearch https://opensearch-project.github.io/helm-charts/
helm repo update
helm dependency update ./helm/cfgov
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml

Expand Down
4 changes: 4 additions & 0 deletions ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ helm-extra-args: --timeout 600s
chart-dirs:
- helm/
target-branch: main
chart-repos:
- bitnami=https://charts.bitnami.com/bitnami
- elastic=https://helm.elastic.co/
- opensearch=https://opensearch-project.github.io/helm-charts/
9 changes: 3 additions & 6 deletions helm-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ else
fi

## Set release name
RELEASE=${RELEASE:-cfgov}
export RELEASE=${RELEASE:-cfgov}

# Setup
## Get absolute path to helm-install.sh
Expand All @@ -49,7 +49,7 @@ realpath() {
## Get Project Dir path containing helm-install.sh
export PROJECT_DIR="$(dirname "$(realpath "$0")")"
## Set Default Args
DEFAULT_ARGS="${PROJECT_DIR}/helm/overrides/local-dev.yaml ${PROJECT_DIR}/helm/overrides/dev-vars.yaml ${PROJECT_DIR}/helm/overrides/services.yaml"
DEFAULT_ARGS="${PROJECT_DIR}/helm/overrides/local-dev.yaml ${PROJECT_DIR}/helm/overrides/dev-vars.yaml ${PROJECT_DIR}/helm/overrides/services.yaml ${PROJECT_DIR}/helm/overrides/required.yaml"
## Source .env, if it exists
if [ -f .env ]; then
source .env
Expand Down Expand Up @@ -81,7 +81,7 @@ fi
if [ $# -eq 0 ]; then
ARGS=${DEFAULT_ARGS}
else
ARGS=$@
ARGS="$@ ${PROJECT_DIR}/helm/overrides/required.yaml"
fi

## Separate --set from files, substitute Environment Variables in override files
Expand All @@ -106,9 +106,6 @@ done
## Install/Upgrade cfgov release
helm upgrade --install ${WAIT_OPT} \
"${RELEASE}" ${NAMESPACE_OPT} ${OVERRIDES} ${IMAGE} ${TAG} \
--set ingress.hosts[0].host="${RELEASE}.localhost" \
--set elasticsearch.clusterName="${RELEASE}-elasticsearch" ${ES_TEST_OVERRIDE} \
--set kibana.elasticsearchHosts="http://${RELEASE}-elasticsearch-master:9200" \
${PROJECT_DIR}/helm/cfgov

# Add these in for local SSL.
Expand Down
3 changes: 2 additions & 1 deletion helm/cfgov/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apiVersion: v2
name: cfgov
description: A Helm chart for Kubernetes
icon: https://www.consumerfinance.gov/static/icon.svg

maintainers:
- name: cfpb
Expand All @@ -19,7 +20,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
version: 0.1.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
16 changes: 16 additions & 0 deletions helm/cfgov/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ helm.sh/chart: {{ include "cfgov.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
release.cfpb.gov/product: {{ .Chart.Name }}
{{- if or (eq .Release.Name .Chart.Name) (eq .Release.Name "edge") }}
release.cfpb.gov/auto-delete: "false"
{{- else }}
release.cfpb.gov/auto-delete: {{ .Values.release.autoDelete | quote }}
{{- end }}
release.cfpb.gov/auto-upgrade: {{ .Values.release.autoUpgrade | quote }}
{{- if .Values.release.branch }}
release.cfpb.gov/branch: {{ .Values.release.branch | quote }}
{{- end }}
{{- if .Values.release.owner }}
release.cfpb.gov/owner: {{ .Values.release.owner | quote }}
{{- end }}
{{- if .Values.release.gitSHA }}
release.cfpb.gov/git-sha: {{ .Values.release.gitSHA | quote }}
{{- end }}
{{- end }}

{{/*
Expand Down
8 changes: 8 additions & 0 deletions helm/cfgov/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

# Release metadata
release:
autoDelete: true # Auto delete release based off branch
autoUpgrade: true # Autoupgrade release based off branch
branch: "" # Ref this is deployed from (ex "<branch-name>" to track a branch, "release" to track release)
owner: "" # Recognizable owner name (user/service account/etc)
gitSHA: "" # Git commit SHA

replicaCount: 1

image:
Expand Down
29 changes: 29 additions & 0 deletions helm/overrides/required.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# These values are required, and always included by helm-install.sh
# Some of these values, are needed to set certain values needed between
# Sibling charts from the Parent chart (cfgov).
#
# Everything can also be overridden explicitly with --set

elasticsearch:
# using release name to always get unique naming,
# as elasticsearch chart breaks convention
clusterName: "${RELEASE}-elasticsearch"

kibana:
# match the generated elasticsearch cluster name,
# overridable with --set kibana.elasticsearchHosts, which is useful
# when using an external ElasticSearch host and not the Child chart
elasticsearchHosts: "http://${RELEASE}-elasticsearch-master:9200"

# ingress is only used for local deployments
ingress:
hosts:
- host: ${RELEASE}.localhost # overridable with --set ingress.hosts[0].host
paths:
- path: /
pathType: ImplementationSpecific

release:
branch: ${RELEASE_BRANCH}
owner: ${RELEASE_OWNER}
gitSHA: ${GitSHA}

0 comments on commit e85f7a6

Please sign in to comment.