Skip to content

Commit 30a6916

Browse files
authored
Merge pull request #8161 from BacLuc/rewrite-deploy-ops-dashboard
Rewrite deploy ops dashboard
2 parents f20ee1b + e13a2a9 commit 30a6916

File tree

11 files changed

+145
-107
lines changed

11 files changed

+145
-107
lines changed

.github/workflows/deploy-ops-dashboard.yml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ on:
44
workflow_dispatch:
55
inputs:
66
environment:
7-
description: 'Choose environment'
7+
description: "Choose environment"
88
type: environment
99
required: true
10-
default: "ops-dashboard-dev"
10+
action:
11+
description: "Choose action"
12+
type: choice
13+
required: true
14+
default: diff
15+
options:
16+
- diff
17+
- deploy
1118

1219
jobs:
1320
deploy-ops-dashboard:
@@ -26,40 +33,43 @@ jobs:
2633
2734
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2835

29-
- name: Dump secrets to .env
36+
- name: Dump secrets to /tmp/secrets.yaml
3037
run: |
31-
echo '${{ toJSON(secrets) }}' | jq -r 'keys[] as $k | select(.[$k] |contains("\n") | not) | "\($k)=\"\(.[$k])\""' >> .env
32-
working-directory: .ops/ops-dashboard
38+
cat << 'EOF' | tee -a /tmp/secrets.yaml
39+
${{ toJSON(secrets) }}
40+
EOF
41+
jq '.' /tmp/secrets.yaml
3342
34-
- name: Dump variables to .env
35-
run: |
36-
echo '${{ toJSON(vars) }}' | jq -r 'keys[] as $k | select(.[$k] |contains("\n") | not) | "\($k)=\"\(.[$k])\""' >> .env
37-
working-directory: .ops/ops-dashboard
43+
- name: Dump variables to /tmp/env.yaml
44+
run: |
45+
cat << 'EOF' | tee -a /tmp/env.yaml
46+
${{ toJSON(vars) }}
47+
EOF
48+
jq '.' /tmp/env.yaml
3849
39-
- name: Show .env for debugging
40-
run: echo "$(cat .env | sort)"
50+
- name: Merge secrets and variables
51+
run: |
52+
jq -s '.[0] + .[1]' /tmp/secrets.yaml /tmp/env.yaml > env.yaml
53+
jq '.' env.yaml
4154
working-directory: .ops/ops-dashboard
4255

4356
- name: Setup helm
4457
run: |
4558
mkdir ~/.kube && echo '${{ secrets.KUBECONFIG }}' > ~/.kube/config && chmod go-r ~/.kube/config
4659
47-
- name: Add helm repositories
48-
run: |
49-
helm repo add oauth2-proxy https://oauth2-proxy.github.io/manifests
50-
helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
51-
helm repo update
60+
- uses: ./.github/actions/setup-helmfile
5261

5362
- name: Diff deployment
5463
run: |
5564
./deploy.sh diff || true
5665
working-directory: .ops/ops-dashboard
57-
58-
- name: Show values.out.yaml
59-
run: cat values.out.yaml
66+
67+
- name: Show values.yaml
68+
run: cat values.yaml
6069
working-directory: .ops/ops-dashboard
6170

6271
- name: Deploy
72+
if: ${{ github.event.inputs.action == 'deploy' }}
6373
run: |
6474
./deploy.sh deploy
6575
working-directory: .ops/ops-dashboard

.ops/ops-dashboard/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/.env
22
/charts
3+
/env.yaml
4+
/values.yaml
35
/values.out.yaml

.ops/ops-dashboard/Chart.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
dependencies:
22
- name: oauth2-proxy
33
repository: https://oauth2-proxy.github.io/manifests
4-
version: 8.2.0
4+
version: 7.18.0
55
- name: kubernetes-dashboard
66
repository: https://kubernetes.github.io/dashboard/
77
version: 7.13.0
88
- name: oauth2-proxy
99
repository: https://oauth2-proxy.github.io/manifests
10-
version: 8.2.0
10+
version: 7.18.0
1111
- name: oauth2-proxy
1212
repository: https://oauth2-proxy.github.io/manifests
13-
version: 8.2.0
14-
digest: sha256:142da8fd57bc6a24ca609e3ad8a4dfb1cca54f5fda7972dea16ad14477d3dcec
15-
generated: "2025-08-24T16:31:56.7842085Z"
13+
version: 7.18.0
14+
digest: sha256:d119e0b8ffb14fc7aee209549ea98ee92c80eefe64a20f4b48a5a7b193efc9c6
15+
generated: "2025-08-14T11:03:55.532011762Z"

.ops/ops-dashboard/Chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ appVersion: 0.1.0
2626
dependencies:
2727
- name: oauth2-proxy
2828
alias: grafana-proxy
29-
version: 8.2.0
29+
version: 7.18.0
3030
repository: https://oauth2-proxy.github.io/manifests
3131
- name: kubernetes-dashboard
3232
version: 7.13.0
3333
repository: https://kubernetes.github.io/dashboard/
3434
- name: oauth2-proxy
3535
alias: kubernetes-dashboard-proxy
36-
version: 8.2.0
36+
version: 7.18.0
3737
repository: https://oauth2-proxy.github.io/manifests
3838
- name: oauth2-proxy
3939
alias: logging-proxy
40-
version: 8.2.0
40+
version: 7.18.0
4141
repository: https://oauth2-proxy.github.io/manifests

.ops/ops-dashboard/README.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@ to see our applications like graphana, kibana, kubernetes-dashboard...
66

77
## Prerequisites
88

9-
You need the oauth2-proxy helm chart:
9+
First you need to have the following dependencies:
1010

11-
```shell
12-
helm repo add oauth2-proxy https://oauth2-proxy.github.io/manifests
13-
helm repo update
14-
```
15-
16-
You also need the kubernetes-dashboard helm chart:
17-
18-
```shell
19-
helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
20-
helm repo update
21-
```
11+
- jq
12+
- kubectl (with a kubeconfig for the cluster you want to deploy to)
13+
- helm
14+
- helmfile
2215

2316
## Deployment
2417

.ops/ops-dashboard/deploy.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,25 @@ set -ea
55
SCRIPT_DIR=$(realpath "$(dirname "$0")")
66
cd $SCRIPT_DIR
77

8-
. $SCRIPT_DIR/.env
8+
action=${1:-diff}
99

10-
envsubst < $SCRIPT_DIR/values.yaml > $SCRIPT_DIR/values.out.yaml
10+
helmfile deps
11+
helmfile write-values --environment default --output-file-template values.yaml
1112

12-
helm dep build
13-
14-
if [ $1 = "deploy" ]; then
13+
if [ "$action" = "deploy" ]; then
1514
# to debug: --dry-run --debug
16-
helm upgrade --install ops-dashboard --namespace=ops-dashboard --create-namespace $SCRIPT_DIR --values $SCRIPT_DIR/values.out.yaml
15+
helm upgrade --install ops-dashboard \
16+
--namespace=ops-dashboard \
17+
--create-namespace \
18+
"$SCRIPT_DIR" \
19+
--values "$SCRIPT_DIR/values.yaml"
1720
exit 0
1821
fi
1922

20-
if [ $1 = "diff" ]; then
23+
if [ "$action" = "diff" ]; then
2124
helm template \
22-
--namespace ops-dashboard --no-hooks --skip-tests ops-dashboard \
23-
$SCRIPT_DIR \
24-
--values $SCRIPT_DIR/values.out.yaml | kubectl diff --namespace ops-dashboard -f -
25+
--namespace ops-dashboard --no-hooks --skip-tests ops-dashboard \
26+
"$SCRIPT_DIR" \
27+
--values "$SCRIPT_DIR/values.yaml" | kubectl diff --namespace ops-dashboard -f -
2528
exit 0
2629
fi
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"COOKIE_SECRET": ,
3+
"GRAFANA_PROXY_HOST": ,
4+
"GRAFANA_PROXY_OAUTH_CLIENT_ID": ,
5+
"GRAFANA_PROXY_OAUTH_CLIENT_SECRET": ,
6+
"KUBERNETES_DASHBOARD_PROXY_HOST": ,
7+
"KUBERNETES_DASHBOARD_PROXY_OAUTH_CLIENT_ID": ,
8+
"KUBERNETES_DASHBOARD_PROXY_OAUTH_CLIENT_SECRET": ,
9+
"LOGGING_PROXY_HOST": ,
10+
"LOGGING_PROXY_OAUTH_CLIENT_ID": ,
11+
"LOGGING_PROXY_OAUTH_CLIENT_SECRET":
12+
}

.ops/ops-dashboard/helmfile.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
environments:
2+
default:
3+
values:
4+
- ./env.yaml
5+
---
6+
repositories:
7+
- name: oauth2-proxy
8+
url: https://oauth2-proxy.github.io/manifests
9+
- name: kubernetes-dashboard
10+
url: https://kubernetes.github.io/dashboard/
11+
12+
releases:
13+
- name: ""
14+
chart: .
15+
values:
16+
- ./values.yaml.gotmpl

.ops/ops-dashboard/values.yaml

Lines changed: 0 additions & 58 deletions
This file was deleted.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
grafana-proxy:
2+
ingress:
3+
enabled: true
4+
className: nginx
5+
hosts:
6+
- {{ .Environment.Values | getOrNil "GRAFANA_PROXY_HOST" | required "GRAFANA_PROXY_HOST is required" | quote }}
7+
extraArgs:
8+
whitelist-domain: {{ .Environment.Values | getOrNil "GRAFANA_PROXY_HOST" | required "GRAFANA_PROXY_HOST is required" | quote }}
9+
provider: github
10+
github-org: ecamp
11+
upstream: http://kube-prometheus-stack-grafana.kube-prometheus-stack.svc.cluster.local:80
12+
config:
13+
# OAuth client ID
14+
clientID: {{ .Environment.Values | getOrNil "GRAFANA_PROXY_OAUTH_CLIENT_ID" | required "GRAFANA_PROXY_OAUTH_CLIENT_ID is required" | quote }}
15+
# OAuth client secret
16+
clientSecret: {{ .Environment.Values | getOrNil "GRAFANA_PROXY_OAUTH_CLIENT_SECRET" | required "GRAFANA_PROXY_OAUTH_CLIENT_SECRET is required" | quote }}
17+
# Create a new secret with the following command
18+
# openssl rand -base64 32 | head -c 32 | base64
19+
cookieSecret: {{ .Environment.Values | getOrNil "COOKIE_SECRET" | required "COOKIE_SECRET is required" | quote }}
20+
kubernetes-dashboard-proxy:
21+
ingress:
22+
enabled: true
23+
className: nginx
24+
hosts:
25+
- {{ .Environment.Values | getOrNil "KUBERNETES_DASHBOARD_PROXY_HOST" | required "KUBERNETES_DASHBOARD_PROXY_HOST is required" | quote }}
26+
extraArgs:
27+
whitelist-domain: {{ .Environment.Values | getOrNil "KUBERNETES_DASHBOARD_PROXY_HOST" | required "KUBERNETES_DASHBOARD_PROXY_HOST is required" | quote }}
28+
provider: github
29+
github-org: ecamp
30+
upstream: https://ops-dashboard-kong-proxy.ops-dashboard.svc.cluster.local
31+
ssl-upstream-insecure-skip-verify: true
32+
config:
33+
# OAuth client ID
34+
clientID: {{ .Environment.Values | getOrNil "KUBERNETES_DASHBOARD_PROXY_OAUTH_CLIENT_ID" | required "KUBERNETES_DASHBOARD_PROXY_OAUTH_CLIENT_ID is required" | quote }}
35+
# OAuth client secret
36+
clientSecret: {{ .Environment.Values | getOrNil "KUBERNETES_DASHBOARD_PROXY_OAUTH_CLIENT_SECRET" | required "KUBERNETES_DASHBOARD_PROXY_OAUTH_CLIENT_SECRET is required" | quote }}
37+
# Create a new secret with the following command
38+
# openssl rand -base64 32 | head -c 32 | base64
39+
cookieSecret: {{ .Environment.Values | getOrNil "COOKIE_SECRET" | required "COOKIE_SECRET is required" | quote }}
40+
logging-proxy:
41+
ingress:
42+
enabled: true
43+
className: nginx
44+
hosts:
45+
- {{ .Environment.Values | getOrNil "LOGGING_PROXY_HOST" | required "LOGGING_PROXY_HOST is required" | quote }}
46+
extraArgs:
47+
whitelist-domain: {{ .Environment.Values | getOrNil "LOGGING_PROXY_HOST" | required "LOGGING_PROXY_HOST is required" | quote }}
48+
provider: github
49+
github-org: ecamp
50+
upstream: http://kibana.ecamp3-logging.svc.cluster.local:5601
51+
config:
52+
# OAuth client ID
53+
clientID: {{ .Environment.Values | getOrNil "LOGGING_PROXY_OAUTH_CLIENT_ID" | required "LOGGING_PROXY_OAUTH_CLIENT_ID is required" | quote }}
54+
# OAuth client secret
55+
clientSecret: {{ .Environment.Values | getOrNil "LOGGING_PROXY_OAUTH_CLIENT_SECRET" | required "LOGGING_PROXY_OAUTH_CLIENT_SECRET is required" | quote }}
56+
# Create a new secret with the following command
57+
# openssl rand -base64 32 | head -c 32 | base64
58+
cookieSecret: {{ .Environment.Values | getOrNil "COOKIE_SECRET" | required "COOKIE_SECRET is required" | quote }}

0 commit comments

Comments
 (0)