Skip to content

Commit

Permalink
feat: ingress resource
Browse files Browse the repository at this point in the history
  • Loading branch information
eshepelyuk committed Aug 5, 2021
1 parent 2c89c8d commit a938eba
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 2 deletions.
34 changes: 34 additions & 0 deletions templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- if .Values.registry.ingress.enabled -}}
{{ $ing := .Values.registry.ingress }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "apicurio-registry.name" . }}
labels:
{{- include "apicurio-registry-sync.labels" . | nindent 4 }}
{{- with $ing.labels }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- with $ing.annotations }}
annotations:
{{- . | toYaml | nindent 4 }}
{{- end }}
spec:
{{- if $ing.tls }}
tls:
- hosts:
- {{ $ing.host }}
secretName: {{ $ing.host }}
{{- end }}
rules:
- host: {{ $ing.host }}
http:
paths:
- path: {{ $ing.path }}
pathType: ImplementationSpecific
backend:
service:
name: {{ include "apicurio-registry.name" . }}
port:
name: http
{{- end }}
15 changes: 15 additions & 0 deletions test/linter/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ if [ $? -eq 0 ]; then
exit 1
fi

helm lint . --strict --set registry.ingress.enabled=true --set registry.ingress.tls=true
if [ $? -ne 0 ]; then
exit 1
fi

helm lint . --strict --set registry.ingress.enabled=true --set registry.ingress.path=null
if [ $? -eq 0 ]; then
exit 1
fi

helm lint . --strict --set registry.ingress.enabled=true --set registry.ingress.host=null
if [ $? -eq 0 ]; then
exit 1
fi

echo "=================================================================================="
echo " LINT PASSED"
echo "=================================================================================="
18 changes: 16 additions & 2 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@
"name": { "type": "string"},
"value": {"type": "string"}
}
},
"ingress": {
"type": "object", "title": "ingress resource for registry",
"required": ["enabled", "host", "path"],
"properties": {
"enabled": {"type": "boolean", "default": false, "title": "enable ingress resource"},
"host": {"type": "string", "default": "apicurio.local", "title": "hostname"},
"path": {"type": "string", "default": "/", "title": "ingress path"},
"tls": {"type": "boolean", "default": false, "title": "enable TLS for ingress host",
"description": "if TLS enabled the certificate is retrieved from secret with the same name as ingress host"},
"annotations": {"type": "object", "default": {}, "title": "ingress resource annotations"},
"labels": {"type": "object", "default": {}, "title": "ingress resource labels"}
}
}
},

Expand All @@ -61,7 +74,7 @@
"properties": {
"registry": {
"type": "object", "title": "registry settings",
"required": ["enabled", "image", "resources"],
"required": ["enabled", "image", "resources", "ingress"],
"additionalProperties": false,
"properties": {
"enabled": {"$ref": "#/definitions/isEnabled"},
Expand All @@ -72,7 +85,8 @@
},
"resources": {"$ref": "#/definitions/podResources"},
"kafka": {"$ref": "#/definitions/persistence/kafka"},
"sql": {"$ref": "#/definitions/persistence/sql"}
"sql": {"$ref": "#/definitions/persistence/sql"},
"ingress": {"$ref": "#/definitions/ingress"}
}
},
"sync": {
Expand Down
10 changes: 10 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ registry:
tag: "2.0.0.Final"
# list of name, value pairs of extra environment vars
extraEnv: []
# - name: SOME_ENV
# value: SOME_VALUE
resources: {}
# limits:
# cpu: 1000m
Expand All @@ -25,6 +27,14 @@ registry:
# cpu: 200m
# memory: 600Mi

ingress:
enabled: false
host: "apicurio.local"
path: "/"
tls: false
annotations: {}
labels: {}

sync:
enabled: true
image:
Expand Down

0 comments on commit a938eba

Please sign in to comment.