Skip to content

Commit

Permalink
Portefaix label v0.14.0 (#689)
Browse files Browse the repository at this point in the history
* Add: manage release label

Signed-off-by: Nicolas Lamirault <[email protected]>

* Add: v0.14.0 label

Signed-off-by: Nicolas Lamirault <[email protected]>

* Update: clean

Signed-off-by: Nicolas Lamirault <[email protected]>

* Fix: Linkerd-viz kustomizaton

Signed-off-by: Nicolas Lamirault <[email protected]>

* Add: kubeconform into Docker Github action

Signed-off-by: Nicolas Lamirault <[email protected]>

* Add: migrate to kubeconform

Signed-off-by: Nicolas Lamirault <[email protected]>

* Add: release goal

Signed-off-by: Nicolas Lamirault <[email protected]>

* Fix: Grafana for Staging

Signed-off-by: Nicolas Lamirault <[email protected]>
  • Loading branch information
nlamirault authored Jun 11, 2021
1 parent a7c3ecd commit 8dec63d
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 85 deletions.
37 changes: 0 additions & 37 deletions .editorconfig

This file was deleted.

14 changes: 8 additions & 6 deletions .github/actions/tools/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,35 @@ set -eu
YQ_VERSION="v4.6.1"
KUSTOMIZE_VERSION="3.9.2"
KUBEVAL_VERSION="0.15.0"
KUBECONFORM_VERSION="v0.4.7"
OPA_VERSION="v0.28.0"
CONFTEST_VERSION="0.25.0"


mkdir -p $GITHUB_WORKSPACE/bin
cd $GITHUB_WORKSPACE/bin

curl -sL https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -o yq

chmod +x $GITHUB_WORKSPACE/bin/yq

kustomize_url=https://github.com/kubernetes-sigs/kustomize/releases/download && \
curl -sL ${kustomize_url}/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz | \
tar xz

chmod +x $GITHUB_WORKSPACE/bin/kustomize

curl -sL https://github.com/instrumenta/kubeval/releases/download/${KUBEVAL_VERSION}/kubeval-linux-amd64.tar.gz | \
tar xz

chmod +x $GITHUB_WORKSPACE/bin/kubeval

curl -sL https://github.com/open-policy-agent/opa/releases/download/${OPA_VERSION}/opa_linux_amd64 -o opa
curl -sL https://github.com/yannh/kubeconform/releases/download/${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz | \
tar xz
chmod +x $GITHUB_WORKSPACE/bin/kubeconform

curl -sL https://github.com/open-policy-agent/opa/releases/download/${OPA_VERSION}/opa_linux_amd64 -o opa
chmod +x $GITHUB_WORKSPACE/bin/opa

curl -sL https://github.com/open-policy-agent/conftest/releases/download/v0.25.0/conftest_0.25.0_Linux_x86_64.tar.gz | \
curl -sL https://github.com/open-policy-agent/conftest/releases/download/v${CONFTEST_VERSION}/conftest_${CONFTEST_VERSION}_Linux_x86_64.tar.gz | \
tar xz

chmod +x $GITHUB_WORKSPACE/bin/conftest

echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,8 @@ sops-decrypt: guard-FILE ## Decrypt
.PHONY: gitops-bootstrap
gitops-bootstrap: guard-ENV guard-CLOUD guard-BRANCH kubernetes-check-context ## Bootstrap Flux v2
./hack/scripts/bootstrap.sh clusters/$(CLOUD)/$(ENV) $(BRANCH)

.PHONY: release-prepare
release-prepare: guard-VERSION ## Update release label
./hack/scripts/portefaix-labels.sh kubernetes $(VERSION)
./hack/scripts/validate.sh clusters kubernetes
12 changes: 8 additions & 4 deletions hack/scripts/portefaix-labels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ version=$2

IFS="
"
for file in $(grep ${label} ${manifests}/*); do
filename=$(echo ${file} | awk -F":" '{ print $1 }')
echo -e "${INFO_COLOR}Update file: ${filename}${NO_COLOR}"
sed -i "s#${label}:.*#${label}: ${version}#g" ${filename}

for k8s_file in $(find ${manifests} -name "*.yaml" ); do
# echo ${k8s_file}
for file in $(grep ${label} ${k8s_file}); do
# echo "${k8s_file}: ${file}"
echo -e "${INFO_COLOR}Update file: ${NO_COLOR}${k8s_file}"
sed -i "s#${label}:.*#${label}: ${version}#g" ${k8s_file}
done
done
28 changes: 5 additions & 23 deletions hack/scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ manifests=$1
clusters=$2
[ -z "${clusters}" ] && echo -e "${ERROR_COLOR}Clusters not satisfied${NO_COLOR}" && exit 1

echo -e "${INFO_COLOR} - Downloading Flux OpenAPI schemas${NO_COLOR}"
mkdir -p /tmp/flux-crd-schemas/master-standalone-strict
curl -sL https://github.com/fluxcd/flux2/releases/latest/download/crd-schemas.tar.gz | tar zxf - -C /tmp/flux-crd-schemas/master-standalone-strict

# mirror kustomize-controller build options
# kustomize_flags="--enable_kyaml=false --allow_id_changes=false --load_restrictor=LoadRestrictionsNone"
kustomize_flags=""
Expand All @@ -60,30 +56,16 @@ find ${clusters} -type f -name '*.yaml' -print0 | while IFS= read -r -d $'\0' fi
yq e 'true' "$file" > /dev/null
done

# echo -e "${INFO_COLOR} - Validating Kubernetes definitions${NO_COLOR}"
# find ${clusters} -type f -name '*.yaml' -maxdepth 1 -print0 | while IFS= read -r -d $'\0' file;
# do
# kubeval ${file} --strict --ignore-missing-schemas --additional-schema-locations=file:///tmp/flux-crd-schemas
# if [[ ${PIPESTATUS[0]} != 0 ]]; then
# exit 1
# fi
# done

# echo -e "${INFO_COLOR} - Validating kustomize base${NO_COLOR}"
# find ${clusters}/base -type f -name $kustomize_config -print0 | while IFS= read -r -d $'\0' file;
# do
# echo -e "${INFO_COLOR} - Validating kustomization ${file/%$kustomize_config}${NO_COLOR}"
# kustomize build "${file/%$kustomize_config}" $kustomize_flags | kubeval --ignore-missing-schemas --strict --additional-schema-locations=file:///tmp/flux-crd-schemas
# if [[ ${PIPESTATUS[0]} != 0 ]]; then
# exit 1
# fi
# done
echo -e "${INFO_COLOR} - Downloading Flux OpenAPI schemas${NO_COLOR}"
mkdir -p /tmp/flux-crd-schemas/master-standalone-strict
curl -sL https://github.com/fluxcd/flux2/releases/latest/download/crd-schemas.tar.gz | tar zxf - -C /tmp/flux-crd-schemas/master-standalone-strict

echo -e "${INFO_COLOR} - Validating kustomize overlays${NO_COLOR}"
find ${clusters}/overlays -type f -name $kustomize_config -print0 | while IFS= read -r -d $'\0' file;
do
echo -e "${INFO_COLOR} - Validating kustomization ${file/%$kustomize_config}${NO_COLOR}"
kustomize build "${file/%$kustomize_config}" $kustomize_flags | kubeval --ignore-missing-schemas --additional-schema-locations=file:///tmp/flux-crd-schemas
# kustomize build "${file/%$kustomize_config}" $kustomize_flags | kubeval --ignore-missing-schemas --additional-schema-locations=file:///tmp/flux-crd-schemas
kustomize build "${file/%$kustomize_config}" $kustomize_flags | kubeconform --ignore-missing-schemas --schema-location=file:///tmp/flux-crd-schemas
if [[ ${PIPESTATUS[0]} != 0 ]]; then
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/base/dns/external-dns/external-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
targetNamespace: dns
values:
podLabels:
portefaix.xyz/version: v0.11.0
portefaix.xyz/version: v0.14.0
metrics:
enabled: true
serviceMonitor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ spec:
cleanupOnFail: true
values:
customLabels:
portefaix.xyz/version: v0.13.0
portefaix.xyz/version: v0.14.0
2 changes: 1 addition & 1 deletion kubernetes/base/litmus/litmus-chaos/litmus-chaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
cleanupOnFail: true
values:
customLabels:
portefaix.xyz/version: v0.13.0
portefaix.xyz/version: v0.14.0
# operator:
# image:
# repository: litmuschaos/chaos-operator
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/base/logging/vector/vector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
targetNamespace: logging
values:
podAnnotations:
portefaix.xyz/version: v0.11.0
portefaix.xyz/version: v0.14.0

serviceAccount:
create: true
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/base/monitoring/grafana/grafana-mixin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ spec:
timeout: 10m
values:
additionalLabels:
portefaix.xyz/version: v0.13.0
portefaix.xyz/version: v0.14.0
2 changes: 1 addition & 1 deletion kubernetes/base/monitoring/grafana/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
values:

extraLabels:
portefaix.xyz/version: v0.13.0
portefaix.xyz/version: v0.14.0

# image:
# repository: grafana/grafana
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
timeout: 20m
values:
commonLabels:
portefaix.xyz/version: v0.13.0
portefaix.xyz/version: v0.14.0
defaultRules:
runbookUrl: "https://github.com/portefaix/portefaix/tree/master/runbook.md#"

Expand Down Expand Up @@ -179,4 +179,4 @@ spec:
nodeExporter:
enabled: true
podLabels:
portefaix.xyz/version: v0.13.0
portefaix.xyz/version: v0.14.0
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ spec:
timeout: 10m
values:
additionalLabels:
portefaix.xyz/version: v0.13.0
portefaix.xyz/version: v0.14.0
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ spec:
timeout: 10m
values:
additionalLabels:
portefaix.xyz/version: v0.13.0
portefaix.xyz/version: v0.14.0
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ spec:
timeout: 10m
values:
additionalLabels:
portefaix.xyz/version: v0.13.0
portefaix.xyz/version: v0.14.0
2 changes: 1 addition & 1 deletion kubernetes/base/networking/speedtest/speedtest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
timeout: 10m
values:
additionalLabels:
portefaix.xyz/version: v0.11.0
portefaix.xyz/version: v0.14.0

additionalAnnotations:
a8r.io/description: Prometheus exporter that runs speedtest and exposes results
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/base/storage/nfs/nfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
targetNamespace: storage
values:
labels:
portefaix.xyz/version: v0.11.0
portefaix.xyz/version: v0.14.0

# nfs:
# server: xx.xx.xx.xx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: linkerd-viz
namespace: linkerd
namespace: linkerd-viz
spec:
values:
dashboard:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../../base/monitoring/grafana
- ../../../../base/monitoring/grafana
patchesStrategicMerge:
- grafana.yaml

0 comments on commit 8dec63d

Please sign in to comment.