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

Commit

Permalink
fix: fix service missing endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
curuvija committed Sep 14, 2024
1 parent 9292f41 commit 3c2eac6
Show file tree
Hide file tree
Showing 8 changed files with 287 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dbConnection:
createDbConnectionSecret: true
dbDonnectionString: "oracle://system:192.168.88.222@oracle:1521/xe"
1 change: 1 addition & 0 deletions source/oracledb-exporter/chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 9161
name: http
protocol: TCP
env:
- name: DATA_SOURCE_NAME
Expand Down
4 changes: 0 additions & 4 deletions source/oracledb-exporter/chart/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if eq .Values.existingDbSecretName "" }}
{{- if eq .Values.dbConnection.createDbConnectionSecret true }}
apiVersion: v1
kind: Secret
Expand All @@ -7,7 +6,4 @@ metadata:
data:
datasource: {{ required "A valid .Values.dbConnection.dbDonnectionString entry required!" .Values.dbConnection.dbDonnectionString | b64enc }}
type: Opaque
{{- else }}
{{- fail "Unless you set .Values.dbConnection.createDbConnectionSecret to true you'll have to create DB connection secret manually and provide secret name in existingDbSecretName." }}
{{- end }}
{{- end }}
142 changes: 142 additions & 0 deletions source/oracledb-exporter/tests/golden/db-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
---
# Source: oracledb-exporter/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: release-name-oracledb-exporter
labels:
helm.sh/chart: oracledb-exporter-1.0.0
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
app.kubernetes.io/version: "0.6.0"
app.kubernetes.io/managed-by: Helm
---
# Source: oracledb-exporter/templates/secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: release-name-oracledb-exporter-secret
data:
datasource: b3JhY2xlOi8vc3lzdGVtOjE5Mi4xNjguODguMjIyQG9yYWNsZToxNTIxL3hl
type: Opaque
---
# Source: oracledb-exporter/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: release-name-oracledb-exporter-custom-metrics
data:
custom-metrics.toml: |-
[[metric]]
context = "test"
request = "SELECT 1 as value_1, 2 as value_2 FROM DUAL"
metricsdesc = { value_1 = "Simple example returning always 1.", value_2 = "Same but returning always 2." }
---
# Source: oracledb-exporter/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: release-name-oracledb-exporter
labels:
helm.sh/chart: oracledb-exporter-1.0.0
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
app.kubernetes.io/version: "0.6.0"
app.kubernetes.io/managed-by: Helm
spec:
type: ClusterIP
ports:
- port: 9161
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
---
# Source: oracledb-exporter/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: release-name-oracledb-exporter
labels:
helm.sh/chart: oracledb-exporter-1.0.0
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
app.kubernetes.io/version: "0.6.0"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
template:
metadata:
annotations:
prometheus.io/path: /metrics
prometheus.io/port: "9161"
prometheus.io/scrape: "true"
labels:
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
spec:
serviceAccountName: release-name-oracledb-exporter
securityContext:
{}
volumes:
- name: custom-metrics
configMap:
name: release-name-oracledb-exporter-custom-metrics
defaultMode: 420
containers:
- name: oracledb-exporter
securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
image: "ghcr.io/iamseth/oracledb_exporter:0.6.0"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9161
name: http
protocol: TCP
env:
- name: DATA_SOURCE_NAME
valueFrom:
secretKeyRef:
name: release-name-oracledb-exporter-secret
key: datasource
- name: CUSTOM_METRICS
value: /tmp/custom-metrics.toml
volumeMounts:
- name: custom-metrics
mountPath: /tmp/custom-metrics.toml
subPath: custom-metrics.toml
livenessProbe:
httpGet:
path: /
port: 9161
readinessProbe:
httpGet:
path: /
port: 9161
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
7 changes: 4 additions & 3 deletions source/oracledb-exporter/tests/golden/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: release-name-oracledb-exporter
labels:
helm.sh/chart: oracledb-exporter-1.1.0
helm.sh/chart: oracledb-exporter-1.0.0
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
Expand All @@ -31,7 +31,7 @@ kind: Service
metadata:
name: release-name-oracledb-exporter
labels:
helm.sh/chart: oracledb-exporter-1.1.0
helm.sh/chart: oracledb-exporter-1.0.0
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
Expand All @@ -57,7 +57,7 @@ kind: Deployment
metadata:
name: release-name-oracledb-exporter
labels:
helm.sh/chart: oracledb-exporter-1.1.0
helm.sh/chart: oracledb-exporter-1.0.0
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
Expand Down Expand Up @@ -102,6 +102,7 @@ spec:
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9161
name: http
protocol: TCP
env:
- name: DATA_SOURCE_NAME
Expand Down
133 changes: 133 additions & 0 deletions source/oracledb-exporter/tests/golden/existing-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
# Source: oracledb-exporter/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: release-name-oracledb-exporter
labels:
helm.sh/chart: oracledb-exporter-1.0.0
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
app.kubernetes.io/version: "0.6.0"
app.kubernetes.io/managed-by: Helm
---
# Source: oracledb-exporter/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: release-name-oracledb-exporter-custom-metrics
data:
custom-metrics.toml: |-
[[metric]]
context = "test"
request = "SELECT 1 as value_1, 2 as value_2 FROM DUAL"
metricsdesc = { value_1 = "Simple example returning always 1.", value_2 = "Same but returning always 2." }
---
# Source: oracledb-exporter/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: release-name-oracledb-exporter
labels:
helm.sh/chart: oracledb-exporter-1.0.0
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
app.kubernetes.io/version: "0.6.0"
app.kubernetes.io/managed-by: Helm
spec:
type: ClusterIP
ports:
- port: 9161
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
---
# Source: oracledb-exporter/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: release-name-oracledb-exporter
labels:
helm.sh/chart: oracledb-exporter-1.0.0
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
app.kubernetes.io/version: "0.6.0"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
template:
metadata:
annotations:
prometheus.io/path: /metrics
prometheus.io/port: "9161"
prometheus.io/scrape: "true"
labels:
app.kubernetes.io/name: oracledb-exporter
app.kubernetes.io/instance: release-name
app: release-name
release: release-name
spec:
serviceAccountName: release-name-oracledb-exporter
securityContext:
{}
volumes:
- name: custom-metrics
configMap:
name: release-name-oracledb-exporter-custom-metrics
defaultMode: 420
containers:
- name: oracledb-exporter
securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
image: "ghcr.io/iamseth/oracledb_exporter:0.6.0"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9161
name: http
protocol: TCP
env:
- name: DATA_SOURCE_NAME
valueFrom:
secretKeyRef:
name: some-secret-name
key: datasource
- name: CUSTOM_METRICS
value: /tmp/custom-metrics.toml
volumeMounts:
- name: custom-metrics
mountPath: /tmp/custom-metrics.toml
subPath: custom-metrics.toml
livenessProbe:
httpGet:
path: /
port: 9161
readinessProbe:
httpGet:
path: /
port: 9161
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
3 changes: 3 additions & 0 deletions source/oracledb-exporter/tests/values/db-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dbConnection:
createDbConnectionSecret: true
dbDonnectionString: "oracle://system:192.168.88.222@oracle:1521/xe"
1 change: 1 addition & 0 deletions source/oracledb-exporter/tests/values/existing-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
existingDbSecretName: "some-secret-name"

0 comments on commit 3c2eac6

Please sign in to comment.