mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-04-07 03:26:54 +00:00
Compare commits
387 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29827dd944 | ||
|
|
9525259938 | ||
|
|
a53ddbcffc | ||
|
|
e3c8277e58 | ||
|
|
420b2f64b8 | ||
|
|
0a93807324 | ||
|
|
d73d94eec9 | ||
|
|
a723c9447d | ||
|
|
eca2d3a1d9 | ||
|
|
2dfda568b2 | ||
|
|
4d7604ab63 | ||
|
|
f3c2e57a6f | ||
|
|
8bded1ba80 | ||
|
|
da120efc04 | ||
|
|
ea672716dd | ||
|
|
47742372b9 | ||
|
|
30be5f5b6a | ||
|
|
4fb3be1de0 | ||
|
|
d532cc2a24 | ||
|
|
f1eb631ac9 | ||
|
|
03172452ee | ||
|
|
b6b680fe50 | ||
|
|
e51374c0ec | ||
|
|
80b5bf5495 | ||
|
|
f53a3109cf | ||
|
|
11b7ac4319 | ||
|
|
396a56493b | ||
|
|
4991d2e6d0 | ||
|
|
c0669703ab | ||
|
|
0f360bb788 | ||
|
|
d7fee06b63 | ||
|
|
4f64661bff | ||
|
|
1318ba1bd1 | ||
|
|
1267688401 | ||
|
|
3ed50e4d85 | ||
|
|
d9fec9778d | ||
|
|
7ac390bb27 | ||
|
|
576ad0ff2f | ||
|
|
74ac24bc86 | ||
|
|
902e62b5f3 | ||
|
|
6a069aed1a | ||
|
|
bca20328fb | ||
|
|
d81ac93a8a | ||
|
|
71fc0d8096 | ||
|
|
81654006ee | ||
|
|
c74b0d4ccb | ||
|
|
e335313b04 | ||
|
|
ca375ee533 | ||
|
|
d8e8054876 | ||
|
|
e86405a867 | ||
|
|
a51de59edb | ||
|
|
1ff6fff334 | ||
|
|
98e8cd39d4 | ||
|
|
65b9e92db3 | ||
|
|
c6536c75ce | ||
|
|
3c4910d1c7 | ||
|
|
c831679d1e | ||
|
|
94a9f99f79 | ||
|
|
86ac641693 | ||
|
|
cdd09cdd3d | ||
|
|
0b8a7dace7 | ||
|
|
e50f88a43d | ||
|
|
67e4628d95 | ||
|
|
73f5e936c8 | ||
|
|
0e26c3b934 | ||
|
|
dc39bd9a08 | ||
|
|
c23d57a4e9 | ||
|
|
85d22b2172 | ||
|
|
ff906f2242 | ||
|
|
2dbf735c46 | ||
|
|
1318243ec9 | ||
|
|
12e7f14ff0 | ||
|
|
fb3b01be30 | ||
|
|
be955e76b0 | ||
|
|
3e79d79447 | ||
|
|
cd555cf439 | ||
|
|
2927336ecd | ||
|
|
8f5425b6d5 | ||
|
|
1cd88028c7 | ||
|
|
ca101e6728 | ||
|
|
c8419e386a | ||
|
|
9356c1c0c4 | ||
|
|
60b5e4c4fe | ||
|
|
322b71c1e5 | ||
|
|
b3396adb98 | ||
|
|
c6e70a7aa0 | ||
|
|
6810566623 | ||
|
|
8efcd73510 | ||
|
|
eb81ed6ed2 | ||
|
|
916f1a298a | ||
|
|
7cc399463c | ||
|
|
78755636d0 | ||
|
|
b99bf8c252 | ||
|
|
e7928cfbc7 | ||
|
|
dc5d3d559e | ||
|
|
71f618320e | ||
|
|
c4e601b4cb | ||
|
|
6b7aab8a10 | ||
|
|
b7d3d71d8f | ||
|
|
abcd272293 | ||
|
|
4af7854aa2 | ||
|
|
fc1e4a48ed | ||
|
|
08238eada7 | ||
|
|
892a66ea93 | ||
|
|
0b1481aa8e | ||
|
|
ff32a1fc4b | ||
|
|
3de84d2360 | ||
|
|
ba6f4ffd7c | ||
|
|
6d4405a1ef | ||
|
|
752950cb4f | ||
|
|
b10c3067c8 | ||
|
|
85cd1c46d4 | ||
|
|
2687a13c75 | ||
|
|
5fb6597929 | ||
|
|
1fbdd9420f | ||
|
|
30cd3b27d7 | ||
|
|
1d7de0bb82 | ||
|
|
c52654c59e | ||
|
|
1a6838a4a2 | ||
|
|
b0c487c6b2 | ||
|
|
b28069ac51 | ||
|
|
d8a136cf74 | ||
|
|
614f74f6df | ||
|
|
0c4f327390 | ||
|
|
d791dedb24 | ||
|
|
220d4e909c | ||
|
|
eba7fe186e | ||
|
|
9108833214 | ||
|
|
386ceb09be | ||
|
|
f350624047 | ||
|
|
37ba3e854f | ||
|
|
70335812c6 | ||
|
|
8d010c498e | ||
|
|
8b3079a417 | ||
|
|
37fa020bcd | ||
|
|
d879d0f4fb | ||
|
|
16191504d1 | ||
|
|
d042732a44 | ||
|
|
649864583b | ||
|
|
c07eb64558 | ||
|
|
44942884c3 | ||
|
|
d562a2a82a | ||
|
|
d7c1bf015c | ||
|
|
cdec0786ef | ||
|
|
e6d611e1e2 | ||
|
|
36bea810ef | ||
|
|
50047dab3a | ||
|
|
2b936e6700 | ||
|
|
55e4e51eba | ||
|
|
47090ad9e1 | ||
|
|
6a0bbda8a5 | ||
|
|
357009a863 | ||
|
|
0f98770296 | ||
|
|
f9032836a6 | ||
|
|
5368c3fe10 | ||
|
|
b1207aa9b1 | ||
|
|
c7f9b521fa | ||
|
|
24405a5a5d | ||
|
|
5195b158fc | ||
|
|
532db405f8 | ||
|
|
2251bee699 | ||
|
|
8535efccb7 | ||
|
|
e008d1f261 | ||
|
|
22097353d2 | ||
|
|
c305843105 | ||
|
|
0d2c428859 | ||
|
|
ecaa7cf4d3 | ||
|
|
8447b6985b | ||
|
|
9371d6d153 | ||
|
|
20b8c1043c | ||
|
|
2d80c7a22d | ||
|
|
dc830d02a6 | ||
|
|
badf3271a1 | ||
|
|
9f9c2f3245 | ||
|
|
33dac1ba40 | ||
|
|
1cf8b8aeef | ||
|
|
22fb1c3d34 | ||
|
|
adf8157da6 | ||
|
|
03f8ad0251 | ||
|
|
101e371e96 | ||
|
|
53c9f3ad9b | ||
|
|
a69f0282fd | ||
|
|
174d183056 | ||
|
|
7bb64e7567 | ||
|
|
49a4b31d53 | ||
|
|
c29e013a33 | ||
|
|
45ecda63bb | ||
|
|
4868f430c7 | ||
|
|
ca9c6bb4f8 | ||
|
|
86f3b1a57c | ||
|
|
b22dd96a54 | ||
|
|
5aaf95849e | ||
|
|
e197eca420 | ||
|
|
73fcdbe4a6 | ||
|
|
074d0f9ff2 | ||
|
|
d9bc6301e9 | ||
|
|
a0e323e331 | ||
|
|
1ee349fa17 | ||
|
|
0f526c3cd4 | ||
|
|
021c55fed9 | ||
|
|
bb2408d17d | ||
|
|
5eb3cafd6a | ||
|
|
df0f8ba885 | ||
|
|
19a59d96f1 | ||
|
|
401461595a | ||
|
|
bd77584ade | ||
|
|
87e0dbaa7e | ||
|
|
c5494104a1 | ||
|
|
74c60a927c | ||
|
|
ecdf07c4d5 | ||
|
|
ff29c549ff | ||
|
|
fa75fc0520 | ||
|
|
0bc496456d | ||
|
|
398c543171 | ||
|
|
a54dc2a9c7 | ||
|
|
bfa42afa1f | ||
|
|
590987704e | ||
|
|
d561182076 | ||
|
|
72bd6faf35 | ||
|
|
2cbe0fcdff | ||
|
|
87e594b109 | ||
|
|
7ec9e6c84a | ||
|
|
8183d0d5fc | ||
|
|
aa27416651 | ||
|
|
b0594a85b9 | ||
|
|
e816d1b5bc | ||
|
|
6316e213d1 | ||
|
|
a1b112f4e1 | ||
|
|
1495fd888e | ||
|
|
dfc4a6d37e | ||
|
|
aaa47e535f | ||
|
|
0278e11a05 | ||
|
|
12ceae475f | ||
|
|
4892983fd1 | ||
|
|
bcf492e92b | ||
|
|
a54550e439 | ||
|
|
29dd482f49 | ||
|
|
3a7d4d1544 | ||
|
|
c14b116dea | ||
|
|
12c078938d | ||
|
|
dd3869b1a1 | ||
|
|
45cfe3abc2 | ||
|
|
fcf573111b | ||
|
|
cadabcc6a5 | ||
|
|
9dfb676083 | ||
|
|
e06a5517da | ||
|
|
fedab0de38 | ||
|
|
7d13025a35 | ||
|
|
7280e43cbf | ||
|
|
3ef0b4cd09 | ||
|
|
073f1ec5af | ||
|
|
1e0307c759 | ||
|
|
d4d75c2fbf | ||
|
|
2a6533c68a | ||
|
|
0647aea75b | ||
|
|
8c258bb1d8 | ||
|
|
58726f0bd2 | ||
|
|
bc08542ed3 | ||
|
|
bbce3f3f67 | ||
|
|
67e2c98a60 | ||
|
|
938b00be6d | ||
|
|
e6c7657155 | ||
|
|
d75e8d7838 | ||
|
|
74d6532429 | ||
|
|
8187f79475 | ||
|
|
2b6f4f0a7d | ||
|
|
3a4a99697b | ||
|
|
1abc44f0d8 | ||
|
|
3d798af827 | ||
|
|
f8f8073946 | ||
|
|
c8c7a6d1bb | ||
|
|
eac008b339 | ||
|
|
d2227a4204 | ||
|
|
ae3fe3da98 | ||
|
|
42fdaf8e7a | ||
|
|
3e2d907993 | ||
|
|
21136b6405 | ||
|
|
e8c388a3fd | ||
|
|
abc38e1bff | ||
|
|
bf4a3140fe | ||
|
|
de2dd687cb | ||
|
|
f7a9563986 | ||
|
|
a699fffe7b | ||
|
|
24e5de8934 | ||
|
|
298c1ae941 | ||
|
|
fdd0a0b7da | ||
|
|
8bab17843c | ||
|
|
34c5ab57b6 | ||
|
|
0f9c989b68 | ||
|
|
e2e85a9604 | ||
|
|
b687d3c76f | ||
|
|
dbbb415194 | ||
|
|
1a89d81ebb | ||
|
|
b39526ebe8 | ||
|
|
607303dca9 | ||
|
|
3053e634f9 | ||
|
|
4f1e56ae83 | ||
|
|
f0590a03e0 | ||
|
|
aa815625d9 | ||
|
|
8615cb75d9 | ||
|
|
b23ebb15cb | ||
|
|
dcb5b13023 | ||
|
|
71869089fa | ||
|
|
1cf228c67b | ||
|
|
b6e81a931b | ||
|
|
744597a481 | ||
|
|
389c86ee93 | ||
|
|
34db5fa463 | ||
|
|
0d62402ae9 | ||
|
|
e40d32ba87 | ||
|
|
3879b59f43 | ||
|
|
44157ecd84 | ||
|
|
bfa8d8032f | ||
|
|
b1251214f6 | ||
|
|
f1168c4946 | ||
|
|
013343a232 | ||
|
|
d460863f3b | ||
|
|
25a1e26159 | ||
|
|
b39afea117 | ||
|
|
6d11ef9baf | ||
|
|
baf128d856 | ||
|
|
79f8138328 | ||
|
|
ceed4e7870 | ||
|
|
bfce2199e8 | ||
|
|
d55bb8eabd | ||
|
|
5fb056ebcb | ||
|
|
35b9c9f946 | ||
|
|
74e0aeeff7 | ||
|
|
bbb081b0e1 | ||
|
|
c16318bb85 | ||
|
|
86d5fe86e4 | ||
|
|
b3b00fe354 | ||
|
|
a7bcfaf9b3 | ||
|
|
1d4c534728 | ||
|
|
f2e0aa154d | ||
|
|
6d5b3d254a | ||
|
|
9b9f11da95 | ||
|
|
1a55e30bcf | ||
|
|
394c40e3ff | ||
|
|
b76b1a38c9 | ||
|
|
2eb17d80c8 | ||
|
|
678a42ce34 | ||
|
|
2da59980fe | ||
|
|
8697f091f3 | ||
|
|
4d2cf65260 | ||
|
|
116a378991 | ||
|
|
450796ddb2 | ||
|
|
cb8c1fcec1 | ||
|
|
37da8d1c74 | ||
|
|
e55ebd258d | ||
|
|
6b869d1a18 | ||
|
|
dea973d614 | ||
|
|
f4199ab8bc | ||
|
|
19603ddfc1 | ||
|
|
bf09377bfd | ||
|
|
075712dd73 | ||
|
|
07dd9a3c3e | ||
|
|
63ac69ea69 | ||
|
|
3db382d2c9 | ||
|
|
9f88a0e940 | ||
|
|
c6a2c90497 | ||
|
|
54908f7d51 | ||
|
|
36bf90b008 | ||
|
|
dd9020c8b2 | ||
|
|
51009591a5 | ||
|
|
2b8c71ba78 | ||
|
|
203f7e1bf0 | ||
|
|
8179263f52 | ||
|
|
b26a34b5b6 | ||
|
|
cd7a0fb18e | ||
|
|
c1fd17e50a | ||
|
|
f98267009e | ||
|
|
7d0203196a | ||
|
|
673966bae4 | ||
|
|
9265828c4f | ||
|
|
0f68b60870 | ||
|
|
217a27ce02 | ||
|
|
fc172b0e7c | ||
|
|
b891025365 | ||
|
|
3c3f2a2e60 | ||
|
|
06b5e969db | ||
|
|
8508550ee6 | ||
|
|
5c1032c578 | ||
|
|
9febc66b98 | ||
|
|
59dc738b25 | ||
|
|
8524be7240 | ||
|
|
065a18c258 |
@@ -1,9 +1,10 @@
|
||||
# Podinfo signed releases
|
||||
|
||||
Podinfo deployment manifests are published to GitHub Container Registry as OCI artifacts
|
||||
and are signed using [cosign](https://github.com/sigstore/cosign).
|
||||
Podinfo release assets (container image, Helm chart, Flux artifact, Timoni module)
|
||||
are published to GitHub Container Registry and are signed with
|
||||
[Cosign v2](https://github.com/sigstore/cosign) keyless & GitHub Actions OIDC.
|
||||
|
||||
## Verify the artifacts with cosign
|
||||
## Verify podinfo with cosign
|
||||
|
||||
Install the [cosign](https://github.com/sigstore/cosign) CLI:
|
||||
|
||||
@@ -11,29 +12,50 @@ Install the [cosign](https://github.com/sigstore/cosign) CLI:
|
||||
brew install sigstore/tap/cosign
|
||||
```
|
||||
|
||||
Verify a podinfo release with cosign CLI:
|
||||
### Container image
|
||||
|
||||
Verify the podinfo container image hosted on GHCR:
|
||||
|
||||
```sh
|
||||
cosign verify -key https://raw.githubusercontent.com/stefanprodan/podinfo/master/cosign/cosign.pub \
|
||||
ghcr.io/stefanprodan/podinfo-deploy:latest
|
||||
cosign verify ghcr.io/stefanprodan/podinfo:6.5.0 \
|
||||
--certificate-identity-regexp="^https://github.com/stefanprodan/podinfo.*$" \
|
||||
--certificate-oidc-issuer=https://token.actions.githubusercontent.com
|
||||
```
|
||||
|
||||
## Download the artifacts with crane
|
||||
|
||||
Install the [crane](https://github.com/google/go-containerregistry/tree/main/cmd/crane) CLI:
|
||||
Verify the podinfo container image hosted on Docker Hub:
|
||||
|
||||
```sh
|
||||
brew install crane
|
||||
cosign verify docker.io/stefanprodan/podinfo:6.5.0 \
|
||||
--certificate-identity-regexp="^https://github.com/stefanprodan/podinfo.*$" \
|
||||
--certificate-oidc-issuer=https://token.actions.githubusercontent.com
|
||||
```
|
||||
|
||||
Download the podinfo deployment manifests with crane CLI:
|
||||
### Helm chart
|
||||
|
||||
```console
|
||||
$ crane export ghcr.io/stefanprodan/podinfo-deploy:latest -| tar -xf -
|
||||
Verify the podinfo [Helm](https://helm.sh) chart hosted on GHCR:
|
||||
|
||||
$ ls -1
|
||||
deployment.yaml
|
||||
hpa.yaml
|
||||
kustomization.yaml
|
||||
service.yaml
|
||||
```sh
|
||||
cosign verify ghcr.io/stefanprodan/charts/podinfo:6.5.0 \
|
||||
--certificate-identity-regexp="^https://github.com/stefanprodan/podinfo.*$" \
|
||||
--certificate-oidc-issuer=https://token.actions.githubusercontent.com
|
||||
```
|
||||
|
||||
### Flux artifact
|
||||
|
||||
Verify the podinfo [Flux](https://fluxcd.io) artifact hosted on GHCR:
|
||||
|
||||
```sh
|
||||
cosign verify ghcr.io/stefanprodan/manifests/podinfo:6.5.0 \
|
||||
--certificate-identity-regexp="^https://github.com/stefanprodan/podinfo.*$" \
|
||||
--certificate-oidc-issuer=https://token.actions.githubusercontent.com
|
||||
```
|
||||
|
||||
### Timoni module
|
||||
|
||||
Verify the podinfo [Timoni](https://timoni.sh) module hosted on GHCR:
|
||||
|
||||
```sh
|
||||
cosign verify ghcr.io/stefanprodan/modules/podinfo:6.5.0 \
|
||||
--certificate-identity-regexp="^https://github.com/stefanprodan/podinfo.*$" \
|
||||
--certificate-oidc-issuer=https://token.actions.githubusercontent.com
|
||||
```
|
||||
|
||||
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
timoni/podinfo/cue.mod/** linguist-vendored
|
||||
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
github: stefanprodan
|
||||
33
.github/actions/helm/action.yml
vendored
33
.github/actions/helm/action.yml
vendored
@@ -1,33 +0,0 @@
|
||||
name: Setup Helm CLI
|
||||
description: A GitHub Action for running Helm commands
|
||||
author: Stefan Prodan
|
||||
branding:
|
||||
color: blue
|
||||
icon: command
|
||||
inputs:
|
||||
version:
|
||||
description: "Helm version"
|
||||
required: true
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: "Download helm binary to tmp"
|
||||
shell: bash
|
||||
run: |
|
||||
VERSION=${{ inputs.version }}
|
||||
BIN_URL="https://get.helm.sh/helm-v${VERSION}-linux-amd64.tar.gz"
|
||||
curl -sL ${BIN_URL} -o /tmp/helm.tar.gz
|
||||
mkdir -p /tmp/helm
|
||||
tar -C /tmp/helm/ -zxvf /tmp/helm.tar.gz
|
||||
- name: "Add helm binary to /usr/local/bin"
|
||||
shell: bash
|
||||
run: |
|
||||
sudo cp /tmp/helm/linux-amd64/helm /usr/local/bin
|
||||
- name: "Cleanup tmp"
|
||||
shell: bash
|
||||
run: |
|
||||
rm -rf /tmp/helm/ /tmp/helm.tar.gz
|
||||
- name: "Verify correct installation of binary"
|
||||
shell: bash
|
||||
run: |
|
||||
helm version
|
||||
38
.github/actions/kubeconform/action.yml
vendored
Normal file
38
.github/actions/kubeconform/action.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Setup kubeconform
|
||||
description: A GitHub Action for running kubeconform commands
|
||||
author: Stefan Prodan
|
||||
branding:
|
||||
color: blue
|
||||
icon: command
|
||||
inputs:
|
||||
version:
|
||||
description: "kubeconform version e.g. 0.5.0 (defaults to latest stable release)"
|
||||
required: false
|
||||
arch:
|
||||
description: "arch can be amd64 or arm64"
|
||||
required: true
|
||||
default: "amd64"
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: "Download binary to the GH runner cache"
|
||||
shell: bash
|
||||
run: |
|
||||
ARCH=${{ inputs.arch }}
|
||||
VERSION=${{ inputs.version }}
|
||||
|
||||
if [ -z $VERSION ]; then
|
||||
VERSION=$(curl https://api.github.com/repos/yannh/kubeconform/releases/latest -sL | grep tag_name | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-)
|
||||
fi
|
||||
|
||||
BIN_URL="https://github.com/yannh/kubeconform/releases/download/v${VERSION}/kubeconform-linux-${ARCH}.tar.gz"
|
||||
BIN_DIR=$RUNNER_TOOL_CACHE/kubeconform/$VERSION/$ARCH
|
||||
|
||||
if [[ ! -x "$BIN_DIR/kind" ]]; then
|
||||
mkdir -p $BIN_DIR
|
||||
cd $BIN_DIR
|
||||
curl -sL $BIN_URL | tar xz
|
||||
chmod +x kubeconform
|
||||
fi
|
||||
|
||||
echo "$BIN_DIR" >> "$GITHUB_PATH"
|
||||
6
.github/actions/release-notes/Dockerfile
vendored
6
.github/actions/release-notes/Dockerfile
vendored
@@ -1,6 +0,0 @@
|
||||
FROM stefanprodan/alpine-base:latest
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
9
.github/actions/release-notes/action.yml
vendored
9
.github/actions/release-notes/action.yml
vendored
@@ -1,9 +0,0 @@
|
||||
name: 'github-release-notes'
|
||||
description: 'A GitHub Action to run github-release-notes commands'
|
||||
author: 'Stefan Prodan'
|
||||
branding:
|
||||
icon: 'command'
|
||||
color: 'blue'
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
25
.github/actions/release-notes/entrypoint.sh
vendored
25
.github/actions/release-notes/entrypoint.sh
vendored
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
VERSION=0.2.0
|
||||
BIN_DIR="$GITHUB_WORKSPACE/bin"
|
||||
|
||||
main() {
|
||||
mkdir -p ${BIN_DIR}
|
||||
tmpDir=$(mktemp -d)
|
||||
|
||||
pushd $tmpDir >& /dev/null
|
||||
|
||||
curl -sSL https://github.com/buchanae/github-release-notes/releases/download/${VERSION}/github-release-notes-linux-amd64-${VERSION}.tar.gz | tar xz
|
||||
cp github-release-notes ${BIN_DIR}/github-release-notes
|
||||
|
||||
popd >& /dev/null
|
||||
rm -rf $tmpDir
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
echo "$BIN_DIR" >> $GITHUB_PATH
|
||||
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH
|
||||
24
.github/actions/runner-cleanup/action.yml
vendored
Normal file
24
.github/actions/runner-cleanup/action.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Runner Cleanup
|
||||
description: A GitHub Action for removing bloat from Ubuntu GitHub Actions runner.
|
||||
author: Stefan Prodan
|
||||
branding:
|
||||
color: blue
|
||||
icon: command
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: "Disk Usage Before Cleanup"
|
||||
shell: bash
|
||||
run: |
|
||||
df -h
|
||||
- name: "Remove .NET, Android and Haskell"
|
||||
shell: bash
|
||||
run: |
|
||||
sudo rm -rf /usr/share/dotnet || true
|
||||
sudo rm -rf /usr/local/lib/android || true
|
||||
sudo rm -rf /opt/ghc || true
|
||||
sudo rm -rf /usr/local/.ghcup || true
|
||||
- name: "Disk Usage After Cleanup"
|
||||
shell: bash
|
||||
run: |
|
||||
df -h
|
||||
11
.github/dependabot.yaml
vendored
Normal file
11
.github/dependabot.yaml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
groups:
|
||||
actions:
|
||||
patterns:
|
||||
- "*"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
51
.github/policy/kubernetes.rego
vendored
51
.github/policy/kubernetes.rego
vendored
@@ -1,51 +0,0 @@
|
||||
package kubernetes
|
||||
|
||||
name = input.metadata.name
|
||||
|
||||
kind = input.kind
|
||||
|
||||
is_service {
|
||||
input.kind = "Service"
|
||||
}
|
||||
|
||||
is_deployment {
|
||||
input.kind = "Deployment"
|
||||
}
|
||||
|
||||
is_pod {
|
||||
input.kind = "Pod"
|
||||
}
|
||||
|
||||
split_image(image) = [image, "latest"] {
|
||||
not contains(image, ":")
|
||||
}
|
||||
|
||||
split_image(image) = [image_name, tag] {
|
||||
[image_name, tag] = split(image, ":")
|
||||
}
|
||||
|
||||
pod_containers(pod) = all_containers {
|
||||
keys = {"containers", "initContainers"}
|
||||
all_containers = [c | keys[k]; c = pod.spec[k][_]]
|
||||
}
|
||||
|
||||
containers[container] {
|
||||
pods[pod]
|
||||
all_containers = pod_containers(pod)
|
||||
container = all_containers[_]
|
||||
}
|
||||
|
||||
containers[container] {
|
||||
all_containers = pod_containers(input)
|
||||
container = all_containers[_]
|
||||
}
|
||||
|
||||
pods[pod] {
|
||||
is_deployment
|
||||
pod = input.spec.template
|
||||
}
|
||||
|
||||
pods[pod] {
|
||||
is_pod
|
||||
pod = input
|
||||
}
|
||||
43
.github/policy/rules.rego
vendored
43
.github/policy/rules.rego
vendored
@@ -1,43 +0,0 @@
|
||||
package main
|
||||
|
||||
import data.kubernetes
|
||||
|
||||
name = input.metadata.name
|
||||
|
||||
# Deny containers with latest image tag
|
||||
deny[msg] {
|
||||
kubernetes.containers[container]
|
||||
[image_name, "latest"] = kubernetes.split_image(container.image)
|
||||
msg = sprintf("%s in the %s %s has an image %s, using the latest tag", [container.name, kubernetes.kind, kubernetes.name, image_name])
|
||||
}
|
||||
|
||||
# Deny services without app label selector
|
||||
service_labels {
|
||||
input.spec.selector["app"]
|
||||
}
|
||||
deny[msg] {
|
||||
kubernetes.is_service
|
||||
not service_labels
|
||||
msg = sprintf("Service %s should set app label selector", [name])
|
||||
}
|
||||
|
||||
# Deny deployments without app label selector
|
||||
match_labels {
|
||||
input.spec.selector.matchLabels["app"]
|
||||
}
|
||||
deny[msg] {
|
||||
kubernetes.is_deployment
|
||||
not match_labels
|
||||
msg = sprintf("Service %s should set app label selector", [name])
|
||||
}
|
||||
|
||||
# Warn if deployments have no prometheus pod annotations
|
||||
annotations {
|
||||
input.spec.template.metadata.annotations["prometheus.io/scrape"]
|
||||
input.spec.template.metadata.annotations["prometheus.io/port"]
|
||||
}
|
||||
warn[msg] {
|
||||
kubernetes.is_deployment
|
||||
not annotations
|
||||
msg = sprintf("Deployment %s should set prometheus.io/scrape and prometheus.io/port pod annotations", [name])
|
||||
}
|
||||
33
.github/workflows/cve-scan.yml
vendored
33
.github/workflows/cve-scan.yml
vendored
@@ -1,28 +1,25 @@
|
||||
name: cve-scan
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- "master"
|
||||
pull_request:
|
||||
branches:
|
||||
- "master"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
trivy:
|
||||
govulncheck:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Build image
|
||||
id: build
|
||||
run: |
|
||||
IMAGE=test/podinfo:${GITHUB_SHA}
|
||||
docker build -t ${IMAGE} .
|
||||
echo "::set-output name=image::$IMAGE"
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@master
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/runner-cleanup
|
||||
- name: Vulnerability scan
|
||||
id: govulncheck
|
||||
uses: golang/govulncheck-action@v1
|
||||
with:
|
||||
image-ref: ${{ steps.build.outputs.image }}
|
||||
format: table
|
||||
exit-code: "1"
|
||||
ignore-unfixed: true
|
||||
vuln-type: os,library
|
||||
severity: CRITICAL,HIGH
|
||||
repo-checkout: false
|
||||
|
||||
60
.github/workflows/e2e.yml
vendored
60
.github/workflows/e2e.yml
vendored
@@ -6,28 +6,29 @@ on:
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
kind-helm:
|
||||
strategy:
|
||||
matrix:
|
||||
helm-version:
|
||||
- 3.6.0
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v6
|
||||
- name: Disk Cleanup
|
||||
uses: ./.github/actions/runner-cleanup
|
||||
- name: Setup Kubernetes
|
||||
uses: engineerd/setup-kind@v0.5.0
|
||||
uses: helm/kind-action@v1.14.0
|
||||
with:
|
||||
version: v0.11.1
|
||||
cluster_name: kind
|
||||
- name: Build container image
|
||||
run: |
|
||||
./test/build.sh
|
||||
kind load docker-image test/podinfo:latest
|
||||
- name: Setup Helm
|
||||
uses: ./.github/actions/helm
|
||||
uses: azure/setup-helm@v4
|
||||
with:
|
||||
version: ${{ matrix.helm-version }}
|
||||
version: v4.1.0
|
||||
- name: Deploy
|
||||
run: ./test/deploy.sh
|
||||
- name: Run integration tests
|
||||
@@ -36,3 +37,44 @@ jobs:
|
||||
if: failure()
|
||||
run: |
|
||||
kubectl logs -l app=podinfo || true
|
||||
kind-timoni:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
registry:
|
||||
image: registry:2
|
||||
ports:
|
||||
- 5000:5000
|
||||
env:
|
||||
PODINFO_IMAGE_URL: "test/podinfo"
|
||||
PODINFO_MODULE_URL: "oci://localhost:5000/podinfo"
|
||||
PODINFO_VERSION: "0.0.0-devel"
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/runner-cleanup
|
||||
- name: Setup Timoni
|
||||
uses: stefanprodan/timoni/actions/setup@main
|
||||
- name: Setup Kubernetes
|
||||
uses: helm/kind-action@v1.14.0
|
||||
with:
|
||||
cluster_name: kind
|
||||
- name: Build container
|
||||
run: |
|
||||
docker build -t ${PODINFO_IMAGE_URL}:${PODINFO_VERSION} --build-arg "REVISION=${GITHUB_SHA}" -f Dockerfile.xx .
|
||||
kind load docker-image ${PODINFO_IMAGE_URL}:${PODINFO_VERSION}
|
||||
- name: Vet module
|
||||
run: |
|
||||
timoni mod vet ./timoni/podinfo --debug
|
||||
- name: Build module
|
||||
run: |
|
||||
timoni mod push ./timoni/podinfo ${PODINFO_MODULE_URL} -v ${PODINFO_VERSION}
|
||||
- name: Apply bundle
|
||||
run: |
|
||||
timoni bundle apply -f ./timoni/bundles/test.podinfo.cue --runtime-from-env
|
||||
- name: Verify status
|
||||
run: |
|
||||
timoni -n podinfo status backend
|
||||
timoni -n podinfo status frontend
|
||||
- name: Debug failure
|
||||
if: failure()
|
||||
run: |
|
||||
kubectl -n podinfo get all || true
|
||||
|
||||
149
.github/workflows/release.yml
vendored
149
.github/workflows/release.yml
vendored
@@ -6,32 +6,58 @@ on:
|
||||
- '*'
|
||||
|
||||
permissions:
|
||||
contents: write # needed to write releases
|
||||
id-token: write # needed for keyless signing
|
||||
packages: write # needed for ghcr access
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # needed to write releases
|
||||
id-token: write # needed for keyless signing
|
||||
packages: write # needed for ghcr access
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: imjasonh/setup-crane@v0.1
|
||||
- uses: sigstore/cosign-installer@main
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/runner-cleanup
|
||||
- uses: sigstore/cosign-installer@v4.0.0
|
||||
with:
|
||||
cosign-release: v2.6.1
|
||||
- uses: fluxcd/flux2/action@v2.8.1
|
||||
- uses: stefanprodan/timoni/actions/setup@v0.26.0
|
||||
- name: Setup Notation CLI
|
||||
uses: notaryproject/notation-action/setup@v1
|
||||
with:
|
||||
version: "1.1.0"
|
||||
- name: Setup Notation signing keys
|
||||
run: |
|
||||
mkdir -p ~/.config/notation/localkeys/
|
||||
cp ./.notation/signingkeys.json ~/.config/notation/
|
||||
cp ./.notation/notation.crt ~/.config/notation/localkeys/
|
||||
echo "$NOTATION_KEY" > ~/.config/notation/localkeys/notation.key
|
||||
env:
|
||||
NOTATION_KEY: ${{ secrets.NOTATION_SIGNING_KEY }}
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: 1.26.x
|
||||
- name: Setup Helm
|
||||
uses: azure/setup-helm@v4
|
||||
with:
|
||||
version: v4.1.1
|
||||
- name: Setup QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: all
|
||||
- name: Setup Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.GHCR_TOKEN }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
@@ -42,37 +68,64 @@ jobs:
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF/refs\/tags\//}
|
||||
fi
|
||||
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
echo ::set-output name=VERSION::${VERSION}
|
||||
- name: Publish multi-arch image
|
||||
uses: docker/build-push-action@v2
|
||||
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
|
||||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "REVISION=${GITHUB_SHA}" >> $GITHUB_OUTPUT
|
||||
- name: Generate images meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
docker.io/stefanprodan/podinfo
|
||||
ghcr.io/stefanprodan/podinfo
|
||||
tags: |
|
||||
type=raw,value=${{ steps.prep.outputs.VERSION }}
|
||||
type=raw,value=latest
|
||||
- name: Publish multi-arch image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
sbom: true
|
||||
provenance: true
|
||||
push: true
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: .
|
||||
file: ./Dockerfile.xx
|
||||
build-args: |
|
||||
REVISION=${{ steps.prep.outputs.REVISION }}
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
tags: |
|
||||
docker.io/stefanprodan/podinfo:${{ steps.prep.outputs.VERSION }}
|
||||
docker.io/stefanprodan/podinfo:latest
|
||||
ghcr.io/stefanprodan/podinfo:${{ steps.prep.outputs.VERSION }}
|
||||
labels: |
|
||||
org.opencontainers.image.title=${{ github.event.repository.name }}
|
||||
org.opencontainers.image.description=${{ github.event.repository.description }}
|
||||
org.opencontainers.image.source=${{ github.event.repository.html_url }}
|
||||
org.opencontainers.image.url=${{ github.event.repository.html_url }}
|
||||
org.opencontainers.image.revision=${{ github.sha }}
|
||||
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
|
||||
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
|
||||
- name: Sign images
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
- name: Publish Timoni module to GHCR
|
||||
run: |
|
||||
timoni mod push ./timoni/podinfo oci://ghcr.io/stefanprodan/modules/podinfo \
|
||||
--sign cosign \
|
||||
--version ${{ steps.prep.outputs.VERSION }} \
|
||||
-a 'org.opencontainers.image.source=https://github.com/stefanprodan/podinfo' \
|
||||
-a 'org.opencontainers.image.licenses=Apache-2.0' \
|
||||
-a 'org.opencontainers.image.description=A timoni.sh module for deploying Podinfo.' \
|
||||
-a 'org.opencontainers.image.documentation=https://github.com/stefanprodan/podinfo/blob/main/timoni/podinfo/README.md'
|
||||
- name: Publish Helm chart to GHCR
|
||||
run: |
|
||||
helm package charts/podinfo
|
||||
helm push podinfo-${{ steps.prep.outputs.VERSION }}.tgz oci://ghcr.io/stefanprodan/charts
|
||||
rm podinfo-${{ steps.prep.outputs.VERSION }}.tgz
|
||||
- name: Publish Flux OCI artifact to GHCR
|
||||
run: |
|
||||
flux push artifact oci://ghcr.io/stefanprodan/manifests/podinfo:${{ steps.prep.outputs.VERSION }} \
|
||||
--path="./kustomize" \
|
||||
--source="${{ github.event.repository.html_url }}" \
|
||||
--revision="${GITHUB_REF_NAME}/${GITHUB_SHA}"
|
||||
flux tag artifact oci://ghcr.io/stefanprodan/manifests/podinfo:${{ steps.prep.outputs.VERSION }} --tag latest
|
||||
- name: Sign artifacts with Cosign
|
||||
env:
|
||||
COSIGN_EXPERIMENTAL: 1
|
||||
run: |
|
||||
cosign sign docker.io/stefanprodan/podinfo:${{ steps.prep.outputs.VERSION }}
|
||||
cosign sign docker.io/stefanprodan/podinfo:latest
|
||||
cosign sign ghcr.io/stefanprodan/podinfo:${{ steps.prep.outputs.VERSION }}
|
||||
cosign sign docker.io/stefanprodan/podinfo:${{ steps.prep.outputs.VERSION }} --yes
|
||||
cosign sign ghcr.io/stefanprodan/podinfo:${{ steps.prep.outputs.VERSION }} --yes
|
||||
cosign sign ghcr.io/stefanprodan/charts/podinfo:${{ steps.prep.outputs.VERSION }} --yes
|
||||
cosign sign ghcr.io/stefanprodan/manifests/podinfo:${{ steps.prep.outputs.VERSION }} --yes
|
||||
- name: Publish base image
|
||||
uses: docker/build-push-action@v2
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
push: true
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
@@ -86,28 +139,30 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Publish config artifact
|
||||
run: |
|
||||
cd kustomize
|
||||
tar -cf config.tar * --numeric-owner --owner=0 --group=0
|
||||
crane append -f config.tar -t ghcr.io/stefanprodan/podinfo-deploy:${{ steps.prep.outputs.VERSION }}
|
||||
crane tag ghcr.io/stefanprodan/podinfo-deploy:${{ steps.prep.outputs.VERSION }} latest
|
||||
rm config.tar
|
||||
- name: Sign config artifact
|
||||
flux push artifact oci://ghcr.io/stefanprodan/podinfo-deploy:${{ steps.prep.outputs.VERSION }} \
|
||||
--path="./kustomize" \
|
||||
--source="${{ github.event.repository.html_url }}" \
|
||||
--revision="${GITHUB_REF_NAME}/${GITHUB_SHA}"
|
||||
flux tag artifact oci://ghcr.io/stefanprodan/podinfo-deploy:${{ steps.prep.outputs.VERSION }} --tag latest
|
||||
- name: Sign config artifact with cso
|
||||
run: |
|
||||
echo "$COSIGN_KEY" > /tmp/cosign.key
|
||||
cosign sign -key /tmp/cosign.key ghcr.io/stefanprodan/podinfo-deploy:${{ steps.prep.outputs.VERSION }}
|
||||
cosign sign -key /tmp/cosign.key ghcr.io/stefanprodan/podinfo-deploy:latest
|
||||
cosign sign -key /tmp/cosign.key ghcr.io/stefanprodan/podinfo-deploy:${{ steps.prep.outputs.VERSION }} --yes
|
||||
cosign sign -key /tmp/cosign.key ghcr.io/stefanprodan/podinfo-deploy:latest --yes
|
||||
env:
|
||||
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}
|
||||
COSIGN_KEY: ${{secrets.COSIGN_KEY}}
|
||||
- uses: ./.github/actions/release-notes
|
||||
- name: Generate release notes
|
||||
- name: Sign artifacts with Notation
|
||||
run: |
|
||||
echo 'CHANGELOG' > /tmp/release.txt
|
||||
github-release-notes -org stefanprodan -repo podinfo -since-latest-release >> /tmp/release.txt
|
||||
notation sign --signature-format cose ghcr.io/stefanprodan/podinfo:${{ steps.prep.outputs.VERSION }}
|
||||
notation sign --signature-format cose ghcr.io/stefanprodan/charts/podinfo:${{ steps.prep.outputs.VERSION }}
|
||||
notation sign --signature-format cose ghcr.io/stefanprodan/manifests/podinfo:${{ steps.prep.outputs.VERSION }}
|
||||
notation sign --signature-format cose ghcr.io/stefanprodan/podinfo-deploy:${{ steps.prep.outputs.VERSION }}
|
||||
notation sign --signature-format cose ghcr.io/stefanprodan/podinfo-deploy:latest
|
||||
- name: Publish release
|
||||
uses: goreleaser/goreleaser-action@v1
|
||||
uses: goreleaser/goreleaser-action@v7
|
||||
with:
|
||||
version: latest
|
||||
args: release --release-notes=/tmp/release.txt
|
||||
args: release --skip=validate
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
76
.github/workflows/test.yml
vendored
76
.github/workflows/test.yml
vendored
@@ -6,42 +6,68 @@ on:
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
KUBERNETES_VERSION: 1.35.0
|
||||
HELM_VERSION: 4.1.1
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Restore Go cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: ${{ runner.os }}-go-
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/runner-cleanup
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: 1.17.x
|
||||
go-version: 1.26.x
|
||||
cache-dependency-path: |
|
||||
**/go.sum
|
||||
**/go.mod
|
||||
- name: Setup kubectl
|
||||
uses: azure/setup-kubectl@v4
|
||||
with:
|
||||
version: v${{ env.KUBERNETES_VERSION }}
|
||||
- name: Setup kubeconform
|
||||
uses: ./.github/actions/kubeconform
|
||||
- name: Setup Helm
|
||||
uses: azure/setup-helm@v4
|
||||
with:
|
||||
version: v${{ env.HELM_VERSION }}
|
||||
- name: Setup CUE
|
||||
uses: cue-lang/setup-cue@v1.0.1
|
||||
- name: Setup Timoni
|
||||
uses: stefanprodan/timoni/actions/setup@v0.26.0
|
||||
- name: Run unit tests
|
||||
run: make test
|
||||
- name: Validate Helm chart
|
||||
run: |
|
||||
helm lint ./charts/podinfo/
|
||||
helm template ./charts/podinfo/ | kubeconform -strict -summary -kubernetes-version ${{ env.KUBERNETES_VERSION }}
|
||||
- name: Validate Kustomize overlay
|
||||
run: |
|
||||
kubectl kustomize ./kustomize/ | kubeconform -strict -summary -kubernetes-version ${{ env.KUBERNETES_VERSION }}
|
||||
- name: Verify CUE formatting
|
||||
working-directory: ./timoni/podinfo
|
||||
run: |
|
||||
cue fmt ./...
|
||||
status=$(git status . --porcelain)
|
||||
[[ -z "$status" ]] || {
|
||||
echo "CUE files are not correctly formatted"
|
||||
echo "$status"
|
||||
git diff
|
||||
exit 1
|
||||
}
|
||||
- name: Validate Timoni module
|
||||
working-directory: ./timoni/podinfo
|
||||
run: |
|
||||
timoni mod lint .
|
||||
timoni build podinfo . -f test_values.cue | kubeconform -strict -summary -skip=ServiceMonitor -kubernetes-version ${{ env.KUBERNETES_VERSION }}
|
||||
- name: Check if working tree is dirty
|
||||
run: |
|
||||
if [[ $(git diff --stat) != '' ]]; then
|
||||
echo 'run make test and commit changes'
|
||||
exit 1
|
||||
fi
|
||||
- name: Validate Helm chart
|
||||
uses: stefanprodan/kube-tools@v1
|
||||
with:
|
||||
kubectl: 1.19.11
|
||||
helm: 2.17.0
|
||||
helmv3: 3.6.0
|
||||
command: |
|
||||
helmv3 template ./charts/podinfo | kubeval --strict --kubernetes-version 1.19.11 --schema-location https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master
|
||||
- name: Validate kustomization
|
||||
uses: stefanprodan/kube-tools@v1
|
||||
with:
|
||||
kubectl: 1.19.11
|
||||
command: |
|
||||
kustomize build ./kustomize | kubeval --strict --kubernetes-version 1.19.11 --schema-location https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master
|
||||
kustomize build ./kustomize | conftest test -p .github/policy -
|
||||
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -19,4 +19,10 @@ release/
|
||||
build/
|
||||
gcloud/
|
||||
dist/
|
||||
bin/
|
||||
bin/
|
||||
cue/cue.mod/gen/
|
||||
cue/go.mod
|
||||
cue/go.sum
|
||||
|
||||
.notation/podinfo.csr
|
||||
.notation/podinfo.key
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
version: 2
|
||||
|
||||
# xref: https://goreleaser.com/customization/project/
|
||||
project_name: podinfo
|
||||
|
||||
# xref: https://goreleaser.com/customization/hooks/
|
||||
before:
|
||||
hooks:
|
||||
- go mod download
|
||||
|
||||
# xref: https://goreleaser.com/customization/env/
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
|
||||
# xref: https://goreleaser.com/customization/build/
|
||||
builds:
|
||||
- main: ./cmd/podcli
|
||||
binary: podcli
|
||||
@@ -8,9 +23,13 @@ builds:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
|
||||
# xref: https://goreleaser.com/customization/archive/
|
||||
archives:
|
||||
- name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
|
||||
files:
|
||||
- none*
|
||||
- LICENSE
|
||||
|
||||
# xref: https://goreleaser.com/customization/changelog/
|
||||
changelog:
|
||||
use: github-native
|
||||
|
||||
15
.notation/README.md
Normal file
15
.notation/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Podinfo signed releases
|
||||
|
||||
Podinfo release assets such as the Helm chart and the Flux artifact
|
||||
are published to GitHub Container Registry and are signed with
|
||||
[Notation](https://github.com/notaryproject/notation).
|
||||
|
||||
## Generate signing keys
|
||||
|
||||
Generate a new signing key pair:
|
||||
|
||||
```sh
|
||||
openssl genrsa -out podinfo.key 2048
|
||||
openssl req -new -key podinfo.key -out podinfo.csr -config codesign.cnf
|
||||
openssl x509 -req -days 1826 -in podinfo.csr -signkey podinfo.key -out notation.crt -extensions v3_req -extfile codesign.cnf
|
||||
```
|
||||
18
.notation/codesign.cnf
Normal file
18
.notation/codesign.cnf
Normal file
@@ -0,0 +1,18 @@
|
||||
[ req ]
|
||||
default_bits = 2048
|
||||
default_keyfile = privatekey.pem
|
||||
distinguished_name = req_distinguished_name
|
||||
req_extensions = v3_req
|
||||
prompt = no
|
||||
|
||||
[ req_distinguished_name ]
|
||||
C = RO
|
||||
ST = BU
|
||||
L = Bucharest
|
||||
O = Notary
|
||||
CN = stefanprodan.com
|
||||
|
||||
[ v3_req ]
|
||||
keyUsage = critical,digitalSignature
|
||||
extendedKeyUsage = critical,codeSigning
|
||||
#subjectKeyIdentifier = hash
|
||||
21
.notation/notation.crt
Normal file
21
.notation/notation.crt
Normal file
@@ -0,0 +1,21 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDbDCCAlSgAwIBAgIUP7zhmTw5XTWLcgBGkBEsErMOkz4wDQYJKoZIhvcNAQEL
|
||||
BQAwWjELMAkGA1UEBhMCUk8xCzAJBgNVBAgMAkJVMRIwEAYDVQQHDAlCdWNoYXJl
|
||||
c3QxDzANBgNVBAoMBk5vdGFyeTEZMBcGA1UEAwwQc3RlZmFucHJvZGFuLmNvbTAe
|
||||
Fw0yNDAyMjUxMDAyMzZaFw0yOTAyMjQxMDAyMzZaMFoxCzAJBgNVBAYTAlJPMQsw
|
||||
CQYDVQQIDAJCVTESMBAGA1UEBwwJQnVjaGFyZXN0MQ8wDQYDVQQKDAZOb3Rhcnkx
|
||||
GTAXBgNVBAMMEHN0ZWZhbnByb2Rhbi5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB
|
||||
DwAwggEKAoIBAQDtH4oPi3SyX/DGv6NdjIvmApvD9eeSgsmHdwpAly8T9D2me+fx
|
||||
Z+wRNJmq4aq/A1anX+Sg28iwHzV+1WKpsHnjYzDAJSEYP2S8A5H1nGRKUoibdijw
|
||||
C3QBh5C75rjF/tmZVSX/Vgbf3HJJEsF4WUxWabLxoV2QLo7UlEsQd9+bSeKNMncx
|
||||
1+E6FdbRCrYo90iobvZJ8K/S2zCWq/JTeHfTnmSEDhx6nMJcaSjvMPn3zyauWcQw
|
||||
dDpkcaGiJ64fEJRT2OFxXv9u+vDmIMKzo/Wjbd+IzFj6YY4VisK88aU7tmDelnk5
|
||||
gQB9eu62PFoaVsYJp4VOhblFKvGJpQwbWB9BAgMBAAGjKjAoMA4GA1UdDwEB/wQE
|
||||
AwIHgDAWBgNVHSUBAf8EDDAKBggrBgEFBQcDAzANBgkqhkiG9w0BAQsFAAOCAQEA
|
||||
6x+C6hAIbLwMvkNx4K5p7Qe/pLQR0VwQFAw10yr/5KSN+YKFpon6pQ0TebL7qll+
|
||||
uBGZvtQhN6v+DlnVqB7lvJKd+89isgirkkews5KwuXg7Gv5UPIugH0dXISZU8DMJ
|
||||
7J4oKREv5HzdFmfsUfNlQcfyVTjKL6UINXfKGdqNNxXxR9b4a1TY2JcmEhzBTHaq
|
||||
ZqX6HK784a0dB7aHgeFrFwPCCP4M684Hs7CFbk3jo2Ef4ljnB5AyWpe8pwCLMdRt
|
||||
UjSjL5xJWVQvRU+STQsPr6SvpokPCG4rLQyjgeYYk4CCj5piSxbSUZFavq8v1y7Y
|
||||
m91USVqfeUX7ZzjDxPHE2A==
|
||||
-----END CERTIFICATE-----
|
||||
10
.notation/signingkeys.json
Normal file
10
.notation/signingkeys.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"default": "stefanprodan.com",
|
||||
"keys": [
|
||||
{
|
||||
"name": "stefanprodan.com",
|
||||
"keyPath": "/home/runner/.config/notation/localkeys/notation.key",
|
||||
"certPath": "/home/runner/.config/notation/localkeys/notation.crt"
|
||||
}
|
||||
]
|
||||
}
|
||||
19
.notation/trustpolicy.json
Normal file
19
.notation/trustpolicy.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"trustPolicies": [
|
||||
{
|
||||
"name": "stefanprodan.com",
|
||||
"registryScopes": [
|
||||
"ghcr.io/stefanprodan/podinfo-deploy",
|
||||
"ghcr.io/stefanprodan/charts/podinfo"
|
||||
],
|
||||
"signatureVerification": {
|
||||
"level" : "strict"
|
||||
},
|
||||
"trustStores": [ "ca:stefanprodan.com" ],
|
||||
"trustedIdentities": [
|
||||
"x509.subject: C=RO, ST=BU, L=Bucharest, O=Notary, CN=stefanprodan.com"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.17-alpine as builder
|
||||
FROM golang:1.26-alpine AS builder
|
||||
|
||||
ARG REVISION
|
||||
|
||||
@@ -18,7 +18,7 @@ RUN CGO_ENABLED=0 go build -ldflags "-s -w \
|
||||
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${REVISION}" \
|
||||
-a -o bin/podcli cmd/podcli/*
|
||||
|
||||
FROM alpine:3.15
|
||||
FROM alpine:3.23
|
||||
|
||||
ARG BUILD_DATE
|
||||
ARG VERSION
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.17
|
||||
FROM golang:1.26
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
ARG GO_VERSION=1.17
|
||||
ARG XX_VERSION=1.1.0
|
||||
ARG GO_VERSION=1.26
|
||||
ARG XX_VERSION=1.9.0
|
||||
|
||||
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
|
||||
|
||||
@@ -28,7 +28,7 @@ RUN xx-go build -ldflags "-s -w \
|
||||
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${REVISION}" \
|
||||
-a -o bin/podcli cmd/podcli/*
|
||||
|
||||
FROM alpine:3.15
|
||||
FROM alpine:3.23
|
||||
|
||||
ARG BUILD_DATE
|
||||
ARG VERSION
|
||||
|
||||
30
Makefile
30
Makefile
@@ -16,7 +16,7 @@ run:
|
||||
--ui-logo=https://raw.githubusercontent.com/stefanprodan/podinfo/gh-pages/cuddle_clap.gif $(EXTRA_RUN_ARGS)
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
test: tidy fmt vet
|
||||
go test ./... -coverprofile cover.out
|
||||
|
||||
build:
|
||||
@@ -24,11 +24,13 @@ build:
|
||||
GIT_COMMIT=$$(git rev-list -1 HEAD) && CGO_ENABLED=0 go build -ldflags "-s -w -X github.com/stefanprodan/podinfo/pkg/version.REVISION=$(GIT_COMMIT)" -a -o ./bin/podcli ./cmd/podcli/*
|
||||
|
||||
tidy:
|
||||
rm -f go.sum; go mod tidy -compat=1.17
|
||||
rm -f go.sum; go mod tidy -compat=1.26
|
||||
|
||||
vet:
|
||||
go vet ./...
|
||||
|
||||
fmt:
|
||||
gofmt -l -s -w ./
|
||||
goimports -l -w ./
|
||||
go fmt ./...
|
||||
|
||||
build-charts:
|
||||
helm lint charts/*
|
||||
@@ -79,12 +81,24 @@ version-set:
|
||||
/usr/bin/sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/webapp/backend/deployment.yaml && \
|
||||
/usr/bin/sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/bases/frontend/deployment.yaml && \
|
||||
/usr/bin/sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/bases/backend/deployment.yaml && \
|
||||
echo "Version $$next set in code, deployment, chart and kustomize"
|
||||
/usr/bin/sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/bases/database/statefulset-primary.yaml && \
|
||||
/usr/bin/sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/bases/database/deployment-replica.yaml && \
|
||||
/usr/bin/sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/bases/database/cronjob-rollup-daily.yaml && \
|
||||
/usr/bin/sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/bases/database/cronjob-rollup-weekly.yaml && \
|
||||
/usr/bin/sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/bases/database/cronjob-backup-daily.yaml && \
|
||||
/usr/bin/sed -i '' "s/$$current/$$next/g" timoni/podinfo/values.cue && \
|
||||
echo "Version $$next set in code, deployment, module, chart and kustomize"
|
||||
|
||||
release:
|
||||
git tag $(VERSION)
|
||||
git tag -s -m $(VERSION) $(VERSION)
|
||||
git push origin $(VERSION)
|
||||
|
||||
swagger:
|
||||
go get github.com/swaggo/swag/cmd/swag
|
||||
cd pkg/api && $$(go env GOPATH)/bin/swag init -g server.go
|
||||
go install github.com/swaggo/swag/cmd/swag@latest
|
||||
go get github.com/swaggo/swag/gen@latest
|
||||
go get github.com/swaggo/swag/cmd/swag@latest
|
||||
cd pkg/api/http && $$(go env GOPATH)/bin/swag init -g server.go
|
||||
|
||||
.PHONY: timoni-build
|
||||
timoni-build:
|
||||
@timoni build podinfo ./timoni/podinfo -f ./timoni/podinfo/debug_values.cue
|
||||
|
||||
56
README.md
56
README.md
@@ -20,12 +20,12 @@ Specifications:
|
||||
* 12-factor app with viper
|
||||
* Fault injection (random errors and latency)
|
||||
* Swagger docs
|
||||
* Helm and Kustomize installers
|
||||
* Timoni, Helm and Kustomize installers
|
||||
* End-to-End testing with Kubernetes Kind and Helm
|
||||
* Kustomize testing with GitHub Actions and Open Policy Agent
|
||||
* Multi-arch container image with Docker buildx and Github Actions
|
||||
* Multi-arch container image with Docker buildx and GitHub Actions
|
||||
* Container image signing with Sigstore cosign
|
||||
* CVE scanning with Trivy
|
||||
* SBOMs and SLSA Provenance embedded in the container image
|
||||
* CVE scanning with govulncheck
|
||||
|
||||
Web API:
|
||||
|
||||
@@ -57,6 +57,16 @@ Web API:
|
||||
gRPC API:
|
||||
|
||||
* `/grpc.health.v1.Health/Check` health checking
|
||||
* `/grpc.EchoService/Echo` echos the received content
|
||||
* `/grpc.VersionService/Version` returns podinfo version and Git commit hash
|
||||
* `/grpc.DelayService/Delay` returns a successful response after the given seconds in the body of gRPC request
|
||||
* `/grpc.EnvService/Env` returns environment variables as a JSON array
|
||||
* `/grpc.HeaderService/Header` returns the headers present in the gRPC request. Any custom header can also be given as a part of request and that can be returned using this API
|
||||
* `/grpc.InfoService/Info` returns the runtime information
|
||||
* `/grpc.PanicService/Panic` crashes the process with gRPC status code as '1 CANCELLED'
|
||||
* `/grpc.StatusService/Status` returns the gRPC Status code given in the request body
|
||||
* `/grpc.TokenService/TokenGenerate` issues a JWT token valid for one minute
|
||||
* `/grpc.TokenService/TokenValidate` validates the JWT token
|
||||
|
||||
Web UI:
|
||||
|
||||
@@ -66,17 +76,26 @@ To access the Swagger UI open `<podinfo-host>/swagger/index.html` in a browser.
|
||||
|
||||
### Guides
|
||||
|
||||
* [GitOps Progressive Deliver with Flagger, Helm v3 and Linkerd](https://helm.workshop.flagger.dev/intro/)
|
||||
* [GitOps Progressive Deliver on EKS with Flagger and AppMesh](https://eks.handson.flagger.dev/prerequisites/)
|
||||
* [Automated canary deployments with Flagger and Istio](https://medium.com/google-cloud/automated-canary-deployments-with-flagger-and-istio-ac747827f9d1)
|
||||
* [Kubernetes autoscaling with Istio metrics](https://medium.com/google-cloud/kubernetes-autoscaling-with-istio-metrics-76442253a45a)
|
||||
* [Autoscaling EKS on Fargate with custom metrics](https://aws.amazon.com/blogs/containers/autoscaling-eks-on-fargate-with-custom-metrics/)
|
||||
* [Managing Helm releases the GitOps way](https://medium.com/google-cloud/managing-helm-releases-the-gitops-way-207a6ac6ff0e)
|
||||
* [Securing EKS Ingress With Contour And Let’s Encrypt The GitOps Way](https://aws.amazon.com/blogs/containers/securing-eks-ingress-contour-lets-encrypt-gitops/)
|
||||
* [Getting started with Timoni](https://timoni.sh/quickstart/)
|
||||
* [Getting started with Flux](https://fluxcd.io/flux/get-started/)
|
||||
* [Progressive Deliver with Flagger and Linkerd](https://docs.flagger.app/tutorials/linkerd-progressive-delivery)
|
||||
* [Automated canary deployments with Kubernetes Gateway API](https://docs.flagger.app/tutorials/gatewayapi-progressive-delivery)
|
||||
|
||||
### Install
|
||||
|
||||
Helm:
|
||||
To install Podinfo on Kubernetes the minimum required version is **Kubernetes v1.23**.
|
||||
|
||||
#### Timoni
|
||||
|
||||
Install with [Timoni](https://timoni.sh):
|
||||
|
||||
```bash
|
||||
timoni -n default apply podinfo oci://ghcr.io/stefanprodan/modules/podinfo
|
||||
```
|
||||
|
||||
#### Helm
|
||||
|
||||
Install from github.io:
|
||||
|
||||
```bash
|
||||
helm repo add podinfo https://stefanprodan.github.io/podinfo
|
||||
@@ -87,7 +106,7 @@ helm upgrade --install --wait frontend \
|
||||
--set backend=http://backend-podinfo:9898/echo \
|
||||
podinfo/podinfo
|
||||
|
||||
helm test frontend
|
||||
helm test frontend --namespace test
|
||||
|
||||
helm upgrade --install --wait backend \
|
||||
--namespace test \
|
||||
@@ -95,13 +114,20 @@ helm upgrade --install --wait backend \
|
||||
podinfo/podinfo
|
||||
```
|
||||
|
||||
Kustomize:
|
||||
Install from ghcr.io:
|
||||
|
||||
```bash
|
||||
helm upgrade --install --wait podinfo --namespace default \
|
||||
oci://ghcr.io/stefanprodan/charts/podinfo
|
||||
```
|
||||
|
||||
#### Kustomize
|
||||
|
||||
```bash
|
||||
kubectl apply -k github.com/stefanprodan/podinfo//kustomize
|
||||
```
|
||||
|
||||
Docker:
|
||||
#### Docker
|
||||
|
||||
```bash
|
||||
docker run -dp 9898:9898 stefanprodan/podinfo
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
apiVersion: v1
|
||||
version: 6.1.0
|
||||
appVersion: 6.1.0
|
||||
version: 6.10.2
|
||||
appVersion: 6.10.2
|
||||
name: podinfo
|
||||
engine: gotpl
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
@@ -10,4 +10,4 @@ maintainers:
|
||||
name: stefanprodan
|
||||
sources:
|
||||
- https://github.com/stefanprodan/podinfo
|
||||
kubeVersion: ">=1.19.0-0"
|
||||
kubeVersion: ">=1.23.0-0"
|
||||
|
||||
@@ -9,12 +9,30 @@ for end-to-end testing and workshops.
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
The Podinfo charts are published to
|
||||
[GitHub Container Registry](https://github.com/stefanprodan/podinfo/pkgs/container/charts%2Fpodinfo)
|
||||
and signed with [Cosign](https://github.com/sigstore/cosign) & GitHub Actions OIDC.
|
||||
|
||||
To install the chart with the release name `podinfo` from GHCR:
|
||||
|
||||
```console
|
||||
$ helm repo add podinfo https://stefanprodan.github.io/podinfo
|
||||
$ helm upgrade -i podinfo oci://ghcr.io/stefanprodan/charts/podinfo
|
||||
```
|
||||
|
||||
$ helm upgrade -i my-release podinfo/podinfo
|
||||
To verify a chart version with Cosign:
|
||||
|
||||
```console
|
||||
$ cosign verify ghcr.io/stefanprodan/charts/podinfo:<VERSION> \
|
||||
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
|
||||
--certificate-identity-regexp=^https://github\\.com/stefanprodan/podinfo/.*$
|
||||
```
|
||||
|
||||
Alternatively, you can install the chart from GitHub pages:
|
||||
|
||||
```console
|
||||
$ helm repo add stefanprodan https://stefanprodan.github.io/podinfo
|
||||
|
||||
$ helm upgrade -i podinfo stefanprodan/podinfo
|
||||
```
|
||||
|
||||
The command deploys podinfo on the Kubernetes cluster in the default namespace.
|
||||
@@ -22,10 +40,10 @@ The [configuration](#configuration) section lists the parameters that can be con
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
To uninstall the `podinfo` release:
|
||||
|
||||
```console
|
||||
$ helm delete my-release
|
||||
$ helm uninstall podinfo
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||
@@ -34,90 +52,101 @@ 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.
|
||||
|
||||
Parameter | Default | Description
|
||||
--- | --- | ---
|
||||
`replicaCount` | `1` | Desired number of pods
|
||||
`logLevel` | `info` | Log level: `debug`, `info`, `warn`, `error`
|
||||
`backend` | `None` | Echo backend URL
|
||||
`backends` | `[]` | Array of echo backend URLs
|
||||
`cache` | `None` | Redis address in the format `<host>:<port>`
|
||||
`redis.enabled` | `false` | Create Redis deployment for caching purposes
|
||||
`ui.color` | `#34577c` | UI color
|
||||
`ui.message` | `None` | UI greetings message
|
||||
`ui.logo` | `None` | UI logo
|
||||
`faults.delay` | `false` | Random HTTP response delays between 0 and 5 seconds
|
||||
`faults.error` | `false` | 1/3 chances of a random HTTP response error
|
||||
`faults.unhealthy` | `false` | When set, the healthy state is never reached
|
||||
`faults.unready` | `false` | When set, the ready state is never reached
|
||||
`faults.testFail` | `false` | When set, a helm test is included which always fails
|
||||
`faults.testTimeout` | `false` | When set, a helm test is included which always times out
|
||||
`image.repository` | `stefanprodan/podinfo` | Image repository
|
||||
`image.tag` | `<VERSION>` | Image tag
|
||||
`image.pullPolicy` | `IfNotPresent` | Image pull policy
|
||||
`service.enabled` | `true` | Create a Kubernetes Service, should be disabled when using [Flagger](https://flagger.app)
|
||||
`service.type` | `ClusterIP` | Type of the Kubernetes Service
|
||||
`service.metricsPort` | `9797` | Prometheus metrics endpoint port
|
||||
`service.httpPort` | `9898` | Container HTTP port
|
||||
`service.externalPort` | `9898` | ClusterIP HTTP port
|
||||
`service.grpcPort` | `9999` | ClusterIP gPRC port
|
||||
`service.grpcService` | `podinfo` | gPRC service name
|
||||
`service.nodePort` | `31198` | NodePort for the HTTP endpoint
|
||||
`h2c.enabled` | `false` | Allow upgrading to h2c (non-TLS version of HTTP/2)
|
||||
`hpa.enabled` | `false` | Enables the Kubernetes HPA
|
||||
`hpa.maxReplicas` | `10` | Maximum amount of pods
|
||||
`hpa.cpu` | `None` | Target CPU usage per pod
|
||||
`hpa.memory` | `None` | Target memory usage per pod
|
||||
`hpa.requests` | `None` | Target HTTP requests per second per pod
|
||||
`serviceAccount.enabled` | `false` | Whether a service account should be created
|
||||
`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
|
||||
`securityContext` | `{}` | The security context to be set on the podinfo container
|
||||
`linkerd.profile.enabled` | `false` | Create Linkerd service profile
|
||||
`serviceMonitor.enabled` | `false` | Whether a Prometheus Operator service monitor should be created
|
||||
`serviceMonitor.interval` | `15s` | Prometheus scraping interval
|
||||
`serviceMonitor.additionalLabels` | `{}` | Add additional labels to the service monitor |
|
||||
`ingress.enabled` | `false` | Enables Ingress
|
||||
`ingress.className ` | `""` | Use ingressClassName
|
||||
`ingress.annotations` | `{}` | Ingress annotations
|
||||
`ingress.hosts` | `[]` | Ingress accepted hosts
|
||||
`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
|
||||
`podAnnotations` | `{}` | Pod annotations
|
||||
| Parameter | Default | Description |
|
||||
|--------------------------------------------------|--------------------------------|---------------------------------------------------------------------------------------------------|
|
||||
| `replicaCount` | `1` | Desired number of pods |
|
||||
| `logLevel` | `info` | Log level: `debug`, `info`, `warn`, `error` |
|
||||
| `backend` | `None` | Echo backend URL |
|
||||
| `backends` | `[]` | Array of echo backend URLs |
|
||||
| `cache` | `None` | Redis address in the format `tcp://<host>:<port>` |
|
||||
| `redis.enabled` | `false` | Create Redis deployment for caching purposes |
|
||||
| `redis.repository` | `docker.io/redis` | Redis image repository |
|
||||
| `redis.tag` | `<VERSION>` | Redis image tag |
|
||||
| `redis.imagePullSecrets` | `[]` | Redis image pull secrets |
|
||||
| `ui.color` | `#34577c` | UI color |
|
||||
| `ui.message` | `None` | UI greetings message |
|
||||
| `ui.logo` | `None` | UI logo |
|
||||
| `faults.delay` | `false` | Random HTTP response delays between 0 and 5 seconds |
|
||||
| `faults.error` | `false` | 1/3 chances of a random HTTP response error |
|
||||
| `faults.unhealthy` | `false` | When set, the healthy state is never reached |
|
||||
| `faults.unready` | `false` | When set, the ready state is never reached |
|
||||
| `faults.testFail` | `false` | When set, a helm test is included which always fails |
|
||||
| `faults.testTimeout` | `false` | When set, a helm test is included which always times out |
|
||||
| `image.repository` | `ghcr.io/stefanprodan/podinfo` | Image repository |
|
||||
| `image.tag` | `<VERSION>` | Image tag |
|
||||
| `image.pullPolicy` | `IfNotPresent` | Image pull policy |
|
||||
| `image.pullSecrets` | `[]` | Image pull secrets |
|
||||
| `service.enabled` | `true` | Create a Kubernetes Service, should be disabled when using [Flagger](https://flagger.app) |
|
||||
| `service.type` | `ClusterIP` | Type of the Kubernetes Service |
|
||||
| `service.metricsPort` | `9797` | Prometheus metrics endpoint port |
|
||||
| `service.httpPort` | `9898` | Container HTTP port |
|
||||
| `service.externalPort` | `9898` | ClusterIP HTTP port |
|
||||
| `service.grpcPort` | `9999` | ClusterIP gPRC port |
|
||||
| `service.grpcService` | `podinfo` | gPRC service name |
|
||||
| `service.nodePort` | `31198` | NodePort for the HTTP endpoint |
|
||||
| `service.trafficDistribution` | `""` | Traffic distribution strategy |
|
||||
| `service.additionalLabels` | `{}` | Additional labels to add to the service |
|
||||
| `service.externalTrafficPolicy` | `None` | External traffic policy for LoadBalance service |
|
||||
| `h2c.enabled` | `false` | Allow upgrading to h2c (non-TLS version of HTTP/2) |
|
||||
| `extraArgs` | `[]` | Additional command line arguments to pass to podinfo container |
|
||||
| `extraEnvs` | `[]` | Extra environment variables for the podinfo container |
|
||||
| `config.path` | `""` | config file path |
|
||||
| `config.name` | `""` | config file name |
|
||||
| `hpa.enabled` | `false` | Enables the Kubernetes HPA |
|
||||
| `hpa.maxReplicas` | `10` | Maximum amount of pods |
|
||||
| `hpa.cpu` | `None` | Target CPU usage per pod |
|
||||
| `hpa.memory` | `None` | Target memory usage per pod |
|
||||
| `hpa.requests` | `None` | Target HTTP requests per second per pod |
|
||||
| `serviceAccount.enabled` | `false` | Whether a service account should be created |
|
||||
| `serviceAccount.name` | `None` | The name of the service account to use, if not set a name is generated using the fullname template|
|
||||
| `serviceAccount.imagePullSecrets` | `[]` | List of image pull secrets if pulling from private registries |
|
||||
| `securityContext` | `{}` | The security context to be set on the podinfo container |
|
||||
| `podSecurityContext` | `{}` | The security context to be set on the pod |
|
||||
| `podAnnotations` | `{}` | Pod annotations |
|
||||
| `serviceMonitor.enabled` | `false` | Whether a Prometheus Operator service monitor should be created |
|
||||
| `serviceMonitor.interval` | `15s` | Prometheus scraping interval |
|
||||
| `serviceMonitor.additionalLabels` | `{}` | Add additional labels to the service monitor |
|
||||
| `ingress.enabled` | `false` | Enables Ingress |
|
||||
| `ingress.className` | `""` | Use ingressClassName |
|
||||
| `ingress.additionalLabels` | `{}` | Add additional labels to the ingress |
|
||||
| `ingress.annotations` | `{}` | Ingress annotations |
|
||||
| `ingress.hosts` | `[]` | Ingress accepted hosts |
|
||||
| `ingress.tls` | `[]` | Ingress TLS configuration |
|
||||
| `httpRoute.enabled` | `false` | Enables Gateway API HTTPRoute |
|
||||
| `httpRoute.additionalLabels` | `{}` | Add additional labels to the HTTPRoute |
|
||||
| `httpRoute.annotations` | `{}` | HTTPRoute annotations |
|
||||
| `httpRoute.parentRefs` | `[]` | Gateways that this route is attached to |
|
||||
| `httpRoute.hostnames` | `["podinfo.local"]` | Hostnames matching HTTP header |
|
||||
| `httpRoute.rules` | `[]` | List of rules and filters applied |
|
||||
| `hooks.<hookType>.job.enabled` | `false` | Create a Helm hook job for testing (hookType: see values.yaml for available hooks) |
|
||||
| `hooks.<hookType>.job.hookDeletePolicy` | `hook-succeeded,hook-failed` | Helm hook delete policy |
|
||||
| `hooks.<hookType>.job.ttlSecondsAfterFinished` | `None` | Job TTL after finished |
|
||||
| `hooks.<hookType>.job.sleepSeconds` | `None` | Sleep duration before job exits |
|
||||
| `hooks.<hookType>.job.exitCode` | `0` | Job exit code |
|
||||
| `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:
|
||||
|
||||
```console
|
||||
$ helm install my-release podinfo/podinfo \
|
||||
$ helm upgrade -i podinfo oci://ghcr.io/stefanprodan/charts/podinfo \
|
||||
--set=serviceMonitor.enabled=true,serviceMonitor.interval=5s
|
||||
```
|
||||
|
||||
To add custom annotations you need to escape the annotation key string:
|
||||
|
||||
```console
|
||||
$ helm upgrade -i my-release podinfo/podinfo \
|
||||
--set podAnnotations."appmesh\.k8s\.aws\/preview"=enabled
|
||||
$ helm upgrade -i podinfo oci://ghcr.io/stefanprodan/charts/podinfo \
|
||||
--set podAnnotations."toolkit\.fluxcd\.io\/tenant"=dev-team
|
||||
```
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
|
||||
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart:
|
||||
|
||||
```console
|
||||
$ helm install my-release podinfo/podinfo -f values.yaml
|
||||
$ helm upgrade -i my-release oci://ghcr.io/stefanprodan/charts/podinfo -f values.yaml
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
|
||||
## Upgrading the chart
|
||||
|
||||
### To =< 5.0.0
|
||||
|
||||
Version 5.0.0 is a major update.
|
||||
|
||||
* The chart now follows the new Kubernetes label recommendations:
|
||||
<https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/>
|
||||
|
||||
The simplest way to update is to do a force upgrade, which recreates the resources by doing a delete and an install.
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "podinfo.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
export NODE_PORT=$(kubectl get --namespace {{ include "podinfo.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "podinfo.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ include "podinfo.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "podinfo.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "podinfo.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ include "podinfo.namespace" . }} {{ template "podinfo.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl -n {{ .Release.Namespace }} port-forward deploy/{{ template "podinfo.fullname" . }} 8080:{{ .Values.service.externalPort }}
|
||||
kubectl -n {{ include "podinfo.namespace" . }} port-forward deploy/{{ template "podinfo.fullname" . }} 8080:{{ .Values.service.externalPort }}
|
||||
{{- end }}
|
||||
|
||||
@@ -23,6 +23,13 @@ If release name contains chart name it will be used as a full name.
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Allow the release namespace to be overridden for multi-namespace deployments in combined charts.
|
||||
*/}}
|
||||
{{- define "podinfo.namespace" -}}
|
||||
{{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
|
||||
@@ -3,6 +3,7 @@ apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
spec:
|
||||
|
||||
@@ -2,6 +2,7 @@ apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
spec:
|
||||
@@ -30,6 +31,9 @@ spec:
|
||||
{{- if .Values.serviceAccount.enabled }}
|
||||
serviceAccountName: {{ template "podinfo.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.image.pullSecrets }}
|
||||
imagePullSecrets: {{ toYaml .Values.image.pullSecrets | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
@@ -73,7 +77,7 @@ spec:
|
||||
{{- if .Values.cache }}
|
||||
- --cache-server={{ .Values.cache }}
|
||||
{{- else if .Values.redis.enabled }}
|
||||
- --cache-server={{ template "podinfo.fullname" . }}-redis:6379
|
||||
- --cache-server=tcp://{{ template "podinfo.fullname" . }}-redis:6379
|
||||
{{- end }}
|
||||
- --level={{ .Values.logLevel }}
|
||||
- --random-delay={{ .Values.faults.delay }}
|
||||
@@ -87,6 +91,15 @@ spec:
|
||||
{{- if .Values.h2c.enabled }}
|
||||
- --h2c
|
||||
{{- end }}
|
||||
{{- with .Values.config.path }}
|
||||
- --config-path={{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.config.name }}
|
||||
- --config={{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraArgs }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.ui.message }}
|
||||
- name: PODINFO_UI_MESSAGE
|
||||
@@ -104,6 +117,9 @@ spec:
|
||||
- name: PODINFO_BACKEND_URL
|
||||
value: {{ .Values.backend }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraEnvs }}
|
||||
{{ toYaml .Values.extraEnvs | indent 10 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.httpPort | default 9898 }}
|
||||
@@ -129,6 +145,22 @@ spec:
|
||||
containerPort: {{ .Values.service.grpcPort }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if .Values.probes.startup.enable }}
|
||||
startupProbe:
|
||||
exec:
|
||||
command:
|
||||
- podcli
|
||||
- check
|
||||
- http
|
||||
- localhost:{{ .Values.service.httpPort | default 9898 }}/healthz
|
||||
{{- with .Values.probes.startup }}
|
||||
initialDelaySeconds: {{ .initialDelaySeconds | default 1 }}
|
||||
timeoutSeconds: {{ .timeoutSeconds | default 5 }}
|
||||
failureThreshold: {{ .failureThreshold | default 3 }}
|
||||
successThreshold: {{ .successThreshold | default 1 }}
|
||||
periodSeconds: {{ .periodSeconds | default 10 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
@@ -136,8 +168,13 @@ spec:
|
||||
- check
|
||||
- http
|
||||
- localhost:{{ .Values.service.httpPort | default 9898 }}/healthz
|
||||
initialDelaySeconds: 1
|
||||
timeoutSeconds: 5
|
||||
{{- with .Values.probes.liveness }}
|
||||
initialDelaySeconds: {{ .initialDelaySeconds | default 1 }}
|
||||
timeoutSeconds: {{ .timeoutSeconds | default 5 }}
|
||||
failureThreshold: {{ .failureThreshold | default 3 }}
|
||||
successThreshold: {{ .successThreshold | default 1 }}
|
||||
periodSeconds: {{ .periodSeconds | default 10 }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
@@ -145,8 +182,13 @@ spec:
|
||||
- check
|
||||
- http
|
||||
- localhost:{{ .Values.service.httpPort | default 9898 }}/readyz
|
||||
initialDelaySeconds: 1
|
||||
timeoutSeconds: 5
|
||||
{{- with .Values.probes.readiness }}
|
||||
initialDelaySeconds: {{ .initialDelaySeconds | default 1 }}
|
||||
timeoutSeconds: {{ .timeoutSeconds | default 5 }}
|
||||
failureThreshold: {{ .failureThreshold | default 3 }}
|
||||
successThreshold: {{ .successThreshold | default 1 }}
|
||||
periodSeconds: {{ .periodSeconds | default 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
@@ -157,6 +199,10 @@ spec:
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
{{- with .Values.podSecurityContext }}
|
||||
securityContext:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
@@ -177,3 +223,7 @@ spec:
|
||||
secret:
|
||||
secretName: {{ template "podinfo.tlsSecretName" . }}
|
||||
{{- end }}
|
||||
{{- with .Values.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
|
||||
37
charts/podinfo/templates/hooks/job.yaml
Normal file
37
charts/podinfo/templates/hooks/job.yaml
Normal file
@@ -0,0 +1,37 @@
|
||||
{{- $hooks := dict "preInstall" "pre-install" "postInstall" "post-install" "preDelete" "pre-delete" "postDelete" "post-delete" "preUpgrade" "pre-upgrade" "postUpgrade" "post-upgrade" "preRollback" "pre-rollback" "postRollback" "post-rollback" }}
|
||||
{{- range $hookName, $hookType := $hooks }}
|
||||
{{- $hookConfig := index $.Values.hooks $hookName }}
|
||||
{{- if and $hookConfig $hookConfig.job $hookConfig.job.enabled }}
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" $ }}-{{ $hookType }}
|
||||
namespace: {{ include "podinfo.namespace" $ }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" $ | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": {{ $hookType }}
|
||||
"helm.sh/hook-delete-policy": {{ $hookConfig.job.hookDeletePolicy }}
|
||||
spec:
|
||||
{{- if kindIs "float64" $hookConfig.job.ttlSecondsAfterFinished }}
|
||||
ttlSecondsAfterFinished: {{ $hookConfig.job.ttlSecondsAfterFinished | int }}
|
||||
{{- end }}
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: job
|
||||
image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}"
|
||||
imagePullPolicy: {{ $.Values.image.pullPolicy }}
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
{{- if kindIs "float64" $hookConfig.job.sleepSeconds }}
|
||||
sleep {{ $hookConfig.job.sleepSeconds | int }}
|
||||
{{- end }}
|
||||
exit {{ $hookConfig.job.exitCode | default 0 }}
|
||||
restartPolicy: Never
|
||||
backoffLimit: 1
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,8 +1,9 @@
|
||||
{{- if .Values.hpa.enabled -}}
|
||||
apiVersion: autoscaling/v2beta2
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
spec:
|
||||
|
||||
42
charts/podinfo/templates/httproute.yaml
Normal file
42
charts/podinfo/templates/httproute.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
{{- if .Values.httpRoute.enabled -}}
|
||||
{{- $fullName := include "podinfo.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.externalPort -}}
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
{{- with .Values.httpRoute.additionalLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.httpRoute.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
parentRefs:
|
||||
{{- with .Values.httpRoute.parentRefs }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.httpRoute.hostnames }}
|
||||
hostnames:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.httpRoute.rules }}
|
||||
{{- with .matches }}
|
||||
- matches:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .filters }}
|
||||
filters:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
backendRefs:
|
||||
- name: {{ $fullName }}
|
||||
port: {{ $svcPort }}
|
||||
weight: 1
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -5,8 +5,12 @@ apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.additionalLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
{{- if .Values.linkerd.profile.enabled -}}
|
||||
apiVersion: linkerd.io/v1alpha2
|
||||
kind: ServiceProfile
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
spec:
|
||||
routes:
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /
|
||||
name: GET /
|
||||
- condition:
|
||||
method: POST
|
||||
pathRegex: /api/echo
|
||||
name: POST /api/echo
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /api/info
|
||||
name: GET /api/info
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /chunked/[^/]*
|
||||
name: GET /chunked/{seconds}
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /delay/[^/]*
|
||||
name: GET /delay/{seconds}
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /env
|
||||
name: GET /env
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /headers
|
||||
name: GET /headers
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /healthz
|
||||
name: GET /healthz
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /metrics
|
||||
name: GET /metrics
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /panic
|
||||
name: GET /panic
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /readyz
|
||||
name: GET /readyz
|
||||
- condition:
|
||||
method: POST
|
||||
pathRegex: /readyz/disable
|
||||
name: POST /readyz/disable
|
||||
- condition:
|
||||
method: POST
|
||||
pathRegex: /readyz/enable
|
||||
name: POST /readyz/enable
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /status/[^/]*
|
||||
name: GET /status/{code}
|
||||
- condition:
|
||||
method: POST
|
||||
pathRegex: /cache
|
||||
name: POST /cache
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /cache/[^/]*
|
||||
name: GET /cache/{hash}
|
||||
- condition:
|
||||
method: POST
|
||||
pathRegex: /store
|
||||
name: POST /store
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /store/[^/]*
|
||||
name: GET /store/{hash}
|
||||
- condition:
|
||||
method: POST
|
||||
pathRegex: /token
|
||||
name: POST /token
|
||||
- condition:
|
||||
method: POST
|
||||
pathRegex: /token/validate
|
||||
name: POST /token/validate
|
||||
- condition:
|
||||
method: GET
|
||||
pathRegex: /version
|
||||
name: GET /version
|
||||
- condition:
|
||||
method: POST
|
||||
pathRegex: /ws/echo
|
||||
name: POST /ws/echo
|
||||
{{- end }}
|
||||
14
charts/podinfo/templates/pdb.yaml
Normal file
14
charts/podinfo/templates/pdb.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
{{- if and .Values.podDisruptionBudget (gt (int .Values.replicaCount) 1) }}
|
||||
apiVersion: policy/v1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ include "podinfo.fullname" . }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "podinfo.selectorLabels" . | nindent 6 }}
|
||||
{{- toYaml .Values.podDisruptionBudget | nindent 2 }}
|
||||
{{- end }}
|
||||
@@ -21,6 +21,9 @@ spec:
|
||||
{{- if .Values.serviceAccount.enabled }}
|
||||
serviceAccountName: {{ template "podinfo.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.redis.imagePullSecrets }}
|
||||
imagePullSecrets: {{ toYaml .Values.redis.imagePullSecrets | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: redis
|
||||
image: "{{ .Values.redis.repository }}:{{ .Values.redis.tag }}"
|
||||
|
||||
@@ -14,4 +14,5 @@ spec:
|
||||
port: 6379
|
||||
protocol: TCP
|
||||
targetPort: redis
|
||||
appProtocol: redis
|
||||
{{- end }}
|
||||
|
||||
@@ -3,8 +3,12 @@ apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
{{- with .Values.service.additionalLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.service.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | indent 4 }}
|
||||
@@ -33,4 +37,10 @@ spec:
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "podinfo.selectorLabels" . | nindent 4 }}
|
||||
{{- if .Values.service.trafficDistribution }}
|
||||
trafficDistribution: {{ .Values.service.trafficDistribution }}
|
||||
{{- end }}
|
||||
{{- if ( and (.Values.service.externalTrafficPolicy) (eq .Values.service.type "LoadBalancer") ) }}
|
||||
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -5,4 +5,8 @@ metadata:
|
||||
name: {{ template "podinfo.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceMonitor.additionalLabels }}
|
||||
@@ -15,7 +16,7 @@ spec:
|
||||
interval: {{ .Values.serviceMonitor.interval }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
- {{ include "podinfo.namespace" . }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "podinfo.selectorLabels" . | nindent 6 }}
|
||||
|
||||
@@ -3,6 +3,7 @@ apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}-cache-test-{{ randAlphaNum 5 | lower }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
@@ -24,6 +25,6 @@ spec:
|
||||
curl -s -XDELETE ${PODINFO_SVC}/cache/test
|
||||
env:
|
||||
- name: PODINFO_SVC
|
||||
value: "{{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.externalPort }}"
|
||||
value: "{{ template "podinfo.fullname" . }}.{{ include "podinfo.namespace" . }}:{{ .Values.service.externalPort }}"
|
||||
restartPolicy: Never
|
||||
{{- end }}
|
||||
|
||||
@@ -3,6 +3,7 @@ apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}-fault-test-{{ randAlphaNum 5 | lower }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
|
||||
@@ -2,6 +2,7 @@ apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}-grpc-test-{{ randAlphaNum 5 | lower }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
@@ -15,5 +16,5 @@ spec:
|
||||
- name: grpc-health-probe
|
||||
image: stefanprodan/grpc_health_probe:v0.3.0
|
||||
command: ['grpc_health_probe']
|
||||
args: ['-addr={{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.grpcPort }}']
|
||||
args: ['-addr={{ template "podinfo.fullname" . }}.{{ include "podinfo.namespace" . }}:{{ .Values.service.grpcPort }}']
|
||||
restartPolicy: Never
|
||||
|
||||
@@ -2,6 +2,7 @@ apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}-jwt-test-{{ randAlphaNum 5 | lower }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
@@ -22,5 +23,5 @@ spec:
|
||||
curl -sH "Authorization: Bearer ${TOKEN}" ${PODINFO_SVC}/token/validate | grep test
|
||||
env:
|
||||
- name: PODINFO_SVC
|
||||
value: "{{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.externalPort }}"
|
||||
value: "{{ template "podinfo.fullname" . }}.{{ include "podinfo.namespace" . }}:{{ .Values.service.externalPort }}"
|
||||
restartPolicy: Never
|
||||
|
||||
@@ -2,6 +2,7 @@ apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}-service-test-{{ randAlphaNum 5 | lower }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
@@ -21,5 +22,5 @@ spec:
|
||||
curl -s ${PODINFO_SVC}/api/info | grep version
|
||||
env:
|
||||
- name: PODINFO_SVC
|
||||
value: "{{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.externalPort }}"
|
||||
value: "{{ template "podinfo.fullname" . }}.{{ include "podinfo.namespace" . }}:{{ .Values.service.externalPort }}"
|
||||
restartPolicy: Never
|
||||
|
||||
@@ -3,6 +3,7 @@ apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}-fault-test-{{ randAlphaNum 5 | lower }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
|
||||
@@ -3,6 +3,7 @@ apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: {{ template "podinfo.fullname" . }}-tls-test-{{ randAlphaNum 5 | lower }}
|
||||
namespace: {{ include "podinfo.namespace" . }}
|
||||
labels:
|
||||
{{- include "podinfo.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
@@ -22,6 +23,6 @@ spec:
|
||||
curl -sk ${PODINFO_SVC}/api/info | grep version
|
||||
env:
|
||||
- name: PODINFO_SVC
|
||||
value: "https://{{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.tls.port }}"
|
||||
value: "https://{{ template "podinfo.fullname" . }}.{{ include "podinfo.namespace" . }}:{{ .Values.tls.port }}"
|
||||
restartPolicy: Never
|
||||
{{- end }}
|
||||
@@ -8,7 +8,7 @@ backends: []
|
||||
|
||||
image:
|
||||
repository: ghcr.io/stefanprodan/podinfo
|
||||
tag: 6.1.0
|
||||
tag: 6.10.2
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
ui:
|
||||
@@ -29,6 +29,7 @@ faults:
|
||||
service:
|
||||
enabled: true
|
||||
annotations: {}
|
||||
additionalLabels: { }
|
||||
type: ClusterIP
|
||||
metricsPort: 9797
|
||||
httpPort: 9898
|
||||
@@ -36,11 +37,23 @@ service:
|
||||
grpcPort: 9999
|
||||
grpcService: podinfo
|
||||
nodePort: 31198
|
||||
trafficDistribution: ""
|
||||
externalTrafficPolicy: ""
|
||||
|
||||
# enable h2c protocol (non-TLS version of HTTP/2)
|
||||
h2c:
|
||||
enabled: false
|
||||
|
||||
# config file settings
|
||||
config:
|
||||
# config file path
|
||||
path: ""
|
||||
# config file name
|
||||
name: ""
|
||||
|
||||
# Additional command line arguments to pass to podinfo container
|
||||
extraArgs: []
|
||||
|
||||
# enable tls on the podinfo service
|
||||
tls:
|
||||
enabled: false
|
||||
@@ -77,13 +90,13 @@ hpa:
|
||||
# average http requests per second per pod (k8s-prometheus-adapter)
|
||||
requests:
|
||||
|
||||
# Redis address in the format <host>:<port>
|
||||
# Redis address in the format tcp://<host>:<port>
|
||||
cache: ""
|
||||
# Redis deployment
|
||||
redis:
|
||||
enabled: true
|
||||
repository: redis
|
||||
tag: 6.0.8
|
||||
tag: 8.6.1
|
||||
|
||||
serviceAccount:
|
||||
# Specifies whether a service account should be created
|
||||
@@ -91,16 +104,25 @@ serviceAccount:
|
||||
# The name of the service account to use.
|
||||
# If not set and create is true, a name is generated using the fullname template
|
||||
name:
|
||||
# List of image pull secrets if pulling from private registries
|
||||
imagePullSecrets: []
|
||||
|
||||
# set container security context
|
||||
securityContext: {}
|
||||
|
||||
# set pod security context
|
||||
podSecurityContext: {}
|
||||
|
||||
# -- Expose the service via Kubernetes Ingress
|
||||
# Requires an Ingress controller
|
||||
# Docs https://kubernetes.io/docs/concepts/services-networking/ingress/
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
additionalLabels: {}
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
hosts:
|
||||
- host: podinfo.local
|
||||
paths:
|
||||
@@ -111,9 +133,30 @@ ingress:
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
|
||||
linkerd:
|
||||
profile:
|
||||
enabled: false
|
||||
# -- Expose the service via Gateway HTTPRoute
|
||||
# Requires a Gateway controller
|
||||
# Docs https://gateway-api.sigs.k8s.io/guides/
|
||||
httpRoute:
|
||||
# HTTPRoute enabled.
|
||||
enabled: false
|
||||
# Add additional labels to the HTTPRoute.
|
||||
additionalLabels: {}
|
||||
# HTTPRoute annotations.
|
||||
annotations: {}
|
||||
# Which Gateways this Route is attached to.
|
||||
parentRefs:
|
||||
- name: gateway
|
||||
sectionName: http
|
||||
# namespace: default
|
||||
# Hostnames matching HTTP header.
|
||||
hostnames:
|
||||
- podinfo.local
|
||||
# List of rules and filters applied.
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
|
||||
# create Prometheus Operator monitor
|
||||
serviceMonitor:
|
||||
@@ -128,6 +171,14 @@ resources:
|
||||
cpu: 100m
|
||||
memory: 64Mi
|
||||
|
||||
# Extra environment variables for the podinfo container
|
||||
extraEnvs: []
|
||||
# Example on how to configure extraEnvs
|
||||
# - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
|
||||
# value: "http://otel:4317"
|
||||
# - name: MULTIPLE_VALUES
|
||||
# value: TEST
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
@@ -135,3 +186,25 @@ tolerations: []
|
||||
affinity: {}
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
# https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
|
||||
probes:
|
||||
readiness:
|
||||
initialDelaySeconds: 1
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
successThreshold: 1
|
||||
periodSeconds: 10
|
||||
liveness:
|
||||
initialDelaySeconds: 1
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
successThreshold: 1
|
||||
periodSeconds: 10
|
||||
startup:
|
||||
enable: false
|
||||
initialDelaySeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 20
|
||||
successThreshold: 1
|
||||
periodSeconds: 10
|
||||
|
||||
@@ -8,8 +8,9 @@ backends: []
|
||||
|
||||
image:
|
||||
repository: ghcr.io/stefanprodan/podinfo
|
||||
tag: 6.1.0
|
||||
tag: 6.10.2
|
||||
pullPolicy: IfNotPresent
|
||||
pullSecrets: []
|
||||
|
||||
ui:
|
||||
color: "#34577c"
|
||||
@@ -29,6 +30,7 @@ faults:
|
||||
service:
|
||||
enabled: true
|
||||
annotations: {}
|
||||
additionalLabels: { }
|
||||
type: ClusterIP
|
||||
metricsPort: 9797
|
||||
httpPort: 9898
|
||||
@@ -40,11 +42,32 @@ service:
|
||||
# NOTE: requires privileged container with NET_BIND_SERVICE capability -- this is useful for testing
|
||||
# in local clusters such as kind without port forwarding
|
||||
hostPort:
|
||||
# Stable from Kubernetes v1.33+ with a value of PreferClose. Additional values are PreferSameZone and PreferSameNode from v1.34+. Empty string means it's disabled.
|
||||
trafficDistribution: ""
|
||||
externalTrafficPolicy: ""
|
||||
|
||||
# enable h2c protocol (non-TLS version of HTTP/2)
|
||||
h2c:
|
||||
enabled: false
|
||||
|
||||
# config file settings
|
||||
config:
|
||||
# config file path
|
||||
path: ""
|
||||
# config file name
|
||||
name: ""
|
||||
|
||||
# Additional command line arguments to pass to podinfo container
|
||||
extraArgs: []
|
||||
|
||||
# Extra environment variables for the podinfo container
|
||||
extraEnvs: []
|
||||
# Example on how to configure extraEnvs
|
||||
# - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
|
||||
# value: "http://otel:4317"
|
||||
# - name: MULTIPLE_VALUES
|
||||
# value: TEST
|
||||
|
||||
# enable tls on the podinfo service
|
||||
tls:
|
||||
enabled: false
|
||||
@@ -70,6 +93,65 @@ certificate:
|
||||
dnsNames:
|
||||
- podinfo
|
||||
|
||||
# Helm hooks (for testing purposes)
|
||||
hooks:
|
||||
preInstall:
|
||||
job:
|
||||
enabled: false
|
||||
hookDeletePolicy: hook-succeeded,hook-failed
|
||||
ttlSecondsAfterFinished:
|
||||
sleepSeconds:
|
||||
exitCode: 0
|
||||
postInstall:
|
||||
job:
|
||||
enabled: false
|
||||
hookDeletePolicy: hook-succeeded,hook-failed
|
||||
ttlSecondsAfterFinished:
|
||||
sleepSeconds:
|
||||
exitCode: 0
|
||||
preDelete:
|
||||
job:
|
||||
enabled: false
|
||||
hookDeletePolicy: hook-succeeded,hook-failed
|
||||
ttlSecondsAfterFinished:
|
||||
sleepSeconds:
|
||||
exitCode: 0
|
||||
postDelete:
|
||||
job:
|
||||
enabled: false
|
||||
hookDeletePolicy: hook-succeeded,hook-failed
|
||||
ttlSecondsAfterFinished:
|
||||
sleepSeconds:
|
||||
exitCode: 0
|
||||
preUpgrade:
|
||||
job:
|
||||
enabled: false
|
||||
hookDeletePolicy: hook-succeeded,hook-failed
|
||||
ttlSecondsAfterFinished:
|
||||
sleepSeconds:
|
||||
exitCode: 0
|
||||
postUpgrade:
|
||||
job:
|
||||
enabled: false
|
||||
hookDeletePolicy: hook-succeeded,hook-failed
|
||||
ttlSecondsAfterFinished:
|
||||
sleepSeconds:
|
||||
exitCode: 0
|
||||
preRollback:
|
||||
job:
|
||||
enabled: false
|
||||
hookDeletePolicy: hook-succeeded,hook-failed
|
||||
ttlSecondsAfterFinished:
|
||||
sleepSeconds:
|
||||
exitCode: 0
|
||||
postRollback:
|
||||
job:
|
||||
enabled: false
|
||||
hookDeletePolicy: hook-succeeded,hook-failed
|
||||
ttlSecondsAfterFinished:
|
||||
sleepSeconds:
|
||||
exitCode: 0
|
||||
|
||||
# metrics-server add-on required
|
||||
hpa:
|
||||
enabled: false
|
||||
@@ -81,13 +163,14 @@ hpa:
|
||||
# average http requests per second per pod (k8s-prometheus-adapter)
|
||||
requests:
|
||||
|
||||
# Redis address in the format <host>:<port>
|
||||
# Redis address in the format tcp://<host>:<port>
|
||||
cache: ""
|
||||
# Redis deployment
|
||||
redis:
|
||||
enabled: false
|
||||
repository: redis
|
||||
tag: 6.0.8
|
||||
repository: docker.io/redis
|
||||
tag: 8.6.1
|
||||
imagePullSecrets: []
|
||||
|
||||
serviceAccount:
|
||||
# Specifies whether a service account should be created
|
||||
@@ -95,13 +178,22 @@ serviceAccount:
|
||||
# The name of the service account to use.
|
||||
# If not set and create is true, a name is generated using the fullname template
|
||||
name:
|
||||
# List of image pull secrets if pulling from private registries
|
||||
imagePullSecrets: []
|
||||
|
||||
# set container security context
|
||||
securityContext: {}
|
||||
|
||||
# set pod security context
|
||||
podSecurityContext: {}
|
||||
|
||||
# -- Expose the service via Kubernetes Ingress
|
||||
# Requires an Ingress controller
|
||||
# Docs https://kubernetes.io/docs/concepts/services-networking/ingress/
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
additionalLabels: {}
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
@@ -115,9 +207,30 @@ ingress:
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
|
||||
linkerd:
|
||||
profile:
|
||||
enabled: false
|
||||
# -- Expose the service via Gateway HTTPRoute
|
||||
# Requires a Gateway controller
|
||||
# Docs https://gateway-api.sigs.k8s.io/guides/
|
||||
httpRoute:
|
||||
# HTTPRoute enabled.
|
||||
enabled: false
|
||||
# Add additional labels to the HTTPRoute.
|
||||
additionalLabels: {}
|
||||
# HTTPRoute annotations.
|
||||
annotations: {}
|
||||
# Which Gateways this Route is attached to.
|
||||
parentRefs:
|
||||
- name: gateway
|
||||
sectionName: http
|
||||
# namespace: default
|
||||
# Hostnames matching HTTP header.
|
||||
hostnames:
|
||||
- podinfo.local
|
||||
# List of rules and filters applied.
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
|
||||
# create Prometheus Operator monitor
|
||||
serviceMonitor:
|
||||
@@ -138,3 +251,32 @@ tolerations: []
|
||||
affinity: {}
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
# https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
|
||||
topologySpreadConstraints: []
|
||||
|
||||
# Disruption budget will be configured only when the replicaCount is greater than 1
|
||||
podDisruptionBudget: {}
|
||||
# maxUnavailable: 1
|
||||
|
||||
# https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
|
||||
probes:
|
||||
readiness:
|
||||
initialDelaySeconds: 1
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
successThreshold: 1
|
||||
periodSeconds: 10
|
||||
liveness:
|
||||
initialDelaySeconds: 1
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
successThreshold: 1
|
||||
periodSeconds: 10
|
||||
startup:
|
||||
enable: false
|
||||
initialDelaySeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 20
|
||||
successThreshold: 1
|
||||
periodSeconds: 10
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
steps:
|
||||
- name: 'gcr.io/cloud-builders/docker'
|
||||
args: ['build','-f' , 'Dockerfile', '-t', 'gcr.io/$PROJECT_ID/podinfo:$BRANCH_NAME-$SHORT_SHA', '.']
|
||||
images: ['gcr.io/$PROJECT_ID/podinfo:$BRANCH_NAME-$SHORT_SHA']
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
@@ -14,10 +13,11 @@ import (
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
|
||||
"github.com/stefanprodan/podinfo/pkg/api"
|
||||
"github.com/stefanprodan/podinfo/pkg/grpc"
|
||||
"github.com/stefanprodan/podinfo/pkg/api/grpc"
|
||||
"github.com/stefanprodan/podinfo/pkg/api/http"
|
||||
"github.com/stefanprodan/podinfo/pkg/signals"
|
||||
"github.com/stefanprodan/podinfo/pkg/version"
|
||||
go_grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -29,11 +29,11 @@ func main() {
|
||||
fs.Int("port-metrics", 0, "metrics port")
|
||||
fs.Int("grpc-port", 0, "gRPC port")
|
||||
fs.String("grpc-service-name", "podinfo", "gPRC service name")
|
||||
fs.String("level", "info", "log level debug, info, warn, error, flat or panic")
|
||||
fs.String("level", "info", "log level debug, info, warn, error, fatal or panic")
|
||||
fs.StringSlice("backend-url", []string{}, "backend service URL")
|
||||
fs.Duration("http-client-timeout", 2*time.Minute, "client timeout duration")
|
||||
fs.Duration("http-server-timeout", 30*time.Second, "server read and write timeout duration")
|
||||
fs.Duration("http-server-shutdown-timeout", 5*time.Second, "server graceful shutdown timeout duration")
|
||||
fs.Duration("server-shutdown-timeout", 5*time.Second, "server graceful shutdown timeout duration")
|
||||
fs.String("data-path", "/data", "data local path")
|
||||
fs.String("config-path", "", "config dir path")
|
||||
fs.String("cert-path", "/data/cert", "certificate path for HTTPS port")
|
||||
@@ -52,7 +52,7 @@ func main() {
|
||||
fs.Bool("unready", false, "when set, ready state is never reached")
|
||||
fs.Int("stress-cpu", 0, "number of CPU cores with 100 load")
|
||||
fs.Int("stress-memory", 0, "MB of data to load into memory")
|
||||
fs.String("cache-server", "", "Redis address in the format <host>:<port>")
|
||||
fs.String("cache-server", "", "Redis address in the format 'tcp://<host>:<port>'")
|
||||
fs.String("otel-service-name", "", "service name for reporting to open telemetry address, when not set tracing is disabled")
|
||||
|
||||
versionFlag := fs.BoolP("version", "v", false, "get version number")
|
||||
@@ -135,13 +135,16 @@ func main() {
|
||||
}
|
||||
|
||||
// start gRPC server
|
||||
var grpcServer *go_grpc.Server
|
||||
if grpcCfg.Port > 0 {
|
||||
grpcSrv, _ := grpc.NewServer(&grpcCfg, logger)
|
||||
go grpcSrv.ListenAndServe()
|
||||
//grpcinfoSrv, _ := grpc.NewInfoServer(&grpcCfg)
|
||||
|
||||
grpcServer = grpcSrv.ListenAndServe()
|
||||
}
|
||||
|
||||
// load HTTP server config
|
||||
var srvCfg api.Config
|
||||
var srvCfg http.Config
|
||||
if err := viper.Unmarshal(&srvCfg); err != nil {
|
||||
logger.Panic("config unmarshal failed", zap.Error(err))
|
||||
}
|
||||
@@ -154,9 +157,13 @@ func main() {
|
||||
)
|
||||
|
||||
// start HTTP server
|
||||
srv, _ := api.NewServer(&srvCfg, logger)
|
||||
srv, _ := http.NewServer(&srvCfg, logger)
|
||||
httpServer, httpsServer, healthy, ready := srv.ListenAndServe()
|
||||
|
||||
// graceful shutdown
|
||||
stopCh := signals.SetupSignalHandler()
|
||||
srv.ListenAndServe(stopCh)
|
||||
sd, _ := signals.NewShutdown(srvCfg.ServerShutdownTimeout, logger)
|
||||
sd.Graceful(stopCh, httpServer, httpsServer, grpcServer, healthy, ready)
|
||||
}
|
||||
|
||||
func initZap(logLevel string) (*zap.Logger, error) {
|
||||
@@ -238,12 +245,12 @@ func beginStressTest(cpus int, mem int, logger *zap.Logger) {
|
||||
logger.Error("memory stress failed", zap.Error(err))
|
||||
}
|
||||
|
||||
stressMemoryPayload, err = ioutil.ReadFile(path)
|
||||
stressMemoryPayload, err = os.ReadFile(path)
|
||||
f.Close()
|
||||
os.Remove(path)
|
||||
if err != nil {
|
||||
logger.Error("memory stress failed", zap.Error(err))
|
||||
}
|
||||
logger.Info("starting CPU stress", zap.Int("memory", len(stressMemoryPayload)))
|
||||
logger.Info("starting MEMORY stress", zap.Int("memory", len(stressMemoryPayload)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,18 +12,18 @@ spec:
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: backend
|
||||
app.kubernetes.io/name: backend
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9797"
|
||||
labels:
|
||||
app: backend
|
||||
app.kubernetes.io/name: backend
|
||||
spec:
|
||||
containers:
|
||||
- name: backend
|
||||
image: ghcr.io/stefanprodan/podinfo:6.1.0
|
||||
image: ghcr.io/stefanprodan/podinfo:6.10.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
@@ -42,7 +42,7 @@ spec:
|
||||
- --grpc-port=9999
|
||||
- --grpc-service-name=backend
|
||||
- --level=info
|
||||
- --cache-server=cache:6379
|
||||
- --cache-server=tcp://cache:6379
|
||||
env:
|
||||
- name: PODINFO_UI_COLOR
|
||||
value: "#34577c"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: autoscaling/v2beta2
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: backend
|
||||
|
||||
@@ -5,7 +5,7 @@ metadata:
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: backend
|
||||
app.kubernetes.io/name: backend
|
||||
ports:
|
||||
- name: http
|
||||
port: 9898
|
||||
|
||||
6
deploy/bases/cache/deployment.yaml
vendored
6
deploy/bases/cache/deployment.yaml
vendored
@@ -5,15 +5,15 @@ metadata:
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cache
|
||||
app.kubernetes.io/name: cache
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cache
|
||||
app.kubernetes.io/name: cache
|
||||
spec:
|
||||
containers:
|
||||
- name: redis
|
||||
image: redis:6.0.1
|
||||
image: docker.io/redis:8.6.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- redis-server
|
||||
|
||||
2
deploy/bases/cache/service.yaml
vendored
2
deploy/bases/cache/service.yaml
vendored
@@ -5,7 +5,7 @@ metadata:
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: cache
|
||||
app.kubernetes.io/name: cache
|
||||
ports:
|
||||
- name: redis
|
||||
port: 6379
|
||||
|
||||
76
deploy/bases/database/README.md
Normal file
76
deploy/bases/database/README.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# Database Setup
|
||||
|
||||
This directory contains the Kubernetes manifests to simulate a database setup
|
||||
with a primary database, read replicas, and scheduled maintenance tasks using CronJobs.
|
||||
|
||||
## Components
|
||||
|
||||
### Core Resources
|
||||
|
||||
| Resource | File | Description |
|
||||
|----------|------|-------------|
|
||||
| ServiceAccount | `serviceaccount.yaml` | Shared service account for all database workloads |
|
||||
| PVC | `pvc-primary.yaml` | 1Gi persistent storage for primary database |
|
||||
| StatefulSet | `statefulset-primary.yaml` | Primary database with persistent storage at `/data` |
|
||||
| Deployment | `deployment-replica.yaml` | Read replica deployment |
|
||||
| Service (Headless) | `service-primary.yaml` | Headless service for StatefulSet |
|
||||
| Service | `service-replica.yaml` | ClusterIP service for replicas |
|
||||
| HPA | `hpa-replica.yaml` | Autoscaler for replicas (2-3 pods, 99% CPU) |
|
||||
|
||||
### CronJobs
|
||||
|
||||
| CronJob | Schedule | Duration | TTL Cleanup | Description |
|
||||
|---------|----------|----------|-------------|-------------|
|
||||
| `rollup-daily` | Every 10 min | ~1 min | 1 hour | Daily rollup simulation (6 iterations) |
|
||||
| `rollup-weekly` | Every 30 min | ~2 min | 1 day | Weekly rollup simulation (12 iterations) |
|
||||
| `backup-daily` | Daily at midnight | ~1 min | 1 day | Backup simulation (configured to fail) |
|
||||
|
||||
### Scripts
|
||||
|
||||
Located in `scripts/` directory:
|
||||
|
||||
- `rollup.sh` - Rollup simulation script with configurable steps via `ROLLUP_STEPS` env var
|
||||
- `backup.sh` - Backup simulation script with configurable exit code via `BACKUP_EXIT` env var
|
||||
|
||||
## Labels
|
||||
|
||||
All resources use Kubernetes recommended labels:
|
||||
|
||||
- `app.kubernetes.io/name` - Component name
|
||||
- `app.kubernetes.io/part-of: database` - Part of database application
|
||||
|
||||
## Configuration
|
||||
|
||||
### Primary Database
|
||||
- **Port**: 3306 (MySQL standard)
|
||||
- **Storage**: 1Gi PersistentVolumeClaim mounted at `/data`
|
||||
- **Service**: Headless (`clusterIP: None`) for StatefulSet
|
||||
|
||||
### Replica Database
|
||||
- **Port**: 3306
|
||||
- **Scaling**: HPA with 2-3 replicas at 99% CPU utilization
|
||||
- **Service**: ClusterIP
|
||||
|
||||
### CronJob Scripts
|
||||
|
||||
The scripts check database-replica health before running:
|
||||
|
||||
```sh
|
||||
podcli check http database-replica:3306/readyz
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Deploy with Kustomize:
|
||||
|
||||
```bash
|
||||
kubectl apply -k deploy/bases/database
|
||||
```
|
||||
|
||||
Or include in an overlay:
|
||||
|
||||
```yaml
|
||||
# kustomization.yaml
|
||||
resources:
|
||||
- ../../bases/database
|
||||
```
|
||||
48
deploy/bases/database/cronjob-backup-daily.yaml
Normal file
48
deploy/bases/database/cronjob-backup-daily.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: backup-daily
|
||||
spec:
|
||||
# Runs every day at midnight for 1 minute
|
||||
schedule: "0 0 * * *"
|
||||
concurrencyPolicy: Forbid
|
||||
successfulJobsHistoryLimit: 1
|
||||
failedJobsHistoryLimit: 1
|
||||
jobTemplate:
|
||||
spec:
|
||||
# Cleanup after 1 day
|
||||
ttlSecondsAfterFinished: 86400
|
||||
backoffLimit: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: backup-daily
|
||||
app.kubernetes.io/part-of: database
|
||||
spec:
|
||||
serviceAccountName: database
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: backup
|
||||
image: ghcr.io/stefanprodan/podinfo:6.10.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- /bin/sh
|
||||
- /scripts/backup.sh
|
||||
env:
|
||||
- name: BACKUP_EXIT
|
||||
value: "1"
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 32Mi
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 16Mi
|
||||
volumeMounts:
|
||||
- name: scripts
|
||||
mountPath: /scripts
|
||||
volumes:
|
||||
- name: scripts
|
||||
configMap:
|
||||
name: backup-script
|
||||
defaultMode: 0755
|
||||
48
deploy/bases/database/cronjob-rollup-daily.yaml
Normal file
48
deploy/bases/database/cronjob-rollup-daily.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: rollup-daily
|
||||
spec:
|
||||
# Runs every 10 minutes for 1 minute
|
||||
schedule: "*/10 * * * *"
|
||||
concurrencyPolicy: Forbid
|
||||
successfulJobsHistoryLimit: 1
|
||||
failedJobsHistoryLimit: 1
|
||||
jobTemplate:
|
||||
spec:
|
||||
# Cleanup after 1 hour
|
||||
ttlSecondsAfterFinished: 3600
|
||||
backoffLimit: 3
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: rollup-daily
|
||||
app.kubernetes.io/part-of: database
|
||||
spec:
|
||||
serviceAccountName: database
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: healthcheck
|
||||
image: ghcr.io/stefanprodan/podinfo:6.10.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- /bin/sh
|
||||
- /scripts/rollup.sh
|
||||
env:
|
||||
- name: ROLLUP_STEPS
|
||||
value: "6"
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 32Mi
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 16Mi
|
||||
volumeMounts:
|
||||
- name: scripts
|
||||
mountPath: /scripts
|
||||
volumes:
|
||||
- name: scripts
|
||||
configMap:
|
||||
name: rollup-script
|
||||
defaultMode: 0755
|
||||
48
deploy/bases/database/cronjob-rollup-weekly.yaml
Normal file
48
deploy/bases/database/cronjob-rollup-weekly.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: rollup-weekly
|
||||
spec:
|
||||
# Runs every 30 minutes for 2 minutes
|
||||
schedule: "*/30 * * * *"
|
||||
concurrencyPolicy: Forbid
|
||||
successfulJobsHistoryLimit: 1
|
||||
failedJobsHistoryLimit: 1
|
||||
jobTemplate:
|
||||
spec:
|
||||
# Cleanup after 1 day
|
||||
ttlSecondsAfterFinished: 86400
|
||||
backoffLimit: 3
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: rollup-weekly
|
||||
app.kubernetes.io/part-of: database
|
||||
spec:
|
||||
serviceAccountName: database
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: healthcheck
|
||||
image: ghcr.io/stefanprodan/podinfo:6.10.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- /bin/sh
|
||||
- /scripts/rollup.sh
|
||||
env:
|
||||
- name: ROLLUP_STEPS
|
||||
value: "12"
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 32Mi
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 16Mi
|
||||
volumeMounts:
|
||||
- name: scripts
|
||||
mountPath: /scripts
|
||||
volumes:
|
||||
- name: scripts
|
||||
configMap:
|
||||
name: rollup-script
|
||||
defaultMode: 0755
|
||||
66
deploy/bases/database/deployment-replica.yaml
Normal file
66
deploy/bases/database/deployment-replica.yaml
Normal file
@@ -0,0 +1,66 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: database-replica
|
||||
spec:
|
||||
minReadySeconds: 3
|
||||
revisionHistoryLimit: 5
|
||||
progressDeadlineSeconds: 60
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxUnavailable: 0
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: database-replica
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9797"
|
||||
labels:
|
||||
app.kubernetes.io/name: database-replica
|
||||
app.kubernetes.io/part-of: database
|
||||
spec:
|
||||
serviceAccountName: database
|
||||
containers:
|
||||
- name: database
|
||||
image: ghcr.io/stefanprodan/podinfo:6.10.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: db
|
||||
containerPort: 3306
|
||||
protocol: TCP
|
||||
- name: http-metrics
|
||||
containerPort: 9797
|
||||
protocol: TCP
|
||||
command:
|
||||
- ./podinfo
|
||||
- --port=3306
|
||||
- --port-metrics=9797
|
||||
- --level=info
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- podcli
|
||||
- check
|
||||
- http
|
||||
- localhost:3306/healthz
|
||||
initialDelaySeconds: 5
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- podcli
|
||||
- check
|
||||
- http
|
||||
- localhost:3306/readyz
|
||||
initialDelaySeconds: 5
|
||||
timeoutSeconds: 5
|
||||
resources:
|
||||
limits:
|
||||
cpu: 2000m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 32Mi
|
||||
18
deploy/bases/database/hpa-replica.yaml
Normal file
18
deploy/bases/database/hpa-replica.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: database-replica
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: database-replica
|
||||
minReplicas: 2
|
||||
maxReplicas: 3
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 99
|
||||
24
deploy/bases/database/kustomization.yaml
Normal file
24
deploy/bases/database/kustomization.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- serviceaccount.yaml
|
||||
- pvc-primary.yaml
|
||||
- statefulset-primary.yaml
|
||||
- deployment-replica.yaml
|
||||
- service-primary.yaml
|
||||
- service-replica.yaml
|
||||
- hpa-replica.yaml
|
||||
- cronjob-rollup-daily.yaml
|
||||
- cronjob-rollup-weekly.yaml
|
||||
- cronjob-backup-daily.yaml
|
||||
configMapGenerator:
|
||||
- name: rollup-script
|
||||
files:
|
||||
- scripts/rollup.sh
|
||||
options:
|
||||
disableNameSuffixHash: true
|
||||
- name: backup-script
|
||||
files:
|
||||
- scripts/backup.sh
|
||||
options:
|
||||
disableNameSuffixHash: true
|
||||
10
deploy/bases/database/pvc-primary.yaml
Normal file
10
deploy/bases/database/pvc-primary.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: database-primary
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
12
deploy/bases/database/scripts/backup.sh
Normal file
12
deploy/bases/database/scripts/backup.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# This is a simulation of a backup process.
|
||||
|
||||
EXIT_CODE=${BACKUP_EXIT:-0}
|
||||
|
||||
echo "Starting backup (estimated run time: 60s)"
|
||||
podcli check http database-replica:3306/readyz
|
||||
sleep 60
|
||||
echo "Backup finished"
|
||||
exit $EXIT_CODE
|
||||
15
deploy/bases/database/scripts/rollup.sh
Normal file
15
deploy/bases/database/scripts/rollup.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# This is a simulation of a rollup process.
|
||||
|
||||
STEPS=${ROLLUP_STEPS:-6}
|
||||
echo "Starting rollup with $STEPS steps (estimated run time: $((STEPS * 10))s)"
|
||||
podcli check http database-replica:3306/readyz
|
||||
i=1
|
||||
while [ $i -le $STEPS ]; do
|
||||
echo "Running rollup iteration $i of $STEPS"
|
||||
sleep 10
|
||||
i=$((i + 1))
|
||||
done
|
||||
echo "Rollup finished"
|
||||
14
deploy/bases/database/service-primary.yaml
Normal file
14
deploy/bases/database/service-primary.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: database-primary
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
selector:
|
||||
app.kubernetes.io/name: database-primary
|
||||
ports:
|
||||
- name: db
|
||||
port: 3306
|
||||
protocol: TCP
|
||||
targetPort: db
|
||||
13
deploy/bases/database/service-replica.yaml
Normal file
13
deploy/bases/database/service-replica.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: database-replica
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app.kubernetes.io/name: database-replica
|
||||
ports:
|
||||
- name: db
|
||||
port: 3306
|
||||
protocol: TCP
|
||||
targetPort: db
|
||||
4
deploy/bases/database/serviceaccount.yaml
Normal file
4
deploy/bases/database/serviceaccount.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: database
|
||||
70
deploy/bases/database/statefulset-primary.yaml
Normal file
70
deploy/bases/database/statefulset-primary.yaml
Normal file
@@ -0,0 +1,70 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: database-primary
|
||||
spec:
|
||||
serviceName: database-primary
|
||||
replicas: 1
|
||||
minReadySeconds: 3
|
||||
revisionHistoryLimit: 5
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: database-primary
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9797"
|
||||
labels:
|
||||
app.kubernetes.io/name: database-primary
|
||||
app.kubernetes.io/part-of: database
|
||||
spec:
|
||||
serviceAccountName: database
|
||||
containers:
|
||||
- name: database
|
||||
image: ghcr.io/stefanprodan/podinfo:6.10.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: db
|
||||
containerPort: 3306
|
||||
protocol: TCP
|
||||
- name: http-metrics
|
||||
containerPort: 9797
|
||||
protocol: TCP
|
||||
command:
|
||||
- ./podinfo
|
||||
- --port=3306
|
||||
- --port-metrics=9797
|
||||
- --level=info
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- podcli
|
||||
- check
|
||||
- http
|
||||
- localhost:3306/healthz
|
||||
initialDelaySeconds: 5
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- podcli
|
||||
- check
|
||||
- http
|
||||
- localhost:3306/readyz
|
||||
initialDelaySeconds: 5
|
||||
timeoutSeconds: 5
|
||||
resources:
|
||||
limits:
|
||||
cpu: 2000m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 32Mi
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: database-primary
|
||||
@@ -12,18 +12,18 @@ spec:
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: frontend
|
||||
app.kubernetes.io/name: frontend
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9797"
|
||||
labels:
|
||||
app: frontend
|
||||
app.kubernetes.io/name: frontend
|
||||
spec:
|
||||
containers:
|
||||
- name: frontend
|
||||
image: ghcr.io/stefanprodan/podinfo:6.1.0
|
||||
image: ghcr.io/stefanprodan/podinfo:6.10.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
@@ -41,7 +41,7 @@ spec:
|
||||
- --port-metrics=9797
|
||||
- --level=info
|
||||
- --backend-url=http://backend:9898/echo
|
||||
- --cache-server=cache:6379
|
||||
- --cache-server=tcp://cache:6379
|
||||
env:
|
||||
- name: PODINFO_UI_COLOR
|
||||
value: "#34577c"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: autoscaling/v2beta2
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: frontend
|
||||
|
||||
@@ -5,7 +5,7 @@ metadata:
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: frontend
|
||||
app.kubernetes.io/name: frontend
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
|
||||
@@ -5,6 +5,7 @@ resources:
|
||||
- ../../bases/backend
|
||||
- ../../bases/frontend
|
||||
- ../../bases/cache
|
||||
- ../../bases/database
|
||||
- namespace.yaml
|
||||
transformers:
|
||||
- labels.yaml
|
||||
|
||||
@@ -3,8 +3,8 @@ kind: LabelTransformer
|
||||
metadata:
|
||||
name: labels
|
||||
labels:
|
||||
env: dev
|
||||
instance: webapp
|
||||
app.kubernetes.io/environment: dev
|
||||
app.kubernetes.io/instance: webapp
|
||||
fieldSpecs:
|
||||
- path: metadata/labels
|
||||
create: true
|
||||
|
||||
@@ -5,6 +5,7 @@ resources:
|
||||
- ../../bases/backend
|
||||
- ../../bases/frontend
|
||||
- ../../bases/cache
|
||||
- ../../bases/database
|
||||
- namespace.yaml
|
||||
transformers:
|
||||
- labels.yaml
|
||||
|
||||
@@ -3,8 +3,8 @@ kind: LabelTransformer
|
||||
metadata:
|
||||
name: labels
|
||||
labels:
|
||||
env: production
|
||||
instance: webapp
|
||||
app.kubernetes.io/environment: production
|
||||
app.kubernetes.io/instance: webapp
|
||||
fieldSpecs:
|
||||
- path: metadata/labels
|
||||
create: true
|
||||
|
||||
@@ -5,6 +5,7 @@ resources:
|
||||
- ../../bases/backend
|
||||
- ../../bases/frontend
|
||||
- ../../bases/cache
|
||||
- ../../bases/database
|
||||
- namespace.yaml
|
||||
transformers:
|
||||
- labels.yaml
|
||||
|
||||
@@ -3,8 +3,8 @@ kind: LabelTransformer
|
||||
metadata:
|
||||
name: labels
|
||||
labels:
|
||||
env: staging
|
||||
instance: webapp
|
||||
app.kubernetes.io/environment: staging
|
||||
app.kubernetes.io/instance: webapp
|
||||
fieldSpecs:
|
||||
- path: metadata/labels
|
||||
create: true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: autoscaling/v2beta2
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: backend
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: autoscaling/v2beta2
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: frontend
|
||||
|
||||
@@ -25,7 +25,7 @@ spec:
|
||||
serviceAccountName: webapp
|
||||
containers:
|
||||
- name: backend
|
||||
image: ghcr.io/stefanprodan/podinfo:6.1.0
|
||||
image: ghcr.io/stefanprodan/podinfo:6.10.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: autoscaling/v2beta2
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: backend
|
||||
|
||||
@@ -25,7 +25,7 @@ spec:
|
||||
serviceAccountName: webapp
|
||||
containers:
|
||||
- name: frontend
|
||||
image: ghcr.io/stefanprodan/podinfo:6.1.0
|
||||
image: ghcr.io/stefanprodan/podinfo:6.10.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: autoscaling/v2beta2
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: frontend
|
||||
|
||||
144
go.mod
144
go.mod
@@ -1,84 +1,82 @@
|
||||
module github.com/stefanprodan/podinfo
|
||||
|
||||
go 1.17
|
||||
go 1.26.0
|
||||
|
||||
require (
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
|
||||
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1
|
||||
github.com/fatih/color v1.9.0
|
||||
github.com/fsnotify/fsnotify v1.4.9
|
||||
github.com/gomodule/redigo v1.8.4
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/prometheus/client_golang v1.11.0
|
||||
github.com/spf13/cobra v1.2.1
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/spf13/viper v1.8.1
|
||||
github.com/swaggo/http-swagger v1.0.0
|
||||
github.com/swaggo/swag v1.7.6
|
||||
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.28.0
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.28.0
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.28.0
|
||||
go.opentelemetry.io/contrib/propagators/aws v1.3.0
|
||||
go.opentelemetry.io/contrib/propagators/b3 v1.3.0
|
||||
go.opentelemetry.io/contrib/propagators/jaeger v1.3.0
|
||||
go.opentelemetry.io/contrib/propagators/ot v1.3.0
|
||||
go.opentelemetry.io/otel v1.3.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0
|
||||
go.opentelemetry.io/otel/sdk v1.3.0
|
||||
go.opentelemetry.io/otel/trace v1.3.0
|
||||
go.uber.org/zap v1.19.1
|
||||
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f
|
||||
google.golang.org/grpc v1.43.0
|
||||
github.com/chzyer/readline v1.5.1
|
||||
github.com/fatih/color v1.18.0
|
||||
github.com/fsnotify/fsnotify v1.9.0
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2
|
||||
github.com/gomodule/redigo v1.9.3
|
||||
github.com/gorilla/mux v1.8.1
|
||||
github.com/gorilla/websocket v1.5.3
|
||||
github.com/prometheus/client_golang v1.23.2
|
||||
github.com/spf13/cobra v1.10.2
|
||||
github.com/spf13/pflag v1.0.10
|
||||
github.com/spf13/viper v1.21.0
|
||||
github.com/swaggo/http-swagger v1.3.4
|
||||
github.com/swaggo/swag v1.16.6
|
||||
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.65.0
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.65.0
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0
|
||||
go.opentelemetry.io/contrib/propagators/aws v1.40.0
|
||||
go.opentelemetry.io/contrib/propagators/b3 v1.40.0
|
||||
go.opentelemetry.io/contrib/propagators/jaeger v1.40.0
|
||||
go.opentelemetry.io/contrib/propagators/ot v1.40.0
|
||||
go.opentelemetry.io/otel v1.40.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0
|
||||
go.opentelemetry.io/otel/sdk v1.40.0
|
||||
go.opentelemetry.io/otel/trace v1.40.0
|
||||
go.uber.org/zap v1.27.1
|
||||
golang.org/x/net v0.51.0
|
||||
google.golang.org/grpc v1.79.1
|
||||
google.golang.org/protobuf v1.36.11
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||
github.com/PuerkitoBio/purell v1.1.1 // indirect
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.1 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.2 // indirect
|
||||
github.com/go-logr/logr v1.2.1 // indirect
|
||||
github.com/go-logr/stdr v1.2.0 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.19.5 // indirect
|
||||
github.com/go-openapi/spec v0.20.3 // indirect
|
||||
github.com/go-openapi/swag v0.19.14 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.1 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/spec v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.1 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/magiconair/properties v1.8.5 // indirect
|
||||
github.com/mailru/easyjson v0.7.6 // indirect
|
||||
github.com/mattn/go-colorable v0.1.4 // indirect
|
||||
github.com/mattn/go-isatty v0.0.12 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/mitchellh/mapstructure v1.4.1 // indirect
|
||||
github.com/pelletier/go-toml v1.9.3 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.26.0 // indirect
|
||||
github.com/prometheus/procfs v0.6.0 // indirect
|
||||
github.com/spf13/afero v1.6.0 // indirect
|
||||
github.com/spf13/cast v1.3.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 // indirect
|
||||
go.opentelemetry.io/otel/internal/metric v0.26.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v0.26.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v0.11.0 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect
|
||||
golang.org/x/text v0.3.6 // indirect
|
||||
golang.org/x/tools v0.1.5 // indirect
|
||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
|
||||
google.golang.org/protobuf v1.27.1 // indirect
|
||||
gopkg.in/ini.v1 v1.62.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.66.1 // indirect
|
||||
github.com/prometheus/procfs v0.16.1 // indirect
|
||||
github.com/sagikazarmark/locafero v0.11.0 // indirect
|
||||
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
|
||||
github.com/spf13/afero v1.15.0 // indirect
|
||||
github.com/spf13/cast v1.10.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/swaggo/files v1.0.1 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.40.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.2 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
golang.org/x/mod v0.33.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/sys v0.41.0 // indirect
|
||||
golang.org/x/text v0.34.0 // indirect
|
||||
golang.org/x/tools v0.42.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: podinfod
|
||||
image: ghcr.io/stefanprodan/podinfo:6.1.0
|
||||
image: ghcr.io/stefanprodan/podinfo:6.10.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
@@ -72,3 +72,9 @@ spec:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 64Mi
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
volumes:
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: autoscaling/v2beta2
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: podinfo
|
||||
|
||||
@@ -4,4 +4,3 @@ resources:
|
||||
- hpa.yaml
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEchoHandler(t *testing.T) {
|
||||
expected := `{"test": true}`
|
||||
req, err := http.NewRequest("POST", "/api/echo", strings.NewReader(expected))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
rr := httptest.NewRecorder()
|
||||
srv := NewMockServer()
|
||||
handler := http.HandlerFunc(srv.echoHandler)
|
||||
|
||||
handler.ServeHTTP(rr, req)
|
||||
|
||||
// Check the status code is what we expect.
|
||||
if status := rr.Code; status != http.StatusAccepted {
|
||||
t.Errorf("handler returned wrong status code: got %v want %v",
|
||||
status, http.StatusAccepted)
|
||||
}
|
||||
|
||||
// Check the response body is what we expect.
|
||||
if rr.Body.String() != expected {
|
||||
t.Fatalf("handler returned unexpected body:\ngot \n%v \nwant \n%s",
|
||||
rr.Body.String(), expected)
|
||||
}
|
||||
}
|
||||
21
pkg/api/grpc/delay.go
Normal file
21
pkg/api/grpc/delay.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
pb "github.com/stefanprodan/podinfo/pkg/api/grpc/delay"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type DelayServer struct {
|
||||
pb.UnimplementedDelayServiceServer
|
||||
config *Config
|
||||
logger *zap.Logger
|
||||
}
|
||||
|
||||
func (s *DelayServer) Delay(ctx context.Context, delayInput *pb.DelayRequest) (*pb.DelayResponse, error) {
|
||||
|
||||
time.Sleep(time.Duration(delayInput.Seconds) * time.Second)
|
||||
return &pb.DelayResponse{Message: delayInput.Seconds}, nil
|
||||
}
|
||||
211
pkg/api/grpc/delay/delay.pb.go
Normal file
211
pkg/api/grpc/delay/delay.pb.go
Normal file
@@ -0,0 +1,211 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.25.0
|
||||
// source: delay/delay.proto
|
||||
|
||||
package delay
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type DelayRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DelayRequest) Reset() {
|
||||
*x = DelayRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_delay_delay_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DelayRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DelayRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DelayRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_delay_delay_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DelayRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DelayRequest) Descriptor() ([]byte, []int) {
|
||||
return file_delay_delay_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *DelayRequest) GetSeconds() int64 {
|
||||
if x != nil {
|
||||
return x.Seconds
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DelayResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Message int64 `protobuf:"varint,1,opt,name=message,proto3" json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DelayResponse) Reset() {
|
||||
*x = DelayResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_delay_delay_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DelayResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DelayResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DelayResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_delay_delay_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DelayResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DelayResponse) Descriptor() ([]byte, []int) {
|
||||
return file_delay_delay_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *DelayResponse) GetMessage() int64 {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_delay_delay_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_delay_delay_proto_rawDesc = []byte{
|
||||
0x0a, 0x11, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x2f, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x12, 0x05, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x22, 0x28, 0x0a, 0x0c, 0x44, 0x65,
|
||||
0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65,
|
||||
0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x63,
|
||||
0x6f, 0x6e, 0x64, 0x73, 0x22, 0x29, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32,
|
||||
0x44, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
|
||||
0x34, 0x0a, 0x05, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x13, 0x2e, 0x64, 0x65, 0x6c, 0x61, 0x79,
|
||||
0x2e, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e,
|
||||
0x64, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x64, 0x65, 0x6c, 0x61, 0x79,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_delay_delay_proto_rawDescOnce sync.Once
|
||||
file_delay_delay_proto_rawDescData = file_delay_delay_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_delay_delay_proto_rawDescGZIP() []byte {
|
||||
file_delay_delay_proto_rawDescOnce.Do(func() {
|
||||
file_delay_delay_proto_rawDescData = protoimpl.X.CompressGZIP(file_delay_delay_proto_rawDescData)
|
||||
})
|
||||
return file_delay_delay_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_delay_delay_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_delay_delay_proto_goTypes = []interface{}{
|
||||
(*DelayRequest)(nil), // 0: delay.DelayRequest
|
||||
(*DelayResponse)(nil), // 1: delay.DelayResponse
|
||||
}
|
||||
var file_delay_delay_proto_depIdxs = []int32{
|
||||
0, // 0: delay.DelayService.Delay:input_type -> delay.DelayRequest
|
||||
1, // 1: delay.DelayService.Delay:output_type -> delay.DelayResponse
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_delay_delay_proto_init() }
|
||||
func file_delay_delay_proto_init() {
|
||||
if File_delay_delay_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_delay_delay_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DelayRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_delay_delay_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DelayResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_delay_delay_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_delay_delay_proto_goTypes,
|
||||
DependencyIndexes: file_delay_delay_proto_depIdxs,
|
||||
MessageInfos: file_delay_delay_proto_msgTypes,
|
||||
}.Build()
|
||||
File_delay_delay_proto = out.File
|
||||
file_delay_delay_proto_rawDesc = nil
|
||||
file_delay_delay_proto_goTypes = nil
|
||||
file_delay_delay_proto_depIdxs = nil
|
||||
}
|
||||
17
pkg/api/grpc/delay/delay.proto
Normal file
17
pkg/api/grpc/delay/delay.proto
Normal file
@@ -0,0 +1,17 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "./delay";
|
||||
|
||||
package delay;
|
||||
|
||||
message DelayRequest {
|
||||
int64 seconds = 1;
|
||||
}
|
||||
|
||||
message DelayResponse {
|
||||
int64 message = 1;
|
||||
}
|
||||
|
||||
service DelayService {
|
||||
rpc Delay (DelayRequest) returns (DelayResponse) {}
|
||||
}
|
||||
105
pkg/api/grpc/delay/delay_grpc.pb.go
Normal file
105
pkg/api/grpc/delay/delay_grpc.pb.go
Normal file
@@ -0,0 +1,105 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v4.25.0
|
||||
// source: delay/delay.proto
|
||||
|
||||
package delay
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// DelayServiceClient is the client API for DelayService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type DelayServiceClient interface {
|
||||
Delay(ctx context.Context, in *DelayRequest, opts ...grpc.CallOption) (*DelayResponse, error)
|
||||
}
|
||||
|
||||
type delayServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewDelayServiceClient(cc grpc.ClientConnInterface) DelayServiceClient {
|
||||
return &delayServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *delayServiceClient) Delay(ctx context.Context, in *DelayRequest, opts ...grpc.CallOption) (*DelayResponse, error) {
|
||||
out := new(DelayResponse)
|
||||
err := c.cc.Invoke(ctx, "/delay.DelayService/Delay", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// DelayServiceServer is the server API for DelayService service.
|
||||
// All implementations must embed UnimplementedDelayServiceServer
|
||||
// for forward compatibility
|
||||
type DelayServiceServer interface {
|
||||
Delay(context.Context, *DelayRequest) (*DelayResponse, error)
|
||||
mustEmbedUnimplementedDelayServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedDelayServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedDelayServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedDelayServiceServer) Delay(context.Context, *DelayRequest) (*DelayResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Delay not implemented")
|
||||
}
|
||||
func (UnimplementedDelayServiceServer) mustEmbedUnimplementedDelayServiceServer() {}
|
||||
|
||||
// UnsafeDelayServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to DelayServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeDelayServiceServer interface {
|
||||
mustEmbedUnimplementedDelayServiceServer()
|
||||
}
|
||||
|
||||
func RegisterDelayServiceServer(s grpc.ServiceRegistrar, srv DelayServiceServer) {
|
||||
s.RegisterService(&DelayService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _DelayService_Delay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DelayRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DelayServiceServer).Delay(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/delay.DelayService/Delay",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DelayServiceServer).Delay(ctx, req.(*DelayRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// DelayService_ServiceDesc is the grpc.ServiceDesc for DelayService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var DelayService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "delay.DelayService",
|
||||
HandlerType: (*DelayServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Delay",
|
||||
Handler: _DelayService_Delay_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "delay/delay.proto",
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user