From 219814de63be97086ca05a27a622db944c7774b6 Mon Sep 17 00:00:00 2001
From: Bot <bot@takima.fr>
Date: Mon, 17 Mar 2025 12:13:00 +0000
Subject: [PATCH] Added solution for day-1 - step-3

---
 solution/day-1/step-3/hello-app-cm.yaml       |  6 +++
 .../step-3/hello-app-deployment-secret.yaml   | 41 +++++++++++++++++++
 .../day-1/step-3/hello-app-deployment.yaml    | 41 +++++++++++++++++++
 solution/day-1/step-3/hello-secret.yaml       |  7 ++++
 4 files changed, 95 insertions(+)
 create mode 100644 solution/day-1/step-3/hello-app-cm.yaml
 create mode 100644 solution/day-1/step-3/hello-app-deployment-secret.yaml
 create mode 100644 solution/day-1/step-3/hello-app-deployment.yaml
 create mode 100644 solution/day-1/step-3/hello-secret.yaml

diff --git a/solution/day-1/step-3/hello-app-cm.yaml b/solution/day-1/step-3/hello-app-cm.yaml
new file mode 100644
index 0000000..12004af
--- /dev/null
+++ b/solution/day-1/step-3/hello-app-cm.yaml
@@ -0,0 +1,6 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: hello-app-cm
+data:
+  color: "#200"
diff --git a/solution/day-1/step-3/hello-app-deployment-secret.yaml b/solution/day-1/step-3/hello-app-deployment-secret.yaml
new file mode 100644
index 0000000..8de0064
--- /dev/null
+++ b/solution/day-1/step-3/hello-app-deployment-secret.yaml
@@ -0,0 +1,41 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: hello-app-secret
+  labels:
+    app: hello-app
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app: hello-app
+  template:
+    metadata:
+      labels:
+        app: hello-app
+    spec:
+      imagePullSecrets:
+        - name: auth-master3-registry
+      containers:
+      - name: hello-app
+        image: registry.master3.takima.io/guide/kubernetes-resources/hello_world:latest
+        ports:
+        - containerPort: 3000
+        env:
+        - name: K8S_NODE_NAME
+          valueFrom:
+            fieldRef:
+              fieldPath: spec.nodeName
+        - name: K8S_POD_NAME
+          valueFrom:
+            fieldRef:
+              fieldPath: metadata.name
+        - name: K8S_POD_IP
+          valueFrom:
+            fieldRef:
+              fieldPath: status.podIP
+        - name: CUSTOM_COLOR # Vrai key de la variable d'env. Peut être différent de la valeur dans le config map
+          valueFrom:
+            secretKeyRef:
+              name: hello-app-secret  # Nom du configmap
+              key: color
diff --git a/solution/day-1/step-3/hello-app-deployment.yaml b/solution/day-1/step-3/hello-app-deployment.yaml
new file mode 100644
index 0000000..cd938b7
--- /dev/null
+++ b/solution/day-1/step-3/hello-app-deployment.yaml
@@ -0,0 +1,41 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: hello-app-deployment
+  labels:
+    app: hello-app
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app: hello-app
+  template:
+    metadata:
+      labels:
+        app: hello-app
+    spec:
+      imagePullSecrets:
+        - name: takima-school-registry
+      containers:
+      - name: hello-app
+        image: registry.gitlab.com/takima-school/images/simple-website:latest
+        ports:
+        - containerPort: 3000
+        env:
+        - name: K8S_NODE_NAME
+          valueFrom:
+            fieldRef:
+              fieldPath: spec.nodeName
+        - name: K8S_POD_NAME
+          valueFrom:
+            fieldRef:
+              fieldPath: metadata.name
+        - name: K8S_POD_IP
+          valueFrom:
+            fieldRef:
+              fieldPath: status.podIP
+        - name: CUSTOM_COLOR # Vrai key de la variable d'env. Peut être différent de la valeur dans le config map
+          valueFrom:
+            configMapKeyRef:
+              name: hello-app-cm  # Nom du configmap
+              key: color  
diff --git a/solution/day-1/step-3/hello-secret.yaml b/solution/day-1/step-3/hello-secret.yaml
new file mode 100644
index 0000000..7499207
--- /dev/null
+++ b/solution/day-1/step-3/hello-secret.yaml
@@ -0,0 +1,7 @@
+apiVersion: v1
+kind: Secret
+metadata:
+  name: hello-app-secret
+type: Opaque
+data:
+  color: IiMyMDAi
-- 
GitLab