1
0
Fork 0

Rename helm package

This commit is contained in:
Joao Gilberto Magalhaes 2022-08-28 01:05:04 -05:00
parent beb7dfb223
commit fa49e16454
10 changed files with 3 additions and 3 deletions

View file

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "easyhaproxy-ingress.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified 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 "easyhaproxy-ingress.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "easyhaproxy-ingress.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "easyhaproxy-ingress.labels" -}}
helm.sh/chart: {{ include "easyhaproxy-ingress.chart" . }}
{{ include "easyhaproxy-ingress.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "easyhaproxy-ingress.selectorLabels" -}}
app.kubernetes.io/name: {{ include "easyhaproxy-ingress.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "easyhaproxy-ingress.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "easyhaproxy-ingress.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,67 @@
{{- if .Values.serviceAccount.create -}}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "easyhaproxy-ingress.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "easyhaproxy-ingress.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- apiGroups:
- ""
resources:
# - configmaps
# - endpoints
# - nodes
- pods
- services
- namespaces
# - events
- serviceaccounts
verbs:
- get
- list
- watch
- apiGroups:
- "extensions"
- "networking.k8s.io"
resources:
- ingresses
# - ingresses/status
# - ingressclasses
verbs:
- get
- list
- watch
# - apiGroups:
# - "extensions"
# - "networking.k8s.io"
# resources:
# - ingresses/status
# verbs:
# - update
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
# - watch
# - create
# - patch
# - update
# - apiGroups:
# - "discovery.k8s.io"
# resources:
# - endpointslices
# verbs:
# - get
# - list
# - watch
{{- end }}

View file

@ -0,0 +1,22 @@
{{- if .Values.serviceAccount.create -}}
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "easyhaproxy-ingress.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "easyhaproxy-ingress.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "easyhaproxy-ingress.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "easyhaproxy-ingress.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}

View file

@ -0,0 +1,66 @@
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "easyhaproxy-ingress.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "easyhaproxy-ingress.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "easyhaproxy-ingress.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "easyhaproxy-ingress.selectorLabels" . | nindent 8 }}
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: {{ .Values.masterNode.label }}
operator: In
values:
{{- toYaml .Values.masterNode.values | nindent 18 }}
serviceAccountName: {{ include "easyhaproxy-ingress.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
hostPort: 80
- name: https
containerPort: 443
hostPort: 443
- name: stats
containerPort: 1936
hostPort: 1936
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: EASYHAPROXY_DISCOVER
value: kubernetes
- name: HAPROXY_USERNAME
value: {{ .Values.easyhaproxy.stats.username }}
- name: HAPROXY_PASSWORD
value: {{ .Values.easyhaproxy.stats.password }}
- name: EASYHAPROXY_REFRESH_CONF
value: {{ .Values.easyhaproxy.refresh | quote }}
- name: HAPROXY_CUSTOMERRORS
value: {{ .Values.easyhaproxy.customErrors | quote}}
- name: EASYHAPROXY_SSL_MODE
value: {{ .Values.easyhaproxy.sslMode }}
- name: EASYHAPROXY_LOG_LEVEL
value: {{ .Values.easyhaproxy.logLevel.easyhaproxy }}
- name: HAPROXY_LOG_LEVEL
value: {{ .Values.easyhaproxy.logLevel.haproxy }}
- name: CERTBOT_LOG_LEVEL
value: {{ .Values.easyhaproxy.logLevel.certbot }}

View file

@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "easyhaproxy-ingress.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "easyhaproxy-ingress.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}