Move service related variables into service map (#1521)

Moving variables related to the service into a map along with the annotations
This commit is contained in:
nomis2k
2017-07-28 07:44:00 +02:00
committed by Reinhard Nägele
parent 0f7dfa14a1
commit 2e62901584
4 changed files with 64 additions and 59 deletions
+19 -15
View File
@@ -29,18 +29,22 @@ The command removes all the Kubernetes components associated with the chart and
## Configuration
| Parameter | Description | Default |
|----------------------------------------|-------------------------------------|---------------------------------------------------|
| `server.image` | Container image to run | grafana/grafana:latest |
| `server.adminUser` | Admin user username | admin |
| `server.adminPassword` | Admin user password | admin |
| `server.persistentVolume.enabled` | Create a volume to store data | true |
| `server.persistentVolume.size` | Size of persistent volume claim | 1Gi RW |
| `server.persistentVolume.storageClass` | Type of persistent volume claim | `nil` (uses alpha storage class annotation) |
| `server.persistentVolume.accessMode` | ReadWriteOnce or ReadOnly | [ReadWriteOnce] |
| `server.persistentVolume.existingClaim`| Existing persistent volume claim | null |
| `server.persistentVolume.subPath` | Subdirectory of pvc to mount | null |
| `server.resources` | Server resource requests and limits | requests: {cpu: 100m, memory: 100Mi} |
| `server.serviceType` | ClusterIP, NodePort, or LoadBalancer| ClusterIP |
| `server.setDatasource.enabled` | Creates grafana datasource with job | false |
| `server.service.annotations` | Service annotations | null |
| Parameter | Description | Default |
|-------------------------------------------|-------------------------------------|---------------------------------------------------|
| `server.image` | Container image to run | grafana/grafana:latest |
| `server.adminUser` | Admin user username | admin |
| `server.adminPassword` | Admin user password | admin |
| `server.persistentVolume.enabled` | Create a volume to store data | true |
| `server.persistentVolume.size` | Size of persistent volume claim | 1Gi RW |
| `server.persistentVolume.storageClass` | Type of persistent volume claim | `nil` (uses alpha storage class annotation) |
| `server.persistentVolume.accessMode` | ReadWriteOnce or ReadOnly | [ReadWriteOnce] |
| `server.persistentVolume.existingClaim` | Existing persistent volume claim | null |
| `server.persistentVolume.subPath` | Subdirectory of pvc to mount | null |
| `server.resources` | Server resource requests and limits | requests: {cpu: 100m, memory: 100Mi} |
| `server.service.annotations` | Service annotations | null |
| `server.service.httpPort` | Service port | 80 |
| `server.service.loadBalancerIP` | IP to assign to load balancer | null |
| `server.service.loadBalancerSourceRanges` | List of IP CIDRs allowed access | null |
| `server.service.nodePort` | For service type "NodePort" | null |
| `server.service.type` | ClusterIP, NodePort, or LoadBalancer| ClusterIP |
| `server.setDatasource.enabled` | Creates grafana datasource with job | false |
+4 -4
View File
@@ -2,7 +2,7 @@
kubectl get secret --namespace {{ .Release.Namespace }} {{ template "grafana.server.fullname" . }} -o jsonpath="{.data.grafana-admin-password}" | base64 --decode ; echo
2. The Grafana server can be accessed via port {{ .Values.server.httpPort }} on the following DNS name from within your cluster:
2. The Grafana server can be accessed via port {{ .Values.server.service.httpPort }} on the following DNS name from within your cluster:
{{ template "grafana.server.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
{{ if .Values.server.ingress.enabled }}
@@ -12,16 +12,16 @@
{{- end }}
{{ else }}
Get the Grafana URL to visit by running these commands in the same shell:
{{ if contains "NodePort" .Values.server.serviceType -}}
{{ if contains "NodePort" .Values.server.service.type -}}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "grafana.server.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{ else if contains "LoadBalancer" .Values.server.serviceType -}}
{{ else if contains "LoadBalancer" .Values.server.service.type -}}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "grafana.server.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "grafana.server.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.server.httpPort -}}
{{ else if contains "ClusterIP" .Values.server.serviceType }}
{{ else if contains "ClusterIP" .Values.server.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "grafana.fullname" . }},component={{ .Values.server.name }}" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 3000
{{- end }}
+11 -11
View File
@@ -14,26 +14,26 @@ metadata:
name: {{ template "grafana.server.fullname" . }}
spec:
ports:
- name: {{ default "http" .Values.server.httpPortName | quote }}
port: {{ .Values.server.httpPort }}
- name: {{ default "http" .Values.server.service.httpPortName | quote }}
port: {{ .Values.server.service.httpPort }}
protocol: TCP
targetPort: 3000
{{- if contains "NodePort" .Values.server.serviceType }}
{{- if .Values.server.nodePort }}
nodePort: {{ .Values.server.nodePort }}
{{- if contains "NodePort" .Values.server.service.type }}
{{- if .Values.server.service.nodePort }}
nodePort: {{ .Values.server.service.nodePort }}
{{- end }}
{{- end }}
selector:
app: {{ template "grafana.fullname" . }}
component: "{{ .Values.server.name }}"
type: "{{ .Values.server.serviceType }}"
{{- if contains "LoadBalancer" .Values.server.serviceType }}
{{- if .Values.server.loadBalancerIP }}
loadBalancerIP: {{ .Values.server.loadBalancerIP }}
type: "{{ .Values.server.service.type }}"
{{- if contains "LoadBalancer" .Values.server.service.type }}
{{- if .Values.server.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.server.service.loadBalancerIP }}
{{- end -}}
{{- if .Values.server.loadBalancerSourceRanges }}
{{- if .Values.server.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- range .Values.server.loadBalancerSourceRanges }}
{{- range .Values.server.service.loadBalancerSourceRanges }}
- {{ . }}
{{- end }}
{{- end -}}
+30 -29
View File
@@ -4,10 +4,6 @@ server:
# annotations:
# iam.amazonaws.com/role: grafana
## Grafana service port
##
httpPort: 80
## Grafana Docker image
##
image: "grafana/grafana:latest"
@@ -107,36 +103,41 @@ server:
cpu: 100m
memory: 100Mi
## Grafana service type
##
serviceType: ClusterIP
## Grafana service annotations
##
## Grafana service
service:
## Grafana service annotations
##
annotations: {}
## Load balancer IP address
## Is not required, but allows for static address with
## serviceType LoadBalancer.
## If not supported by cloud provider, this field is ignored.
## Default: nil
##
# loadBalancerIP: 130.211.x.x
## Grafana service type
##
type: ClusterIP
## This will restrict traffic through the cloud-provider load-balancer
## to the specified client IPs.
## If not supported by cloud provider, this field is ignored.
## Default: nil
##
# loadBalancerSourceRanges:
# - 0.0.0.0/0
## Grafana service port
##
httpPort: 80
## nodePort port number
## Is not required, but allows for static port assignment with
## serviceType NodePort.
## Default: nil
# nodePort: 30000
## Load balancer IP address
## Is not required, but allows for static address with
## serviceType LoadBalancer.
## If not supported by cloud provider, this field is ignored.
## Default: nil
##
# loadBalancerIP: 130.211.x.x
## This will restrict traffic through the cloud-provider load-balancer
## to the specified client IPs.
## If not supported by cloud provider, this field is ignored.
## Default: nil
##
# loadBalancerSourceRanges:
# - 0.0.0.0/0
## nodePort port number
## Is not required, but allows for static port assignment with
## serviceType NodePort.
## Default: nil
# nodePort: 30000
## Grafana local config path
## Default '/etc/grafana'