diff --git a/.github/actions/lint-test-chart/action.yml b/.github/actions/lint-test-chart/action.yml index a0583d31571a..49271bc304be 100644 --- a/.github/actions/lint-test-chart/action.yml +++ b/.github/actions/lint-test-chart/action.yml @@ -45,6 +45,12 @@ runs: - name: Create kind cluster uses: helm/kind-action@v1 + - name: Install Dependencies + shell: bash + run: | + LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name) + curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f - + - name: Getting cluster ready shell: bash run: | diff --git a/contrib/charts/dragonfly/ci/service-monitor-values.golden.yaml b/contrib/charts/dragonfly/ci/service-monitor-values.golden.yaml new file mode 100644 index 000000000000..1115ca9cecd3 --- /dev/null +++ b/contrib/charts/dragonfly/ci/service-monitor-values.golden.yaml @@ -0,0 +1,146 @@ +--- +# Source: dragonfly/templates/serviceaccount.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: test-dragonfly + namespace: default + labels: + app.kubernetes.io/name: dragonfly + app.kubernetes.io/instance: test + app.kubernetes.io/version: "v1.15.1" + app.kubernetes.io/managed-by: Helm +--- +# Source: dragonfly/templates/metrics-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-dragonfly-metrics + namespace: default + labels: + app.kubernetes.io/name: dragonfly + app.kubernetes.io/instance: test + app.kubernetes.io/version: "v1.15.1" + app.kubernetes.io/managed-by: Helm + type: metrics +spec: + type: ClusterIP + ports: + - name: metrics + port: 6379 + targetPort: 6379 + protocol: TCP + selector: + app.kubernetes.io/name: dragonfly + app.kubernetes.io/instance: test +--- +# Source: dragonfly/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-dragonfly + namespace: default + labels: + app.kubernetes.io/name: dragonfly + app.kubernetes.io/instance: test + app.kubernetes.io/version: "v1.15.1" + app.kubernetes.io/managed-by: Helm +spec: + type: ClusterIP + ports: + - port: 6379 + targetPort: dragonfly + protocol: TCP + name: dragonfly + selector: + app.kubernetes.io/name: dragonfly + app.kubernetes.io/instance: test +--- +# Source: dragonfly/templates/deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-dragonfly + namespace: default + labels: + app.kubernetes.io/name: dragonfly + app.kubernetes.io/instance: test + app.kubernetes.io/version: "v1.15.1" + app.kubernetes.io/managed-by: Helm +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: dragonfly + app.kubernetes.io/instance: test + template: + metadata: + annotations: + labels: + app.kubernetes.io/name: dragonfly + app.kubernetes.io/instance: test + spec: + serviceAccountName: test-dragonfly + containers: + - name: dragonfly + image: "docker.dragonflydb.io/dragonflydb/dragonfly:v1.15.1" + imagePullPolicy: IfNotPresent + ports: + - name: dragonfly + containerPort: 6379 + protocol: TCP + livenessProbe: + exec: + command: + - /bin/sh + - /usr/local/bin/healthcheck.sh + failureThreshold: 3 + initialDelaySeconds: 10 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + readinessProbe: + exec: + command: + - /bin/sh + - /usr/local/bin/healthcheck.sh + failureThreshold: 3 + initialDelaySeconds: 10 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + args: + - "--alsologtostderr" + resources: + limits: {} + requests: {} +--- +# Source: dragonfly/templates/servicemonitor.yaml +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: test-dragonfly-metrics + namespace: default + labels: + release: prometheus-stack + app.kubernetes.io/name: dragonfly + app.kubernetes.io/instance: test + app.kubernetes.io/version: "v1.15.1" + app.kubernetes.io/managed-by: Helm +spec: + endpoints: + - interval: 10s + scrapeTimeout: 10s + honorLabels: true + port: metrics + path: /metrics + scheme: http + jobLabel: "test" + selector: + matchLabels: + app.kubernetes.io/name: dragonfly + app.kubernetes.io/instance: test + type: metrics + namespaceSelector: + matchNames: + - default diff --git a/contrib/charts/dragonfly/ci/service-monitor-values.yaml b/contrib/charts/dragonfly/ci/service-monitor-values.yaml new file mode 100644 index 000000000000..b35e51ad8314 --- /dev/null +++ b/contrib/charts/dragonfly/ci/service-monitor-values.yaml @@ -0,0 +1,8 @@ +serviceMonitor: + enabled: true + namespace: "" + labels: + release: prometheus-stack + annotations: {} + interval: 10s + scrapeTimeout: 10s diff --git a/contrib/charts/dragonfly/golden_test.go b/contrib/charts/dragonfly/golden_test.go index d704e60f0954..f63cbc552675 100644 --- a/contrib/charts/dragonfly/golden_test.go +++ b/contrib/charts/dragonfly/golden_test.go @@ -3,7 +3,6 @@ package golden import ( "flag" "fmt" - "io/ioutil" "os" "path/filepath" "regexp" @@ -40,13 +39,13 @@ func TestHelmRender(t *testing.T) { output = fmt.Sprintf("%s\n", string(bytes)) if *update { - err := ioutil.WriteFile(goldenFile, []byte(output), 0644) + err := os.WriteFile(goldenFile, []byte(output), 0644) if err != nil { t.Fatal(err) } } - expected, err := ioutil.ReadFile(goldenFile) + expected, err := os.ReadFile(goldenFile) if err != nil { t.Fatal(err) } @@ -55,6 +54,5 @@ func TestHelmRender(t *testing.T) { t.Fatalf("Expected %s, but got %s\n. Update golden files by running `go test -v ./... -update`", string(expected), output) } } - } } diff --git a/contrib/charts/dragonfly/templates/certificate.yaml b/contrib/charts/dragonfly/templates/certificate.yaml index be421874c842..cbf4a5338251 100644 --- a/contrib/charts/dragonfly/templates/certificate.yaml +++ b/contrib/charts/dragonfly/templates/certificate.yaml @@ -21,6 +21,7 @@ spec: issuerRef: kind: {{ required "tls.issuer.kind is required, if createCerts is enabled" .Values.tls.issuer.kind }} name: {{ required "tls.issuer.name is required, if createCerts is enabled" .Values.tls.issuer.name }} + group: {{ .Values.tls.issuer.group }} secretName: '{{ include "dragonfly.fullname" . }}-server-tls' usages: - client auth diff --git a/contrib/charts/dragonfly/templates/servicemonitor.yaml b/contrib/charts/dragonfly/templates/servicemonitor.yaml index db6faa05182a..a45440f81414 100644 --- a/contrib/charts/dragonfly/templates/servicemonitor.yaml +++ b/contrib/charts/dragonfly/templates/servicemonitor.yaml @@ -1,10 +1,12 @@ -{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) .Values.serviceMonitor.enabled }} +{{- if .Values.serviceMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ template "dragonfly.fullname" . }}-metrics - {{- with .Values.serviceMonitor.namespace }} - namespace: {{ . }} + {{- if .Values.serviceMonitor.namespace }} + namespace: {{ .Values.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace }} {{- end }} {{- with .Values.serviceMonitor.annotations }} annotations: diff --git a/contrib/charts/dragonfly/values.yaml b/contrib/charts/dragonfly/values.yaml index b5a0ee9596b1..0e1e433bdcc9 100644 --- a/contrib/charts/dragonfly/values.yaml +++ b/contrib/charts/dragonfly/values.yaml @@ -105,6 +105,9 @@ tls: kind: ClusterIssuer # -- name of the referenced issuer name: selfsigned + # -- group of the referenced issuer + # if you are using an external issuer, change this to that issuer group. + group: cert-manager.io # -- use TLS certificates from existing secret existing_secret: "" # -- TLS certificate