Skip to content

Commit 9f94130

Browse files
authored
fix: manage dns alias in radixconfig file (#121)
* fix: add dns alias and upgrade go * fix(deps): update golangci-lint version to v2.10.1 * refactor: remove commented line from radixconfigs target in Makefile
1 parent 74a3504 commit 9f94130

11 files changed

Lines changed: 438 additions & 86 deletions

.github/workflows/pr.yaml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Build
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v6
1414
- name: Build docker image
1515
env:
1616
REF: ${{ github. sha }}
@@ -20,23 +20,23 @@ jobs:
2020
name: Lint
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v6
2424
with:
2525
fetch-depth: 2
26-
- uses: actions/setup-go@v5
26+
- uses: actions/setup-go@v6
2727
with:
2828
go-version-file: "go.mod"
2929
- name: golangci-lint
3030
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
3131
with:
32-
version: v2.7.2
32+
version: v2.10.1
3333

3434
test:
3535
name: Unit Test
3636
runs-on: ubuntu-latest
3737
steps:
38-
- uses: actions/checkout@v4
39-
- uses: actions/setup-go@v5
38+
- uses: actions/checkout@v6
39+
- uses: actions/setup-go@v6
4040
with:
4141
go-version-file: "go.mod"
4242
- name: Install dependencies
@@ -48,23 +48,23 @@ jobs:
4848
name: Verify Code Generation
4949
runs-on: ubuntu-latest
5050
steps:
51-
- uses: actions/checkout@v4
52-
- uses: actions/setup-go@v5
51+
- uses: actions/checkout@v6
52+
- uses: actions/setup-go@v6
5353
with:
5454
go-version-file: "go.mod"
5555
- name: Verify Code Generation
5656
run: |
5757
make verify-generate
5858
59-
validate-radixconfig:
60-
name: Validate RadixConfig
59+
test-radixconfig:
60+
name: Test RadixConfig
6161
runs-on: ubuntu-latest
6262
steps:
63-
- name: "Get Azure principal token for Radix"
64-
run: |
65-
echo "APP_SERVICE_ACCOUNT_TOKEN=hello-world" >> $GITHUB_ENV
66-
- uses: actions/checkout@v4
67-
- name: "Validate public-site"
68-
uses: equinor/radix-github-actions@v1
69-
with:
70-
args: validate radix-config --config-file radixconfig.yaml
63+
- uses: actions/checkout@v6
64+
- uses: equinor/radix-github-actions@v2
65+
66+
- run: rx validate radix-config --config-file radixconfig.platform.yaml
67+
- run: rx validate radix-config --config-file radixconfig.c2.yaml
68+
- run: rx validate radix-config --config-file radixconfig.c3.yaml
69+
- run: rx validate radix-config --config-file radixconfig.dev.yaml
70+
- run: rx validate radix-config --config-file radixconfig.playground.yaml

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM docker.io/golang:1.25.7-alpine3.23 AS builder
1+
FROM --platform=$BUILDPLATFORM docker.io/golang:1.26.0-alpine3.23 AS builder
22
ARG TARGETARCH
33
ENV CGO_ENABLED=0 \
44
GOOS=linux \

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,20 @@ docker-push: $(addsuffix -push,$(IMAGES))
4242
.PHONY: deploy
4343
deploy: docker-build docker-push
4444

45+
.PHONY: radixconfigs
46+
radixconfigs:
47+
ENV=qa envsubst < radixconfig.tpl.yaml > radixconfig.dev.yaml
48+
ENV=prod envsubst < radixconfig.tpl.yaml > radixconfig.c2.yaml
49+
ENV=prod envsubst < radixconfig.tpl.yaml > radixconfig.c3.yaml
50+
ENV=prod envsubst < radixconfig.tpl.yaml > radixconfig.platform.yaml
51+
ENV=prod envsubst < radixconfig.tpl.yaml > radixconfig.playground.yaml
52+
4553
.PHONY: mocks
4654
mocks: bootstrap
4755
mockgen -source ./radix/api_server.go -destination ./radix/api_server_mock.go -package radix
4856

4957
.PHONY: generate
50-
generate: mocks
58+
generate: mocks radixconfigs
5159

5260
.PHONY: verify-generate
5361
verify-generate: generate
@@ -59,7 +67,7 @@ HAS_MOCKGEN := $(shell command -v mockgen;)
5967
.PHONY: bootstrap
6068
bootstrap:
6169
ifndef HAS_GOLANGCI_LINT
62-
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.7.2
70+
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1
6371
endif
6472
ifndef HAS_MOCKGEN
6573
go install go.uber.org/mock/mockgen@v0.6.0

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/equinor/radix-github-webhook
22

3-
go 1.25.7
3+
go 1.26.0
44

55
require (
66
github.com/equinor/radix-common v1.11.0

radixconfig.c2.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: radix.equinor.com/v1
2+
kind: RadixApplication
3+
metadata:
4+
name: radix-github-webhook
5+
spec:
6+
build:
7+
useBuildKit: true
8+
environments:
9+
- name: prod
10+
build:
11+
from: release
12+
- name: qa
13+
build:
14+
from: master
15+
components:
16+
- name: "webhook"
17+
readOnlyFileSystem: true
18+
src: "."
19+
dockerfileName: "Dockerfile"
20+
ports:
21+
- name: http
22+
port: 3001
23+
- name: metrics
24+
port: 9090
25+
publicPort: http
26+
runtime:
27+
architecture: arm64
28+
monitoring: true
29+
monitoringConfig:
30+
portName: metrics
31+
variables:
32+
LOG_LEVEL: info
33+
LOG_PRETTY: "false"
34+
GIN_MODE: "release"
35+
environmentConfig:
36+
- environment: qa
37+
variables:
38+
API_SERVER_ENDPOINT_PREFIX: "https://server-radix-api-qa"
39+
resources:
40+
requests:
41+
memory: "30Mi"
42+
cpu: "10m"
43+
limits:
44+
cpu: "1000m"
45+
horizontalScaling:
46+
maxReplicas: 1
47+
minReplicas: 0
48+
triggers:
49+
- name: cron
50+
cron:
51+
timezone: Europe/Oslo
52+
start: 0 7 * * 1-5 # 07:00 Monday - Friday
53+
end: 0 17 * * 1-5 # 17:00 Monday - Friday
54+
desiredReplicas: 1
55+
- environment: prod
56+
replicas: 2
57+
variables:
58+
API_SERVER_ENDPOINT_PREFIX: "https://server-radix-api-prod"
59+
resources:
60+
requests:
61+
memory: "75Mi"
62+
cpu: "10m"
63+
limits:
64+
cpu: "1000m"
65+
dnsAlias:
66+
- alias: webhook
67+
environment: "prod"
68+
component: webhook

radixconfig.c3.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: radix.equinor.com/v1
2+
kind: RadixApplication
3+
metadata:
4+
name: radix-github-webhook
5+
spec:
6+
build:
7+
useBuildKit: true
8+
environments:
9+
- name: prod
10+
build:
11+
from: release
12+
- name: qa
13+
build:
14+
from: master
15+
components:
16+
- name: "webhook"
17+
readOnlyFileSystem: true
18+
src: "."
19+
dockerfileName: "Dockerfile"
20+
ports:
21+
- name: http
22+
port: 3001
23+
- name: metrics
24+
port: 9090
25+
publicPort: http
26+
runtime:
27+
architecture: arm64
28+
monitoring: true
29+
monitoringConfig:
30+
portName: metrics
31+
variables:
32+
LOG_LEVEL: info
33+
LOG_PRETTY: "false"
34+
GIN_MODE: "release"
35+
environmentConfig:
36+
- environment: qa
37+
variables:
38+
API_SERVER_ENDPOINT_PREFIX: "https://server-radix-api-qa"
39+
resources:
40+
requests:
41+
memory: "30Mi"
42+
cpu: "10m"
43+
limits:
44+
cpu: "1000m"
45+
horizontalScaling:
46+
maxReplicas: 1
47+
minReplicas: 0
48+
triggers:
49+
- name: cron
50+
cron:
51+
timezone: Europe/Oslo
52+
start: 0 7 * * 1-5 # 07:00 Monday - Friday
53+
end: 0 17 * * 1-5 # 17:00 Monday - Friday
54+
desiredReplicas: 1
55+
- environment: prod
56+
replicas: 2
57+
variables:
58+
API_SERVER_ENDPOINT_PREFIX: "https://server-radix-api-prod"
59+
resources:
60+
requests:
61+
memory: "75Mi"
62+
cpu: "10m"
63+
limits:
64+
cpu: "1000m"
65+
dnsAlias:
66+
- alias: webhook
67+
environment: "prod"
68+
component: webhook

radixconfig.dev.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: radix.equinor.com/v1
2+
kind: RadixApplication
3+
metadata:
4+
name: radix-github-webhook
5+
spec:
6+
build:
7+
useBuildKit: true
8+
environments:
9+
- name: prod
10+
build:
11+
from: release
12+
- name: qa
13+
build:
14+
from: master
15+
components:
16+
- name: "webhook"
17+
readOnlyFileSystem: true
18+
src: "."
19+
dockerfileName: "Dockerfile"
20+
ports:
21+
- name: http
22+
port: 3001
23+
- name: metrics
24+
port: 9090
25+
publicPort: http
26+
runtime:
27+
architecture: arm64
28+
monitoring: true
29+
monitoringConfig:
30+
portName: metrics
31+
variables:
32+
LOG_LEVEL: info
33+
LOG_PRETTY: "false"
34+
GIN_MODE: "release"
35+
environmentConfig:
36+
- environment: qa
37+
variables:
38+
API_SERVER_ENDPOINT_PREFIX: "https://server-radix-api-qa"
39+
resources:
40+
requests:
41+
memory: "30Mi"
42+
cpu: "10m"
43+
limits:
44+
cpu: "1000m"
45+
horizontalScaling:
46+
maxReplicas: 1
47+
minReplicas: 0
48+
triggers:
49+
- name: cron
50+
cron:
51+
timezone: Europe/Oslo
52+
start: 0 7 * * 1-5 # 07:00 Monday - Friday
53+
end: 0 17 * * 1-5 # 17:00 Monday - Friday
54+
desiredReplicas: 1
55+
- environment: prod
56+
replicas: 2
57+
variables:
58+
API_SERVER_ENDPOINT_PREFIX: "https://server-radix-api-prod"
59+
resources:
60+
requests:
61+
memory: "75Mi"
62+
cpu: "10m"
63+
limits:
64+
cpu: "1000m"
65+
dnsAlias:
66+
- alias: webhook
67+
environment: "qa"
68+
component: webhook

radixconfig.platform.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: radix.equinor.com/v1
2+
kind: RadixApplication
3+
metadata:
4+
name: radix-github-webhook
5+
spec:
6+
build:
7+
useBuildKit: true
8+
environments:
9+
- name: prod
10+
build:
11+
from: release
12+
- name: qa
13+
build:
14+
from: master
15+
components:
16+
- name: "webhook"
17+
readOnlyFileSystem: true
18+
src: "."
19+
dockerfileName: "Dockerfile"
20+
ports:
21+
- name: http
22+
port: 3001
23+
- name: metrics
24+
port: 9090
25+
publicPort: http
26+
runtime:
27+
architecture: arm64
28+
monitoring: true
29+
monitoringConfig:
30+
portName: metrics
31+
variables:
32+
LOG_LEVEL: info
33+
LOG_PRETTY: "false"
34+
GIN_MODE: "release"
35+
environmentConfig:
36+
- environment: qa
37+
variables:
38+
API_SERVER_ENDPOINT_PREFIX: "https://server-radix-api-qa"
39+
resources:
40+
requests:
41+
memory: "30Mi"
42+
cpu: "10m"
43+
limits:
44+
cpu: "1000m"
45+
horizontalScaling:
46+
maxReplicas: 1
47+
minReplicas: 0
48+
triggers:
49+
- name: cron
50+
cron:
51+
timezone: Europe/Oslo
52+
start: 0 7 * * 1-5 # 07:00 Monday - Friday
53+
end: 0 17 * * 1-5 # 17:00 Monday - Friday
54+
desiredReplicas: 1
55+
- environment: prod
56+
replicas: 2
57+
variables:
58+
API_SERVER_ENDPOINT_PREFIX: "https://server-radix-api-prod"
59+
resources:
60+
requests:
61+
memory: "75Mi"
62+
cpu: "10m"
63+
limits:
64+
cpu: "1000m"
65+
dnsAlias:
66+
- alias: webhook
67+
environment: "prod"
68+
component: webhook

0 commit comments

Comments
 (0)