Skip to content

Commit

Permalink
Merge branch 'main' into prod-kustomize
Browse files Browse the repository at this point in the history
  • Loading branch information
mjarrett0 committed May 12, 2022
2 parents d2c6f8d + 8326133 commit 59b9724
Show file tree
Hide file tree
Showing 35 changed files with 493 additions and 23 deletions.
2 changes: 1 addition & 1 deletion base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ spec:
emptyDir: {}
- name: db-init
emptyDir: {}
---

13 changes: 13 additions & 0 deletions base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- namespace.yaml
#- subscription.yaml
- application.yaml
- deployment-frontend.yaml
- deployment.yaml
- service.yaml
- service-frontend.yaml
- route.yaml
# - placementrule.yaml
6 changes: 6 additions & 0 deletions base/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: mysql
---
13 changes: 13 additions & 0 deletions base/placementrule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
labels:
app: mysql
name: mysql-placement-1
namespace: mysql
spec:
clusterSelector:
matchLabels:
'local-cluster': 'true'
---
17 changes: 17 additions & 0 deletions base/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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

1 change: 1 addition & 0 deletions local-cluster/mysql/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is temp, will be removed, please don't panic
39 changes: 39 additions & 0 deletions local-cluster/mysql/deployment-frontend.yaml
Original file line number Diff line number Diff line change
@@ -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'
---
43 changes: 43 additions & 0 deletions local-cluster/mysql/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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:1-156
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: {}
---
4 changes: 4 additions & 0 deletions local-cluster/mysql/kustomiation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resources:
#- service.yaml
#- deployment.yaml
#- route.yaml
17 changes: 17 additions & 0 deletions local-cluster/mysql/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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

12 changes: 12 additions & 0 deletions local-cluster/mysql/service-frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: todonodejs
name: frontend
name: frontend
spec:
ports:
- port: 8080
selector:
name: frontend
12 changes: 12 additions & 0 deletions local-cluster/mysql/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: todonodejs
name: mysql
name: mysql
spec:
ports:
- port: 3306
selector:
name: mysql
9 changes: 9 additions & 0 deletions local-cluster/subscriptions/mysql/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
name: mysql
spec:
selector:
matchLabels:
app: mysql
6 changes: 6 additions & 0 deletions local-cluster/subscriptions/mysql/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: mysql

31 changes: 31 additions & 0 deletions local-cluster/subscriptions/mysql/placementrule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: mysql-development
labels:
app: mysql
spec:
clusterConditions:
- type: ManagedClusterConditionAvailable
status: "True"
clusterSelector:
matchLabels:
usage: development
#clusterReplicas: 1 #Apply to how many matched clusters, default is ALL
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: mysql-production
namespace: mysql
labels:
app: mysql
spec:
clusterConditions:
- type: ManagedClusterConditionAvailable
status: "True"
clusterSelector:
matchLabels:
usage: production
#clusterReplicas: 1 #Apply to how many matched clusters, default is ALL
33 changes: 33 additions & 0 deletions local-cluster/subscriptions/mysql/subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
apiVersion: apps.open-cluster-management.io/v1
kind: Subscription
metadata:
name: mysql-development-subscription
labels:
app: mysql
annotations:
apps.open-cluster-management.io/github-path: mysql
apps.open-cluster-management.io/github-branch: main
spec:
channel: application/gitops
placement:
placementRef:
name: mysql-development
kind: PlacementRule
---
apiVersion: apps.open-cluster-management.io/v1
kind: Subscription
metadata:
name: mysql-production-subscription
namespace: mysql
labels:
app: mysql
annotations:
apps.open-cluster-management.io/github-path: mysql
apps.open-cluster-management.io/github-branch: production
spec:
channel: application/gitops
placement:
placementRef:
name: mysql-production
kind: PlacementRule
1 change: 1 addition & 0 deletions managed-cluster/mysql/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is temp, will be removed, please don't panic
4 changes: 4 additions & 0 deletions managed-cluster/mysql/kustomiation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resources:
#- service.yaml
#- deployment.yaml
#- route.yaml
39 changes: 39 additions & 0 deletions managed-cluster/mysql/prod-deployment-frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend-prod
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'
---
43 changes: 43 additions & 0 deletions managed-cluster/mysql/prod-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql-prod
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:1-156
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: {}
---
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ kind: Route
metadata:
labels:
app: todonodejs
name: route-frontend-mng
name: frontend-mng
name: route-frontend
name: frontend-prod
namespace: mysql
spec:
host: todo.apps.ocp4-mng.example.com
path: "/todo"
to:
kind: Service
name: frontend
name: frontend-prod
weight: 100
wildcardPolicy: None

12 changes: 12 additions & 0 deletions managed-cluster/mysql/prod-service-frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: todonodejs
name: frontend
name: frontend-prod
spec:
ports:
- port: 8080
selector:
name: frontend-prod
Loading

0 comments on commit 59b9724

Please sign in to comment.