Update examples

This commit is contained in:
Darren Shepherd
2020-08-31 23:29:55 -07:00
parent 56bca25f64
commit 3614aa139d
17 changed files with 181 additions and 5 deletions

View File

@@ -7,4 +7,6 @@ This repository contains examples of how to use Fleet using different approaches
| [simple](simple/) | The minimally viable repo to deploy raw Kubernetes resources |
| [manifest](manifest/) | A full example of using raw Kubernetes YAML and customizing it per target cluster |
| [helm](helm/) | A full example of using Helm and customizing it per target cluster |
| [kustomize](kustomize/) | A full example of using Kustomize and customizing it per target cluster |
| [helm-external](helm-external/) | A full example of using a Helm chart that is downloaded from a third party source and customizing it per target cluster |
| [kustomize](kustomize/) | A full example of using Kustomize and customizing it per target cluster |
| [helm-kustomize](helm-kustomize/) | A full example of using Kustomize to modify a third party Helm chart |

22
helm-external/README.md Normal file
View File

@@ -0,0 +1,22 @@
# 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-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/
bundleDirs: helm-external
```

24
helm-external/fleet.yaml Normal file
View File

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

22
helm-kustomize/README.md Normal file
View File

@@ -0,0 +1,22 @@
# 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-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/
bundleDirs: helm-kustomize
```

23
helm-kustomize/fleet.yaml Normal file
View File

@@ -0,0 +1,23 @@
namespace: fleet-helm-kustomize-example
chart: https://github.com/rancher/fleet-examples/releases/download/example/guestbook-0.0.0.tgz
targets:
- name: dev
clusterSelector:
matchLabels:
env: dev
# NOTE: This directory is always relative to ./kustomize
kustomizeDir: overlays/dev
- name: test
clusterSelector:
matchLabels:
env: test
# NOTE: This directory is always relative to ./kustomize
kustomizeDir: overlays/test
- name: prod
clusterSelector:
matchLabels:
env: prod
# NOTE: This directory is always relative to ./kustomize
kustomizeDir: 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

@@ -8,4 +8,15 @@ 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
* 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/
bundleDirs: helm
```

View File

@@ -7,4 +7,15 @@ 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
* 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
```

View File

@@ -7,4 +7,15 @@ 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
* 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
```

View File

@@ -1,4 +1,15 @@
# Simple 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 `default` namespace.
The app will be deployed into the `default` namespace.
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: simple
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples/
bundleDirs: simple
```