Skip to content

Commit

Permalink
Add dnsConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
ekarlso committed Feb 17, 2022
1 parent b84a667 commit f8eb083
Show file tree
Hide file tree
Showing 19 changed files with 155 additions and 141 deletions.
175 changes: 87 additions & 88 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ jobs:
CONFTEST_VERSION: "0.15.0"

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Conftest Install
run: |
curl -sSL https://github.com/instrumenta/conftest/releases/download/v${CONFTEST_VERSION}/conftest_${CONFTEST_VERSION}_Linux_x86_64.tar.gz \
| tar vxz \
&& sudo mv -v conftest /usr/local/bin/conftest
- name: Install YQ
run: |
curl -sSL https://github.com/mikefarah/yq/releases/download/2.4.1/yq_linux_amd64 -o yq && chmod +x yq && sudo mv yq /usr/local/bin
- name: Helm Install
run: |
curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz \
| tar vxz \
&& sudo mv -v linux-amd64/helm /usr/local/bin/helm \
&& rm -vrf linux-amd64
- name: Helm Lint
run: ./helm-test.sh
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Conftest Install
run: |
curl -sSL https://github.com/instrumenta/conftest/releases/download/v${CONFTEST_VERSION}/conftest_${CONFTEST_VERSION}_Linux_x86_64.tar.gz \
| tar vxz \
&& sudo mv -v conftest /usr/local/bin/conftest
- name: Install YQ
run: |
curl -sSL https://github.com/mikefarah/yq/releases/download/v4.20.1/yq_linux_amd64 -o yq && chmod +x yq && sudo mv yq /usr/local/bin
- name: Helm Install
run: |
curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz \
| tar vxz \
&& sudo mv -v linux-amd64/helm /usr/local/bin/helm \
&& rm -vrf linux-amd64
- name: Helm Lint
run: ./helm-test.sh

publish:
runs-on: ubuntu-latest
Expand All @@ -46,74 +46,73 @@ jobs:
HELM_RELEASE_BRANCH: gh-pages

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Helm Install
run: |
curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz \
| tar vxz \
&& sudo mv -v linux-amd64/helm /usr/local/bin/helm \
&& rm -vrf linux-amd64
# Package
- name: Helm Package
run: |
mkdir -p ${HELM_TMP_DIR}
./helm-package.sh ${HELM_TMP_DIR}
ls -la ${HELM_TMP_DIR}
# Publish
- uses: actions/checkout@v2
with:
ref: gh-pages
path: ./gh-pages
token: ${{ secrets.GITHUB_TOKEN }}

- name: Debug
run: |
ls -la .
ls -la ${HELM_RELEASE_BRANCH}
ls -la ${HELM_RELEASE_BRANCH}/${HELM_RELEASE_DIR}
ls -la ${HELM_TMP_DIR}
- name: Helm Publish
run: |
cd ${HELM_RELEASE_BRANCH}
for chart in ${HELM_TMP_DIR}/*; do
chart=$(basename $chart)
echo $chart
if [ ! -f "${HELM_RELEASE_DIR}/${chart}" ]; then
mv -vn "${HELM_TMP_DIR}/${chart}" "${HELM_RELEASE_DIR}/${chart}"
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Helm Install
run: |
curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz \
| tar vxz \
&& sudo mv -v linux-amd64/helm /usr/local/bin/helm \
&& rm -vrf linux-amd64
# Package
- name: Helm Package
run: |
mkdir -p ${HELM_TMP_DIR}
./helm-package.sh ${HELM_TMP_DIR}
ls -la ${HELM_TMP_DIR}
# Publish
- uses: actions/checkout@v2
with:
ref: gh-pages
path: ./gh-pages
token: ${{ secrets.GITHUB_TOKEN }}

- name: Debug
run: |
ls -la .
ls -la ${HELM_RELEASE_BRANCH}
ls -la ${HELM_RELEASE_BRANCH}/${HELM_RELEASE_DIR}
ls -la ${HELM_TMP_DIR}
- name: Helm Publish
run: |
cd ${HELM_RELEASE_BRANCH}
for chart in ${HELM_TMP_DIR}/*; do
chart=$(basename $chart)
echo $chart
if [ ! -f "${HELM_RELEASE_DIR}/${chart}" ]; then
mv -vn "${HELM_TMP_DIR}/${chart}" "${HELM_RELEASE_DIR}/${chart}"
else
echo "Chart $chart is already released!"
fi
done
# Generate new index.yaml
helm repo index ${HELM_RELEASE_DIR} --url ${HELM_RELEASE_DIR}
# Move generated index.yaml to root dir
mv ${HELM_RELEASE_DIR}/index.yaml .
- name: Git Push
run: |
cd ${HELM_RELEASE_BRANCH}
git add -v ${HELM_RELEASE_DIR}
git status
if ! $(git diff-index --quiet HEAD -- ${HELM_RELEASE_DIR}/*); then
git add -v index.yaml
git status
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
git commit -am "AUTO-RELEASE: publish Helm Charts from master@${GITHUB_SHA:0:7}"
git push "https://${{ secrets.GITHUB_PAT }}@github.com/${GITHUB_REPOSITORY}.git"
else
echo "Chart $chart is already released!"
echo "No new packages to push"
fi
done
# Generate new index.yaml
helm repo index ${HELM_RELEASE_DIR} --url ${HELM_RELEASE_DIR}
# Move generated index.yaml to root dir
mv ${HELM_RELEASE_DIR}/index.yaml .
- name: Git Push
run: |
cd ${HELM_RELEASE_BRANCH}
git add -v ${HELM_RELEASE_DIR}
git status
if ! $(git diff-index --quiet HEAD -- ${HELM_RELEASE_DIR}/*); then
git add -v index.yaml
git status
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
git commit -am "AUTO-RELEASE: publish Helm Charts from master@${GITHUB_SHA:0:7}"
git push "https://${{ secrets.GITHUB_PAT }}@github.com/${GITHUB_REPOSITORY}.git"
else
echo "No new packages to push"
fi
38 changes: 19 additions & 19 deletions .github/workflows/pullrequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ jobs:
CONFTEST_VERSION: "0.15.0"

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Conftest Install
run: |
curl -sSL https://github.com/instrumenta/conftest/releases/download/v${CONFTEST_VERSION}/conftest_${CONFTEST_VERSION}_Linux_x86_64.tar.gz \
| tar vxz \
&& sudo mv -v conftest /usr/local/bin/conftest
- name: Install YQ
run: |
curl -sSL https://github.com/mikefarah/yq/releases/download/2.4.1/yq_linux_amd64 -o yq && chmod +x yq && sudo mv yq /usr/local/bin
- name: Helm Install
run: |
curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz \
| tar vxz \
&& sudo mv -v linux-amd64/helm /usr/local/bin/helm \
&& rm -vrf linux-amd64
- name: Test & Lint
run: ./helm-test.sh
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Conftest Install
run: |
curl -sSL https://github.com/instrumenta/conftest/releases/download/v${CONFTEST_VERSION}/conftest_${CONFTEST_VERSION}_Linux_x86_64.tar.gz \
| tar vxz \
&& sudo mv -v conftest /usr/local/bin/conftest
- name: Install YQ
run: |
curl -sSL https://github.com/mikefarah/yq/releases/download/v4.20.1/yq_linux_amd64 -o yq && chmod +x yq && sudo mv yq /usr/local/bin
- name: Helm Install
run: |
curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz \
| tar vxz \
&& sudo mv -v linux-amd64/helm /usr/local/bin/helm \
&& rm -vrf linux-amd64
- name: Test & Lint
run: ./helm-test.sh
4 changes: 2 additions & 2 deletions dotnet/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: .NET Core Helm Chart
name: dotnet
version: 9.1.0
version: 9.2.0
dependencies:
- name: libchart
version: 0.2.0
version: 0.3.0
repository: file://../libchart
3 changes: 3 additions & 0 deletions dotnet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,6 @@ deployKind: deployment

autoscaling:
enabled: false

# https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
dnsConfig: {}
6 changes: 3 additions & 3 deletions golang/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: libchart
repository: file://../libchart
version: 0.1.0
digest: sha256:e35a15b496d3f45163e2f993af8ab76d90ce6f0f9949d452bcd7461746840e5f
generated: "2021-04-05T19:44:52.693708282+02:00"
version: 0.3.0
digest: sha256:e51db0ee894288ecbe88427507cf23b80d5f5449c5f47d27044675537092ca49
generated: "2022-02-17T17:13:18.1276499+01:00"
4 changes: 2 additions & 2 deletions golang/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: golan Helm Chart
name: golang
version: 13.1.0
version: 13.2.0
dependencies:
- name: libchart
version: 0.2.0
version: 0.3.0
repository: file://../libchart
3 changes: 3 additions & 0 deletions golang/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,6 @@ deployKind: deployment

autoscaling:
enabled: false

# https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
dnsConfig: {}
1 change: 1 addition & 0 deletions helm-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set -o pipefail
PUBLISH_DIR=$1

for chart in */Chart.yaml; do
echo $chart
chart=$(dirname $chart)

helm package $chart -u -d ${PUBLISH_DIR}
Expand Down
5 changes: 3 additions & 2 deletions helm-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ rm -rf data temp

for chart in */Chart.yaml; do
chart=$(dirname $chart)
echo "Doing - $chart"

helm dep update $chart
helm lint $chart
[ ! -z "$(echo $chart | egrep '(dotnet|golang|java|nodejs|web)')" ] && {
[ ! -z "$(echo $chart | egrep 'dotnet|golang|java|nodejs|web')" ] && {
[ -d data ] && rm -rf data
mkdir data temp
helm template $chart --output-dir temp --set istio.enabled=1 --set csi.enabled=1
for f in temp/$chart/templates/*.yaml; do dst="data/$(basename $f | sed 's/yaml/json/g')"; yq read $f -j > $dst; done
for f in temp/$chart/templates/*.yaml; do dst="data/$(basename $f | sed 's/yaml/json/g')"; yq eval $f -o json > $dst; done
conftest test data/*
rm -rf data temp
}
Expand Down
4 changes: 2 additions & 2 deletions java/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: Java Helm Chart
name: java
version: 6.1.0
version: 6.2.0
dependencies:
- name: libchart
version: 0.2.0
version: 0.3.0
repository: file://../libchart
3 changes: 3 additions & 0 deletions java/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,6 @@ deployKind: deployment

autoscaling:
enabled: false

# https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
dnsConfig: {}
1 change: 1 addition & 0 deletions libchart/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ affinity:
{{- end }}

{{- with .Values.dnsConfig }}
dnsConfig:
{{ toYaml . | nindent 2 }}
{{- end -}}

Expand Down
6 changes: 3 additions & 3 deletions nodejs/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: libchart
repository: file://../libchart
version: 0.1.0
digest: sha256:e35a15b496d3f45163e2f993af8ab76d90ce6f0f9949d452bcd7461746840e5f
generated: "2021-04-05T19:44:31.578537705+02:00"
version: 0.3.0
digest: sha256:e51db0ee894288ecbe88427507cf23b80d5f5449c5f47d27044675537092ca49
generated: "2022-02-17T17:15:23.372119587+01:00"
4 changes: 2 additions & 2 deletions nodejs/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: Node.js Helm Chart
name: nodejs
version: 13.1.0
version: 13.2.0
dependencies:
- name: libchart
version: 0.2.0
version: 0.3.0
repository: file://../libchart
3 changes: 3 additions & 0 deletions nodejs/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,6 @@ deployKind: deployment

autoscaling:
enabled: false

# https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
dnsConfig: {}
13 changes: 13 additions & 0 deletions rabbitmq-tester/templates/serviceaccount-producer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "rabbitmq-tester.serviceAccountName" . }}-producer
labels:
{{- include "rabbitmq-tester.labels" . | nindent 4 }}
app.kubernetes.io/component: producer
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
16 changes: 0 additions & 16 deletions rabbitmq-tester/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,3 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

---

{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "rabbitmq-tester.serviceAccountName" . }}-producer
labels:
{{- include "rabbitmq-tester.labels" . | nindent 4 }}
app.kubernetes.io/component: producer
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit f8eb083

Please sign in to comment.