Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Merge #690
Browse files Browse the repository at this point in the history
690: add option to configure namespace in values.yaml r=VineethReddy02 a=VineethReddy02

1. Add option to configure namespace in `values.yaml`
2. In helm chart template files add default namespace value as `.Release.Namespace` (better practice used in community helm charts)
3. Rename `connector` to `promscale` in helm chart. 
4. Add helm chart static generation check to CI i.e. PR level tests & scheduled tests. 

Co-authored-by: Vineeth Pothulapati <vineethpothulapati@outlook.com>
  • Loading branch information
bors[bot] and VineethReddy02 committed Jul 13, 2021
2 parents 5ac4858 + 06bd9d3 commit a903f1d
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 18 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,14 @@ jobs:
- name: Test against first supported
run: ./scripts/end_to_end_tests.sh timescale/timescaledb:1.7.4-pg12
shell: bash

test-helm-chart:
name: Test helm-chart template generation
runs-on: ubuntu-latest
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Test helm chart static generation
run: ./scripts/generate-deploy-script.sh
11 changes: 11 additions & 0 deletions .github/workflows/go-scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,14 @@ jobs:
MULTI: ${{ matrix.test-setups.multi }}
NIGHTLY: ${{ matrix.test-setups.nightly }}
run: go test ./pkg/tests/end_to_end_tests/ -use-extension=$EXT -use-timescaledb=$TSDB -use-timescale2=$TSDB2 -use-multinode=$MULTI -use-timescaledb-nightly=$NIGHTLY -postgres-version-major=$PG

test-helm-chart:
name: Test helm-chart template generation
runs-on: ubuntu-latest
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Test helm chart static generation
run: ./scripts/generate-deploy-script.sh
16 changes: 14 additions & 2 deletions helm-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "connector.fullname" -}}
{{- define "promscale.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
Expand All @@ -19,6 +19,18 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "connector.chart" -}}
{{- define "promscale.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}


{{/*
Allow the release namespace to be overridden
*/}}
{{- define "promscale.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
7 changes: 4 additions & 3 deletions helm-chart/templates/config-maintenance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "connector.fullname" . | trunc 51 }}-maintenance
name: {{ include "promscale.fullname" . | trunc 51 }}-maintenance
namespace: {{ template "promscale.namespace" . }}
labels:
app: {{ template "connector.fullname" . }}
chart: {{ template "connector.chart" . }}
app: {{ template "promscale.fullname" . }}
chart: {{ template "promscale.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
Expand Down
9 changes: 5 additions & 4 deletions helm-chart/templates/cronjob-maintenance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ include "connector.fullname" . | trunc 51 }}-maintenance
name: {{ include "promscale.fullname" . | trunc 51 }}-maintenance
namespace: {{ template "promscale.namespace" . }}
labels:
app: {{ template "connector.fullname" . }}
chart: {{ template "connector.chart" . }}
app: {{ template "promscale.fullname" . }}
chart: {{ template "promscale.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
Expand Down Expand Up @@ -56,7 +57,7 @@ spec:
volumes:
- name: script-volume
configMap:
name: {{ include "connector.fullname" . | trunc 51 }}-maintenance
name: {{ include "promscal.fullname" . | trunc 51 }}-maintenance
restartPolicy: OnFailure
{{- with .Values.maintenance.nodeSelector }}
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "connector.fullname" . }}
name: {{ template "promscale.fullname" . }}
namespace: {{ template "promscale.namespace" . }}
labels:
app: {{ template "connector.fullname" . }}
chart: {{ template "connector.chart" . }}
app: {{ template "promscale.fullname" . }}
chart: {{ template "promscale.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
Expand All @@ -13,11 +14,11 @@ spec:
type: {{ .Values.upgradeStrategy }}
selector:
matchLabels:
app: {{ template "connector.fullname" . }}
app: {{ template "promscale.fullname" . }}
template:
metadata:
labels:
app: {{ template "connector.fullname" . }}
app: {{ template "promscale.fullname" . }}
{{ if .Values.prometheus.enabled }}
annotations: {{ .Values.prometheus.annotations | toYaml | nindent 8 }}
{{ end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "connector.fullname" . | trunc 53 }}-connector
name: {{ include "promscale.fullname" . | trunc 53 }}-connector
namespace: {{ template "promscale.namespace" . }}
labels:
app: {{ template "connector.fullname" . }}
chart: {{ template "connector.chart" . }}
app: {{ template "promscale.fullname" . }}
chart: {{ template "promscale.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
{{ .Values.service.loadBalancer.annotations | toYaml | indent 4 }}
spec:
selector:
app: {{ template "connector.fullname" . }}
app: {{ template "promscale.fullname" . }}
{{- if .Values.service.loadBalancer.enabled }}
type: LoadBalancer
{{- else }}
Expand Down
3 changes: 3 additions & 0 deletions helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ imagePullPolicy: IfNotPresent
# number of connector pods to spawn
replicaCount: 1

# Override the deployment namespace
namespaceOverride: ""

# Promscale deployment upgrade strategy
# as Promscale upgrade requires no existing Promscale
# connected with TimescaleDB. Recreate strategy helps
Expand Down
File renamed without changes.

0 comments on commit a903f1d

Please sign in to comment.