diff --git a/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/.gitignore b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..77738287f0e619e47739347e957fda11878d3fff --- /dev/null +++ b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/.gitignore @@ -0,0 +1 @@ +dist/ \ No newline at end of file diff --git a/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/Chart.yaml b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7f8f18dd76ee95198d9212a6fa83af40cb995ece --- /dev/null +++ b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/Chart.yaml @@ -0,0 +1,26 @@ +apiVersion: v2 +name: cdb +description: All applications in the cdb ecosystem + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +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 + +# 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. +appVersion: snapshot +maintainers: +- name: takiformation + email: takiformation@takima.school diff --git a/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-config.yaml b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..da89df77a97e1c3bee1c975c1c7dbb9db99547b5 --- /dev/null +++ b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-config.yaml @@ -0,0 +1,14 @@ +{{- if .Values.front.enabled }} + {{- $apiUrl := "" }} + {{- if .Values.api.ingress.tlsEnabled }} + {{- $apiUrl = printf "https://%s" .Values.api.ingress.host | quote }} + {{- else }} + {{- $apiUrl = printf "http://%s" .Values.api.ingress.host | quote }} + {{- end }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.name }}-front +data: + API_URL: {{ $apiUrl }} +{{- end }} \ No newline at end of file diff --git a/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-deployment.yaml b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fa7c697c84c6b69bc07da8282ea9a3952024706f --- /dev/null +++ b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-deployment.yaml @@ -0,0 +1,68 @@ +{{- if .Values.front.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.name }}-front + labels: + app: front +spec: + replicas: {{ .Values.front.replicaCount }} + selector: + matchLabels: + app: front + template: + metadata: + labels: + app: front + spec: + imagePullSecrets: + - name: takima-school-registry + securityContext: + runAsUser: 101 + runAsGroup: 101 + + containers: + - name: front + image: {{ .Values.front.image.repository }}:{{ .Values.front.image.tag }} + imagePullPolicy: Always + ports: + - containerPort: 8080 + resources: + requests: + memory: "32M" + cpu: "0.1" + limits: + memory: "128M" + cpu: "1" + startupProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: 3 + periodSeconds: 1 + successThreshold: 1 + failureThreshold: 5 + livenessProbe: + httpGet: + path: /health + port: 8080 + periodSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + httpGet: + path: /health + port: 8080 + periodSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + securityContext: + allowPrivilegeEscalation: false + + env: + - name: API_URL + valueFrom: + configMapKeyRef: + name: {{ .Values.name }}-front + key: API_URL +{{- end }} \ No newline at end of file diff --git a/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-ingress.yaml b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-ingress.yaml new file mode 100644 index 0000000000000000000000000000000000000000..297d8009a95c0a9e763a5d13ff971c8bd00a678c --- /dev/null +++ b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-ingress.yaml @@ -0,0 +1,25 @@ +{{- if .Values.front.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Values.name }}-front +spec: + ingressClassName: nginx + rules: + - host: {{ .Values.front.ingress.host }} + http: + paths: + - backend: + service: + name: {{ .Values.name }}-front + port: + number: 80 + path: / + pathType: Prefix + {{- if .Values.front.ingress.tlsEnabled }} + tls: + - hosts: + - {{ .Values.front.ingress.host }} + secretName: app-wildcard + {{- end }} +{{- end }} diff --git a/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-service.yaml b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8031d1a9e190946393c8359877c954bfb10ec2d5 --- /dev/null +++ b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/templates/front-service.yaml @@ -0,0 +1,13 @@ +{{- if .Values.front.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.name }}-front +spec: + selector: + app: front + ports: + - protocol: TCP + port: 80 + targetPort: 8080 +{{- end }} \ No newline at end of file diff --git a/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/values.yaml b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9ab42efacd88ffc744ad5862da8aa53e9b1042bf --- /dev/null +++ b/k8s-trainees-main-boilerplate-day-3-step-1/boilerplate/day-3/step-1/values.yaml @@ -0,0 +1,20 @@ +# Default values for CDB app. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +# We have only done front for now +name: cdb + +api: + ingress: + tlsEnabled: false + host: api.to-replace.takima.school + +front: + enabled: true + image: + repository: registry.gitlab.com/takima-school/images/cdb/www + tag: latest + replicaCount: 1 + ingress: + tlsEnabled: false + host: www.to-replace.takima.school \ No newline at end of file