mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-04-19 17:26:39 +00:00
Compare commits
41 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f43f9b2eb6 | ||
|
|
9a46ed3182 | ||
|
|
82b7007c5d | ||
|
|
806f0dbe82 | ||
|
|
936018e5bb | ||
|
|
1b4131b5ad | ||
|
|
b98a9dcc1a | ||
|
|
8860e57362 | ||
|
|
f1ecea6b53 | ||
|
|
ebc6493990 | ||
|
|
a2f9216fe4 | ||
|
|
27436ed538 | ||
|
|
c103a50423 | ||
|
|
5ac16f0f98 | ||
|
|
b4138fdb4d | ||
|
|
a2e6fd0ef1 | ||
|
|
c2aaf7a962 | ||
|
|
a066ff5385 | ||
|
|
113360052b | ||
|
|
a24e3e539c | ||
|
|
ed8a14d4d9 | ||
|
|
d2798e1a24 | ||
|
|
369014455c | ||
|
|
db1b8a7acd | ||
|
|
cc9231ae10 | ||
|
|
03ba47a0be | ||
|
|
ab953493ee | ||
|
|
c04ee365e6 | ||
|
|
26e8935520 | ||
|
|
dd027359e6 | ||
|
|
cf26a9cefc | ||
|
|
026b40876c | ||
|
|
fd1814052a | ||
|
|
98c2853ec3 | ||
|
|
b2ca15b8af | ||
|
|
55e7178dad | ||
|
|
ea55d3facf | ||
|
|
a72aa7a184 | ||
|
|
b4248cae1e | ||
|
|
7d2bc4905a | ||
|
|
f75f6e9fbc |
@@ -1,113 +0,0 @@
|
|||||||
version: 2.1
|
|
||||||
jobs:
|
|
||||||
e2e-kubernetes:
|
|
||||||
machine: true
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run:
|
|
||||||
name: Build podinfo container
|
|
||||||
command: e2e/build.sh
|
|
||||||
- run:
|
|
||||||
name: Start Kubernetes Kind cluster
|
|
||||||
command: e2e/bootstrap.sh
|
|
||||||
- run:
|
|
||||||
name: Install podinfo with Helm v3
|
|
||||||
command: e2e/install.sh
|
|
||||||
- run:
|
|
||||||
name: Run Helm tests
|
|
||||||
command: e2e/test.sh
|
|
||||||
|
|
||||||
push-container:
|
|
||||||
docker:
|
|
||||||
- image: circleci/golang:1.14
|
|
||||||
working_directory: ~/build
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- setup_remote_docker:
|
|
||||||
docker_layer_caching: false
|
|
||||||
- run: make build-container
|
|
||||||
- run: |
|
|
||||||
if [ -z "$CIRCLE_TAG" ]; then
|
|
||||||
echo "Not a release, skipping container push";
|
|
||||||
else
|
|
||||||
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin;
|
|
||||||
echo $QUAY_PASS | docker login -u $QUAY_USER --password-stdin quay.io;
|
|
||||||
make push-container;
|
|
||||||
make push-base;
|
|
||||||
fi
|
|
||||||
|
|
||||||
push-binary:
|
|
||||||
docker:
|
|
||||||
- image: circleci/golang:1.14
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run: curl -sL https://git.io/goreleaser | bash
|
|
||||||
|
|
||||||
push-helm-charts:
|
|
||||||
docker:
|
|
||||||
- image: circleci/golang:1.14
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run:
|
|
||||||
name: Install kubectl
|
|
||||||
command: sudo curl -L https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl && sudo chmod +x /usr/local/bin/kubectl
|
|
||||||
- run:
|
|
||||||
name: Install helm
|
|
||||||
command: sudo curl -L https://storage.googleapis.com/kubernetes-helm/helm-v2.14.2-linux-amd64.tar.gz | tar xz && sudo mv linux-amd64/helm /bin/helm && sudo rm -rf linux-amd64
|
|
||||||
- run:
|
|
||||||
name: Initialize helm
|
|
||||||
command: helm init --client-only --kubeconfig=$HOME/.kube/kubeconfig
|
|
||||||
- run:
|
|
||||||
name: Lint charts
|
|
||||||
command: |
|
|
||||||
helm lint ./charts/*
|
|
||||||
- run:
|
|
||||||
name: Package charts
|
|
||||||
command: |
|
|
||||||
mkdir $HOME/charts
|
|
||||||
helm package ./charts/* --destination $HOME/charts
|
|
||||||
- run:
|
|
||||||
name: Publish charts
|
|
||||||
command: |
|
|
||||||
if echo "${CIRCLE_TAG}" | grep -Eq "[0-9]+(\.[0-9]+)*(-[a-z]+)?$"; then
|
|
||||||
REPOSITORY="https://stefanprodan:${GITHUB_TOKEN}@github.com/stefanprodan/podinfo.git"
|
|
||||||
git config user.email stefanprodan@users.noreply.github.com
|
|
||||||
git config user.name stefanprodan
|
|
||||||
git remote set-url origin ${REPOSITORY}
|
|
||||||
git checkout gh-pages
|
|
||||||
mv -f $HOME/charts/*.tgz .
|
|
||||||
helm repo index . --url https://stefanprodan.github.io/podinfo
|
|
||||||
git add .
|
|
||||||
git commit -m "Publish Helm charts v${CIRCLE_TAG}"
|
|
||||||
git push origin gh-pages
|
|
||||||
else
|
|
||||||
echo "Not a release! Skip charts publish"
|
|
||||||
fi
|
|
||||||
|
|
||||||
workflows:
|
|
||||||
version: 2
|
|
||||||
build-test:
|
|
||||||
jobs:
|
|
||||||
- e2e-kubernetes
|
|
||||||
release:
|
|
||||||
jobs:
|
|
||||||
- push-binary:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
ignore: /.*/
|
|
||||||
tags:
|
|
||||||
ignore: /^chart.*/
|
|
||||||
- push-container:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
ignore: /.*/
|
|
||||||
tags:
|
|
||||||
ignore: /^chart.*/
|
|
||||||
- push-helm-charts:
|
|
||||||
requires:
|
|
||||||
- push-container
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
ignore: /.*/
|
|
||||||
tags:
|
|
||||||
ignore: /^chart.*/
|
|
||||||
6
.github/actions/helm/Dockerfile
vendored
Normal file
6
.github/actions/helm/Dockerfile
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
FROM stefanprodan/alpine-base:latest
|
||||||
|
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
15
.github/actions/helm/action.yml
vendored
Normal file
15
.github/actions/helm/action.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
name: 'helm'
|
||||||
|
description: 'A GitHub Action to run helm commands'
|
||||||
|
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 }}
|
||||||
24
.github/actions/helm/entrypoint.sh
vendored
Normal file
24
.github/actions/helm/entrypoint.sh
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
HELM_VERSION=$1
|
||||||
|
BIN_DIR="$GITHUB_WORKSPACE/bin"
|
||||||
|
|
||||||
|
main() {
|
||||||
|
mkdir -p ${BIN_DIR}
|
||||||
|
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 ${BIN_DIR}/helm
|
||||||
|
|
||||||
|
popd >& /dev/null
|
||||||
|
rm -rf $tmpDir
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
|
echo "::add-path::$BIN_DIR"
|
||||||
|
echo "::add-path::$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin"
|
||||||
6
.github/actions/release-notes/Dockerfile
vendored
Normal file
6
.github/actions/release-notes/Dockerfile
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
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
Normal file
9
.github/actions/release-notes/action.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
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'
|
||||||
24
.github/actions/release-notes/entrypoint.sh
vendored
Normal file
24
.github/actions/release-notes/entrypoint.sh
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/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 "::add-path::$BIN_DIR"
|
||||||
|
echo "::add-path::$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin"
|
||||||
23
.github/workflows/cve-scan.yml
vendored
Normal file
23
.github/workflows/cve-scan.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
name: cve-scan
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trivy:
|
||||||
|
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: Scan image
|
||||||
|
uses: docker://docker.io/aquasec/trivy:latest
|
||||||
|
with:
|
||||||
|
args: --cache-dir /var/lib/trivy --no-progress --exit-code 1 --severity MEDIUM,HIGH,CRITICAL ${{ steps.build.outputs.image }}
|
||||||
50
.github/workflows/e2e.yml
vendored
Normal file
50
.github/workflows/e2e.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: e2e
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
kind-helm:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
helm-version:
|
||||||
|
- 2.16.6
|
||||||
|
- 3.2.1
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup Kubernetes
|
||||||
|
uses: engineerd/setup-kind@v0.4.0
|
||||||
|
- 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 \
|
||||||
|
--set image.repository=test/podinfo \
|
||||||
|
--set image.tag=latest \
|
||||||
|
--namespace=default
|
||||||
|
- name: Run integration tests
|
||||||
|
run: |
|
||||||
|
kubectl rollout status deployment/podinfo --timeout=1m
|
||||||
|
helm test podinfo
|
||||||
|
- name: Debug failure
|
||||||
|
if: failure()
|
||||||
|
run: |
|
||||||
|
kubectl logs -l app=podinfo || true
|
||||||
46
.github/workflows/release.yml
vendored
Normal file
46
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
name: release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: crazy-max/ghaction-docker-buildx@v1
|
||||||
|
- name: Publish multi-arch image
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login --username "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||||
|
docker buildx build --platform "linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64" \
|
||||||
|
--output "type=image,push=true" \
|
||||||
|
--build-arg "REVISION=${GITHUB_SHA}" \
|
||||||
|
--build-arg "VERSION=${GITHUB_REF#refs/tags/}" \
|
||||||
|
--build-arg "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
|
||||||
|
--tag "docker.io/stefanprodan/podinfo:${GITHUB_REF#refs/tags/}" \
|
||||||
|
--tag "docker.io/stefanprodan/podinfo:latest" \
|
||||||
|
--file Dockerfile .
|
||||||
|
- name: Publish base image
|
||||||
|
uses: docker/build-push-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
repository: stefanprodan/podinfo-base
|
||||||
|
tags: latest
|
||||||
|
- name: Publish helm chart
|
||||||
|
uses: stefanprodan/helm-gh-pages@master
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- uses: ./.github/actions/release-notes
|
||||||
|
- name: Generate release notes
|
||||||
|
run: |
|
||||||
|
echo 'CHANGELOG' > /tmp/release.txt
|
||||||
|
github-release-notes -org stefanprodan -repo podinfo -since-latest-release >> /tmp/release.txt
|
||||||
|
- name: Publish release
|
||||||
|
uses: goreleaser/goreleaser-action@v1
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
args: release --release-notes=/tmp/release.txt
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
42
.github/workflows/test.yml
vendored
42
.github/workflows/test.yml
vendored
@@ -1,17 +1,43 @@
|
|||||||
on: [push, pull_request]
|
|
||||||
name: test
|
name: test
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- name: Checkout
|
||||||
- name: kubeval
|
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
|
uses: stefanprodan/kube-tools@v1
|
||||||
with:
|
with:
|
||||||
command: |
|
command: |
|
||||||
kustomize build ./kustomize | kubeval --strict
|
kustomize build ./kustomize | kubeval --strict
|
||||||
- name: conftest
|
|
||||||
uses: stefanprodan/kube-tools@v1
|
|
||||||
with:
|
|
||||||
command: |
|
|
||||||
kustomize build ./kustomize | conftest test -p .github/policy -
|
kustomize build ./kustomize | conftest test -p .github/policy -
|
||||||
|
|||||||
35
Dockerfile
35
Dockerfile
@@ -1,4 +1,6 @@
|
|||||||
FROM golang:1.14 as builder
|
FROM golang:1.14-alpine as builder
|
||||||
|
|
||||||
|
ARG REVISION
|
||||||
|
|
||||||
RUN mkdir -p /podinfo/
|
RUN mkdir -p /podinfo/
|
||||||
|
|
||||||
@@ -8,24 +10,35 @@ COPY . .
|
|||||||
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
RUN go test -v -race ./...
|
RUN CGO_ENABLED=0 go build -ldflags "-s -w \
|
||||||
|
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${REVISION}" \
|
||||||
RUN GIT_COMMIT=$(git rev-list -1 HEAD) && \
|
|
||||||
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w \
|
|
||||||
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${GIT_COMMIT}" \
|
|
||||||
-a -o bin/podinfo cmd/podinfo/*
|
-a -o bin/podinfo cmd/podinfo/*
|
||||||
|
|
||||||
RUN GIT_COMMIT=$(git rev-list -1 HEAD) && \
|
RUN CGO_ENABLED=0 go build -ldflags "-s -w \
|
||||||
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w \
|
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${REVISION}" \
|
||||||
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${GIT_COMMIT}" \
|
|
||||||
-a -o bin/podcli cmd/podcli/*
|
-a -o bin/podcli cmd/podcli/*
|
||||||
|
|
||||||
FROM alpine:3.11
|
FROM alpine:3.12
|
||||||
|
|
||||||
|
ARG BUILD_DATE
|
||||||
|
ARG VERSION
|
||||||
|
ARG REVISION
|
||||||
|
|
||||||
|
LABEL maintainer="stefanprodan" \
|
||||||
|
org.opencontainers.image.created=$BUILD_DATE \
|
||||||
|
org.opencontainers.image.url="https://github.com/stefanprodan/podinfo" \
|
||||||
|
org.opencontainers.image.source="https://github.com/stefanprodan/podinfo" \
|
||||||
|
org.opencontainers.image.version=$VERSION \
|
||||||
|
org.opencontainers.image.revision=$REVISION \
|
||||||
|
org.opencontainers.image.vendor="stefanprodan" \
|
||||||
|
org.opencontainers.image.title="podinfo" \
|
||||||
|
org.opencontainers.image.description="Go microservice template for Kubernetes" \
|
||||||
|
org.opencontainers.image.licenses="MIT"
|
||||||
|
|
||||||
RUN addgroup -S app \
|
RUN addgroup -S app \
|
||||||
&& adduser -S -g app app \
|
&& adduser -S -g app app \
|
||||||
&& apk --no-cache add \
|
&& apk --no-cache add \
|
||||||
curl openssl netcat-openbsd
|
ca-certificates curl netcat-openbsd
|
||||||
|
|
||||||
WORKDIR /home/app
|
WORKDIR /home/app
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
# podinfo
|
# podinfo
|
||||||
|
|
||||||
[](https://circleci.com/gh/stefanprodan/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/test.yml)
|
||||||
|
[](https://github.com/stefanprodan/podinfo/blob/master/.github/workflows/cve-scan.yml)
|
||||||
[](https://goreportcard.com/report/github.com/stefanprodan/podinfo)
|
[](https://goreportcard.com/report/github.com/stefanprodan/podinfo)
|
||||||
[](https://hub.docker.com/r/stefanprodan/podinfo)
|
[](https://hub.docker.com/r/stefanprodan/podinfo)
|
||||||
|
|
||||||
@@ -22,6 +23,8 @@ Specifications:
|
|||||||
* Helm and Kustomize installers
|
* Helm and Kustomize installers
|
||||||
* End-to-End testing with Kubernetes Kind and Helm
|
* End-to-End testing with Kubernetes Kind and Helm
|
||||||
* Kustomize testing with GitHub Actions and Open Policy Agent
|
* Kustomize testing with GitHub Actions and Open Policy Agent
|
||||||
|
* Multi-arch container image with Docker buildx and Github Actions
|
||||||
|
* CVE scanning with trivy
|
||||||
|
|
||||||
Web API:
|
Web API:
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
# Patterns to ignore when building packages.
|
|
||||||
# This supports shell glob matching, relative path matching, and
|
|
||||||
# negation (prefixed with !). Only one pattern per line.
|
|
||||||
.DS_Store
|
|
||||||
# Common VCS dirs
|
|
||||||
.git/
|
|
||||||
.gitignore
|
|
||||||
.bzr/
|
|
||||||
.bzrignore
|
|
||||||
.hg/
|
|
||||||
.hgignore
|
|
||||||
.svn/
|
|
||||||
# Common backup files
|
|
||||||
*.swp
|
|
||||||
*.bak
|
|
||||||
*.tmp
|
|
||||||
*~
|
|
||||||
# Various IDEs
|
|
||||||
.project
|
|
||||||
.idea/
|
|
||||||
*.tmproj
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
appVersion: "1.0"
|
|
||||||
description: A Ngrok Helm chart for Kubernetes
|
|
||||||
name: ngrok
|
|
||||||
version: 0.2.0
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
# Ngrok
|
|
||||||
|
|
||||||
Expose Kubernetes service with [Ngrok](https://ngrok.com).
|
|
||||||
|
|
||||||
## Installing the Chart
|
|
||||||
|
|
||||||
To install the chart with the release name `my-release`:
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ helm install sp/ngrok --name my-release \
|
|
||||||
--set token=NGROK-TOKEN \
|
|
||||||
--set expose.service=podinfo:9898
|
|
||||||
```
|
|
||||||
|
|
||||||
The command deploys Ngrok on the Kubernetes cluster in the default namespace.
|
|
||||||
The [configuration](#configuration) section lists the parameters that can be configured during installation.
|
|
||||||
|
|
||||||
## Uninstalling the Chart
|
|
||||||
|
|
||||||
To uninstall/delete the `my-release` deployment:
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ helm delete --purge my-release
|
|
||||||
```
|
|
||||||
|
|
||||||
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
The following tables lists the configurable parameters of the Grafana chart and their default values.
|
|
||||||
|
|
||||||
Parameter | Description | Default
|
|
||||||
--- | --- | ---
|
|
||||||
`image.repository` | Image repository | `stefanprodan/ngrok`
|
|
||||||
`image.pullPolicy` | Image pull policy | `IfNotPresent`
|
|
||||||
`image.tag` | Image tag | `latest`
|
|
||||||
`replicaCount` | desired number of pods | `1`
|
|
||||||
`tolerations` | List of node taints to tolerate | `[]`
|
|
||||||
`affinity` | node/pod affinities | `node`
|
|
||||||
`nodeSelector` | node labels for pod assignment | `{}`
|
|
||||||
`service.type` | type of service | `ClusterIP`
|
|
||||||
`token` | Ngrok auth token | `none`
|
|
||||||
`expose.service` | Service address to be exposed as in `service-name:port` | `none`
|
|
||||||
`subdomain` | Ngrok subdomain | `none`
|
|
||||||
|
|
||||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ helm upgrade --install --wait tunel \
|
|
||||||
--set token=NGROK-TOKEN \
|
|
||||||
--set service.type=NodePort \
|
|
||||||
--set expose.service=podinfo:9898 \
|
|
||||||
sp/ngrok
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ helm install sp/grafana --name my-release -f values.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
1. Get the application URL by running these commands:
|
|
||||||
{{- if contains "NodePort" .Values.service.type }}
|
|
||||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "ngrok.fullname" . }})
|
|
||||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.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 "ngrok.fullname" . }}'
|
|
||||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "ngrok.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
|
||||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
|
||||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
|
||||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "ngrok.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
|
||||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
|
||||||
kubectl port-forward $POD_NAME 8080:80
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
{{/* vim: set filetype=mustache: */}}
|
|
||||||
{{/*
|
|
||||||
Expand the name of the chart.
|
|
||||||
*/}}
|
|
||||||
{{- define "ngrok.name" -}}
|
|
||||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{/*
|
|
||||||
Create a default fully qualified app name.
|
|
||||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
||||||
If release name contains chart name it will be used as a full name.
|
|
||||||
*/}}
|
|
||||||
{{- define "ngrok.fullname" -}}
|
|
||||||
{{- if .Values.fullnameOverride -}}
|
|
||||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
|
||||||
{{- else -}}
|
|
||||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
|
||||||
{{- if contains $name .Release.Name -}}
|
|
||||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
|
||||||
{{- else -}}
|
|
||||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{/*
|
|
||||||
Create chart name and version as used by the chart label.
|
|
||||||
*/}}
|
|
||||||
{{- define "ngrok.chart" -}}
|
|
||||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
|
||||||
{{- end -}}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: {{ template "ngrok.fullname" . }}
|
|
||||||
data:
|
|
||||||
ngrok.yml: |-
|
|
||||||
web_addr: 0.0.0.0:4040
|
|
||||||
update: false
|
|
||||||
log: stdout
|
|
||||||
{{- if .Values.token }}
|
|
||||||
authtoken: {{ .Values.token }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
apiVersion: apps/v1beta2
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: {{ template "ngrok.fullname" . }}
|
|
||||||
labels:
|
|
||||||
app: {{ template "ngrok.name" . }}
|
|
||||||
chart: {{ template "ngrok.chart" . }}
|
|
||||||
release: {{ .Release.Name }}
|
|
||||||
heritage: {{ .Release.Service }}
|
|
||||||
spec:
|
|
||||||
replicas: {{ .Values.replicaCount }}
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: {{ template "ngrok.name" . }}
|
|
||||||
release: {{ .Release.Name }}
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: {{ template "ngrok.name" . }}
|
|
||||||
release: {{ .Release.Name }}
|
|
||||||
annotations:
|
|
||||||
prometheus.io/scrape: 'false'
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: {{ .Chart.Name }}
|
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
||||||
command:
|
|
||||||
- ./ngrok
|
|
||||||
- http
|
|
||||||
{{- if .Values.subdomain }}
|
|
||||||
- --subdomain={{ .Values.subdomain }}
|
|
||||||
{{- end }}
|
|
||||||
- {{ .Values.expose.service }}
|
|
||||||
volumeMounts:
|
|
||||||
- name: config
|
|
||||||
mountPath: /home/ngrok/.ngrok2
|
|
||||||
ports:
|
|
||||||
- name: http
|
|
||||||
containerPort: 4040
|
|
||||||
protocol: TCP
|
|
||||||
livenessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /api/tunnels
|
|
||||||
port: http
|
|
||||||
initialDelaySeconds: 10
|
|
||||||
periodSeconds: 30
|
|
||||||
resources:
|
|
||||||
{{ toYaml .Values.resources | indent 12 }}
|
|
||||||
{{- with .Values.nodeSelector }}
|
|
||||||
nodeSelector:
|
|
||||||
{{ toYaml . | indent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.affinity }}
|
|
||||||
affinity:
|
|
||||||
{{ toYaml . | indent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.tolerations }}
|
|
||||||
tolerations:
|
|
||||||
{{ toYaml . | indent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
volumes:
|
|
||||||
- name: config
|
|
||||||
configMap:
|
|
||||||
name: {{ template "ngrok.fullname" . }}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: {{ template "ngrok.fullname" . }}
|
|
||||||
labels:
|
|
||||||
app: {{ template "ngrok.name" . }}
|
|
||||||
chart: {{ template "ngrok.chart" . }}
|
|
||||||
release: {{ .Release.Name }}
|
|
||||||
heritage: {{ .Release.Service }}
|
|
||||||
spec:
|
|
||||||
type: {{ .Values.service.type }}
|
|
||||||
ports:
|
|
||||||
- port: {{ .Values.service.port }}
|
|
||||||
targetPort: http
|
|
||||||
protocol: TCP
|
|
||||||
name: http
|
|
||||||
selector:
|
|
||||||
app: {{ template "ngrok.name" . }}
|
|
||||||
release: {{ .Release.Name }}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
# Default values for ngrok.
|
|
||||||
# This is a YAML-formatted file.
|
|
||||||
# Declare variables to be passed into your templates.
|
|
||||||
|
|
||||||
replicaCount: 1
|
|
||||||
|
|
||||||
image:
|
|
||||||
repository: stefanprodan/ngrok
|
|
||||||
tag: latest
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
port: 4040
|
|
||||||
|
|
||||||
expose:
|
|
||||||
service: ga-podinfo:9898
|
|
||||||
|
|
||||||
token: 4i3rDinhLqMHtvez71N9S_38rkS7onwv77VFNZTaUR6
|
|
||||||
|
|
||||||
nodeSelector: {}
|
|
||||||
|
|
||||||
tolerations: []
|
|
||||||
|
|
||||||
affinity: {}
|
|
||||||
|
|
||||||
subdomain:
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
version: 3.3.1
|
version: 4.0.5
|
||||||
appVersion: 3.3.1
|
appVersion: 4.0.5
|
||||||
name: podinfo
|
name: podinfo
|
||||||
engine: gotpl
|
engine: gotpl
|
||||||
description: Podinfo Helm chart for Kubernetes
|
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`:
|
To install the chart with the release name `my-release`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ helm repo add sp https://stefanprodan.github.io/podinfo
|
$ helm repo add podinfo https://stefanprodan.github.io/podinfo
|
||||||
$ helm upgrade my-release --install sp/podinfo
|
|
||||||
|
$ helm upgrade -i my-release podinfo/podinfo
|
||||||
```
|
```
|
||||||
|
|
||||||
The command deploys podinfo on the Kubernetes cluster in the default namespace.
|
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:
|
To uninstall/delete the `my-release` deployment:
|
||||||
|
|
||||||
```console
|
```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.
|
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||||
@@ -36,6 +37,7 @@ Parameter | Default | Description
|
|||||||
`backend` | `None` | Echo backend URL
|
`backend` | `None` | Echo backend URL
|
||||||
`backends` | `[]` | Array of echo backend URLs
|
`backends` | `[]` | Array of echo backend URLs
|
||||||
`cache` | `None` | Redis address in the format `<host>:<port>`
|
`cache` | `None` | Redis address in the format `<host>:<port>`
|
||||||
|
`redis.enabled` | `false` | Create Redis deployment for caching purposes
|
||||||
`ui.color` | `#34577c` | UI color
|
`ui.color` | `#34577c` | UI color
|
||||||
`ui.message` | `None` | UI greetings message
|
`ui.message` | `None` | UI greetings message
|
||||||
`ui.logo` | `None` | UI logo
|
`ui.logo` | `None` | UI logo
|
||||||
@@ -79,18 +81,26 @@ Parameter | Default | Description
|
|||||||
`nodeSelector` | `{}` | Node labels for pod assignment
|
`nodeSelector` | `{}` | Node labels for pod assignment
|
||||||
`tolerations` | `[]` | List of node taints to tolerate
|
`tolerations` | `[]` | List of node taints to tolerate
|
||||||
`affinity` | `None` | Node/pod affinities
|
`affinity` | `None` | Node/pod affinities
|
||||||
|
`podAnnotations` | `{}` | Pod annotations
|
||||||
|
|
||||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ helm install stable/podinfo --name my-release \
|
$ helm install my-release podinfo/podinfo \
|
||||||
--set=serviceMonitor.enabled=true,serviceMonitor.interval=5s
|
--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
|
||||||
|
```
|
||||||
|
|
||||||
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. For example,
|
||||||
|
|
||||||
```console
|
```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)
|
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ spec:
|
|||||||
annotations:
|
annotations:
|
||||||
prometheus.io/scrape: "true"
|
prometheus.io/scrape: "true"
|
||||||
prometheus.io/port: "{{ .Values.service.httpPort }}"
|
prometheus.io/port: "{{ .Values.service.httpPort }}"
|
||||||
|
{{- range $key, $value := .Values.podAnnotations }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
terminationGracePeriodSeconds: 30
|
terminationGracePeriodSeconds: 30
|
||||||
{{- if .Values.serviceAccount.enabled }}
|
{{- if .Values.serviceAccount.enabled }}
|
||||||
@@ -51,6 +54,8 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.cache }}
|
{{- if .Values.cache }}
|
||||||
- --cache-server={{ .Values.cache }}
|
- --cache-server={{ .Values.cache }}
|
||||||
|
{{- else if .Values.redis.enabled }}
|
||||||
|
- --cache-server={{ template "podinfo.fullname" . }}:6379
|
||||||
{{- end }}
|
{{- end }}
|
||||||
- --level={{ .Values.logLevel }}
|
- --level={{ .Values.logLevel }}
|
||||||
- --random-delay={{ .Values.faults.delay }}
|
- --random-delay={{ .Values.faults.delay }}
|
||||||
|
|||||||
12
charts/podinfo/templates/redis/config.yaml
Normal file
12
charts/podinfo/templates/redis/config.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{{- if .Values.redis.enabled -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ template "podinfo.fullname" . }}-redis
|
||||||
|
data:
|
||||||
|
redis.conf: |
|
||||||
|
maxmemory 64mb
|
||||||
|
maxmemory-policy allkeys-lru
|
||||||
|
save ""
|
||||||
|
appendonly no
|
||||||
|
{{- end }}
|
||||||
68
charts/podinfo/templates/redis/deployment.yaml
Normal file
68
charts/podinfo/templates/redis/deployment.yaml
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
{{- if .Values.redis.enabled -}}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ template "podinfo.fullname" . }}-redis
|
||||||
|
labels:
|
||||||
|
app: {{ template "podinfo.fullname" . }}-redis
|
||||||
|
spec:
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ template "podinfo.fullname" . }}-redis
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ template "podinfo.fullname" . }}-redis
|
||||||
|
annotations:
|
||||||
|
checksum/config: {{ include (print $.Template.BasePath "/redis/config.yaml") . | sha256sum | quote }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.serviceAccount.enabled }}
|
||||||
|
serviceAccountName: {{ template "podinfo.serviceAccountName" . }}
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
- name: redis
|
||||||
|
image: "{{ .Values.redis.repository }}:{{ .Values.redis.tag }}"
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
command:
|
||||||
|
- redis-server
|
||||||
|
- "/redis-master/redis.conf"
|
||||||
|
ports:
|
||||||
|
- name: redis
|
||||||
|
containerPort: 6379
|
||||||
|
protocol: TCP
|
||||||
|
livenessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: redis
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 5
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- redis-cli
|
||||||
|
- ping
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 5
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 1000m
|
||||||
|
memory: 128Mi
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 32Mi
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /var/lib/redis
|
||||||
|
name: data
|
||||||
|
- mountPath: /redis-master
|
||||||
|
name: config
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
emptyDir: {}
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: {{ template "podinfo.fullname" . }}-redis
|
||||||
|
items:
|
||||||
|
- key: redis.conf
|
||||||
|
path: redis.conf
|
||||||
|
{{- end }}
|
||||||
17
charts/podinfo/templates/redis/service.yaml
Normal file
17
charts/podinfo/templates/redis/service.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{{- if .Values.redis.enabled -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ template "podinfo.fullname" . }}-redis
|
||||||
|
labels:
|
||||||
|
app: {{ template "podinfo.fullname" . }}-redis
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app: {{ template "podinfo.fullname" . }}-redis
|
||||||
|
ports:
|
||||||
|
- name: redis
|
||||||
|
port: 6379
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: redis
|
||||||
|
{{- end }}
|
||||||
@@ -9,7 +9,7 @@ metadata:
|
|||||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||||
app: {{ template "podinfo.name" . }}
|
app: {{ template "podinfo.name" . }}
|
||||||
annotations:
|
annotations:
|
||||||
"helm.sh/hook": test
|
"helm.sh/hook": test-success
|
||||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||||
sidecar.istio.io/inject: "false"
|
sidecar.istio.io/inject: "false"
|
||||||
linkerd.io/inject: disabled
|
linkerd.io/inject: disabled
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ metadata:
|
|||||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||||
app: {{ template "podinfo.name" . }}
|
app: {{ template "podinfo.name" . }}
|
||||||
annotations:
|
annotations:
|
||||||
"helm.sh/hook": test
|
"helm.sh/hook": test-success
|
||||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||||
sidecar.istio.io/inject: "false"
|
sidecar.istio.io/inject: "false"
|
||||||
linkerd.io/inject: disabled
|
linkerd.io/inject: disabled
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ metadata:
|
|||||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||||
app: {{ template "podinfo.name" . }}
|
app: {{ template "podinfo.name" . }}
|
||||||
annotations:
|
annotations:
|
||||||
"helm.sh/hook": test
|
"helm.sh/hook": test-success
|
||||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||||
sidecar.istio.io/inject: "false"
|
sidecar.istio.io/inject: "false"
|
||||||
linkerd.io/inject: disabled
|
linkerd.io/inject: disabled
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ metadata:
|
|||||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||||
app: {{ template "podinfo.name" . }}
|
app: {{ template "podinfo.name" . }}
|
||||||
annotations:
|
annotations:
|
||||||
"helm.sh/hook": test
|
"helm.sh/hook": test-success
|
||||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||||
sidecar.istio.io/inject: "false"
|
sidecar.istio.io/inject: "false"
|
||||||
linkerd.io/inject: disabled
|
linkerd.io/inject: disabled
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ metadata:
|
|||||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||||
app: {{ template "podinfo.name" . }}
|
app: {{ template "podinfo.name" . }}
|
||||||
annotations:
|
annotations:
|
||||||
"helm.sh/hook": test
|
"helm.sh/hook": test-success
|
||||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||||
sidecar.istio.io/inject: "false"
|
sidecar.istio.io/inject: "false"
|
||||||
linkerd.io/inject: disabled
|
linkerd.io/inject: disabled
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ replicaCount: 1
|
|||||||
logLevel: info
|
logLevel: info
|
||||||
backend: #http://backend-podinfo:9898/echo
|
backend: #http://backend-podinfo:9898/echo
|
||||||
backends: []
|
backends: []
|
||||||
cache: ""
|
|
||||||
|
|
||||||
ui:
|
ui:
|
||||||
color: "#34577c"
|
color: "#34577c"
|
||||||
@@ -24,7 +23,7 @@ h2c:
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
repository: stefanprodan/podinfo
|
repository: stefanprodan/podinfo
|
||||||
tag: 3.3.1
|
tag: 4.0.5
|
||||||
pullPolicy: IfNotPresent
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
service:
|
service:
|
||||||
@@ -48,6 +47,14 @@ hpa:
|
|||||||
# average http requests per second per pod (k8s-prometheus-adapter)
|
# average http requests per second per pod (k8s-prometheus-adapter)
|
||||||
requests:
|
requests:
|
||||||
|
|
||||||
|
# Redis address in the format <host>:<port>
|
||||||
|
cache: ""
|
||||||
|
# Redis deployment
|
||||||
|
redis:
|
||||||
|
enabled: false
|
||||||
|
repository: redis
|
||||||
|
tag: 6.0.1
|
||||||
|
|
||||||
serviceAccount:
|
serviceAccount:
|
||||||
# Specifies whether a service account should be created
|
# Specifies whether a service account should be created
|
||||||
enabled: false
|
enabled: false
|
||||||
@@ -88,3 +95,4 @@ tolerations: []
|
|||||||
|
|
||||||
affinity: {}
|
affinity: {}
|
||||||
|
|
||||||
|
podAnnotations: {}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: backend
|
- name: backend
|
||||||
image: stefanprodan/podinfo:3.3.1
|
image: stefanprodan/podinfo:4.0.5
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: frontend
|
- name: frontend
|
||||||
image: stefanprodan/podinfo:3.3.1
|
image: stefanprodan/podinfo:4.0.5
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ spec:
|
|||||||
serviceAccountName: webapp
|
serviceAccountName: webapp
|
||||||
containers:
|
containers:
|
||||||
- name: backend
|
- name: backend
|
||||||
image: stefanprodan/podinfo:3.3.1
|
image: stefanprodan/podinfo:4.0.5
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ spec:
|
|||||||
serviceAccountName: webapp
|
serviceAccountName: webapp
|
||||||
containers:
|
containers:
|
||||||
- name: frontend
|
- name: frontend
|
||||||
image: stefanprodan/podinfo:3.3.1
|
image: stefanprodan/podinfo:4.0.5
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
# podinfo end-to-end testing
|
|
||||||
|
|
||||||
The e2e testing infrastructure is powered by CircleCI and [Kubernetes Kind](https://github.com/kubernetes-sigs/kind).
|
|
||||||
|
|
||||||
### CI workflow
|
|
||||||
|
|
||||||
* download go modules
|
|
||||||
* run unit tests
|
|
||||||
* build container
|
|
||||||
* install kubectl, Helm v3 and Kubernetes Kind CLIs
|
|
||||||
* create local Kubernetes cluster with kind
|
|
||||||
* load podinfo image onto the local cluster
|
|
||||||
* deploy podinfo with Helm
|
|
||||||
* set the podinfo image to the locally built one
|
|
||||||
* run Helm tests
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
jobs:
|
|
||||||
e2e-kubernetes:
|
|
||||||
machine: true
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run:
|
|
||||||
name: Build podinfo container
|
|
||||||
command: e2e/build.sh
|
|
||||||
- run:
|
|
||||||
name: Start Kubernetes Kind cluster
|
|
||||||
command: e2e/bootstrap.sh
|
|
||||||
- run:
|
|
||||||
name: Install podinfo with Helm
|
|
||||||
command: e2e/install.sh
|
|
||||||
- run:
|
|
||||||
name: Run Helm tests
|
|
||||||
command: e2e/test.sh
|
|
||||||
```
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -o errexit
|
|
||||||
|
|
||||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
|
||||||
KIND_VERSION=v0.8.1
|
|
||||||
|
|
||||||
if [[ "$1" ]]; then
|
|
||||||
KIND_VERSION=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ">>> Installing kubectl"
|
|
||||||
curl -sLO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
|
|
||||||
chmod +x kubectl && \
|
|
||||||
sudo mv kubectl /usr/local/bin/
|
|
||||||
|
|
||||||
echo ">>> Installing kind"
|
|
||||||
curl -sSLo kind "https://github.com/kubernetes-sigs/kind/releases/download/$KIND_VERSION/kind-linux-amd64"
|
|
||||||
chmod +x kind
|
|
||||||
sudo mv kind /usr/local/bin/kind
|
|
||||||
|
|
||||||
echo ">>> Creating kind cluster"
|
|
||||||
kind create cluster --wait 5m
|
|
||||||
|
|
||||||
echo ">>> Installing Helm v3"
|
|
||||||
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -o errexit
|
|
||||||
|
|
||||||
docker build -t test/podinfo:latest .
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -o errexit
|
|
||||||
|
|
||||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
|
||||||
|
|
||||||
echo '>>> Loading image in Kind'
|
|
||||||
kind load docker-image test/podinfo:latest
|
|
||||||
|
|
||||||
echo '>>> Installing'
|
|
||||||
helm upgrade -i podinfo ${REPO_ROOT}/charts/podinfo --namespace=default
|
|
||||||
kubectl set image deployment/podinfo podinfo=test/podinfo:latest
|
|
||||||
kubectl rollout status deployment/podinfo
|
|
||||||
12
e2e/test.sh
12
e2e/test.sh
@@ -1,12 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -o errexit
|
|
||||||
|
|
||||||
function finish {
|
|
||||||
echo '>>> Test logs'
|
|
||||||
kubectl logs -l app=podinfo || true
|
|
||||||
}
|
|
||||||
trap "finish" EXIT SIGINT
|
|
||||||
|
|
||||||
echo '>>> Start integration tests'
|
|
||||||
helm test podinfo
|
|
||||||
@@ -23,7 +23,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: podinfod
|
- name: podinfod
|
||||||
image: stefanprodan/podinfo:3.3.1
|
image: stefanprodan/podinfo:4.0.5
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/health"
|
"google.golang.org/grpc/health"
|
||||||
"google.golang.org/grpc/health/grpc_health_v1"
|
"google.golang.org/grpc/health/grpc_health_v1"
|
||||||
|
"google.golang.org/grpc/reflection"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
@@ -37,6 +38,7 @@ func (s *Server) ListenAndServe() {
|
|||||||
|
|
||||||
srv := grpc.NewServer()
|
srv := grpc.NewServer()
|
||||||
server := health.NewServer()
|
server := health.NewServer()
|
||||||
|
reflection.Register(srv)
|
||||||
grpc_health_v1.RegisterHealthServer(srv, server)
|
grpc_health_v1.RegisterHealthServer(srv, server)
|
||||||
server.SetServingStatus(s.config.ServiceName, grpc_health_v1.HealthCheckResponse_SERVING)
|
server.SetServingStatus(s.config.ServiceName, grpc_health_v1.HealthCheckResponse_SERVING)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package version
|
package version
|
||||||
|
|
||||||
var VERSION = "3.3.1"
|
var VERSION = "4.0.5"
|
||||||
var REVISION = "unknown"
|
var REVISION = "unknown"
|
||||||
|
|||||||
Reference in New Issue
Block a user