commit
4f9eb3ddf8
13 changed files with 146 additions and 0 deletions
@ -0,0 +1,7 @@ |
|||
FROM registry.access.redhat.com/ubi8/nginx-118 |
|||
|
|||
# Add application sources |
|||
ADD index.html . |
|||
|
|||
# Run script uses standard ways to run the application |
|||
CMD nginx -g "daemon off;" |
|||
@ -0,0 +1,6 @@ |
|||
# Build the application |
|||
|
|||
```sh |
|||
podman login quay.io |
|||
./build.sh |
|||
``` |
|||
@ -0,0 +1,18 @@ |
|||
#!/bin/sh |
|||
|
|||
set -Eeuo pipefail |
|||
|
|||
echo "Building the container image..." |
|||
podman build -t multi-cluster-app:latest . |
|||
|
|||
echo "Running it..." |
|||
podman run -d --rm --name multi-cluster-app -p 8080:8080 multi-cluster-app:latest |
|||
trap "podman stop multi-cluster-app" EXIT |
|||
|
|||
echo "Testing it..." |
|||
sleep 2 |
|||
curl -s -o /dev/null -w "HTTP status code: %{http_code}\n" http://localhost:8080/ |
|||
|
|||
echo "Pushing to Quay.io..." |
|||
podman tag multi-cluster-app:latest quay.io/nmasse_itix/multi-cluster-app:latest |
|||
podman push quay.io/nmasse_itix/multi-cluster-app:latest |
|||
@ -0,0 +1,5 @@ |
|||
<html> |
|||
<body> |
|||
<h1>DEFAULT</h1> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,11 @@ |
|||
apiVersion: v1 |
|||
kind: ConfigMap |
|||
metadata: |
|||
name: multi-cluster-config |
|||
data: |
|||
index.html: | |
|||
<html> |
|||
<body> |
|||
<h1>BASE</h1> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,26 @@ |
|||
apiVersion: apps/v1 |
|||
kind: Deployment |
|||
metadata: |
|||
name: multi-cluster-app |
|||
spec: |
|||
replicas: 1 |
|||
selector: |
|||
matchLabels: |
|||
app: multi-cluster-app |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app: multi-cluster-app |
|||
spec: |
|||
containers: |
|||
- name: nginx |
|||
image: quay.io/nmasse_itix/multi-cluster-app:latest |
|||
ports: |
|||
- containerPort: 8080 |
|||
volumeMounts: |
|||
- name: config |
|||
mountPath: /opt/app-root/src |
|||
volumes: |
|||
- name: config |
|||
configMap: |
|||
name: multi-cluster-config |
|||
@ -0,0 +1,8 @@ |
|||
apiVersion: kustomize.config.k8s.io/v1beta1 |
|||
kind: Kustomization |
|||
|
|||
resources: |
|||
- deployment.yaml |
|||
- service.yaml |
|||
- config.yaml |
|||
- route.yaml |
|||
@ -0,0 +1,14 @@ |
|||
apiVersion: route.openshift.io/v1 |
|||
kind: Route |
|||
metadata: |
|||
name: multi-cluster-app |
|||
spec: |
|||
port: |
|||
targetPort: 8080 |
|||
tls: |
|||
termination: edge |
|||
to: |
|||
kind: Service |
|||
name: multi-cluster-app |
|||
weight: 100 |
|||
wildcardPolicy: None |
|||
@ -0,0 +1,13 @@ |
|||
apiVersion: v1 |
|||
kind: Service |
|||
metadata: |
|||
name: multi-cluster-app |
|||
labels: |
|||
app: multi-cluster-app |
|||
spec: |
|||
ports: |
|||
- port: 8080 |
|||
protocol: TCP |
|||
targetPort: 8080 |
|||
selector: |
|||
app: multi-cluster-app |
|||
@ -0,0 +1,11 @@ |
|||
apiVersion: v1 |
|||
kind: ConfigMap |
|||
metadata: |
|||
name: multi-cluster-config |
|||
data: |
|||
index.html: | |
|||
<html> |
|||
<body> |
|||
<h1>PROD-DC1</h1> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,8 @@ |
|||
apiVersion: kustomize.config.k8s.io/v1beta1 |
|||
kind: Kustomization |
|||
|
|||
bases: |
|||
- ../../base |
|||
|
|||
patchesStrategicMerge: |
|||
- config.yaml |
|||
@ -0,0 +1,11 @@ |
|||
apiVersion: v1 |
|||
kind: ConfigMap |
|||
metadata: |
|||
name: multi-cluster-config |
|||
data: |
|||
index.html: | |
|||
<html> |
|||
<body> |
|||
<h1>PROD-DC2</h1> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,8 @@ |
|||
apiVersion: kustomize.config.k8s.io/v1beta1 |
|||
kind: Kustomization |
|||
|
|||
bases: |
|||
- ../../base |
|||
|
|||
patchesStrategicMerge: |
|||
- config.yaml |
|||
Loading…
Reference in new issue