diff --git a/Chart.yaml b/Chart.yaml index 7f8f18dd76ee95198d9212a6fa83af40cb995ece..98a670fc91364a61d83282f0cf26ba407d646772 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -22,5 +22,5 @@ version: 0.1.0 # follow Semantic Versioning. They should reflect the version the application is using. appVersion: snapshot maintainers: -- name: takiformation - email: takiformation@takima.school + - name: takiformation + email: takiformation@takima.school diff --git a/templates/api/api-config.yaml b/templates/api/api-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0497e183aa245f64e009614d0355d4e13f5c5d4e --- /dev/null +++ b/templates/api/api-config.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.name }}-api +data: + endpoint: "pg-service:5432" + database: {{ .Values.name}}-db diff --git a/templates/api/api-deployment.yaml b/templates/api/api-deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1b851ae3a0da6f1fb0c066f2a938ec818f2fd472 --- /dev/null +++ b/templates/api/api-deployment.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.name }}-api + labels: + app: api +spec: + replicas: 3 + selector: + matchLabels: + app: api + template: + metadata: + labels: + app: api + spec: + containers: + - name: api + resources: + requests: + memory: "192M" + cpu: "100m" + limits: + memory: "256M" + cpu: "1" + image: registry.gitlab.com/takima-school/images/cdb/api:latest + ports: + - containerPort: 3000 + env: + - name: DB_ENDPOINT + valueFrom: + configMapKeyRef: + name: {{ .Values.name }}-api + key: endpoint + - name: POSTGRES_DB + valueFrom: + configMapKeyRef: + name: {{ .Values.name }}-api + key: database + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: pg-credentials + key: username + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: pg-credentials + key: password + imagePullSecrets: + - name : takima-school-registry \ No newline at end of file diff --git a/templates/api/api-ingress.yaml b/templates/api/api-ingress.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8253997c364577e4c13d112f813c2e9e2aa265cc --- /dev/null +++ b/templates/api/api-ingress.yaml @@ -0,0 +1,22 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: nginx + name: {{ .Values.name}}-api +spec: + rules: + - host: {{ .Values.api.ingress.host }} + http: + paths: + - backend: + service: + name: {{ .Values.name}}-api + port: + number: 80 + path: / + pathType: Prefix + tls: + - hosts: + - {{ .Values.api.ingress.host }} + secretName: app-wildcard diff --git a/templates/api/api-service.yaml b/templates/api/api-service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ae8d7e5e2a1bf0fbdc7abb84e5cd3917263d61ef --- /dev/null +++ b/templates/api/api-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.name}}-api +spec: + selector: + app: api + ports: + - protocol: TCP + port: 80 + targetPort: 8080 diff --git a/templates/database/pg-config.yaml b/templates/database/pg-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d53efcb32fd2497c5ac16d21280f5ec3bdc52004 --- /dev/null +++ b/templates/database/pg-config.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.name}}-pg +data: + database: {{ .Values.name}}-db + db_path: "/var/lib/postgresql/data/pgdata" \ No newline at end of file diff --git a/templates/database/pg-credentials.yaml b/templates/database/pg-credentials.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2800e43d5933eee4ce4cdafc05d7cdf9573ca31c --- /dev/null +++ b/templates/database/pg-credentials.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: pg-credentials +type: Opaque +data: + username: YWRtaW4= + password: MWYyZDFlMmU2N2Rm diff --git a/templates/database/pg-deployment.yaml b/templates/database/pg-deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..14abdd39b6326af1ac487e7bc2d70be8845971fc --- /dev/null +++ b/templates/database/pg-deployment.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.name}}-pg + labels: + app: pg +spec: + replicas: 1 + selector: + matchLabels: + app: pg + template: + metadata: + labels: + app: pg + spec: + volumes: + - name: pg-data + persistentVolumeClaim: + claimName: pg-db + containers: + - name: pg + volumeMounts: + - mountPath: /var/lib/postgresql/data + name: pg-data + image: registry.takima.io/school/proxy/postgres:latest + ports: + - containerPort: 5432 + env: + - name: PGDATA + valueFrom: + configMapKeyRef: + name: {{ .Values.name}}-pg # Nom du configmap + key: db_path + - name: POSTGRES_DB # Vrai key de la variable d'env. Peut ĂȘtre diffĂ©rent de la valeur dans le config map + valueFrom: + configMapKeyRef: + name: {{ .Values.name}}-pg + key: database + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: pg-credentials + key: username + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: pg-credentials + key: password + imagePullSecrets: + - name : takima-school-registry \ No newline at end of file diff --git a/templates/database/pg-service.yaml b/templates/database/pg-service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e3d1abb559d759252b0702f2d7c8dc4fbb91e710 --- /dev/null +++ b/templates/database/pg-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: pg-service +spec: + selector: + app: pg + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 diff --git a/templates/front-config.yaml b/templates/front/front-config.yaml similarity index 100% rename from templates/front-config.yaml rename to templates/front/front-config.yaml diff --git a/templates/front-deployment.yaml b/templates/front/front-deployment.yaml similarity index 100% rename from templates/front-deployment.yaml rename to templates/front/front-deployment.yaml diff --git a/templates/front-ingress.yaml b/templates/front/front-ingress.yaml similarity index 100% rename from templates/front-ingress.yaml rename to templates/front/front-ingress.yaml diff --git a/templates/front-service.yaml b/templates/front/front-service.yaml similarity index 100% rename from templates/front-service.yaml rename to templates/front/front-service.yaml diff --git a/values.yaml b/values.yaml index 9ab42efacd88ffc744ad5862da8aa53e9b1042bf..4515d92e9b60512cd8426b8c174223c88f2dc40c 100644 --- a/values.yaml +++ b/values.yaml @@ -6,8 +6,8 @@ name: cdb api: ingress: - tlsEnabled: false - host: api.to-replace.takima.school + tlsEnabled: true + host: api.lbruchon.takima.school front: enabled: true @@ -16,5 +16,5 @@ front: tag: latest replicaCount: 1 ingress: - tlsEnabled: false - host: www.to-replace.takima.school \ No newline at end of file + tlsEnabled: true + host: www.lbruchon.takima.school