Skip to content

Commit

Permalink
Add cloud-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
jnpacker committed Feb 4, 2021
1 parent 03bf4c2 commit 1c357a2
Show file tree
Hide file tree
Showing 33 changed files with 674 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions cloud-provider/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Part of the Pacman application found in this repository

## This example, Deploys nginx with an internal service, that allows reading the Cloud provider and Region json. This is designed to work with the modified Pacman application.
1. Add the subscription to your Red Hat Advanced Cluster Management for Kubernetes HUB
```
clone https://github.com/open-cluster-management/application-samples.git
oc apply -k application-samples/subscriptoins/cloud-provider
```
### results
This will automatically provision the nginx with cloud provider and region identifier to:
### Amazon AWS
- us-east-1
- us-east-2
- us-east-3
- us-west-1
- eu-central-1
- eu-west-3

### Google GCP
- europe-west3

### Azure
- centralus

### Related
Pacman deployment with an Ansible job in: `ansible/`
33 changes: 33 additions & 0 deletions cloud-provider/deployment-a-eu1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloud-provider-nginx
labels:
app.kubernetes.io/name: nginx-cp
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nginx-cp
template:
metadata:
labels:
app.kubernetes.io/name: nginx-cp
spec:
containers:
- name: nginx
image: quay.io/jpacker/nginx:1.16.1
ports:
- containerPort: 8080
imagePullPolicy: Always
env:
- name: CLOUD_PROVIDER
value: "Amazon"
- name: ZONE
value: "eu-central-1"
volumeMounts:
- mountPath: /app/provider
name: cache-provider
volumes:
- name: cache-provider
emptyDir: {}
33 changes: 33 additions & 0 deletions cloud-provider/deployment-a-eu3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloud-provider-nginx
labels:
app.kubernetes.io/name: nginx-cp
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nginx-cp
template:
metadata:
labels:
app.kubernetes.io/name: nginx-cp
spec:
containers:
- name: nginx
image: quay.io/jpacker/nginx:1.16.1
ports:
- containerPort: 8080
imagePullPolicy: Always
env:
- name: CLOUD_PROVIDER
value: "Amazon"
- name: ZONE
value: "eu-west-3"
volumeMounts:
- mountPath: /app/provider
name: cache-provider
volumes:
- name: cache-provider
emptyDir: {}
33 changes: 33 additions & 0 deletions cloud-provider/deployment-a-us1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloud-provider-nginx
labels:
app.kubernetes.io/name: nginx-cp
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nginx-cp
template:
metadata:
labels:
app.kubernetes.io/name: nginx-cp
spec:
containers:
- name: nginx
image: quay.io/jpacker/nginx:1.16.1
ports:
- containerPort: 8080
imagePullPolicy: Always
env:
- name: CLOUD_PROVIDER
value: "Amazon"
- name: ZONE
value: "us-east-1"
volumeMounts:
- mountPath: /app/provider
name: cache-provider
volumes:
- name: cache-provider
emptyDir: {}
33 changes: 33 additions & 0 deletions cloud-provider/deployment-a-us2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloud-provider-nginx
labels:
app.kubernetes.io/name: nginx-cp
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nginx-cp
template:
metadata:
labels:
app.kubernetes.io/name: nginx-cp
spec:
containers:
- name: nginx
image: quay.io/jpacker/nginx:1.16.1
ports:
- containerPort: 8080
imagePullPolicy: Always
env:
- name: CLOUD_PROVIDER
value: "Amazon"
- name: ZONE
value: "us-east-2"
volumeMounts:
- mountPath: /app/provider
name: cache-provider
volumes:
- name: cache-provider
emptyDir: {}
33 changes: 33 additions & 0 deletions cloud-provider/deployment-a-us3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloud-provider-nginx
labels:
app.kubernetes.io/name: nginx-cp
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nginx-cp
template:
metadata:
labels:
app.kubernetes.io/name: nginx-cp
spec:
containers:
- name: nginx
image: quay.io/jpacker/nginx:1.16.1
ports:
- containerPort: 8080
imagePullPolicy: Always
env:
- name: CLOUD_PROVIDER
value: "Amazon"
- name: ZONE
value: "us-west-3"
volumeMounts:
- mountPath: /app/provider
name: cache-provider
volumes:
- name: cache-provider
emptyDir: {}
33 changes: 33 additions & 0 deletions cloud-provider/deployment-a-uw1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloud-provider-nginx
labels:
app.kubernetes.io/name: nginx-cp
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nginx-cp
template:
metadata:
labels:
app.kubernetes.io/name: nginx-cp
spec:
containers:
- name: nginx
image: quay.io/jpacker/nginx:1.16.1
ports:
- containerPort: 8080
imagePullPolicy: Always
env:
- name: CLOUD_PROVIDER
value: "Amazon"
- name: ZONE
value: "us-west-1"
volumeMounts:
- mountPath: /app/provider
name: cache-provider
volumes:
- name: cache-provider
emptyDir: {}
33 changes: 33 additions & 0 deletions cloud-provider/deployment-az-cus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloud-provider-nginx
labels:
app.kubernetes.io/name: nginx-cp
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nginx-cp
template:
metadata:
labels:
app.kubernetes.io/name: nginx-cp
spec:
containers:
- name: nginx
image: quay.io/jpacker/nginx:1.16.1
ports:
- containerPort: 8080
imagePullPolicy: Always
env:
- name: CLOUD_PROVIDER
value: "Azure"
- name: ZONE
value: "centralus"
volumeMounts:
- mountPath: /app/provider
name: cache-provider
volumes:
- name: cache-provider
emptyDir: {}
33 changes: 33 additions & 0 deletions cloud-provider/deployment-g-eu3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloud-provider-nginx
labels:
app.kubernetes.io/name: nginx-cp
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nginx-cp
template:
metadata:
labels:
app.kubernetes.io/name: nginx-cp
spec:
containers:
- name: nginx
image: quay.io/jpacker/nginx:1.16.1
ports:
- containerPort: 8080
imagePullPolicy: Always
env:
- name: CLOUD_PROVIDER
value: "Google"
- name: ZONE
value: "europe-west3"
volumeMounts:
- mountPath: /app/provider
name: cache-provider
volumes:
- name: cache-provider
emptyDir: {}
4 changes: 4 additions & 0 deletions cloud-provider/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace: provider
resources:
- service.yaml
- deployment.yaml
12 changes: 12 additions & 0 deletions cloud-provider/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: cloud
spec:
selector:
app.kubernetes.io/name: nginx-cp
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 8080
10 changes: 10 additions & 0 deletions subscriptions/subscription/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
name: cloud
namespace: provider
spec:
selector:
matchLabels:
app: cloud
19 changes: 19 additions & 0 deletions subscriptions/subscription/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resources:
- namespace.yaml
#- secret.yaml
- ../channelchannel.yaml
- placementrule-a-us1.yaml
- placementrule-a-us2.yaml
- placementrule-a-eu1.yaml
- placementrule-a-eu3.yaml
- placementrule-g-eu3.yaml
- placementrule-a-uw1.yaml
- placementrule-az-cus.yaml
- subscription-provider-a-us1.yaml
- subscription-provider-a-us2.yaml
- subscription-provider-a-eu1.yaml
- subscription-provider-a-eu3.yaml
- subscription-provider-g-eu3.yaml
- subscription-provider-a-uw1.yaml
- subscription-provider-az-cus.yaml
- application.yaml
11 changes: 11 additions & 0 deletions subscriptions/subscription/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: demo
---
apiVersion: v1
kind: Namespace
metadata:
name: provider

16 changes: 16 additions & 0 deletions subscriptions/subscription/placementrule-a-eu1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: cloud-provider-a-eu1
namespace: provider
labels:
app: cloud
spec:
clusterConditions:
- type: ManagedClusterConditionAvailable
status: "True"
clusterSelector:
matchLabels:
cloud: Amazon
region: eu-central-1
#clusterReplicas: 1 #Apply to how many matched clusters, default is ALL
16 changes: 16 additions & 0 deletions subscriptions/subscription/placementrule-a-eu3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: cloud-provider-a-eu3
namespace: provider
labels:
app: cloud
spec:
clusterConditions:
- type: ManagedClusterConditionAvailable
status: "True"
clusterSelector:
matchLabels:
cloud: Amazon
region: eu-west-3
#clusterReplicas: 1 #Apply to how many matched clusters, default is ALL
Loading

0 comments on commit 1c357a2

Please sign in to comment.