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/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 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