Skip to content

Commit

Permalink
feat: configurable ingress resource
Browse files Browse the repository at this point in the history
  • Loading branch information
ebcFlagman authored and eshepelyuk committed Feb 23, 2021
1 parent ee2824c commit 93aed37
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 3 deletions.
3 changes: 2 additions & 1 deletion templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ spec:
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 9000
containerPort: {{ .Values.ui.port }}
protocol: TCP
args:
- "-Dcmak.zkhosts=127.0.0.1:2181"
- "-Dhttp.port={{ .Values.ui.port }}"
{{- range .Values.ui.extraArgs }}
- {{ . | quote }}
{{- end }}
Expand Down
27 changes: 27 additions & 0 deletions templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if .Values.ingress -}}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: {{ include "cmak.name" . | quote }}
labels:
{{- include "cmak.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{ . | toYaml | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
- hosts:
- {{ .Values.ingress.host | quote }}
secretName: {{ printf "%s-tls" .Values.ingress.host | replace "." "-" | quote }}
{{- end }}
rules:
- host: {{ .Values.ingress.host | quote }}
http:
paths:
- path: {{ .Values.ingress.path | quote }}
backend:
serviceName: {{ include "cmak.name" . | quote }}
servicePort: {{ .Values.ui.port }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
targetPort: zk
protocol: TCP
- name: http
port: 9000
port: {{ .Values.ui.port }}
targetPort: http
protocol: TCP
selector:
Expand Down
5 changes: 5 additions & 0 deletions test-linter/values-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ ui:
limits:
cpu: 100m
memory: 128Mi

ingress:
host: "cmak"
path: "/"

13 changes: 12 additions & 1 deletion values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},

"type": "object", "additionalProperties": false,
"required": ["cmak", "reconcile"],
"required": ["cmak", "reconcile", "ui", "zk"],

"properties": {
"global": { "type": "object", "additionalProperties": true, "title": "placeholder for usage as a subchart" },
Expand Down Expand Up @@ -122,6 +122,17 @@
"properties": {
"resources": { "$ref": "#/definitions/resources" }
}
},
"ingress": {
"type": ["null", "object"], "title": "ingress configuration", "default": null, "additionalProperties": false,
"description": "If object not null, then Ingress resources will be created.",
"required": ["host", "path"],
"properties": {
"host": { "type": "string", "title": "ingress host" },
"path": { "type": "string", "title": "ingress path" },
"tls": { "type": "boolean", "title": "use TLS secret", "default": false },
"annotations": { "type": "object", "title": "optional ingress annotations", "default": {}}
}
}
}
}
15 changes: 15 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ reconcile:

# K8S related settings for CMAK UI container
ui:
port: 9090
# additional command line arguments
extraArgs: []
#- "-DbasicAuthentication.enabled=false"
Expand All @@ -77,3 +78,17 @@ zk:
# cpu: 100m
# memory: 128Mi

# uncomment section and remove null to create Ingress resource
ingress: null
## ingress host
# host: www.cmak.mycompany

## ingress path
# path: /

## Enable TLS configuration for the hostname defined at ingress.host
## secret name will be "${ingress.host.replace(".", "-")}-tls"
# tls: false

## optional ingress annotations
# annotations: {}

0 comments on commit 93aed37

Please sign in to comment.