Compare commits

...

21 Commits
3.2.2 ... 3.2.4

Author SHA1 Message Date
Stefan Prodan
e5516b38cb Merge pull request #63 from stefanprodan/release-3.2.4
Release v3.2.4
2020-05-15 13:17:35 +03:00
stefanprodan
39130004d5 Release v3.2.4 2020-05-15 13:02:08 +03:00
Stefan Prodan
d4b615e3a2 Merge pull request #62 from stefanprodan/base-image
Push base image to Docker Hub
2020-05-15 13:00:18 +03:00
stefanprodan
98e133a7be Push base image to Docker Hub 2020-05-15 12:49:22 +03:00
Stefan Prodan
7674b76dab Merge pull request #60 from seaneagan/helm_test_fault
Support simulating helm test failure and timeout
2020-05-14 23:57:16 +03:00
Stefan Prodan
8fa39d90be Merge pull request #61 from seaneagan/helm3_tests_should_be_jobs
Helm 3 tests should be Jobs
2020-05-14 22:35:33 +03:00
Sean Eagan
638bdc8e83 Helm 3 tests should be Jobs
Without this "helm.sh/hook-delete-policy": before-hook-creation" does not work.
2020-05-14 09:12:53 -05:00
Sean Eagan
b565a67dec Support simulating helm test failure and timeout
This is to support testing of https://github.com/fluxcd/helm-operator/issues/369.
2020-05-13 14:22:24 -05:00
stefanprodan
65d077291b Add reconciler RBAC to webapp manifests 2020-05-01 20:29:55 +03:00
Stefan Prodan
e9d11c247e Merge pull request #58 from ytsarev/quote-message
Quote ui message in deployment template
2020-04-30 23:23:27 +03:00
Yury Tsarev
126ac55801 Quote ui message in deployment template
* To handle rare situation of digit-only message like 270 and
avoid associated failure during helm install
```
ReadString: expects " or n, but found 2, error found in #10 byte of ...|,"value":270},
{"name|..., bigger context ...|se"],"env":[{"name":"PODINFO_UI_MESSAGE","value":270},
```
2020-04-30 21:47:49 +02:00
Stefan Prodan
306aac3e65 Merge pull request #57 from stefanprodan/release-3.2.3
Release v3.2.3
2020-04-29 00:23:16 +03:00
stefanprodan
55318b0c20 Release v3.2.3 2020-04-28 19:20:23 +03:00
Stefan Prodan
1865faf7ce Merge pull request #56 from stefanprodan/webapp-demo
Add webapp demo
2020-04-28 19:18:28 +03:00
stefanprodan
9edd7abbe8 Include webapp demo in release 2020-04-28 19:13:01 +03:00
stefanprodan
1c4acc0b33 Add webapp demo kustomizations 2020-04-28 19:12:44 +03:00
stefanprodan
6274f16b9b Add webapp demo manifests 2020-04-28 19:12:25 +03:00
stefanprodan
93e338a964 Add app common label to kustomization 2020-04-15 12:22:49 +03:00
Stefan Prodan
73b03b77fc Merge pull request #54 from hiddeco/chart/readme-fix
chart: align README with actual values file
2020-04-04 13:36:58 +03:00
Hidde Beydals
0135757fbd chart: remove redundant codeblock opening 2020-04-04 12:32:54 +02:00
Hidde Beydals
ea1fe87d49 chart: align README with actual values file 2020-04-04 12:31:01 +02:00
43 changed files with 754 additions and 90 deletions

View File

@@ -33,6 +33,7 @@ jobs:
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin; echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin;
echo $QUAY_PASS | docker login -u $QUAY_USER --password-stdin quay.io; echo $QUAY_PASS | docker login -u $QUAY_USER --password-stdin quay.io;
make push-container; make push-container;
make push-base;
fi fi
push-binary: push-binary:

10
Dockerfile.base Normal file
View File

@@ -0,0 +1,10 @@
FROM golang:1.14
WORKDIR /workspace
# copy modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache modules
RUN go mod download

View File

@@ -33,6 +33,12 @@ build-charts:
build-container: build-container:
docker build -t $(DOCKER_IMAGE_NAME):$(VERSION) . docker build -t $(DOCKER_IMAGE_NAME):$(VERSION) .
build-base:
docker build -f Dockerfile.base -t $(DOCKER_REPOSITORY)/podinfo-base:latest .
push-base: build-base
docker push $(DOCKER_REPOSITORY)/podinfo-base:latest
test-container: test-container:
@docker rm -f podinfo || true @docker rm -f podinfo || true
@docker run -dp 9898:9898 --name=podinfo $(DOCKER_IMAGE_NAME):$(VERSION) @docker run -dp 9898:9898 --name=podinfo $(DOCKER_IMAGE_NAME):$(VERSION)
@@ -57,6 +63,10 @@ version-set:
sed -i '' "s/appVersion: $$current/appVersion: $$next/g" charts/podinfo/Chart.yaml && \ sed -i '' "s/appVersion: $$current/appVersion: $$next/g" charts/podinfo/Chart.yaml && \
sed -i '' "s/version: $$current/version: $$next/g" charts/podinfo/Chart.yaml && \ sed -i '' "s/version: $$current/version: $$next/g" charts/podinfo/Chart.yaml && \
sed -i '' "s/podinfo:$$current/podinfo:$$next/g" kustomize/deployment.yaml && \ sed -i '' "s/podinfo:$$current/podinfo:$$next/g" kustomize/deployment.yaml && \
sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/webapp/frontend/deployment.yaml && \
sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/webapp/backend/deployment.yaml && \
sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/bases/frontend/deployment.yaml && \
sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/bases/backend/deployment.yaml && \
echo "Version $$next set in code, deployment, chart and kustomize" echo "Version $$next set in code, deployment, chart and kustomize"
release: release:

View File

@@ -1,6 +1,6 @@
apiVersion: v1 apiVersion: v1
version: 3.2.2 version: 3.2.4
appVersion: 3.2.2 appVersion: 3.2.4
name: podinfo name: podinfo
engine: gotpl engine: gotpl
description: Podinfo Helm chart for Kubernetes description: Podinfo Helm chart for Kubernetes

View File

@@ -29,48 +29,55 @@ The command removes all the Kubernetes components associated with the chart and
The following tables lists the configurable parameters of the podinfo chart and their default values. The following tables lists the configurable parameters of the podinfo chart and their default values.
Parameter | Description | Default Parameter | Default | Description
--- | --- | --- --- | --- | ---
`affinity` | node/pod affinities | None `replicaCount` | `1` | Desired number of pods
`backend` | echo backend URL | None `logLevel` | `info` | Log level: `debug`, `info`, `warn`, `error`, `flat` or `panic`
`backends` | echo backend URL array | None `backend` | `None` | Echo backend URL
`faults.delay` | random HTTP response delays between 0 and 5 seconds | `false` `backends` | `[]` | Array of echo backend URLs
`faults.error` | 1/3 chances of a random HTTP response error | `false` `ui.color` | `#34577c` | UI color
`faults.unhealthy` | when set, the healthy state is never reached | `false` `ui.message` | `None` | UI greetings message
`faults.unready` | when set, the ready state is never reached | `false` `ui.logo` | `None` | UI logo
`hpa.enabled` | enables HPA | `false` `faults.delay` | `false` | Random HTTP response delays between 0 and 5 seconds
`hpa.cpu` | target CPU usage per pod | None `faults.error` | `false` | 1/3 chances of a random HTTP response error
`hpa.memory` | target memory usage per pod | None `faults.unhealthy` | `false` | When set, the healthy state is never reached
`hpa.requests` | target requests per second per pod | None `faults.unready` | `false` | When set, the ready state is never reached
`hpa.maxReplicas` | maximum pod replicas | `10` `faults.testFail` | `false` | When set, a helm test is included which always fails
`image.pullPolicy` | image pull policy | `IfNotPresent` `faults.testTimeout` | `false` | When set, a helm test is included which always times out
`image.repository` | image repository | `stefanprodan/podinfo` `h2c.enabled` | `false` | Allow upgrading to h2c
`image.tag` | image tag | `<VERSION>` `image.repository` | `stefanprodan/podinfo` | Image repository
`ingress.enabled` | enables ingress | `false` `image.tag` | `<VERSION>` | Image tag
`ingress.annotations` | ingress annotations | None `image.pullPolicy` | `IfNotPresent` | Image pull policy
`ingress.hosts` | ingress accepted hostnames | None `service.enabled` | `true` | Create a Kubernetes Service, should be disabled when using [Flagger](https://flagger.app)
`ingress.tls` | ingress TLS configuration | None `service.type` | `ClusterIP` | Type of the Kubernetes Service
`message` | UI greetings message | None `service.metricsPort` | `9797` | Prometheus metrics endpoint port
`nodeSelector` | node labels for pod assignment | `{}` `service.httpPort` | `9898` | Container HTTP port
`replicaCount` | desired number of pods | `2` `service.externalPort` | `9898` | ClusterIP HTTP port
`resources.requests/cpu` | pod CPU request | `1m` `service.grpcPort` | `9999` | ClusterIP gPRC port
`resources.requests/memory` | pod memory request | `16Mi` `service.grpcService` | `podinfo` | gPRC service name
`resources.limits/cpu` | pod CPU limit | None `service.nodePort` | `31198` | NodePort for the HTTP endpoint
`resources.limits/memory` | pod memory limit | None `hpa.enabled` | `false` | Enables the Kubernetes HPA
`service.enabled` | create Kubernetes service (should be disabled when using Flagger) | `true` `hpa.maxReplicas` | `10` | Maximum amount of pods
`service.metricsPort` | Prometheus metrics endpoint port | `9797` `hpa.cpu` | `None` | Target CPU usage per pod
`service.externalPort` | ClusterIP HTTP port | `9898` `hpa.memory` | `None` | Target memory usage per pod
`service.httpPort` | container HTTP port | `9898` `hpa.requests` | `None` | Target HTTP requests per second per pod
`service.nodePort` | NodePort for the HTTP endpoint | `31198` `serviceAccount.enabled` | `false` | Whether a service account should be created
`service.grpcPort` | ClusterIP gPRC port | `9999` `serviceAccount.name` | `None` | The name of the service account to use, if not set and create is true, a name is generated using the fullname template
`service.grpcService` | gPRC service name | `podinfo` `linkerd.profile.enabled` | `false` | Create Linkerd service profile
`service.type` | type of service | `ClusterIP` `serviceMonitor.enabled` | `false` | Whether a Prometheus Operator service monitor should be created
`tolerations` | list of node taints to tolerate | `[]` `serviceMonitor.interval` | `15s` | Prometheus scraping interval
`serviceAccount.enabled` | specifies whether a service account should be created | `false` `ingress.enabled` | `false` | Enables Ingress
`serviceAccount.name` | the name of the service account to use, if not set and create is true, a name is generated using the fullname template | None `ingress.annotations` | `{}` | Ingress annotations
`linkerd.profile.enabled` | create Linkerd service profile | `false` `ingress.path` | `/*` | Ingress path
`serviceMonitor.enabled` | specifies whether a Prometheus Operator service monitor should be created | `false` `ingress.hosts` | `[]` | Ingress accepted hosts
`serviceMonitor.interval` | Prometheus scraping interval | `15s` `ingress.tls` | `[]` | Ingress TLS configuration
`resources.requests.cpu` | `1m` | Pod CPU request
`resources.requests.memory` | `16Mi` | Pod memory request
`resources.limits.cpu` | `None` | Pod CPU limit
`resources.limits.memory` | `None` | Pod memory limit
`nodeSelector` | `{}` | Node labels for pod assignment
`tolerations` | `[]` | List of node taints to tolerate
`affinity` | `None` | Node/pod affinities
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
@@ -86,5 +93,3 @@ $ helm install stable/podinfo --name my-release -f values.yaml
``` ```
> **Tip**: You can use the default [values.yaml](values.yaml) > **Tip**: You can use the default [values.yaml](values.yaml)
```

View File

@@ -64,7 +64,7 @@ spec:
env: env:
{{- if .Values.ui.message }} {{- if .Values.ui.message }}
- name: PODINFO_UI_MESSAGE - name: PODINFO_UI_MESSAGE
value: {{ .Values.ui.message }} value: {{ quote .Values.ui.message }}
{{- end }} {{- end }}
{{- if .Values.ui.logo }} {{- if .Values.ui.logo }}
- name: PODINFO_UI_LOGO - name: PODINFO_UI_LOGO

View File

@@ -0,0 +1,26 @@
{{- if .Values.faults.test }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "podinfo.fullname" . }}-fault-test-{{ randAlphaNum 5 | lower }}
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "podinfo.name" . }}
annotations:
"helm.sh/hook": test
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
sidecar.istio.io/inject: "false"
linkerd.io/inject: disabled
appmesh.k8s.aws/sidecarInjectorWebhook: disabled
spec:
template:
spec:
containers:
- name: fault
image: alpine:3.11
command: ['/bin/sh']
args: ['-c', 'exit 1']
restartPolicy: Never
{{- end }}

View File

@@ -1,5 +1,5 @@
apiVersion: v1 apiVersion: batch/v1
kind: Pod kind: Job
metadata: metadata:
name: {{ template "podinfo.fullname" . }}-grpc-test-{{ randAlphaNum 5 | lower }} name: {{ template "podinfo.fullname" . }}-grpc-test-{{ randAlphaNum 5 | lower }}
labels: labels:
@@ -14,9 +14,11 @@ metadata:
linkerd.io/inject: disabled linkerd.io/inject: disabled
appmesh.k8s.aws/sidecarInjectorWebhook: disabled appmesh.k8s.aws/sidecarInjectorWebhook: disabled
spec: spec:
containers: template:
- name: grpc-health-probe spec:
image: stefanprodan/grpc_health_probe:v0.3.0 containers:
command: ['grpc_health_probe'] - name: grpc-health-probe
args: ['-addr={{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.grpcPort }}'] image: stefanprodan/grpc_health_probe:v0.3.0
restartPolicy: Never command: ['grpc_health_probe']
args: ['-addr={{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.grpcPort }}']
restartPolicy: Never

View File

@@ -1,5 +1,5 @@
apiVersion: v1 apiVersion: batch/v1
kind: Pod kind: Job
metadata: metadata:
name: {{ template "podinfo.fullname" . }}-jwt-test-{{ randAlphaNum 5 | lower }} name: {{ template "podinfo.fullname" . }}-jwt-test-{{ randAlphaNum 5 | lower }}
labels: labels:
@@ -14,16 +14,18 @@ metadata:
linkerd.io/inject: disabled linkerd.io/inject: disabled
appmesh.k8s.aws/sidecarInjectorWebhook: disabled appmesh.k8s.aws/sidecarInjectorWebhook: disabled
spec: spec:
containers: template:
- name: tools spec:
image: giantswarm/tiny-tools containers:
command: - name: tools
- sh image: giantswarm/tiny-tools
- -c command:
- | - sh
TOKEN=$(curl -sd 'test' ${PODINFO_SVC}/token | jq -r .token) && - -c
curl -sH "Authorization: Bearer ${TOKEN}" ${PODINFO_SVC}/token/validate | grep test - |
env: TOKEN=$(curl -sd 'test' ${PODINFO_SVC}/token | jq -r .token) &&
- name: PODINFO_SVC curl -sH "Authorization: Bearer ${TOKEN}" ${PODINFO_SVC}/token/validate | grep test
value: "{{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.externalPort }}" env:
restartPolicy: Never - name: PODINFO_SVC
value: "{{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.externalPort }}"
restartPolicy: Never

View File

@@ -1,5 +1,5 @@
apiVersion: v1 apiVersion: batch/v1
kind: Pod kind: Job
metadata: metadata:
name: {{ template "podinfo.fullname" . }}-service-test-{{ randAlphaNum 5 | lower }} name: {{ template "podinfo.fullname" . }}-service-test-{{ randAlphaNum 5 | lower }}
labels: labels:
@@ -14,15 +14,17 @@ metadata:
linkerd.io/inject: disabled linkerd.io/inject: disabled
appmesh.k8s.aws/sidecarInjectorWebhook: disabled appmesh.k8s.aws/sidecarInjectorWebhook: disabled
spec: spec:
containers: template:
- name: curl spec:
image: curlimages/curl:7.69.0 containers:
command: - name: curl
- sh image: curlimages/curl:7.69.0
- -c command:
- | - sh
curl -s ${PODINFO_SVC}/api/info | grep version - -c
env: - |
- name: PODINFO_SVC curl -s ${PODINFO_SVC}/api/info | grep version
value: "{{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.externalPort }}" env:
restartPolicy: Never - name: PODINFO_SVC
value: "{{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.externalPort }}"
restartPolicy: Never

View File

@@ -0,0 +1,26 @@
{{- if .Values.faults.test }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "podinfo.fullname" . }}-fault-test-{{ randAlphaNum 5 | lower }}
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "podinfo.name" . }}
annotations:
"helm.sh/hook": test
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
sidecar.istio.io/inject: "false"
linkerd.io/inject: disabled
appmesh.k8s.aws/sidecarInjectorWebhook: disabled
spec:
template:
spec:
containers:
- name: fault
image: alpine:3.11
command: ['/bin/sh']
args: ['-c', 'while sleep 3600; do :; done']
restartPolicy: Never
{{- end }}

View File

@@ -15,13 +15,15 @@ faults:
error: false error: false
unhealthy: false unhealthy: false
unready: false unready: false
testFail: false
testTimeout: false
h2c: h2c:
enabled: false enabled: false
image: image:
repository: stefanprodan/podinfo repository: stefanprodan/podinfo
tag: 3.2.2 tag: 3.2.4
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
service: service:

32
deploy/README.md Normal file
View File

@@ -0,0 +1,32 @@
# Deploy demo webapp
Demo webapp manifests:
- [common](webapp/common)
- [frontend](webapp/frontend)
- [backend](webapp/backend)
Deploy the demo in `webapp` namespace:
```bash
kubectl apply -f ./webapp/common
kubectl apply -f ./webapp/backend
kubectl apply -f ./webapp/frontend
```
Deploy the demo in the `dev` namespace:
```bash
kustomize build ./overlays/dev | kubectl apply -f-
```
Deploy the demo in the `staging` namespace:
```bash
kustomize build ./overlays/staging | kubectl apply -f-
```
Deploy the demo in the `production` namespace:
```bash
kustomize build ./overlays/production | kubectl apply -f-
```

View File

@@ -0,0 +1,72 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
spec:
minReadySeconds: 3
revisionHistoryLimit: 5
progressDeadlineSeconds: 60
strategy:
rollingUpdate:
maxUnavailable: 0
type: RollingUpdate
selector:
matchLabels:
app: backend
template:
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9797"
labels:
app: backend
spec:
containers:
- name: backend
image: stefanprodan/podinfo:3.2.4
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 9898
protocol: TCP
- name: http-metrics
containerPort: 9797
protocol: TCP
- name: grpc
containerPort: 9999
protocol: TCP
command:
- ./podinfo
- --port=9898
- --port-metrics=9797
- --grpc-port=9999
- --grpc-service-name=backend
- --level=info
env:
- name: PODINFO_UI_COLOR
value: "#34577c"
livenessProbe:
exec:
command:
- podcli
- check
- http
- localhost:9898/healthz
initialDelaySeconds: 5
timeoutSeconds: 5
readinessProbe:
exec:
command:
- podcli
- check
- http
- localhost:9898/readyz
initialDelaySeconds: 5
timeoutSeconds: 5
resources:
limits:
cpu: 2000m
memory: 512Mi
requests:
cpu: 100m
memory: 32Mi

View File

@@ -0,0 +1,18 @@
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: backend
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: backend
minReplicas: 1
maxReplicas: 2
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 99

View File

@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- service.yaml
- deployment.yaml
- hpa.yaml

View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: backend
spec:
type: ClusterIP
selector:
app: backend
ports:
- name: http
port: 9898
protocol: TCP
targetPort: http
- port: 9999
targetPort: grpc
protocol: TCP
name: grpc

View File

@@ -0,0 +1,71 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
minReadySeconds: 3
revisionHistoryLimit: 5
progressDeadlineSeconds: 60
strategy:
rollingUpdate:
maxUnavailable: 0
type: RollingUpdate
selector:
matchLabels:
app: frontend
template:
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9797"
labels:
app: frontend
spec:
containers:
- name: frontend
image: stefanprodan/podinfo:3.2.4
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 9898
protocol: TCP
- name: http-metrics
containerPort: 9797
protocol: TCP
- name: grpc
containerPort: 9999
protocol: TCP
command:
- ./podinfo
- --port=9898
- --port-metrics=9797
- --level=info
- --backend-url=http://backend:9898/echo
env:
- name: PODINFO_UI_COLOR
value: "#34577c"
livenessProbe:
exec:
command:
- podcli
- check
- http
- localhost:9898/healthz
initialDelaySeconds: 5
timeoutSeconds: 5
readinessProbe:
exec:
command:
- podcli
- check
- http
- localhost:9898/readyz
initialDelaySeconds: 5
timeoutSeconds: 5
resources:
limits:
cpu: 1000m
memory: 128Mi
requests:
cpu: 100m
memory: 32Mi

View File

@@ -0,0 +1,18 @@
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: frontend
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: frontend
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 99

View File

@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- service.yaml
- deployment.yaml
- hpa.yaml

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
spec:
type: ClusterIP
selector:
app: frontend
ports:
- name: http
port: 80
protocol: TCP
targetPort: http

View File

@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: dev
resources:
- ../../bases/backend
- ../../bases/frontend
- namespace.yaml
transformers:
- labels.yaml

View File

@@ -0,0 +1,10 @@
apiVersion: builtin
kind: LabelTransformer
metadata:
name: labels
labels:
env: dev
instance: webapp
fieldSpecs:
- path: metadata/labels
create: true

View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: dev

View File

@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: production
resources:
- ../../bases/backend
- ../../bases/frontend
- namespace.yaml
transformers:
- labels.yaml

View File

@@ -0,0 +1,10 @@
apiVersion: builtin
kind: LabelTransformer
metadata:
name: labels
labels:
env: production
instance: webapp
fieldSpecs:
- path: metadata/labels
create: true

View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: production

View File

@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: staging
resources:
- ../../bases/backend
- ../../bases/frontend
- namespace.yaml
transformers:
- labels.yaml

View File

@@ -0,0 +1,10 @@
apiVersion: builtin
kind: LabelTransformer
metadata:
name: labels
labels:
env: staging
instance: webapp
fieldSpecs:
- path: metadata/labels
create: true

View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: staging

View File

@@ -0,0 +1,74 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
namespace: webapp
spec:
minReadySeconds: 3
revisionHistoryLimit: 5
progressDeadlineSeconds: 60
strategy:
rollingUpdate:
maxUnavailable: 0
type: RollingUpdate
selector:
matchLabels:
app: backend
template:
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9797"
labels:
app: backend
spec:
serviceAccountName: webapp
containers:
- name: backend
image: stefanprodan/podinfo:3.2.4
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 9898
protocol: TCP
- name: http-metrics
containerPort: 9797
protocol: TCP
- name: grpc
containerPort: 9999
protocol: TCP
command:
- ./podinfo
- --port=9898
- --port-metrics=9797
- --grpc-port=9999
- --grpc-service-name=backend
- --level=info
env:
- name: PODINFO_UI_COLOR
value: "#34577c"
livenessProbe:
exec:
command:
- podcli
- check
- http
- localhost:9898/healthz
initialDelaySeconds: 5
timeoutSeconds: 5
readinessProbe:
exec:
command:
- podcli
- check
- http
- localhost:9898/readyz
initialDelaySeconds: 5
timeoutSeconds: 5
resources:
limits:
cpu: 2000m
memory: 512Mi
requests:
cpu: 100m
memory: 32Mi

View File

@@ -0,0 +1,19 @@
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: backend
namespace: webapp
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: backend
minReplicas: 1
maxReplicas: 2
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 99

View File

@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: backend
namespace: webapp
spec:
type: ClusterIP
selector:
app: backend
ports:
- name: http
port: 9898
protocol: TCP
targetPort: http
- port: 9999
targetPort: grpc
protocol: TCP
name: grpc

View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: webapp

View File

@@ -0,0 +1,29 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: reconciler
namespace: webapp
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: reconciler
namespace: webapp
rules:
- apiGroups: ['*']
resources: ['*']
verbs: ['*']
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: reconciler
namespace: webapp
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: reconciler
subjects:
- kind: ServiceAccount
name: reconciler
namespace: webapp

View File

@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: webapp
namespace: webapp

View File

@@ -0,0 +1,73 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
namespace: webapp
spec:
minReadySeconds: 3
revisionHistoryLimit: 5
progressDeadlineSeconds: 60
strategy:
rollingUpdate:
maxUnavailable: 0
type: RollingUpdate
selector:
matchLabels:
app: frontend
template:
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9797"
labels:
app: frontend
spec:
serviceAccountName: webapp
containers:
- name: frontend
image: stefanprodan/podinfo:3.2.4
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 9898
protocol: TCP
- name: http-metrics
containerPort: 9797
protocol: TCP
- name: grpc
containerPort: 9999
protocol: TCP
command:
- ./podinfo
- --port=9898
- --port-metrics=9797
- --level=info
- --backend-url=http://backend:9898/echo
env:
- name: PODINFO_UI_COLOR
value: "#34577c"
livenessProbe:
exec:
command:
- podcli
- check
- http
- localhost:9898/healthz
initialDelaySeconds: 5
timeoutSeconds: 5
readinessProbe:
exec:
command:
- podcli
- check
- http
- localhost:9898/readyz
initialDelaySeconds: 5
timeoutSeconds: 5
resources:
limits:
cpu: 1000m
memory: 128Mi
requests:
cpu: 100m
memory: 32Mi

View File

@@ -0,0 +1,19 @@
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: frontend
namespace: webapp
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: backend
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 99

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
namespace: webapp
spec:
type: ClusterIP
selector:
app: frontend
ports:
- name: http
port: 80
protocol: TCP
targetPort: http

View File

@@ -2,8 +2,6 @@ apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: podinfo name: podinfo
labels:
app: podinfo
spec: spec:
minReadySeconds: 3 minReadySeconds: 3
revisionHistoryLimit: 5 revisionHistoryLimit: 5
@@ -25,7 +23,7 @@ spec:
spec: spec:
containers: containers:
- name: podinfod - name: podinfod
image: stefanprodan/podinfo:3.2.2 image: stefanprodan/podinfo:3.2.4
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- name: http - name: http

View File

@@ -2,3 +2,6 @@ resources:
- hpa.yaml - hpa.yaml
- deployment.yaml - deployment.yaml
- service.yaml - service.yaml
commonLabels:
app: podinfo

View File

@@ -2,8 +2,6 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: podinfo name: podinfo
labels:
app: podinfo
spec: spec:
type: ClusterIP type: ClusterIP
selector: selector:

View File

@@ -1,4 +1,4 @@
package version package version
var VERSION = "3.2.2" var VERSION = "3.2.4"
var REVISION = "unknown" var REVISION = "unknown"