From 3fcaff9119f40c8b16c39e0c74cf1dfca6f7480a Mon Sep 17 00:00:00 2001 From: Donatien Eneman <45652587+Donatien26@users.noreply.github.com> Date: Thu, 12 Nov 2020 21:52:22 +0100 Subject: [PATCH] Sugoi (#9) --- charts/sugoi-ui/templates/_helpers.tpl | 62 --------- charts/sugoi-ui/templates/deployment.yaml | 66 ---------- charts/sugoi-ui/templates/hpa.yaml | 28 ---- charts/sugoi-ui/templates/ingress.yaml | 32 ----- charts/sugoi-ui/templates/service.yaml | 15 --- charts/sugoi-ui/values.yaml | 81 ------------ charts/{sugoi-ui => sugoi}/.helmignore | 0 charts/{sugoi-ui => sugoi}/Chart.yaml | 4 +- .../{sugoi-ui => sugoi}/templates/NOTES.txt | 0 charts/sugoi/templates/_helpers.tpl | 124 ++++++++++++++++++ charts/sugoi/templates/deployment-api.yaml | 60 +++++++++ charts/sugoi/templates/deployment-ui.yaml | 69 ++++++++++ charts/sugoi/templates/ingress.yaml | 41 ++++++ charts/sugoi/templates/service-api.yaml | 15 +++ charts/sugoi/templates/service-ui.yaml | 15 +++ .../sugoi/templates/serviceaccount-api.yaml | 12 ++ .../templates/serviceaccount-ui.yaml} | 6 +- .../templates/tests/test-connection-api.yaml | 15 +++ .../templates/tests/test-connection-ihm.yaml} | 6 +- charts/sugoi/values.yaml | 102 ++++++++++++++ 20 files changed, 461 insertions(+), 292 deletions(-) delete mode 100644 charts/sugoi-ui/templates/_helpers.tpl delete mode 100644 charts/sugoi-ui/templates/deployment.yaml delete mode 100644 charts/sugoi-ui/templates/hpa.yaml delete mode 100644 charts/sugoi-ui/templates/ingress.yaml delete mode 100644 charts/sugoi-ui/templates/service.yaml delete mode 100644 charts/sugoi-ui/values.yaml rename charts/{sugoi-ui => sugoi}/.helmignore (100%) rename charts/{sugoi-ui => sugoi}/Chart.yaml (97%) rename charts/{sugoi-ui => sugoi}/templates/NOTES.txt (100%) create mode 100644 charts/sugoi/templates/_helpers.tpl create mode 100644 charts/sugoi/templates/deployment-api.yaml create mode 100644 charts/sugoi/templates/deployment-ui.yaml create mode 100644 charts/sugoi/templates/ingress.yaml create mode 100644 charts/sugoi/templates/service-api.yaml create mode 100644 charts/sugoi/templates/service-ui.yaml create mode 100644 charts/sugoi/templates/serviceaccount-api.yaml rename charts/{sugoi-ui/templates/serviceaccount.yaml => sugoi/templates/serviceaccount-ui.yaml} (63%) create mode 100644 charts/sugoi/templates/tests/test-connection-api.yaml rename charts/{sugoi-ui/templates/tests/test-connection.yaml => sugoi/templates/tests/test-connection-ihm.yaml} (50%) create mode 100644 charts/sugoi/values.yaml diff --git a/charts/sugoi-ui/templates/_helpers.tpl b/charts/sugoi-ui/templates/_helpers.tpl deleted file mode 100644 index 0e7c52268211..000000000000 --- a/charts/sugoi-ui/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "sugoi-ui.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 "sugoi-ui.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 "sugoi-ui.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "sugoi-ui.labels" -}} -helm.sh/chart: {{ include "sugoi-ui.chart" . }} -{{ include "sugoi-ui.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "sugoi-ui.selectorLabels" -}} -app.kubernetes.io/name: {{ include "sugoi-ui.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "sugoi-ui.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "sugoi-ui.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/charts/sugoi-ui/templates/deployment.yaml b/charts/sugoi-ui/templates/deployment.yaml deleted file mode 100644 index 2f2972b2781d..000000000000 --- a/charts/sugoi-ui/templates/deployment.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "sugoi-ui.fullname" . }} - labels: - {{- include "sugoi-ui.labels" . | nindent 4 }} -spec: -{{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} -{{- end }} - selector: - matchLabels: - {{- include "sugoi-ui.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "sugoi-ui.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "sugoi-ui.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 }} - env: - {{- range .Values.env }} - - name: {{ .name }} - value: {{ .value }} - {{- end }} - ports: - - name: http - containerPort: 80 - 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/sugoi-ui/templates/hpa.yaml b/charts/sugoi-ui/templates/hpa.yaml deleted file mode 100644 index 73db3592da3d..000000000000 --- a/charts/sugoi-ui/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "sugoi-ui.fullname" . }} - labels: - {{- include "sugoi-ui.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "sugoi-ui.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/charts/sugoi-ui/templates/ingress.yaml b/charts/sugoi-ui/templates/ingress.yaml deleted file mode 100644 index eac023b50634..000000000000 --- a/charts/sugoi-ui/templates/ingress.yaml +++ /dev/null @@ -1,32 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "sugoi-ui.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 "sugoi-ui.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: -{{- if .Values.ingress.tls }} - tls: - - hosts: - - {{ .Values.ingress.hostname | quote }} -{{- end }} - rules: - - host: {{ .Values.ingress.hostname | quote }} - http: - paths: - - path: / - backend: - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} -{{- end }} \ No newline at end of file diff --git a/charts/sugoi-ui/templates/service.yaml b/charts/sugoi-ui/templates/service.yaml deleted file mode 100644 index 08b0d3159555..000000000000 --- a/charts/sugoi-ui/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "sugoi-ui.fullname" . }} - labels: - {{- include "sugoi-ui.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "sugoi-ui.selectorLabels" . | nindent 4 }} diff --git a/charts/sugoi-ui/values.yaml b/charts/sugoi-ui/values.yaml deleted file mode 100644 index 0860634aa841..000000000000 --- a/charts/sugoi-ui/values.yaml +++ /dev/null @@ -1,81 +0,0 @@ -# Default values for sugoi-ui. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: inseefrlab/sugoi-ui - pullPolicy: Always - # Overrides the image tag whose default is the chart appVersion. - tag: "main" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: true - # 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: "" - -podAnnotations: {} - -podSecurityContext: - {} - # fsGroup: 2000 - -securityContext: - {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 80 - -ingress: - enabled: true - tls: true - hostname: example.com - annotations: - kubernetes.io/ingress.class: nginx - # nginx.ingress.kubernetes.io/use-regex: "true" - -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 - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} - -env: - # - name: KEYCLOAK_REALM - # value: "" diff --git a/charts/sugoi-ui/.helmignore b/charts/sugoi/.helmignore similarity index 100% rename from charts/sugoi-ui/.helmignore rename to charts/sugoi/.helmignore diff --git a/charts/sugoi-ui/Chart.yaml b/charts/sugoi/Chart.yaml similarity index 97% rename from charts/sugoi-ui/Chart.yaml rename to charts/sugoi/Chart.yaml index 38979a8f493e..aae532a280a1 100644 --- a/charts/sugoi-ui/Chart.yaml +++ b/charts/sugoi/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: sugoi-ui +name: sugoi description: A Helm chart for Kubernetes # A chart can be either an 'application' or a 'library' chart. @@ -15,7 +15,7 @@ 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 diff --git a/charts/sugoi-ui/templates/NOTES.txt b/charts/sugoi/templates/NOTES.txt similarity index 100% rename from charts/sugoi-ui/templates/NOTES.txt rename to charts/sugoi/templates/NOTES.txt diff --git a/charts/sugoi/templates/_helpers.tpl b/charts/sugoi/templates/_helpers.tpl new file mode 100644 index 000000000000..9fa27fc0a967 --- /dev/null +++ b/charts/sugoi/templates/_helpers.tpl @@ -0,0 +1,124 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "sugoi.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "sugoi.ui.name" -}} +{{- printf "%s-%s" (include "sugoi.name" .) .Values.ui.name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "sugoi.api.name" -}} +{{- printf "%s-%s" (include "sugoi.name" .) .Values.api.name | 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 "sugoi.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 -}} + +{{- define "sugoi.ui.fullname" -}} +{{- printf "%s-%s" (include "sugoi.fullname" .) .Values.ui.name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "sugoi.api.fullname" -}} +{{- printf "%s-%s" (include "sugoi.fullname" .) .Values.api.name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "sugoi.chart" -}} +{{- printf "sugoi" -}} +{{- end -}} + +{{- define "sugoi.api.chart" -}} +{{- printf "sugoi-api" -}} +{{- end -}} + +{{- define "sugoi.ui.chart" -}} +{{- printf "sugoi-ui" -}} +{{- end -}} + + +{{/*Common labels*/}} + +{{- define "sugoi.labels" -}} +helm.sh/chart: {{ include "sugoi.chart" . }} +{{ include "sugoi.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{- define "sugoi.api.labels" -}} +helm.sh/chart: {{ include "sugoi.api.chart" . }} +{{ include "sugoi.api.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{- define "sugoi.ui.labels" -}} +helm.sh/chart: {{ include "sugoi.ui.chart" . }} +{{ include "sugoi.ui.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/*Selector labels*/}} +{{- define "sugoi.selectorLabels" -}} +app.kubernetes.io/name: {{ include "sugoi.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + + +{{- define "sugoi.api.selectorLabels" -}} +app.kubernetes.io/name: {{ include "sugoi.api.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{- define "sugoi.ui.selectorLabels" -}} +app.kubernetes.io/name: {{ include "sugoi.ui.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/*Create the name of the service account to use*/}} + +{{- define "sugoi.api.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "sugoi.api.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{- define "sugoi.ui.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "sugoi.ui.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/sugoi/templates/deployment-api.yaml b/charts/sugoi/templates/deployment-api.yaml new file mode 100644 index 000000000000..e635e52f0e51 --- /dev/null +++ b/charts/sugoi/templates/deployment-api.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "sugoi.api.fullname" . }} + labels: + {{- include "sugoi.api.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.api.replicaCount }} + selector: + matchLabels: + {{- include "sugoi.api.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "sugoi.api.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.api.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "sugoi.api.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.api.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.api.securityContext | nindent 12 }} + image: "{{ .Values.api.image.name }}:{{ .Values.api.image.version }}" + env: + {{- range .Values.ui.env }} + - name: {{ .name }} + value: {{ .value }} + {{- end }} + imagePullPolicy: {{ .Values.api.image.pullPolicy }} + ports: + - name: http + containerPort: 8080 + protocol: TCP + livenessProbe: + httpGet: + path: /public/healthcheck + port: http + readinessProbe: + httpGet: + path: /public/healthcheck + port: http + resources: + {{- toYaml .Values.api.resources | nindent 12 }} + {{- with .Values.api.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.api.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.api.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/sugoi/templates/deployment-ui.yaml b/charts/sugoi/templates/deployment-ui.yaml new file mode 100644 index 000000000000..0d8449515a70 --- /dev/null +++ b/charts/sugoi/templates/deployment-ui.yaml @@ -0,0 +1,69 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "sugoi.ui.fullname" . }} + labels: + {{- include "sugoi.ui.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.ui.replicaCount }} + selector: + matchLabels: + {{- include "sugoi.ui.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "sugoi.ui.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "sugoi.ui.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.ui.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.ui.securityContext | nindent 12 }} + image: "{{ .Values.ui.image.name }}:{{ .Values.ui.image.version }}" + imagePullPolicy: {{ .Values.ui.image.pullPolicy }} + env: + {{- if .Values.ingress.enabled }} + {{- if .Values.ingress.tls }} + - name: API_URL_CI + value: {{ printf "https://%s/%s" .Values.ingress.hostname "api/" | quote }} + {{- else }} + - name: API_URL_CI + value: {{ printf "http://%s/%s" .Values.ingress.hostname "api/" | quote }} + {{- end}} + {{- end}} + {{- range .Values.ui.env }} + - name: {{ .name }} + value: {{ .value }} + {{- end }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.ui.resources | nindent 12 }} + {{- with .Values.ui.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.ui.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.ui.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/sugoi/templates/ingress.yaml b/charts/sugoi/templates/ingress.yaml new file mode 100644 index 000000000000..9ee684df2e9b --- /dev/null +++ b/charts/sugoi/templates/ingress.yaml @@ -0,0 +1,41 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullNameApi := include "sugoi.api.fullname" . -}} +{{- $fullNameUi := include "sugoi.ui.fullname" . -}} +{{- $fullName := include "sugoi.fullname" . -}} +{{- $svcPortApi := .Values.api.service.port -}} +{{- $svcPortUi := .Values.api.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 "sugoi.labels" . | nindent 4 }} + annotations: + {{- with .Values.ingress.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + nginx.ingress.kubernetes.io/rewrite-target: /$1 + +spec: +{{- if .Values.ingress.tls }} + tls: + - hosts: + - {{ .Values.ingress.hostname | quote }} +{{- end }} + rules: + - host: {{ .Values.ingress.hostname | quote }} + http: + paths: + - path: /api/(.*) + backend: + serviceName: {{ $fullNameApi }} + servicePort: {{ $svcPortApi }} + - path: /(.*) + backend: + serviceName: {{$fullNameUi}} + servicePort: {{$svcPortUi}} +{{- end }} diff --git a/charts/sugoi/templates/service-api.yaml b/charts/sugoi/templates/service-api.yaml new file mode 100644 index 000000000000..9537fb84d2bf --- /dev/null +++ b/charts/sugoi/templates/service-api.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "sugoi.api.fullname" . }} + labels: + {{- include "sugoi.api.labels" . | nindent 4 }} +spec: + type: {{ .Values.api.service.type }} + ports: + - port: {{ .Values.api.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "sugoi.api.selectorLabels" . | nindent 4 }} diff --git a/charts/sugoi/templates/service-ui.yaml b/charts/sugoi/templates/service-ui.yaml new file mode 100644 index 000000000000..c6de066433ac --- /dev/null +++ b/charts/sugoi/templates/service-ui.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "sugoi.ui.fullname" . }} + labels: + {{- include "sugoi.ui.labels" . | nindent 4 }} +spec: + type: {{ .Values.ui.service.type }} + ports: + - port: {{ .Values.ui.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "sugoi.ui.selectorLabels" . | nindent 4 }} diff --git a/charts/sugoi/templates/serviceaccount-api.yaml b/charts/sugoi/templates/serviceaccount-api.yaml new file mode 100644 index 000000000000..72d6290d0f76 --- /dev/null +++ b/charts/sugoi/templates/serviceaccount-api.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "sugoi.api.serviceAccountName" . }} + labels: + {{- include "sugoi.api.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end -}} diff --git a/charts/sugoi-ui/templates/serviceaccount.yaml b/charts/sugoi/templates/serviceaccount-ui.yaml similarity index 63% rename from charts/sugoi-ui/templates/serviceaccount.yaml rename to charts/sugoi/templates/serviceaccount-ui.yaml index e8945c1558e6..fc57acc628cf 100644 --- a/charts/sugoi-ui/templates/serviceaccount.yaml +++ b/charts/sugoi/templates/serviceaccount-ui.yaml @@ -2,11 +2,11 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "sugoi-ui.serviceAccountName" . }} + name: {{ include "sugoi.ui.serviceAccountName" . }} labels: - {{- include "sugoi-ui.labels" . | nindent 4 }} + {{- include "sugoi.ui.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} -{{- end }} +{{- end -}} diff --git a/charts/sugoi/templates/tests/test-connection-api.yaml b/charts/sugoi/templates/tests/test-connection-api.yaml new file mode 100644 index 000000000000..3400bcbd0156 --- /dev/null +++ b/charts/sugoi/templates/tests/test-connection-api.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "sugoi.api.fullname" . }}-test-connection" + labels: + {{- include "sugoi.api.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "sugoi.api.fullname" . }}:{{ .Values.api.service.port }}'] + restartPolicy: Never diff --git a/charts/sugoi-ui/templates/tests/test-connection.yaml b/charts/sugoi/templates/tests/test-connection-ihm.yaml similarity index 50% rename from charts/sugoi-ui/templates/tests/test-connection.yaml rename to charts/sugoi/templates/tests/test-connection-ihm.yaml index b94b30450117..7f7b0ac461b5 100644 --- a/charts/sugoi-ui/templates/tests/test-connection.yaml +++ b/charts/sugoi/templates/tests/test-connection-ihm.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Pod metadata: - name: "{{ include "sugoi-ui.fullname" . }}-test-connection" + name: "{{ include "sugoi.ui.fullname" . }}-test-connection" labels: - {{- include "sugoi-ui.labels" . | nindent 4 }} + {{- include "sugoi.ui.labels" . | nindent 4 }} annotations: "helm.sh/hook": test-success spec: @@ -11,5 +11,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "sugoi-ui.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "sugoi.ui.fullname" . }}:{{ .Values.ui.service.port }}'] restartPolicy: Never diff --git a/charts/sugoi/values.yaml b/charts/sugoi/values.yaml new file mode 100644 index 000000000000..94385ebbc43c --- /dev/null +++ b/charts/sugoi/values.yaml @@ -0,0 +1,102 @@ +imagePullSecrets: [] + +serviceAccount: + # Specifies whether a service account should be created + create: true + # 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: + +ui: + name: ui + replicaCount: 1 + image: + name: inseefrlab/sugoi-ui + version: latest + pullPolicy: Always + podSecurityContext: + {} + # fsGroup: 2000 + securityContext: + {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + service: + type: ClusterIP + port: 80 + 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 + + nodeSelector: {} + + tolerations: [] + + affinity: {} + + env: + # - name: AUTH_TYPE + # value: "none" + +api: + name: api + replicaCount: 1 + image: + name: inseefrlab/sugoi-api + version: latest + pullPolicy: Always + podSecurityContext: + {} + # fsGroup: 2000 + securityContext: + {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + service: + type: ClusterIP + port: 80 + 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 + nodeSelector: {} + tolerations: [] + affinity: {} + env: + # - name: authentication.mode + # value: "none" + +ingress: + enabled: true + tls: true + hostname: example.com + annotations: + kubernetes.io/ingress.class: nginx + # nginx.ingress.kubernetes.io/use-regex: "true"