Update examples

This commit is contained in:
Darren Shepherd
2020-09-15 22:35:41 -07:00
parent 556d18c26b
commit 4eff05a5c2
153 changed files with 24853 additions and 120 deletions

View File

@@ -0,0 +1,38 @@
# Helm External Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as
packaged as a Helm chart downloaded from a third party source.
The app will be deployed into the `fleet-mc-helm-external-example` namespace.
The application will be customized as follows per environment:
* Dev clusters: Only the redis leader is deployed and not the followers.
* Test clusters: Scale the front deployment to 3
* Prod clusters: Scale the front deployment to 3 and set the service type to LoadBalancer
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: helm-external
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples/
paths:
- helm-external
targetCustomizations:
- name: dev
clusterSelector:
matchLabels:
env: dev
- name: test
clusterSelector:
matchLabels:
env: test
- name: prod
clusterSelector:
matchLabels:
env: prod
```

View File

@@ -0,0 +1,28 @@
namespace: fleet-mc-helm-external-example
helm:
chart: https://github.com/rancher/fleet-examples/releases/download/example/guestbook-0.0.0.tgz
targets:
- name: dev
helm:
values:
replication: false
clusterSelector:
matchLabels:
env: dev
- name: test
helm:
values:
replicas: 3
clusterSelector:
matchLabels:
env: test
- name: prod
helm:
values:
serviceType: LoadBalancer
replicas: 3
clusterSelector:
matchLabels:
env: prod

View File

@@ -0,0 +1,38 @@
# Helm Kustomize Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as
packaged as a Helm chart downloaded from a third party source and will modify the helm chart using Kustomize.
The app will be deployed into the `fleet-mc-helm-kustomize-example` namespace.
The application will be customized as follows per environment:
* Dev clusters: Only the redis leader is deployed and not the followers.
* Test clusters: Scale the front deployment to 3
* Prod clusters: Scale the front deployment to 3 and set the service type to LoadBalancer
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: helm-kustomize
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples/
paths:
- helm-kustomize
targetCustomizations:
- name: dev
clusterSelector:
matchLabels:
env: dev
- name: test
clusterSelector:
matchLabels:
env: test
- name: prod
clusterSelector:
matchLabels:
env: prod
```

View File

@@ -0,0 +1,24 @@
namespace: fleet-mc-helm-kustomize-example
helm:
chart: https://github.com/rancher/fleet-examples/releases/download/example/guestbook-0.0.0.tgz
targets:
- name: dev
clusterSelector:
matchLabels:
env: dev
kustomize:
dir: overlays/dev
- name: test
clusterSelector:
matchLabels:
env: test
kustomize:
dir: overlays/test
- name: prod
clusterSelector:
matchLabels:
env: prod
kustomize:
dir: overlays/prod

View File

@@ -0,0 +1,3 @@
patches:
- redis-slave-deployment.yaml
- redis-slave-service.yaml

View File

@@ -0,0 +1,6 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: redis-slave
spec:
replicas: 0

View File

@@ -0,0 +1,7 @@
kind: Service
apiVersion: v1
metadata:
name: redis-slave
spec:
selector:
role: master

View File

@@ -0,0 +1,6 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 3

View File

@@ -0,0 +1,6 @@
kind: Service
apiVersion: v1
metadata:
name: frontend
spec:
type: LoadBalancer

View File

@@ -0,0 +1,3 @@
patches:
- frontend-deployment.yaml
- frontend-service.yaml

View File

@@ -0,0 +1,6 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 3

View File

@@ -0,0 +1,2 @@
patches:
- frontend-deployment.yaml

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: guestbook
description: Sample application
version: 0.0.0
appVersion: 0.0.0

View File

@@ -0,0 +1,38 @@
# Helm Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as
packaged as a Helm chart.
The app will be deployed into the `fleet-mc-helm-example` namespace.
The application will be customized as follows per environment:
* Dev clusters: Only the redis leader is deployed and not the followers.
* Test clusters: Scale the front deployment to 3
* Prod clusters: Scale the front deployment to 3 and set the service type to LoadBalancer
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: helm
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples/
paths:
- helm
targetCustomizations:
- name: dev
clusterSelector:
matchLabels:
env: dev
- name: test
clusterSelector:
matchLabels:
env: test
- name: prod
clusterSelector:
matchLabels:
env: prod
```

View File

@@ -0,0 +1,26 @@
namespace: fleet-mc-helm-example
targetCustomizations:
- name: dev
helm:
values:
replication: false
clusterSelector:
matchLabels:
env: dev
- name: test
helm:
values:
replicas: 3
clusterSelector:
matchLabels:
env: test
- name: prod
helm:
values:
serviceType: LoadBalancer
replicas: 3
clusterSelector:
matchLabels:
env: prod

View File

@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
selector:
matchLabels:
app: guestbook
tier: frontend
replicas: {{ .Values.replicas }}
template:
metadata:
labels:
app: guestbook
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google-samples/gb-frontend:v4
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 80

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
type: "{{ .Values.serviceType }}"
ports:
- port: 80
selector:
app: guestbook
tier: frontend

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-master
spec:
selector:
matchLabels:
app: redis
role: master
tier: backend
replicas: 1
template:
metadata:
labels:
app: redis
role: master
tier: backend
spec:
containers:
- name: master
image: redis
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: redis-master
labels:
app: redis
role: master
tier: backend
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: redis
role: master
tier: backend

View File

@@ -0,0 +1,29 @@
{{ if .Values.replication }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-slave
spec:
selector:
matchLabels:
app: redis
role: slave
tier: backend
replicas: 2
template:
metadata:
labels:
app: redis
role: slave
tier: backend
spec:
containers:
- name: slave
image: gcr.io/google_samples/gb-redisslave:v1
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379
{{ end }}

View File

@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: redis-slave
labels:
app: redis
role: slave
tier: backend
spec:
ports:
- port: 6379
selector:
app: redis
{{ if .Values.replication }}
role: slave
{{ else }}
role: master
{{ end }}
tier: backend

View File

@@ -0,0 +1,3 @@
replication: true
replicas: 1
serviceType: NodePort

View File

@@ -0,0 +1,37 @@
# Helm Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application
using kustomize. The app will be deployed into the `fleet-mc-kustomize-example` namespace.
The application will be customized as follows per environment:
* Dev clusters: Only the redis leader is deployed and not the followers.
* Test clusters: Scale the front deployment to 3
* Prod clusters: Scale the front deployment to 3 and set the service type to LoadBalancer
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: kustomize
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples/
bundleDirs:
- kustomize
targetCustomization:
- name: dev
clusterSelector:
matchLabels:
env: dev
- name: test
clusterSelector:
matchLabels:
env: test
- name: prod
clusterSelector:
matchLabels:
env: prod
```

View File

@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
selector:
matchLabels:
app: guestbook
tier: frontend
replicas: 1
template:
metadata:
labels:
app: guestbook
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google-samples/gb-frontend:v4
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 80

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
type: NodePort
ports:
- port: 80
selector:
app: guestbook
tier: frontend

View File

@@ -0,0 +1,7 @@
resources:
- frontend-deployment.yaml
- frontend-service.yaml
- redis-master-deployment.yaml
- redis-master-service.yaml
- redis-slave-deployment.yaml
- redis-slave-service.yaml

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-master
spec:
selector:
matchLabels:
app: redis
role: master
tier: backend
replicas: 1
template:
metadata:
labels:
app: redis
role: master
tier: backend
spec:
containers:
- name: master
image: redis
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: redis-master
labels:
app: redis
role: master
tier: backend
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: redis
role: master
tier: backend

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-slave
spec:
selector:
matchLabels:
app: redis
role: slave
tier: backend
replicas: 2
template:
metadata:
labels:
app: redis
role: slave
tier: backend
spec:
containers:
- name: slave
image: gcr.io/google_samples/gb-redisslave:v1
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: redis-slave
labels:
app: redis
role: slave
tier: backend
spec:
ports:
- port: 6379
selector:
app: redis
role: slave
tier: backend

View File

@@ -0,0 +1,22 @@
namespace: fleet-mc-kustomize-example
targets:
- name: dev
clusterSelector:
matchLabels:
env: dev
kustomize:
dir: overlays/dev
- name: test
clusterSelector:
matchLabels:
env: test
kustomize:
dir: overlays/test
- name: prod
clusterSelector:
matchLabels:
env: prod
kustomize:
dir: overlays/prod

View File

@@ -0,0 +1,2 @@
resources:
- overlays/dev

View File

@@ -0,0 +1,5 @@
resources:
- ../../base
patches:
- redis-slave-deployment.yaml
- redis-slave-service.yaml

View File

@@ -0,0 +1,6 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: redis-slave
spec:
replicas: 0

View File

@@ -0,0 +1,7 @@
kind: Service
apiVersion: v1
metadata:
name: redis-slave
spec:
selector:
role: master

View File

@@ -0,0 +1,6 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 3

View File

@@ -0,0 +1,6 @@
kind: Service
apiVersion: v1
metadata:
name: frontend
spec:
type: LoadBalancer

View File

@@ -0,0 +1,5 @@
resources:
- ../../base
patches:
- frontend-deployment.yaml
- frontend-service.yaml

View File

@@ -0,0 +1,6 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 3

View File

@@ -0,0 +1,4 @@
resources:
- ../../base
patches:
- frontend-deployment.yaml

View File

@@ -0,0 +1,37 @@
# Manifests Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application.
The app will be deployed into the `fleet-mc-manifest-example` namespace.
The application will be customized as follows per environment:
* Dev clusters: Only the redis leader is deployed and not the followers.
* Test clusters: Scale the front deployment to 3
* Prod clusters: Scale the front deployment to 3 and set the service type to LoadBalancer
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: manifests
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples/
bundleDirs:
- manifests
targetCustomizations:
- name: dev
clusterSelector:
matchLabels:
env: dev
- name: test
clusterSelector:
matchLabels:
env: test
- name: prod
clusterSelector:
matchLabels:
env: prod
```

View File

@@ -0,0 +1,29 @@
namespace: fleet-mc-manifest-example
targets:
- name: dev
clusterSelector:
matchLabels:
env: dev
yaml:
overlays:
# Refers to overlays/noreplication folder
- noreplication
- name: test
clusterSelector:
matchLabels:
env: test
yaml:
overlays:
# Refers to overlays/scale3 folder
- scale3
- name: prod
clusterSelector:
matchLabels:
env: prod
yaml:
# Refers to overlays/servicelb, scale3 folders
overlays:
- servicelb
- scale3

View File

@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
selector:
matchLabels:
app: guestbook
tier: frontend
replicas: 1
template:
metadata:
labels:
app: guestbook
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google-samples/gb-frontend:v4
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 80

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
type: NodePort
ports:
- port: 80
selector:
app: guestbook
tier: frontend

View File

@@ -0,0 +1,3 @@
spec:
selector:
role: master

View File

@@ -0,0 +1,2 @@
spec:
replicas: 3

View File

@@ -0,0 +1,2 @@
spec:
type: LoadBalancer

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-master
spec:
selector:
matchLabels:
app: redis
role: master
tier: backend
replicas: 1
template:
metadata:
labels:
app: redis
role: master
tier: backend
spec:
containers:
- name: master
image: redis
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: redis-master
labels:
app: redis
role: master
tier: backend
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: redis
role: master
tier: backend

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-slave
spec:
selector:
matchLabels:
app: redis
role: slave
tier: backend
replicas: 2
template:
metadata:
labels:
app: redis
role: slave
tier: backend
spec:
containers:
- name: slave
image: gcr.io/google_samples/gb-redisslave:v1
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: redis-slave
labels:
app: redis
role: slave
tier: backend
spec:
ports:
- port: 6379
selector:
app: redis
role: slave
tier: backend