Skip to content

Commit

Permalink
Merge pull request #234 from RADAR-base/hook-fix
Browse files Browse the repository at this point in the history
Fixed helmfile hook error
  • Loading branch information
keyvaann authored Apr 17, 2023
2 parents 3cc0653 + 689e45c commit 0d654c8
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 89 deletions.
9 changes: 8 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@
**Applicable issues**

<!-- Enter any applicable Issues here (You can reference an issue using #) -->
- fixes #

- fixes #

**Additional information**

<!-- If there's anything else that's important and relevant to your pull
request, mention that information here.-->

**Checklist**

<!-- [Place an '[X]' (no spaces) in all applicable fields. Please remove unrelated fields.] -->

- Make sure application versions in compatiblity section of README is same as the versions tested in CI
148 changes: 74 additions & 74 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
required: false
default: false

Expand All @@ -17,97 +17,97 @@ jobs:
KUBECTL_VERSION: ["v1.23.0", "v1.24.0", "v1.25.0", "v1.26.0"]
include:
- KUBECTL_VERSION: "v1.23.0"
K3S_VERSION: "v1.23.15+k3s1"
K3S_VERSION: "v1.23.17+k3s1"
- KUBECTL_VERSION: "v1.24.0"
K3S_VERSION: "v1.24.9+k3s2"
K3S_VERSION: "v1.24.12+k3s1"
- KUBECTL_VERSION: "v1.25.0"
K3S_VERSION: "v1.25.5+k3s2"
K3S_VERSION: "v1.25.8+k3s1"
- KUBECTL_VERSION: "v1.26.0"
K3S_VERSION: "v1.26.0+k3s2"
K3S_VERSION: "v1.26.3+k3s1"
runs-on: self-hosted
steps:
- name: Cleanup
continue-on-error: true
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
/usr/local/bin/k3s-uninstall.sh
- name: Cleanup
continue-on-error: true
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
/usr/local/bin/k3s-uninstall.sh
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Install dependencies
env:
KUBECTL_VERSION: ${{ matrix.KUBECTL_VERSION }}
HELM_VERSION: "v3.10.2"
HELM_DIFF_VERSION: "3.4.2"
HELMFILE_VERSION: "v0.148.1"
YQ_VERSION: "v4.30.1"
run: |
./.github/ci_config/bin/install-dependencies
- name: Install dependencies
env:
KUBECTL_VERSION: ${{ matrix.KUBECTL_VERSION }}
HELM_VERSION: "v3.11.3"
HELM_DIFF_VERSION: "3.6.0"
HELMFILE_VERSION: "v0.152.0"
YQ_VERSION: "v4.33.3"
run: |
./.github/ci_config/bin/install-dependencies
- name: Prepare the environment
run: |
DNAME='CN=CI,O=TheHyve,L=Utrecht,C=NL' ./bin/init
yq -i -f process '.environments.default.values += ["../.github/ci_config/install-all.yaml", "../.github/ci_config/secrets.yaml.gotmpl"]' environments.yaml
- name: Prepare the environment
run: |
DNAME='CN=CI,O=TheHyve,L=Utrecht,C=NL' ./bin/init
yq -i -f process '.environments.default.values += ["../.github/ci_config/install-all.yaml", "../.github/ci_config/secrets.yaml.gotmpl"]' environments.yaml
- name: Run helmfile template
env:
FIREBASE_ADMINSDK_JSON: ${{ secrets.FIREBASE_ADMINSDK_JSON }}
run: |
helmfile template
- name: Run helmfile template
env:
FIREBASE_ADMINSDK_JSON: ${{ secrets.FIREBASE_ADMINSDK_JSON }}
run: |
helmfile template
- name: Install K3S
env:
INSTALL_K3S_VERSION: ${{ matrix.K3S_VERSION }}
INSTALL_K3S_SYMLINK: "skip"
K3S_KUBECONFIG_MODE: "644"
run: |
curl -sfL https://get.k3s.io | sh -s - --disable traefik --disable-helm-controller
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
- name: Install K3S
env:
INSTALL_K3S_VERSION: ${{ matrix.K3S_VERSION }}
INSTALL_K3S_SYMLINK: "skip"
K3S_KUBECONFIG_MODE: "644"
run: |
curl -sfL https://get.k3s.io | sh -s - --disable traefik --disable-helm-controller
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
- name: Install RADAR-Kubernetes
env:
FIREBASE_ADMINSDK_JSON: ${{ secrets.FIREBASE_ADMINSDK_JSON }}
run: |
echo "kubeconfig: $KUBECONFIG"
kubectl get pods --all-namespaces
- name: Install RADAR-Kubernetes
env:
FIREBASE_ADMINSDK_JSON: ${{ secrets.FIREBASE_ADMINSDK_JSON }}
run: |
echo "kubeconfig: $KUBECONFIG"
kubectl get pods --all-namespaces
helmfile sync --concurrency 1
helmfile sync --concurrency 1
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Manually triggered tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
with:
limit-access-to-actor: true
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Manually triggered tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
with:
limit-access-to-actor: true

- name: Setup tmate session if jobs have failed
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
with:
limit-access-to-actor: true
- name: Setup tmate session if jobs have failed
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
with:
limit-access-to-actor: true

- name: Report cluster state
if: always()
run: |
kubectl get pods --all-namespaces
- name: Report cluster state
if: always()
run: |
kubectl get pods --all-namespaces
check-gitignore:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Check gitignore
run: |
echo "Checking whether any files that should be ignored are uploaded"
echo
if find . -not -path './.git/*' -type f | git check-ignore --stdin --no-index; then
- name: Check gitignore
run: |
echo "Checking whether any files that should be ignored are uploaded"
echo
echo "Remove the above files from this branch"
exit 1
else
echo "No ignored files have been added"
fi
if find . -not -path './.git/*' -type f | git check-ignore --stdin --no-index; then
echo
echo "Remove the above files from this branch"
exit 1
else
echo "No ignored files have been added"
fi
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,18 @@ RADAR-Kubernetes is one of the youngest project of RADAR-base and will be the **

### Compatibility

Currently RADAR-Kubernetes is supported on Kubernetes versions thought 1.23 to 1.26. You should be able to install the platform on other versions of Kubernetes as well but you might encounter compatibility issues.
Currently RADAR-Kubernetes is tested and supported following versions:
| Component | Version |
| ---- | ------- |
| Kubernetes | v1.23 to v1.26 |
| K3s | v1.23.17+k3s1 to v1.26.3+k3s1 |
| Kubectl | v1.23 to v1.26 |
| Helm | v3.11.3 |
| Helm diff | v3.6.0 |
| Helmfile | v0.152.0 |
| YQ | v4.33.3 |

It's possible to install RADAR-Kubernetes on different version of tools as well, but you might encounter compatiblity issues. Make sure that `kubectl` version matches or it's higher than Kubernetes or K3s version that you're using. For other tools such as Git or Java the version, as long as it's not very old, it's not very impactful.

### Disclaimer

Expand Down
68 changes: 67 additions & 1 deletion etc/helmfile-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,70 @@ templates:
- events: ["postsync"]
showlogs: true
command: "../bin/log-failed-release"
args: ["-c", "'{{ .Values.kubeContext }}'", "-n", "'{{ .Release.Namespace }}'", "-r", "'{{ .Release.Name }}'", "-e", "'{{ if .Event.Error }}{{ .Event.Error }}{{ end }}'"]
args:
[
"-c",
"'{{ .Values.kubeContext }}'",
"-n",
"'{{ .Release.Namespace }}'",
"-r",
"'{{ .Release.Name }}'",
"-e",
"'{{ if .Event.Error }}{{ .Event.Error }}{{ end }}'",
]
logFailedReleasePrometheus: &logFailedReleasePrometheus
hooks:
- events: ["postsync"]
showlogs: true
command: "../bin/log-failed-release"
args:
[
"-c",
"'{{ .Values.kubeContext }}'",
"-n",
"'{{ .Release.Namespace }}'",
"-r",
"'{{ .Release.Name }}'",
"-e",
"'{{ if .Event.Error }}{{ .Event.Error }}{{ end }}'",
]
- events: ["presync"]
showlogs: true
command: "kubectl"
args:
[
"--context",
"{{ .Values.kubeContext }}",
"apply",
"--force-conflicts",
"--server-side",
"-f",
"../etc/kube-prometheus-stack/files/crds.yaml",
]
logFailedReleaseCertManager: &logFailedReleaseCertManager
hooks:
- events: ["postsync"]
showlogs: true
command: "../bin/log-failed-release"
args:
[
"-c",
"'{{ .Values.kubeContext }}'",
"-n",
"'{{ .Release.Namespace }}'",
"-r",
"'{{ .Release.Name }}'",
"-e",
"'{{ if .Event.Error }}{{ .Event.Error }}{{ end }}'",
]
- events: ["presync"]
showlogs: true
command: "kubectl"
args:
[
"--context",
"{{ .Values.kubeContext }}",
"apply",
"-f",
"../etc/cert-manager/files/crds.yaml",
]
14 changes: 2 additions & 12 deletions helmfile.d/00-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ releases:
installed: {{ .Values.kube_prometheus_stack._install }}
timeout: {{ add .Values.base_timeout .Values.kube_prometheus_stack._extra_timeout }}
disableValidation: true
<<: *logFailedRelease
<<: *logFailedReleasePrometheus
values:
- {{ .Values.kube_prometheus_stack | toYaml | indent 8 | trim }}
set:
Expand All @@ -97,11 +97,6 @@ releases:
value: radar-base-tls-grafana
- name: kube-prometheus-stack.grafana.ingress.tls[0].hosts
values: ["grafana.{{ .Values.server_name }}"]
hooks:
- events: ["presync"]
showlogs: true
command: "kubectl"
args: ["--context", "{{ .Values.kubeContext }}", "apply", "--force-conflicts", "--server-side", "-f", "../etc/kube-prometheus-stack/files/crds.yaml"]

- name: cert-manager
namespace: cert-manager
Expand All @@ -110,14 +105,9 @@ releases:
installed: {{ .Values.cert_manager._install }}
timeout: {{ add .Values.base_timeout .Values.cert_manager._extra_timeout }}
disableValidation: true
<<: *logFailedRelease
<<: *logFailedReleaseCertManager
values:
- {{ .Values.cert_manager | toYaml | indent 8 | trim }}
hooks:
- events: ["presync"]
showlogs: true
command: "kubectl"
args: ["--context", "{{ .Values.kubeContext }}", "apply", "-f", "../etc/cert-manager/files/crds.yaml"]

- name: nginx-ingress
chart: radar/ingress-nginx
Expand Down

0 comments on commit 0d654c8

Please sign in to comment.