Skip to content

Commit 56bca25

Browse files
Initial Commit
0 parents  commit 56bca25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+684
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Fleet Examples
2+
3+
This repository contains examples of how to use Fleet using different approaches.
4+
5+
| Example | Description |
6+
|-------------|-------------|
7+
| [simple](simple/) | The minimally viable repo to deploy raw Kubernetes resources |
8+
| [manifest](manifest/) | A full example of using raw Kubernetes YAML and customizing it per target cluster |
9+
| [helm](helm/) | A full example of using Helm and customizing it per target cluster |
10+
| [kustomize](kustomize/) | A full example of using Kustomize and customizing it per target cluster |

helm/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Helm Example
2+
3+
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as
4+
packaged as a Helm chart.
5+
The app will be deployed into the `fleet-helm-example` namespace.
6+
7+
The application will be customized as follows per environment:
8+
9+
* Dev clusters: Only the redis leader is deployed and not the followers.
10+
* Test clusters: Scale the front deployment to 3
11+
* Prod clusters: Scale the front deployment to 3 and set the service type to LoadBalancer

helm/chart/Chart.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v2
2+
name: guestbook
3+
description: Sample application
4+
version: 0.0.0
5+
appVersion: 0.0.0
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: frontend
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: guestbook
9+
tier: frontend
10+
replicas: {{ .Values.replicas }}
11+
template:
12+
metadata:
13+
labels:
14+
app: guestbook
15+
tier: frontend
16+
spec:
17+
containers:
18+
- name: php-redis
19+
image: gcr.io/google-samples/gb-frontend:v4
20+
resources:
21+
requests:
22+
cpu: 100m
23+
memory: 100Mi
24+
ports:
25+
- containerPort: 80
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: frontend
5+
labels:
6+
app: guestbook
7+
tier: frontend
8+
spec:
9+
type: "{{ .Values.serviceType }}"
10+
ports:
11+
- port: 80
12+
selector:
13+
app: guestbook
14+
tier: frontend
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: redis-master
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: redis
9+
role: master
10+
tier: backend
11+
replicas: 1
12+
template:
13+
metadata:
14+
labels:
15+
app: redis
16+
role: master
17+
tier: backend
18+
spec:
19+
containers:
20+
- name: master
21+
image: redis
22+
resources:
23+
requests:
24+
cpu: 100m
25+
memory: 100Mi
26+
ports:
27+
- containerPort: 6379
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: redis-master
5+
labels:
6+
app: redis
7+
role: master
8+
tier: backend
9+
spec:
10+
ports:
11+
- port: 6379
12+
targetPort: 6379
13+
selector:
14+
app: redis
15+
role: master
16+
tier: backend
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{ if .Values.replication }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: redis-slave
6+
spec:
7+
selector:
8+
matchLabels:
9+
app: redis
10+
role: slave
11+
tier: backend
12+
replicas: 2
13+
template:
14+
metadata:
15+
labels:
16+
app: redis
17+
role: slave
18+
tier: backend
19+
spec:
20+
containers:
21+
- name: slave
22+
image: gcr.io/google_samples/gb-redisslave:v1
23+
resources:
24+
requests:
25+
cpu: 100m
26+
memory: 100Mi
27+
ports:
28+
- containerPort: 6379
29+
{{ end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: redis-slave
5+
labels:
6+
app: redis
7+
role: slave
8+
tier: backend
9+
spec:
10+
ports:
11+
- port: 6379
12+
selector:
13+
app: redis
14+
{{ if .Values.replication }}
15+
role: slave
16+
{{ else }}
17+
role: master
18+
{{ end }}
19+
tier: backend

helm/chart/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
replication: true
2+
replicas: 1
3+
serviceType: NodePort

0 commit comments

Comments
 (0)