Skip to content

Commit

Permalink
Sync up with the hazelcast Helm Chart repo (helm#15948)
Browse files Browse the repository at this point in the history
Signed-off-by: Rafal Leszko <rafal@hazelcast.com>
  • Loading branch information
Rafał Leszko authored and Ram Sri committed Sep 30, 2019
1 parent 3e4221d commit 8808a97
Show file tree
Hide file tree
Showing 18 changed files with 613 additions and 99 deletions.
7 changes: 4 additions & 3 deletions stable/hazelcast/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
apiVersion: v1
name: hazelcast
version: 1.4.0
version: 2.0.0
appVersion: "3.12.1"
tillerVersion: ">=2.7.2"
kubeVersion: ">=1.9.0-0"
description: Hazelcast IMDG is the most widely used in-memory data grid with hundreds of thousands of installed clusters around the world. It offers caching solutions ensuring that data is in the right place when it’s needed for optimal performance.
keywords:
- hazelcast
- keyvalue
- in-memory
- database
- caching
home: http://hazelcast.com/
home: http://hazelcast.org/
icon: http://hazelcast.com/images/logos/Hazelcast-IMDG-Logo-Orange_Dark_Icon_200px.png
sources:
- https://github.com/hazelcast/hazelcast
Expand Down
90 changes: 57 additions & 33 deletions stable/hazelcast/README.md

Large diffs are not rendered by default.

37 changes: 30 additions & 7 deletions stable/hazelcast/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

To access Hazelcast within the Kubernetes cluster:

- Use Hazelcast Client with Kubernetes Discovery Strategy pointing to DNS: {{ template "hazelcast.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local. Read more at: https://github.com/hazelcast/hazelcast-kubernetes.
- Use Hazelcast Client with Kubernetes Discovery Strategy. Read more at: https://github.com/hazelcast/hazelcast-kubernetes.
{{- if .Values.hazelcast.rest }}

- Use REST endpoint:
*) Insert Data:
$ curl -v -X POST -H "Content-Type: text/plain" -d "bar" http://{{ template "hazelcast.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:5701/hazelcast/rest/maps/mapName/foo
$ curl -v -X POST -H "Content-Type: text/plain" -d "bar" http://{{ template "hazelcast.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}/hazelcast/rest/maps/mapName/foo
*) Get Data:
$ curl http://{{ template "hazelcast.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:5701/hazelcast/rest/maps/mapName/foo
$ curl http://{{ template "hazelcast.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}/hazelcast/rest/maps/mapName/foo
{{- end }}

-------------------------------------------------------------------------------
Expand All @@ -27,8 +27,8 @@ To access Hazelcast from outside the Kubernetes cluster:
clientConfig.getNetworkConfig().addAddress("$SERVICE_IP:{{ .Values.service.port }}");
{{- else if contains "ClusterIP" .Values.service.type }}
*) Forward port from POD:
$ export POD=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "hazelcast.name" . }}" -o jsonpath="{.items[0].metadata.name}")
$ kubectl port-forward --namespace {{ .Release.Namespace }} $POD 5701:5701
$ export POD=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "hazelcast.name" . }},role=hazelcast" -o jsonpath="{.items[0].metadata.name}")
$ kubectl port-forward --namespace {{ .Release.Namespace }} $POD 5701:{{ .Values.service.port }}
*) In Hazelcast Client configure:
clientConfig.getNetworkConfig().setSmartRouting(false);
clientConfig.getNetworkConfig().addAddress("127.0.0.1:5701");
Expand All @@ -52,8 +52,8 @@ To access Hazelcast from outside the Kubernetes cluster:
$ curl http://$SERVICE_IP:{{ .Values.service.port }}/hazelcast/rest/maps/mapName/foo
{{- else if contains "ClusterIP" .Values.service.type }}
*) Forward port from POD:
$ export POD=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "hazelcast.name" . }}" -o jsonpath="{.items[0].metadata.name}")
$ kubectl port-forward --namespace {{ .Release.Namespace }} $POD 5701:5701
$ export POD=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "hazelcast.name" . }},role=hazelcast" -o jsonpath="{.items[0].metadata.name}")
$ kubectl port-forward --namespace {{ .Release.Namespace }} $POD 5701:{{ .Values.service.port }}
*) Insert Data:
$ curl -v -X POST -H "Content-Type: text/plain" -d "bar" http://127.0.0.1:5701/hazelcast/rest/maps/mapName/foo
*) Get Data:
Expand All @@ -68,3 +68,26 @@ To access Hazelcast from outside the Kubernetes cluster:
$ curl http://$NODE_IP:$NODE_PORT/hazelcast/rest/maps/mapName/foo
{{- end }}
{{- end }}

{{- if .Values.mancenter.enabled }}

-------------------------------------------------------------------------------

To access Hazelcast Management Center:

{{- if contains "LoadBalancer" .Values.mancenter.service.type }}
*) Check Management Center external IP:
$ export MANCENTER_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "mancenter.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
*) Open Browser at: http://$MANCENTER_IP:{{ .Values.mancenter.service.port }}/hazelcast-mancenter
{{- else if contains "ClusterIP" .Values.mancenter.service.type }}
*) Forward port from POD:
$ export POD=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "hazelcast.name" . }},role=mancenter" -o jsonpath="{.items[0].metadata.name}")
$ kubectl port-forward --namespace {{ .Release.Namespace }} $POD 8080:8080
*) Open Browser at: http://127.0.0.1:8080/hazelcast-mancenter
{{- else if contains "NodePort" .Values.mancenter.service.type }}
*) Check Node IP and Port:
$ export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
$ export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "mancenter.fullname" . }})
*) Open Browser at: http://$NODE_IP:$NODE_PORT/hazelcast-mancenter
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions stable/hazelcast/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,13 @@ Create the name of the service account to use
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Create a default fully qualified Management Center app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "mancenter.fullname" -}}
{{ (include "hazelcast.fullname" .) | trunc 53 | }}-mancenter
{{- end -}}
10 changes: 5 additions & 5 deletions stable/hazelcast/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{- if or .Values.hazelcast.configurationFiles .Values.hazelcast.yaml }}
{{- if and (or .Values.hazelcast.configurationFiles .Values.hazelcast.yaml) (not .Values.hazelcast.existingConfigMap) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "hazelcast.fullname" . }}-configuration
labels:
app: {{ template "hazelcast.name" . }}
chart: {{ template "hazelcast.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: {{ template "hazelcast.name" . }}
helm.sh/chart: {{ template "hazelcast.chart" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
data:
{{- range $key, $val := .Values.hazelcast.configurationFiles }}
{{ $key }}: |-
Expand Down
44 changes: 44 additions & 0 deletions stable/hazelcast/templates/mancenter-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{- if .Values.mancenter.ingress.enabled -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "{{ include "mancenter.fullname" . }}"
labels:
app.kubernetes.io/name: {{ template "hazelcast.name" . }}
helm.sh/chart: {{ template "hazelcast.chart" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
{{- if .Values.mancenter.ingress.annotations }}
annotations:
{{ toYaml .Values.mancenter.ingress.annotations | indent 4 }}
{{- end }}
spec:
{{- if .Values.mancenter.ingress.tls }}
tls:
{{- range .Values.mancenter.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- $serviceName := include "mancenter.fullname" . -}}
{{- if .Values.mancenter.ingress.hosts }}
{{- range $host := .Values.mancenter.ingress.hosts }}
- host: {{ $host | quote }}
http:
paths:
- backend:
serviceName: {{ $serviceName }}
servicePort: mancenterport
{{- end }}
{{- else }}
- http:
paths:
- backend:
serviceName: {{ $serviceName }}
servicePort: mancenterport
{{- end }}
{{- end }}
26 changes: 26 additions & 0 deletions stable/hazelcast/templates/mancenter-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if and (and .Values.mancenter.enabled .Values.mancenter.persistence.enabled (not .Values.mancenter.persistence.existingClaim)) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "mancenter.fullname" . }}
labels:
app.kubernetes.io/name: {{ template "hazelcast.name" . }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
spec:
accessModes:
{{- range .Values.mancenter.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.mancenter.persistence.size | quote }}
{{- if .Values.mancenter.persistence.storageClass }}
{{- if (eq "-" .Values.mancenter.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.mancenter.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
25 changes: 25 additions & 0 deletions stable/hazelcast/templates/mancenter-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if .Values.mancenter.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "mancenter.fullname" . }}
labels:
app.kubernetes.io/name: {{ template "hazelcast.name" . }}
helm.sh/chart: {{ template "hazelcast.chart" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
spec:
type: {{ .Values.mancenter.service.type }}
{{- if .Values.mancenter.service.clusterIP }}
clusterIP: {{ .Values.mancenter.service.clusterIP }}
{{- end }}
selector:
app.kubernetes.io/name: {{ template "hazelcast.name" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
role: mancenter
ports:
- protocol: TCP
port: {{ .Values.mancenter.service.port }}
targetPort: mancenter
name: mancenterport
{{- end }}
116 changes: 116 additions & 0 deletions stable/hazelcast/templates/mancenter-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{{- if .Values.mancenter.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ template "mancenter.fullname" . }}
labels:
app.kubernetes.io/name: {{ template "hazelcast.name" . }}
helm.sh/chart: {{ template "hazelcast.chart" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
spec:
serviceName: {{ template "mancenter.fullname" . }}
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ template "hazelcast.name" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
role: mancenter
template:
metadata:
labels:
app.kubernetes.io/name: {{ template "hazelcast.name" . }}
helm.sh/chart: {{ template "hazelcast.chart" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
role: mancenter
spec:
{{- if .Values.mancenter.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.mancenter.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end}}
{{- if .Values.mancenter.nodeSelector }}
nodeSelector:
{{ toYaml .Values.mancenter.nodeSelector | indent 8 }}
{{- end }}
hostNetwork: false
hostPID: false
hostIPC: false
securityContext:
runAsNonRoot: true
runAsUser: {{ .Values.securityContext.runAsUser }}
fsGroup: {{ .Values.securityContext.fsGroup }}
containers:
- name: {{ template "mancenter.fullname" . }}
image: "{{ .Values.mancenter.image.repository }}:{{ .Values.mancenter.image.tag }}"
imagePullPolicy: {{ .Values.mancenter.image.pullPolicy | quote }}
resources:
{{ toYaml .Values.mancenter.resources | indent 10 }}
ports:
- name: mancenter
containerPort: 8080
{{- if .Values.mancenter.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /hazelcast-mancenter/health
port: 8080
initialDelaySeconds: {{ .Values.mancenter.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.mancenter.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.mancenter.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.mancenter.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.mancenter.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.mancenter.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /hazelcast-mancenter/health
port: 8080
initialDelaySeconds: {{ .Values.mancenter.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.mancenter.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.mancenter.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.mancenter.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.mancenter.readinessProbe.failureThreshold }}
{{- end }}
volumeMounts:
- name: mancenter-storage
mountPath: /data
env:
- name: MC_LICENSE_KEY
{{- if .Values.mancenter.licenseKeySecretName }}
valueFrom:
secretKeyRef:
name: {{ .Values.mancenter.licenseKeySecretName }}
key: key
{{- else }}
value: {{ .Values.mancenter.licenseKey }}
{{- end }}
- name: JAVA_OPTS
value: "{{ if or .Values.mancenter.licenseKey .Values.mancenter.licenseKeySecretName }}-Dhazelcast.mc.license=$(MC_LICENSE_KEY){{ end }} {{ .Values.mancenter.javaOpts }}"
serviceAccountName: {{ template "hazelcast.serviceAccountName" . }}
{{- if .Values.securityContext.enabled }}
securityContext:
runAsNonRoot: true
runAsUser: {{ .Values.securityContext.runAsUser }}
privileged: false
readOnlyRootFilesystem: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
{{- end }}
{{- if .Values.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
{{- end }}
serviceAccountName: {{ template "hazelcast.serviceAccountName" . }}
volumes:
- name: mancenter-storage
{{- if .Values.mancenter.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.mancenter.persistence.existingClaim | default (include "mancenter.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end -}}
{{- end -}}
12 changes: 6 additions & 6 deletions stable/hazelcast/templates/metrics-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ kind: Service
metadata:
name: {{ template "hazelcast.fullname" . }}-metrics
labels:
app: {{ template "hazelcast.name" . }}
chart: {{ template "hazelcast.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: {{ template "hazelcast.name" . }}
helm.sh/chart: {{ template "hazelcast.chart" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
annotations:
{{ toYaml .Values.metrics.service.annotations | indent 4 }}
spec:
type: {{ .Values.metrics.service.type }}
selector:
app: {{ template "hazelcast.name" . }}
release: "{{ .Release.Name }}"
app.kubernetes.io/name: {{ template "hazelcast.name" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
ports:
- protocol: TCP
port: {{ .Values.metrics.service.port }}
Expand Down
12 changes: 7 additions & 5 deletions stable/hazelcast/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
kind: ClusterRole
metadata:
name: {{ template "hazelcast.fullname" . }}
labels:
app: {{ template "hazelcast.name" . }}
chart: {{ template "hazelcast.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: {{ template "hazelcast.name" . }}
helm.sh/chart: {{ template "hazelcast.chart" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
rules:
- apiGroups:
- ""
resources:
- endpoints
- pods
- nodes
verbs:
- get
- list
Expand Down
Loading

0 comments on commit 8808a97

Please sign in to comment.