From 602be9ce7e4161ce62c579bb99e0c4ef8ba0abd9 Mon Sep 17 00:00:00 2001 From: Syed Aamir <81068983+kodesam@users.noreply.github.com> Date: Sun, 8 Oct 2023 19:01:36 +0200 Subject: [PATCH 1/2] Update deployment.yaml --- mysql/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql/deployment.yaml b/mysql/deployment.yaml index 197d84c21..15e3b4d84 100644 --- a/mysql/deployment.yaml +++ b/mysql/deployment.yaml @@ -19,7 +19,7 @@ spec: name: mysql spec: containers: - - image: registry.redhat.io/rhel8/mysql-80:1-152 + - image: registry.redhat.io/rhel8/mysql-80:latest name: mysql env: - name: MYSQL_ROOT_PASSWORD From 50d558d287e4e90dcfa51d8da69c9bd462714bc4 Mon Sep 17 00:00:00 2001 From: Student User Date: Wed, 11 Oct 2023 23:43:50 +0200 Subject: [PATCH 2/2] kustomize storage --- base/deployment-frontend.yaml | 39 +++++++++++++++++++++ base/deployment.yaml | 46 +++++++++++++++++++++++++ base/kustomization.yaml | 7 ++++ base/service-frontend.yaml | 12 +++++++ base/service.yaml | 12 +++++++ overlays/development/dbclaim-pvc.yaml | 11 ++++++ overlays/development/kustomization.yaml | 9 +++++ overlays/development/route.yaml | 16 +++++++++ 8 files changed, 152 insertions(+) create mode 100644 base/deployment-frontend.yaml create mode 100644 base/deployment.yaml create mode 100644 base/kustomization.yaml create mode 100644 base/service-frontend.yaml create mode 100644 base/service.yaml create mode 100644 overlays/development/dbclaim-pvc.yaml create mode 100644 overlays/development/kustomization.yaml create mode 100644 overlays/development/route.yaml diff --git a/base/deployment-frontend.yaml b/base/deployment-frontend.yaml new file mode 100644 index 000000000..1ca80cf39 --- /dev/null +++ b/base/deployment-frontend.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: frontend + labels: + app: todonodejs + name: frontend + namespace: mysql +spec: + replicas: 1 + selector: + matchLabels: + app: todonodejs + name: frontend + template: + metadata: + labels: + app: todonodejs + name: frontend + spec: + containers: + - resources: + limits: + cpu: '0.5' + image: quay.io/redhattraining/todo-single:v1.0 + name: todonodejs + ports: + - containerPort: 8080 + name: nodejs-http + env: + - name: MYSQL_ENV_MYSQL_DATABASE + value: items + - name: MYSQL_ENV_MYSQL_USER + value: user1 + - name: MYSQL_ENV_MYSQL_PASSWORD + value: mypa55 + - name: APP_PORT + value: '8080' +--- diff --git a/base/deployment.yaml b/base/deployment.yaml new file mode 100644 index 000000000..dbf0bd101 --- /dev/null +++ b/base/deployment.yaml @@ -0,0 +1,46 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mysql + labels: + app: todonodejs + name: mysql +spec: + replicas: 1 + selector: + matchLabels: + app: todonodejs + name: mysql + template: + metadata: + labels: + app: todonodejs + name: mysql + spec: + containers: + - image: registry.redhat.io/rhel8/mysql-80:latest + name: mysql + env: + - name: MYSQL_ROOT_PASSWORD + value: r00tpa55 + - name: MYSQL_USER + value: user1 + - name: MYSQL_PASSWORD + value: mypa55 + - name: MYSQL_DATABASE + value: items + ports: + - containerPort: 3306 + name: mysql + volumeMounts: + - mountPath: "/var/lib/mysql" + name: db-volume + volumes: + - name: db-volume + emptyDir: {} + - name: db-init + emptyDir: {} + - name: db-volume + persistentVolumeClaim: + claimName: mysql-pv-claim diff --git a/base/kustomization.yaml b/base/kustomization.yaml new file mode 100644 index 000000000..d74d3a35d --- /dev/null +++ b/base/kustomization.yaml @@ -0,0 +1,7 @@ +kind: Kustomization + +resources: +- deployment-frontend.yaml +- deployment.yaml +- service.yaml +- service-frontend.yaml diff --git a/base/service-frontend.yaml b/base/service-frontend.yaml new file mode 100644 index 000000000..a17af0f8f --- /dev/null +++ b/base/service-frontend.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: todonodejs + name: frontend + name: frontend +spec: + ports: + - port: 8080 + selector: + name: frontend diff --git a/base/service.yaml b/base/service.yaml new file mode 100644 index 000000000..eea7aab03 --- /dev/null +++ b/base/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: todonodejs + name: mysql + name: mysql +spec: + ports: + - port: 3306 + selector: + name: mysql diff --git a/overlays/development/dbclaim-pvc.yaml b/overlays/development/dbclaim-pvc.yaml new file mode 100644 index 000000000..1777e5ffb --- /dev/null +++ b/overlays/development/dbclaim-pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-pv-claim +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Mi + storageClassName: nfs-storage diff --git a/overlays/development/kustomization.yaml b/overlays/development/kustomization.yaml new file mode 100644 index 000000000..85ddfb27d --- /dev/null +++ b/overlays/development/kustomization.yaml @@ -0,0 +1,9 @@ +kind: Kustomization + +bases: + - ../../base + +resources: +- dbclaim-pvc.yaml +- route.yaml +namePrefix: dev- diff --git a/overlays/development/route.yaml b/overlays/development/route.yaml new file mode 100644 index 000000000..882b1b059 --- /dev/null +++ b/overlays/development/route.yaml @@ -0,0 +1,16 @@ +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + labels: + app: todonodejs + name: route-frontend + name: frontend + namespace: mysql +spec: + host: todo.apps.ocp4.example.com + path: "/todo" + to: + kind: Service + name: frontend + weight: 100 + wildcardPolicy: None