mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-04-07 19:46:57 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
113360052b | ||
|
|
a24e3e539c | ||
|
|
ed8a14d4d9 | ||
|
|
d2798e1a24 | ||
|
|
369014455c | ||
|
|
db1b8a7acd | ||
|
|
cc9231ae10 | ||
|
|
03ba47a0be |
8
.github/actions/helm-gh-pages/Dockerfile
vendored
8
.github/actions/helm-gh-pages/Dockerfile
vendored
@@ -1,8 +0,0 @@
|
||||
FROM stefanprodan/alpine-base:latest
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
RUN apk --no-cache add git
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
35
.github/actions/helm-gh-pages/action.yml
vendored
35
.github/actions/helm-gh-pages/action.yml
vendored
@@ -1,35 +0,0 @@
|
||||
name: 'helm-gh-pages'
|
||||
description: 'A GitHub Action to publish helm charts to Github Pages'
|
||||
author: 'Stefan Prodan'
|
||||
branding:
|
||||
icon: 'command'
|
||||
color: 'blue'
|
||||
inputs:
|
||||
token:
|
||||
description: "GitHub token"
|
||||
required: true
|
||||
charts_dir:
|
||||
description: "The charts directory, defaults to `charts`"
|
||||
required: false
|
||||
charts_url:
|
||||
description: "The GitHub Pages URL, default to `https://<USER>.github.io/<REPOSITORY>`"
|
||||
required: false
|
||||
user:
|
||||
description: "The GitHub user that owns this repository"
|
||||
required: false
|
||||
repository:
|
||||
description: "The GitHub repository name"
|
||||
required: false
|
||||
branch:
|
||||
description: "The branch to publish charts, default to `gh-pages`"
|
||||
required: false
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
args:
|
||||
- ${{ inputs.token }}
|
||||
- ${{ inputs.charts_dir }}
|
||||
- ${{ inputs.charts_url }}
|
||||
- ${{ inputs.user }}
|
||||
- ${{ inputs.repository }}
|
||||
- ${{ inputs.branch }}
|
||||
87
.github/actions/helm-gh-pages/entrypoint.sh
vendored
87
.github/actions/helm-gh-pages/entrypoint.sh
vendored
@@ -1,87 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
GITHUB_TOKEN=$1
|
||||
CHARTS_DIR=$2
|
||||
CHARTS_URL=$3
|
||||
USER=$4
|
||||
REPOSITORY=$5
|
||||
BRANCH=$6
|
||||
|
||||
HELM_VERSION=3.2.1
|
||||
CHARTS_TMP_DIR=$(mktemp -d)
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
|
||||
main() {
|
||||
if [[ -z "$CHARTS_DIR" ]]; then
|
||||
CHARTS_DIR="charts"
|
||||
fi
|
||||
|
||||
if [[ -z "$USER" ]]; then
|
||||
USER=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY")
|
||||
fi
|
||||
|
||||
if [[ -z "$REPOSITORY" ]]; then
|
||||
REPOSITORY=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY")
|
||||
fi
|
||||
|
||||
if [[ -z "$BRANCH" ]]; then
|
||||
BRANCH="gh-pages"
|
||||
fi
|
||||
|
||||
if [[ -z "$CHARTS_URL" ]]; then
|
||||
CHARTS_URL="https://${USER}.github.io/${REPOSITORY}"
|
||||
fi
|
||||
|
||||
download
|
||||
lint
|
||||
package
|
||||
upload
|
||||
}
|
||||
|
||||
download() {
|
||||
tmpDir=$(mktemp -d)
|
||||
|
||||
pushd $tmpDir >& /dev/null
|
||||
|
||||
curl -sSL https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz | tar xz
|
||||
cp linux-amd64/helm /usr/local/bin/helm
|
||||
|
||||
popd >& /dev/null
|
||||
rm -rf $tmpDir
|
||||
}
|
||||
|
||||
lint() {
|
||||
helm lint ${REPO_ROOT}/${CHARTS_DIR}/*
|
||||
}
|
||||
|
||||
package() {
|
||||
helm package ${REPO_ROOT}/${CHARTS_DIR}/* --destination ${CHARTS_TMP_DIR}
|
||||
}
|
||||
|
||||
upload() {
|
||||
tmpDir=$(mktemp -d)
|
||||
pushd $tmpDir >& /dev/null
|
||||
|
||||
repo_url="https://x-access-token:${GITHUB_TOKEN}@github.com/${USER}/${REPOSITORY}"
|
||||
git clone ${repo_url}
|
||||
cd ${REPOSITORY}
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
git remote set-url origin ${repo_url}
|
||||
git checkout gh-pages
|
||||
|
||||
mv -f ${CHARTS_TMP_DIR}/*.tgz .
|
||||
helm repo index . --url ${CHARTS_URL}
|
||||
|
||||
git add .
|
||||
git commit -m "Publish Helm charts"
|
||||
git push origin gh-pages
|
||||
|
||||
popd >& /dev/null
|
||||
rm -rf $tmpDir
|
||||
}
|
||||
|
||||
main
|
||||
6
.github/actions/helm/action.yml
vendored
6
.github/actions/helm/action.yml
vendored
@@ -4,6 +4,12 @@ author: 'Stefan Prodan'
|
||||
branding:
|
||||
icon: 'command'
|
||||
color: 'blue'
|
||||
inputs:
|
||||
helm-version:
|
||||
description: Helm version to use
|
||||
required: true
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
args:
|
||||
- ${{ inputs.helm-version }}
|
||||
|
||||
2
.github/actions/helm/entrypoint.sh
vendored
2
.github/actions/helm/entrypoint.sh
vendored
@@ -3,7 +3,7 @@
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
HELM_VERSION=3.2.1
|
||||
HELM_VERSION=$1
|
||||
BIN_DIR="$GITHUB_WORKSPACE/bin"
|
||||
|
||||
main() {
|
||||
|
||||
38
.github/workflows/e2e.yml
vendored
38
.github/workflows/e2e.yml
vendored
@@ -7,39 +7,33 @@ on:
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
kind:
|
||||
kind-helm:
|
||||
strategy:
|
||||
matrix:
|
||||
helm-version:
|
||||
- 2.16.6
|
||||
- 3.2.1
|
||||
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-
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.14.x
|
||||
- name: Setup Helm
|
||||
uses: ./.github/actions/helm
|
||||
- name: Setup Kubernetes
|
||||
uses: engineerd/setup-kind@v0.4.0
|
||||
- name: Run unit tests
|
||||
run: make test
|
||||
- name: Check if working tree is dirty
|
||||
run: |
|
||||
if [[ $(git diff --stat) != '' ]]; then
|
||||
echo 'run make test and commit changes'
|
||||
exit 1
|
||||
fi
|
||||
- name: Build container image
|
||||
run: |
|
||||
GIT_COMMIT=$(git rev-list -1 HEAD) && \
|
||||
docker build -t test/podinfo:latest --build-arg "REVISION=${GIT_COMMIT}" .
|
||||
kind load docker-image test/podinfo:latest
|
||||
- name: Setup Helm
|
||||
uses: ./.github/actions/helm
|
||||
with:
|
||||
helm-version: ${{ matrix.helm-version }}
|
||||
- name: Install Tiller
|
||||
if: ${{ startsWith(matrix.helm-version, '2') }}
|
||||
run: |
|
||||
kubectl --namespace kube-system create sa tiller
|
||||
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
|
||||
helm init --service-account tiller --upgrade --wait
|
||||
- name: Deploy
|
||||
run: |
|
||||
helm upgrade -i podinfo ./charts/podinfo \
|
||||
|
||||
28
.github/workflows/lint.yml
vendored
28
.github/workflows/lint.yml
vendored
@@ -1,28 +0,0 @@
|
||||
name: lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: helm
|
||||
uses: stefanprodan/kube-tools@v1
|
||||
with:
|
||||
command: |
|
||||
helmv3 template ./charts/podinfo | kubeval --strict
|
||||
- name: kubeval
|
||||
uses: stefanprodan/kube-tools@v1
|
||||
with:
|
||||
command: |
|
||||
kustomize build ./kustomize | kubeval --strict
|
||||
- name: conftest
|
||||
uses: stefanprodan/kube-tools@v1
|
||||
with:
|
||||
command: |
|
||||
kustomize build ./kustomize | conftest test -p .github/policy -
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
repository: stefanprodan/podinfo-base
|
||||
tags: latest
|
||||
- name: Publish helm chart
|
||||
uses: ./.github/actions/helm-gh-pages
|
||||
uses: stefanprodan/helm-gh-pages@master
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: ./.github/actions/release-notes
|
||||
|
||||
43
.github/workflows/test.yml
vendored
Normal file
43
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
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-
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.14.x
|
||||
- name: Run unit tests
|
||||
run: make test
|
||||
- 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:
|
||||
command: |
|
||||
helmv3 template ./charts/podinfo | kubeval --strict
|
||||
- name: Validate kustomization
|
||||
uses: stefanprodan/kube-tools@v1
|
||||
with:
|
||||
command: |
|
||||
kustomize build ./kustomize | kubeval --strict
|
||||
kustomize build ./kustomize | conftest test -p .github/policy -
|
||||
@@ -1,6 +1,7 @@
|
||||
# podinfo
|
||||
|
||||
[](https://github.com/stefanprodan/podinfo/blob/master/.github/workflows/e2e.yml)
|
||||
[](https://github.com/stefanprodan/podinfo/blob/master/.github/workflows/test.yml)
|
||||
[](https://github.com/stefanprodan/podinfo/blob/master/.github/workflows/release.yml)
|
||||
[](https://goreportcard.com/report/github.com/stefanprodan/podinfo)
|
||||
[](https://hub.docker.com/r/stefanprodan/podinfo)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
apiVersion: v1
|
||||
version: 4.0.0
|
||||
appVersion: 4.0.0
|
||||
version: 4.0.1
|
||||
appVersion: 4.0.1
|
||||
name: podinfo
|
||||
engine: gotpl
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
|
||||
@@ -8,8 +8,9 @@ that showcases best practices of running microservices in Kubernetes.
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```console
|
||||
$ helm repo add sp https://stefanprodan.github.io/podinfo
|
||||
$ helm upgrade my-release --install sp/podinfo
|
||||
$ helm repo add podinfo https://stefanprodan.github.io/podinfo
|
||||
|
||||
$ helm upgrade -i my-release podinfo/podinfo
|
||||
```
|
||||
|
||||
The command deploys podinfo on the Kubernetes cluster in the default namespace.
|
||||
@@ -20,7 +21,7 @@ The [configuration](#configuration) section lists the parameters that can be con
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
|
||||
```console
|
||||
$ helm delete --purge my-release
|
||||
$ helm delete my-release
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||
@@ -83,14 +84,14 @@ Parameter | Default | Description
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```console
|
||||
$ helm install stable/podinfo --name my-release \
|
||||
$ helm install my-release podinfo/podinfo \
|
||||
--set=serviceMonitor.enabled=true,serviceMonitor.interval=5s
|
||||
```
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
|
||||
|
||||
```console
|
||||
$ helm install stable/podinfo --name my-release -f values.yaml
|
||||
$ helm install my-release podinfo/podinfo -f values.yaml
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
|
||||
@@ -9,7 +9,7 @@ metadata:
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app: {{ template "podinfo.name" . }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
"helm.sh/hook": test-success
|
||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||
sidecar.istio.io/inject: "false"
|
||||
linkerd.io/inject: disabled
|
||||
|
||||
@@ -8,7 +8,7 @@ metadata:
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app: {{ template "podinfo.name" . }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
"helm.sh/hook": test-success
|
||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||
sidecar.istio.io/inject: "false"
|
||||
linkerd.io/inject: disabled
|
||||
|
||||
@@ -8,7 +8,7 @@ metadata:
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app: {{ template "podinfo.name" . }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
"helm.sh/hook": test-success
|
||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||
sidecar.istio.io/inject: "false"
|
||||
linkerd.io/inject: disabled
|
||||
|
||||
@@ -8,7 +8,7 @@ metadata:
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app: {{ template "podinfo.name" . }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
"helm.sh/hook": test-success
|
||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||
sidecar.istio.io/inject: "false"
|
||||
linkerd.io/inject: disabled
|
||||
|
||||
@@ -9,7 +9,7 @@ metadata:
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app: {{ template "podinfo.name" . }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
"helm.sh/hook": test-success
|
||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||
sidecar.istio.io/inject: "false"
|
||||
linkerd.io/inject: disabled
|
||||
|
||||
@@ -24,7 +24,7 @@ h2c:
|
||||
|
||||
image:
|
||||
repository: stefanprodan/podinfo
|
||||
tag: 4.0.0
|
||||
tag: 4.0.1
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
|
||||
@@ -23,7 +23,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: backend
|
||||
image: stefanprodan/podinfo:4.0.0
|
||||
image: stefanprodan/podinfo:4.0.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
|
||||
@@ -23,7 +23,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: frontend
|
||||
image: stefanprodan/podinfo:4.0.0
|
||||
image: stefanprodan/podinfo:4.0.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
|
||||
@@ -25,7 +25,7 @@ spec:
|
||||
serviceAccountName: webapp
|
||||
containers:
|
||||
- name: backend
|
||||
image: stefanprodan/podinfo:4.0.0
|
||||
image: stefanprodan/podinfo:4.0.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
|
||||
@@ -25,7 +25,7 @@ spec:
|
||||
serviceAccountName: webapp
|
||||
containers:
|
||||
- name: frontend
|
||||
image: stefanprodan/podinfo:4.0.0
|
||||
image: stefanprodan/podinfo:4.0.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
|
||||
@@ -23,7 +23,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: podinfod
|
||||
image: stefanprodan/podinfo:4.0.0
|
||||
image: stefanprodan/podinfo:4.0.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package version
|
||||
|
||||
var VERSION = "4.0.0"
|
||||
var VERSION = "4.0.1"
|
||||
var REVISION = "unknown"
|
||||
|
||||
Reference in New Issue
Block a user