Skip to content

Commit

Permalink
fix(): k8s helm chart cluster fix scope
Browse files Browse the repository at this point in the history
Signed-off-by: gkarthiks <[email protected]>
  • Loading branch information
gkarthiks committed Mar 11, 2019
1 parent 9ac1acd commit b317d45
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.runScope.cluster -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app: {{ template "prometheus-container-resource-exporter.name" . }}
chart: {{ template "prometheus-container-resource-exporter.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
name: {{ template "prometheus-container-resource-exporter.fullname" . }}
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- list
- apiGroups:
- metrics.k8s.io
resources:
- pods
verbs:
- list
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.runScope.cluster -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app: {{ template "prometheus-container-resource-exporter.name" . }}
chart: {{ template "prometheus-container-resource-exporter.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
name: {{ template "prometheus-container-resource-exporter.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "prometheus-container-resource-exporter.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "prometheus-container-resource-exporter.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "prometheus-container-resource-exporter.fullname" . }}
labels:
app: {{ template "prometheus-container-resource-exporter.name" . }}
chart: {{ template "prometheus-container-resource-exporter.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
name: {{ template "prometheus-container-resource-exporter.fullname" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
Expand All @@ -15,52 +15,49 @@ spec:
release: {{ .Release.Name }}
template:
metadata:
annotations:
prometheus.io/port: "9000"
prometheus.io/scrape: "true"
{{ toYaml .Values.annotations | indent 8 }}
labels:
app: {{ template "prometheus-container-resource-exporter.name" . }}
release: {{ .Release.Name }}
annotations:
prometheus.io/port: "9000"
prometheus.io/scrape: "true"
spec:
serviceAccountName: {{ template "prometheus-container-resource-exporter.serviceAccountName" . }}
containers:
- image: gkarthics/container-resource-exporter:latest
imagePullPolicy: IfNotPresent
{{- if .Values.runScope.local -}}
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
{{- end -}}
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: server-port
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 5
name: {{ .Chart.Name }}
ports:
- containerPort: 9000
name: server-port
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: server-port
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
resources:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.runScope.local }}
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
{{- end }}
ports:
- containerPort: 9000
name: server-port
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: server-port
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /healthz
port: server-port
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

deployTo:
openshift:
enabled: true
host: "cre.example.com"
kubernetes:
enabled: false

runScope:
local: true
cluster: false
Expand All @@ -20,6 +13,7 @@ image:
tag: latest
pullPolicy: IfNotPresent


serviceAccount:
# Specifies whether a ServiceAccount should be created
create: true
Expand Down

0 comments on commit b317d45

Please sign in to comment.