Skip to content

Commit 668db16

Browse files
committed
fix: Add default config values
1 parent e292cdd commit 668db16

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

charts/host-ip-service/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ apiVersion: v2
22
description: Helm chart to expose host IP services and generate optional Ingress entries per port.
33
name: host-ip-service
44
type: application
5-
version: 0.0.1
5+
version: 0.0.6
66
annotations:
77
"helm.sh/schema": values.schema.json

charts/host-ip-service/templates/ingress.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
{{- $globalAnnotations := .Values.ingress.annotations | default dict }}
1+
{{- $ingress := coalesce .Values.ingress dict }}
2+
{{- $globalAnnotations := coalesce $ingress.annotations dict }}
23
{{- range .Values.endpoint.ports }}
3-
{{- if and .ingress.enabled .ingress.host }}
4+
{{- if and .ingress .ingress.host }}
45
---
56
apiVersion: networking.k8s.io/v1
67
kind: Ingress
78
metadata:
89
name: {{ printf "%s-%s" $.Values.endpoint.name .name }}
910
namespace: {{ $.Values.namespace }}
1011
annotations:
11-
{{- range $k, $v := merge $globalAnnotations (.ingress.annotations | default dict) }}
12+
{{- range $k, $v := merge $globalAnnotations (coalesce .ingress.annotations dict) }}
1213
{{ $k }}: {{ $v | quote }}
1314
{{- end }}
1415
spec:
15-
ingressClassName: {{ .Values.ingress.className | default "nginx" }}
16+
ingressClassName: {{ coalesce $ingress.className "nginx" }}
1617
rules:
1718
- host: {{ .ingress.host }}
1819
http:
@@ -24,9 +25,9 @@ spec:
2425
name: {{ $.Values.endpoint.name }}
2526
port:
2627
number: {{ .port }}
27-
{{- if $.Values.ingress.tls }}
28+
{{- if $ingress.tls }}
2829
tls:
29-
{{- range $.Values.ingress.tls }}
30+
{{- range $ingress.tls }}
3031
- secretName: {{ .secretName }}
3132
hosts:
3233
{{- range .hosts }}

charts/host-ip-service/values.schema.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"properties": {
66
"namespace": {
77
"type": "string",
8+
"default": "default",
89
"description": "Namespace where resources are deployed"
910
},
1011
"endpoint": {
@@ -38,6 +39,7 @@
3839
"properties": {
3940
"enabled": {
4041
"type": "boolean",
42+
"default": false,
4143
"description": "Whether to create an ingress for this port"
4244
},
4345
"host": {
@@ -54,10 +56,11 @@
5456
"additionalProperties": {
5557
"type": "string"
5658
},
59+
"default": {},
5760
"description": "Custom annotations for this ingress"
5861
}
5962
},
60-
"required": ["enabled"]
63+
"default": {}
6164
}
6265
},
6366
"required": ["name", "port"]
@@ -68,21 +71,25 @@
6871
},
6972
"ingress": {
7073
"type": "object",
74+
"default": {},
7175
"description": "Global ingress settings",
7276
"properties": {
7377
"className": {
7478
"type": "string",
79+
"default": "nginx",
7580
"description": "Ingress class to use (e.g., nginx, traefik)"
7681
},
7782
"annotations": {
7883
"type": "object",
84+
"default": {},
7985
"description": "Global ingress annotations",
8086
"additionalProperties": {
8187
"type": "string"
8288
}
8389
},
8490
"tls": {
8591
"type": "array",
92+
"default": [],
8693
"description": "TLS configuration for ingress",
8794
"items": {
8895
"type": "object",
@@ -105,5 +112,5 @@
105112
}
106113
}
107114
},
108-
"required": ["namespace", "endpoint"]
115+
"required": ["endpoint"]
109116
}

0 commit comments

Comments
 (0)