From a03ee4ea2db8bd2d474b22ff8cb4c4e168fed2e8 Mon Sep 17 00:00:00 2001 From: Bryan Brancotte <bryan.brancotte@pasteur.fr> Date: Thu, 25 May 2023 16:51:50 +0200 Subject: [PATCH] use packaged helm recipe rshiny --- .gitignore | 25 ++++++++++++++++ chart/Chart.yaml | 13 ++++++--- chart/charts/.gitkeep | 0 chart/templates/.gitkeep | 0 chart/templates/_helpers.tpl | 51 --------------------------------- chart/templates/deployment.yaml | 38 ------------------------ chart/templates/hpa.yaml | 28 ------------------ chart/templates/ingress.yaml | 21 -------------- chart/templates/service.yaml | 14 --------- chart/values.yaml | 28 +----------------- 10 files changed, 35 insertions(+), 183 deletions(-) create mode 100644 .gitignore create mode 100644 chart/charts/.gitkeep create mode 100644 chart/templates/.gitkeep delete mode 100644 chart/templates/_helpers.tpl delete mode 100644 chart/templates/deployment.yaml delete mode 100644 chart/templates/hpa.yaml delete mode 100644 chart/templates/ingress.yaml delete mode 100644 chart/templates/service.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..74afef7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ +rshiny-*.tgz +chart/charts/*tgz +Chart.lock diff --git a/chart/Chart.yaml b/chart/Chart.yaml index bd9877c..11b899f 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -name: rshiny -description: A Helm chart for deploying rshiny app in Kubernetes +name: rshiny-example +description: An example # A chart can be either an 'application' or a 'library' chart. # @@ -15,10 +15,15 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 +version: 1.0.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "1.16.0" +appVersion: "1.0.0" + +dependencies: +- name: rshiny + version: "0.2.0" + repository: "https://gitlab.pasteur.fr/api/v4/projects/5334/packages/helm/stable" diff --git a/chart/charts/.gitkeep b/chart/charts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/chart/templates/.gitkeep b/chart/templates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl deleted file mode 100644 index b4c3802..0000000 --- a/chart/templates/_helpers.tpl +++ /dev/null @@ -1,51 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "chart.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 "chart.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 "chart.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "chart.labels" -}} -helm.sh/chart: {{ include "chart.chart" . }} -{{ include "chart.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "chart.selectorLabels" -}} -app.kubernetes.io/name: {{ include "chart.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml deleted file mode 100644 index 4b20e17..0000000 --- a/chart/templates/deployment.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "chart.fullname" . }} - labels: - {{- include "chart.labels" . | nindent 4 }} -spec: - selector: - matchLabels: - {{- include "chart.selectorLabels" . | nindent 6 }} -{{- if .Values.nodowntime.enabled }} - strategy: - type: RollingUpdate - rollingUpdate: - maxSurge: 1 - maxUnavailable: 0 -{{- end }} - template: - metadata: - labels: - {{- include "chart.selectorLabels" . | nindent 8 }} - spec: - imagePullSecrets: - - name: registry-gitlab - containers: - - name: rshiny-pod - image: {{ .Values.imageFullNameAndTag }} - securityContext: - runAsGroup: 999 - runAsUser: 999 - ports: - - name: http - containerPort: 3838 - protocol: TCP - resources: - {{- toYaml .Values.resources | nindent 12 }} ---- \ No newline at end of file diff --git a/chart/templates/hpa.yaml b/chart/templates/hpa.yaml deleted file mode 100644 index 548ee03..0000000 --- a/chart/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "chart.fullname" . }} - labels: - {{- include "chart.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "chart.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/chart/templates/ingress.yaml b/chart/templates/ingress.yaml deleted file mode 100644 index f6d131a..0000000 --- a/chart/templates/ingress.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - annotations: - {{- toYaml .Values.ingress.annotations | nindent 4 }} - name: {{ include "chart.fullname" . }} -spec: - ingressClassName: {{ .Values.ingress.className | quote }} - rules: - - host: {{ .Values.ingress.hostname | quote }} - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: {{ include "chart.fullname" . }} - port: - number: 8080 ---- \ No newline at end of file diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml deleted file mode 100644 index 609de41..0000000 --- a/chart/templates/service.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ include "chart.fullname" . }} -spec: - type: ClusterIP - ports: - - name: http - port: 8080 - targetPort: 3838 - selector: - {{- include "chart.selectorLabels" . | nindent 4 }} ---- \ No newline at end of file diff --git a/chart/values.yaml b/chart/values.yaml index e0d8b1f..768686d 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -1,31 +1,5 @@ autoscaling: enabled: true - minReplicas: 1 - maxReplicas: 2 - targetCPUUtilizationPercentage: 80 - targetMemoryUtilizationPercentage: 80 - nodowntime: - enabled: true - - -imageFullNameAndTag: registry-gitlab.pasteur.fr/hub/rshiny-k8s-example/main:latest - - -resources: - requests: - memory: "256Mi" - cpu: "500m" - limits: - memory: "512Mi" - cpu: "1000m" - - -ingress: - enabled: true - className: "" - annotations: - nginx.ingress.kubernetes.io/affinity: cookie - nginx.ingress.kubernetes.io/proxy-body-size: 256m - hostname: "" + enabled: true \ No newline at end of file -- GitLab