diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..77738287f0e619e47739347e957fda11878d3fff --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist/ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..13566b81b018ad684f3a35fee301741b2734c8f4 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/ch3-gitops.iml b/.idea/ch3-gitops.iml new file mode 100644 index 0000000000000000000000000000000000000000..d6ebd4805981b8400db3e3291c74a743fef9a824 --- /dev/null +++ b/.idea/ch3-gitops.iml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$" /> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..639900d13c6182e452e33a3bd638e70a0146c785 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectRootManager"> + <output url="file://$PROJECT_DIR$/out" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..4c34d1d4b46a89d4c7c127aaa4f288b4d45fa669 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/ch3-gitops.iml" filepath="$PROJECT_DIR$/.idea/ch3-gitops.iml" /> + </modules> + </component> +</project> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..35eb1ddfbbc029bcab630581847471d7f238ec53 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/templates/front-config.yaml b/templates/front-config.yaml index 3a3c1264bd350254e69f5760193416ad1a44b692..da89df77a97e1c3bee1c975c1c7dbb9db99547b5 100644 --- a/templates/front-config.yaml +++ b/templates/front-config.yaml @@ -1,6 +1,6 @@ {{- if .Values.front.enabled }} {{- $apiUrl := "" }} - {{- if .Values.api.ingress.tls.enabled }} + {{- if .Values.api.ingress.tlsEnabled }} {{- $apiUrl = printf "https://%s" .Values.api.ingress.host | quote }} {{- else }} {{- $apiUrl = printf "http://%s" .Values.api.ingress.host | quote }} @@ -8,7 +8,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: front-config + name: {{ .Values.name }}-front data: API_URL: {{ $apiUrl }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/templates/front-deployment.yaml b/templates/front-deployment.yaml index f6f73764e51ee50684e37b3ae870598514582ddf..9f5e41dc39cd8ed768cc50ac0e2b9978ec68ba44 100644 --- a/templates/front-deployment.yaml +++ b/templates/front-deployment.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: front + name: {{ .Values.name }}-front labels: app: front spec: @@ -16,20 +16,50 @@ spec: app: front spec: imagePullSecrets: - - name: auth-master3-registry + - 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: 80 + - containerPort: 8080 resources: requests: - memory: "100Mi" + memory: "32M" cpu: "0.1" limits: - memory: "300Mi" - cpu: "0.5" - env: + 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: diff --git a/templates/front-ingress.yaml b/templates/front-ingress.yaml index 158e1cf23e3836196d38489af7f97dc20ee71abf..8513bb5bc872270f3785ecc4f51469e7b2b881cc 100644 --- a/templates/front-ingress.yaml +++ b/templates/front-ingress.yaml @@ -1,14 +1,10 @@ {{- if .Values.front.enabled }} -{{- if .Values.front.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - annotations: - kubernetes.io/ingress.class: nginx -{{- if .Values.front.ingress.tls.enabled }} - cert-manager.io/cluster-issuer: letsencrypt-prod -{{- end }} - name: front + annotations: + kubernetes.io/ingress.class: nginx + name: {{ .Values.name }}-front spec: rules: - host: {{ .Values.front.ingress.host }} @@ -16,16 +12,15 @@ spec: paths: - backend: service: - name: {{ .Values.front.serviceName }} + name: {{ .Values.name }}-front port: - number: {{ .Values.front.servicePort }} + number: 80 path: / pathType: Prefix -{{- if .Values.front.ingress.tls.enabled }} + {{- if .Values.front.ingress.tlsEnabled }} tls: - hosts: - {{ .Values.front.ingress.host }} - secretName: front-tls - {{- end }} -{{- end }} + secretName: app-wildcard + {{- end }} {{- end }} \ No newline at end of file diff --git a/templates/front-service.yaml b/templates/front-service.yaml index 6c89a724f8b7e7bd40de5aa99374e74b8fda5f75..8031d1a9e190946393c8359877c954bfb10ec2d5 100644 --- a/templates/front-service.yaml +++ b/templates/front-service.yaml @@ -2,12 +2,12 @@ apiVersion: v1 kind: Service metadata: - name: {{ .Values.front.serviceName }} + name: {{ .Values.name }}-front spec: selector: app: front ports: - protocol: TCP - port: {{ .Values.front.servicePort }} - targetPort: 80 + port: 80 + targetPort: 8080 {{- end }} \ No newline at end of file diff --git a/values.yaml b/values.yaml index e4e8cf630ed39d3412cdccbbe495e88b36e66e48..35b966be886815d90f2be45ebccfe32275f6a478 100644 --- a/values.yaml +++ b/values.yaml @@ -1,44 +1,25 @@ # Default values for CDB app. # This is a YAML-formatted file. # Declare variables to be passed into your templates. - -## The global properties are used to configure multiple charts at once. -## Extended documentation at doc/charts/globals.md +# We have only done front for now +name: cdb api: enabled: true + image: + repository: registry.gitlab.com/takima-school/images/cdb/api + tag: latest + replicaCount: 1 ingress: - tls: - enable: false + tlsEnabled: false host: api.to-replace.takima.school front: enabled: true image: - repository: registry.master3.takima.io/guide/kubernetes-resources/front + repository: registry.gitlab.com/takima-school/images/cdb/www tag: latest - serviceName: front - servicePort: 80 - replicaCount: 3 + replicaCount: 1 ingress: - enabled: true - host: www.to-replace.takima.school - tls: - enabled: false - -db: - enabled: true - image: - repository: registry.master3.takima.io/guide/kubernetes-resources/db - tag: latest - name: "cdb-db" - path: "/var/lib/postgresql/data/pgdata" - serviceName: db - servicePort: 5432 - pvc: - storageClass: gp2 - size: 512Mi - credentials: - user: cdb - pwd: cdb123 - + tlsEnabled: false + host: www.to-replace.takima.school \ No newline at end of file