diff --git a/README.md b/README.md new file mode 100644 index 0000000..fd2f137 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# ip-helm + diff --git a/charts/ip/.helmignore b/charts/ip/.helmignore index 0e8a0eb..4379e2b 100644 --- a/charts/ip/.helmignore +++ b/charts/ip/.helmignore @@ -14,10 +14,13 @@ *.swp *.bak *.tmp -*.orig *~ # Various IDEs .project .idea/ *.tmproj .vscode/ +# OWNERS file for Kubernetes +OWNERS +# helm-docs templates +*.gotmpl diff --git a/charts/ip/Chart.yaml b/charts/ip/Chart.yaml index b1c3fce..145c66c 100644 --- a/charts/ip/Chart.yaml +++ b/charts/ip/Chart.yaml @@ -3,7 +3,7 @@ apiVersion: v2 description: Helm chart for ip name: ip type: application -version: 0.1.11 +version: 0.1.12 kubeVersion: ">=1.16.0-0" keywords: - ip @@ -21,3 +21,8 @@ maintainers: # It is recommended to use it with quotes. #appVersion: "1.16.0" appVersion: "latest" + +dependencies: +- name: common + repository: "https://scm.docker.cabillot.eu/perso/helm-library-common/raw/branch/master/" + version: 4.2.0 diff --git a/charts/ip/templates/NOTES.txt b/charts/ip/templates/NOTES.txt index a80d45a..90f7b65 100644 --- a/charts/ip/templates/NOTES.txt +++ b/charts/ip/templates/NOTES.txt @@ -1,22 +1 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "ip.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.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 --namespace {{ .Release.Namespace }} svc -w {{ include "ip.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ip.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "ip.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} +{{- include "common.notes.defaultNotes" . -}} diff --git a/charts/ip/templates/_helpers.tpl b/charts/ip/templates/_helpers.tpl deleted file mode 100644 index cc5abbd..0000000 --- a/charts/ip/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "ip.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 "ip.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 "ip.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "ip.labels" -}} -helm.sh/chart: {{ include "ip.chart" . }} -{{ include "ip.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "ip.selectorLabels" -}} -app.kubernetes.io/name: {{ include "ip.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "ip.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "ip.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/charts/ip/templates/common.yaml b/charts/ip/templates/common.yaml new file mode 100644 index 0000000..64e027a --- /dev/null +++ b/charts/ip/templates/common.yaml @@ -0,0 +1,5 @@ +{{/* Make sure all variables are set properly */}} +{{- include "common.values.setup" . }} + +{{/* Render the templates */}} +{{ include "common.all" . }} diff --git a/charts/ip/templates/deployment.yaml b/charts/ip/templates/deployment.yaml deleted file mode 100644 index 67457d6..0000000 --- a/charts/ip/templates/deployment.yaml +++ /dev/null @@ -1,61 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "ip.fullname" . }} - labels: - {{- include "ip.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "ip.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "ip.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} - 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: 8080 - protocol: TCP - livenessProbe: - httpGet: - path: / - port: http - readinessProbe: - httpGet: - path: / - port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/charts/ip/templates/ingress.yaml b/charts/ip/templates/ingress.yaml deleted file mode 100644 index fbcea1e..0000000 --- a/charts/ip/templates/ingress.yaml +++ /dev/null @@ -1,41 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "ip.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "ip.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - backend: - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} diff --git a/charts/ip/templates/service.yaml b/charts/ip/templates/service.yaml deleted file mode 100644 index f18f982..0000000 --- a/charts/ip/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "ip.fullname" . }} - labels: - {{- include "ip.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "ip.selectorLabels" . | nindent 4 }} diff --git a/charts/ip/values.yaml b/charts/ip/values.yaml index 21e8de8..150b611 100644 --- a/charts/ip/values.yaml +++ b/charts/ip/values.yaml @@ -1,84 +1,63 @@ -# Default values for ip. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 +# +# IMPORTANT NOTE +# +# This chart inherits from our common library chart. You can check the default values/options here: +# https://scm.docker.cabillot.eu/perso/helm-library-common +# image: repository: docker.io/jcabillot/ip - pullPolicy: Always - # Overrides the image tag whose default is the chart appVersion. tag: "" + pullPolicy: Always -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" -automountServiceAccountToken: false - -serviceAccount: - # Specifies whether a service account should be created - create: false - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "ip" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 +env: + TZ: America/New_York service: - type: "ClusterIP" - port: 80 + main: + ports: + http: + port: 8080 ingress: - enabled: false - annotations: - kubernetes.io/ingress.class: "traefik" - cert-manager.io/cluster-issuer: "letsencrypt-prod" - hosts: - - host: "toto.opti.cabillot.eu" - paths: - - path: / - backend: - serviceName: "ip" - servicePort: 80 - tls: - - secretName: "ip-tls" - hosts: - - "toto.opti.cabillot.eu" + main: + enabled: false +# Example +# hosts: +# - host: "yy.xx.zz" +# paths: +# - path: / +# tls: +# - secretName: "ip-tls" +# hosts: +# - "yy.xx.zz" -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi +probes: + liveness: + enabled: true + custom: true + spec: + httpGet: + path: / + port: http + scheme: HTTP + timeoutSeconds: 1 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + readiness: + enabled: true + custom: true + spec: + httpGet: + path: / + port: http + scheme: HTTP + timeoutSeconds: 1 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + startup: + enabled: false -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 1 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} +automountServiceAccountToken: false