Compare commits

...

83 Commits

Author SHA1 Message Date
3a63034e26 Properly check for firewallGroup in same namespace
All checks were successful
Build project / build (push) Successful in 1m54s
Publish / build (push) Successful in 2m0s
2025-06-29 00:58:57 +02:00
2e95d29373 Merge pull request 'Check for firewallGroup in same namespace if namespace is not defined' (#31) from feature/default-namespace-same-as-firewallpolicy-namespace-when-referring-firewallgroup into main
All checks were successful
Publish / build (push) Successful in 2m16s
Reviewed-on: #31
2025-06-28 21:56:08 +00:00
990140ee1c Check for firewallGroup in same namespace if namespace is not defined
All checks were successful
Build project / build (push) Successful in 1m51s
2025-06-28 23:53:51 +02:00
24c88264c9 Merge pull request 'Fix namespace matching for firewallgroups in firewallpolicies' (#30) from feature/default-namespace-same-as-firewallpolicy-namespace-when-referring-firewallgroup into main
All checks were successful
Publish / build (push) Successful in 2m1s
Reviewed-on: #30
2025-06-28 16:38:11 +00:00
938d53fa8f Fix namespace matching for firewallgroups in firewallpolicies
All checks were successful
Build project / build (push) Successful in 1m55s
Publish / build (push) Successful in 2m5s
2025-06-28 18:33:54 +02:00
768c61020e Merge pull request 'feature/add-namespace-to-firewallgroup-and-firewallpolicy-resources' (#29) from feature/add-namespace-to-firewallgroup-and-firewallpolicy-resources into main
All checks were successful
Publish / build (push) Successful in 1m58s
Reviewed-on: #29
2025-06-27 15:48:14 +00:00
8d70a78a50 fix
All checks were successful
Build project / build (push) Successful in 1m47s
Publish / build (push) Successful in 1m59s
2025-06-27 17:01:55 +02:00
5885daac55 Fix
Some checks failed
Build project / build (push) Failing after 1m9s
Publish / build (push) Failing after 1m19s
2025-06-27 16:53:44 +02:00
440dc04e5b Add namespace to some names
Some checks failed
Build project / build (push) Failing after 1m10s
Publish / build (push) Failing after 1m21s
2025-06-27 16:51:05 +02:00
22c8df6833 Add namespace to name of firewallgroups 2025-06-27 16:46:45 +02:00
35d95d107c Merge pull request 'Use pre-built image' (#28) from feature/use-prebuilt-image into main
Some checks failed
Publish / build (push) Has been cancelled
Reviewed-on: #28
2025-06-26 23:49:34 +00:00
4bb45b0128 Use pre-built image
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Successful in 1m54s
2025-06-27 01:47:15 +02:00
9eefd08823 Merge pull request 'Add variables' (#27) from feature/fix-indentation into main
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Has been cancelled
Reviewed-on: #27
2025-06-26 23:36:27 +00:00
d53810b714 Add variables
Some checks failed
Build project / build (push) Has been cancelled
2025-06-27 01:36:01 +02:00
33f1fd5eac Merge pull request 'Need docker on main build' (#26) from feature/fix-indentation into main
Some checks failed
Publish / build (push) Failing after 2m21s
Reviewed-on: #26
2025-06-26 23:28:36 +00:00
9ae7d91365 Need docker on main build
Some checks failed
Build project / build (push) Has been cancelled
2025-06-27 01:28:01 +02:00
6fe5fdf859 Merge pull request 'Fix indentation' (#25) from feature/fix-indentation into main
Some checks failed
Publish / build (push) Failing after 1m9s
Reviewed-on: #25
2025-06-26 23:24:16 +00:00
37b5eb830a Fix indentation
Some checks failed
Build project / build (push) Has been cancelled
2025-06-27 01:23:49 +02:00
1834527d43 feature/create-correct-manifests (#23)
Reviewed-on: #23
2025-06-26 23:19:55 +00:00
b562c200ba Merge pull request 'split up regex' (#22) from feature/build-alpha-and-beta into main
All checks were successful
Publish / build (push) Successful in 2m53s
Reviewed-on: #22
2025-06-26 22:19:58 +00:00
2485365728 split up regex
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Successful in 3m22s
2025-06-27 00:18:05 +02:00
efeaf521fd Merge pull request 'match alpha and beta tags' (#21) from feature/build-alpha-and-beta into main
All checks were successful
Publish / build (push) Successful in 2m55s
Reviewed-on: #21
2025-06-26 22:08:57 +00:00
7ce8682ecb match alpha and beta tags
All checks were successful
Build project / build (push) Successful in 2m14s
2025-06-27 00:07:04 +02:00
744e43c1f4 Merge pull request 'Add image url' (#20) from feature/update-image-labels into main
All checks were successful
Publish / build (push) Successful in 3m22s
Reviewed-on: #20
2025-06-26 19:35:12 +00:00
8095723337 Add image url
Some checks failed
Build project / build (push) Has been cancelled
2025-06-26 21:34:42 +02:00
9e7b6123c2 Merge pull request 'Override image labels' (#19) from feature/update-image-labels into main
All checks were successful
Publish / build (push) Successful in 3m15s
Reviewed-on: #19
2025-06-26 19:14:46 +00:00
062b386f7f Override image labels
All checks were successful
Build project / build (push) Successful in 1m54s
2025-06-26 21:14:23 +02:00
aca35507ba Merge pull request 'Override image labels' (#18) from feature/update-image-labels into main
Some checks failed
Publish / build (push) Failing after 1m35s
Reviewed-on: #18
2025-06-26 19:06:58 +00:00
4ede272b70 Override image labels
All checks were successful
Build project / build (push) Successful in 1m58s
2025-06-26 21:06:25 +02:00
5e413a64e8 Merge pull request 'Add ko.yaml' (#17) from feature/update-image-labels into main
All checks were successful
Publish / build (push) Successful in 3m22s
Reviewed-on: #17
2025-06-26 18:22:11 +00:00
1cfd5ef55c Add ko.yaml
All checks were successful
Build project / build (push) Successful in 2m1s
2025-06-26 20:21:45 +02:00
c89dad396b Merge pull request 'feature/generate-manifest' (#16) from feature/generate-manifest into main
All checks were successful
Publish / build (push) Successful in 3m17s
Reviewed-on: #16
2025-06-25 18:30:29 +00:00
cddda7098c generic in the path
All checks were successful
Build project / build (push) Successful in 1m59s
2025-06-25 20:29:15 +02:00
9a186ad190 Add forgotten files
All checks were successful
Build project / build (push) Successful in 1m58s
2025-06-25 17:52:28 +02:00
4ece12d18b Merge pull request 'Upload manifest' (#15) from feature/generate-manifest into main
All checks were successful
Publish / build (push) Successful in 3m15s
Reviewed-on: #15
2025-06-25 15:48:20 +00:00
6d0df79c87 Upload manifest
All checks were successful
Build project / build (push) Successful in 1m27s
2025-06-25 17:45:02 +02:00
445dd7830e Merge pull request 'Use image from gitea' (#14) from feature/use-image-from-gitea into main
All checks were successful
Publish / build (push) Successful in 2m19s
Reviewed-on: #14
2025-06-25 15:26:34 +00:00
a73aef4f9d Use image from gitea
All checks were successful
Build project / build (push) Successful in 1m29s
2025-06-25 17:25:05 +02:00
a99de02594 Merge pull request 'Fix variable reference' (#13) from feature/fix-variable into main
All checks were successful
Publish / build (push) Successful in 3m2s
Reviewed-on: #13
2025-06-25 15:09:34 +00:00
893318ad53 Fix variable reference
Some checks failed
Build project / build (push) Has been cancelled
2025-06-25 17:09:15 +02:00
201edb1b82 Merge pull request 'feature/fix' (#12) from feature/fix into main
Some checks failed
Publish / build (push) Failing after 1m34s
Reviewed-on: #12
2025-06-25 15:01:09 +00:00
b1c0a4ee11 :q:Merge branch 'feature/fix-push-workflow'
All checks were successful
Build project / build (push) Successful in 1m28s
2025-06-25 16:59:39 +02:00
0046157633 Fix variable reference (#10)
Some checks failed
Publish / build (push) Failing after 1m33s
Reviewed-on: #10
Co-authored-by: Vegard Engen <vegard@engen.priv.no>
Co-committed-by: Vegard Engen <vegard@engen.priv.no>
2025-06-25 14:52:55 +00:00
56a781a260 Merge pull request 'fix secret names' (#9) from feature/fix-push-workflow into main
Some checks failed
Publish / build (push) Failing after 1m34s
Reviewed-on: #9
2025-06-25 14:35:35 +00:00
29fb9601fd fix secret names
Some checks failed
Build project / build (push) Has been cancelled
2025-06-25 16:35:12 +02:00
c34eea5e13 Merge pull request 'Add missing sign' (#8) from feature/fix-push-workflow into main
Some checks failed
Publish / build (push) Failing after 1m34s
Reviewed-on: #8
2025-06-25 14:30:15 +00:00
fe90ac7ea4 Add missing sign
Some checks failed
Build project / build (push) Has been cancelled
2025-06-25 16:29:37 +02:00
31679a3f53 Merge pull request 'Fix workflow' (#7) from feature/fix-push-workflow into main
Some checks failed
Publish / build (push) Has been cancelled
Reviewed-on: #7
2025-06-25 14:25:22 +00:00
de38c76e24 Fix workflow
Some checks failed
Build project / build (push) Has been cancelled
2025-06-25 16:25:03 +02:00
2a396ad981 Merge pull request 'Change package repo' (#6) from feature/push-to-gitea into main
All checks were successful
Publish / build (push) Successful in 2m20s
Reviewed-on: #6
2025-06-25 14:21:03 +00:00
f147ec8108 Change package repo
Some checks failed
Build project / build (push) Has been cancelled
2025-06-25 16:20:35 +02:00
b6a2b73eb8 Merge pull request 'cleanup' (#5) from feature/clean_some_files into main
All checks were successful
Publish / build (push) Successful in 2m20s
Reviewed-on: #5
2025-06-25 13:41:23 +00:00
2304e33586 cleanup
All checks were successful
Build project / build (push) Successful in 1m33s
2025-06-25 15:40:02 +02:00
a40f1342fe Merge pull request 'feature/fix-publish-pipeline' (#4) from feature/fix-publish-pipeline into main
All checks were successful
Publish / build (push) Successful in 2m29s
Reviewed-on: #4
2025-06-24 21:13:12 +00:00
bd8d1f7c01 bare
All checks were successful
Build project / build (push) Successful in 1m48s
Publish / build (push) Successful in 2m26s
2025-06-24 23:12:39 +02:00
ac47c880ed fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Successful in 2m21s
2025-06-24 12:01:15 +02:00
481091160b fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m6s
2025-06-24 11:58:06 +02:00
14e4fe1c46 fix
Some checks failed
Publish / build (push) Has been cancelled
Build project / build (push) Has been cancelled
2025-06-24 11:57:31 +02:00
4901dfbad5 fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m8s
2025-06-24 11:56:05 +02:00
c454c78478 fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m5s
2025-06-24 11:53:10 +02:00
c30e27efc4 fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m6s
2025-06-24 11:43:37 +02:00
f2a943de3c fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m7s
2025-06-24 11:41:12 +02:00
720865c984 fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m7s
2025-06-24 11:39:41 +02:00
913a24a613 fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m6s
2025-06-24 11:33:40 +02:00
719ba853bc fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m8s
2025-06-24 11:31:09 +02:00
4e26fe02f5 fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 3s
2025-06-24 11:29:54 +02:00
cd61d5c82a fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 0s
2025-06-24 11:29:25 +02:00
6983253c9e fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 3s
2025-06-24 11:26:23 +02:00
1d7c7c864e fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1s
2025-06-24 11:25:03 +02:00
1a2def25bf fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1s
2025-06-24 11:21:51 +02:00
6c8503bf15 fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m8s
2025-06-24 11:17:03 +02:00
b9b86e0d5d fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 2m14s
2025-06-24 11:10:19 +02:00
2c9659409c fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 2m46s
2025-06-24 11:05:01 +02:00
20c4dda5ad fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m7s
2025-06-24 11:02:18 +02:00
bb28850ca5 fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 34s
2025-06-24 10:58:27 +02:00
f08c165628 fix
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m13s
2025-06-24 10:54:43 +02:00
46e6217557 fix
Some checks failed
Build project / build (push) Successful in 1m29s
Publish / build (push) Failing after 1s
2025-06-24 10:52:17 +02:00
36f337434d Tag
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m7s
2025-06-24 10:47:51 +02:00
3f14d82679 Tag
Some checks failed
Build project / build (push) Has been cancelled
Publish / build (push) Failing after 1m11s
2025-06-24 10:42:24 +02:00
2817272082 Merge pull request 'fix tagging' (#3) from feature/fix-publish-pipeline into main
Some checks failed
Publish / build (push) Failing after 1m7s
Reviewed-on: #3
2025-06-24 08:35:30 +00:00
1545f05d53 fix tagging
Some checks failed
Build project / build (push) Has been cancelled
2025-06-24 10:35:05 +02:00
47116c70b5 Merge pull request 'ko build --local on main' (#2) from feature/kobuild-on-main into main
All checks were successful
Publish / build (push) Successful in 2m24s
Reviewed-on: #2
2025-06-24 08:24:32 +00:00
7e6573deb4 Merge pull request 'ko build on main' (#1) from feature/kobuild-on-main into main
All checks were successful
Publish / build (push) Successful in 2m19s
Reviewed-on: #1
2025-06-24 08:15:36 +00:00
10 changed files with 96 additions and 50 deletions

View File

@@ -6,7 +6,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: golang:1.24
container: registry.engen.priv.no/gitea-build:0.1.0
steps:
- name: Setup SSH
run: |
@@ -22,3 +22,5 @@ jobs:
run: git config --global url.git@gitea-ssh.engen.priv.no:.insteadOf https://gitea.engen.priv.no/
- name: Build
run: go build cmd/main.go
- name: Build manifest
run: make build-installer

View File

@@ -6,7 +6,12 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: golang:1.24
container: registry.engen.priv.no/gitea-build:0.1.0
env:
GITEA_USER: ${{ secrets.GITEAUSER }}
GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
GITEA_REGISTRY: gitea.engen.priv.no
GITEA_ORG: klauvsteinen
steps:
- name: Setup SSH
run: |
@@ -14,13 +19,32 @@ jobs:
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan gitea-ssh.engen.priv.no >> ~/.ssh/known_hosts
- name: Install node and go
run: apt update && apt -y install nodejs
- name: Check out repository code
uses: actions/checkout@v4
- name: ssh repo
run: git config --global url.git@gitea-ssh.engen.priv.no:.insteadOf https://gitea.engen.priv.no/
- name: Install ko
run: go install github.com/google/ko@latest
- name: Docker login
run: echo "${GITEA_TOKEN}" | docker login "${GITEA_REGISTRY}" --username "${GITEA_USER}" --password-stdin
- name: Build
run: KO_DOCKER_REPO=gitea.engen.priv.no/unifi-network-operator-controller PATH=~/go/bin:$PATH ko build --local ./cmd
run: |
export KO_DOCKER_REPO="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller"
ko publish ./cmd \
--tags "latest" \
--image-label 'org.opencontainers.image.authors=Klauvsteinen <vegard@engen.priv.no>' \
--image-label 'org.opencontainers.image.vendor=Klauvsteinen' \
--image-label 'org.opencontainers.image.source=https://gitea.engen.priv.no/klauvsteinen/unifi-network-operator' \
--image-label 'org.opencontainers.image.url=https://gitea.engen.priv.no/klauvsteinen/unifi-network-operator' \
--image-label 'dev.chainguard.package.main=' \
--bare
- name: Build manifest
run: |
make IMG="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:latest" build-installer
curl -X DELETE \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/x-yaml" \
https://gitea.engen.priv.no/api/packages/klauvsteinen/generic/unifi-network-operator/latest/install.yaml
curl -X PUT \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/x-yaml" \
--data-binary @./dist/install.yaml \
https://gitea.engen.priv.no/api/packages/klauvsteinen/generic/unifi-network-operator/latest/install.yaml

View File

@@ -3,18 +3,18 @@ on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-alpha[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-beta[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
container: golang:1.24-bookworm
container: registry.engen.priv.no/gitea-build:0.1.0
env:
GITEA_USER: ${{ secrets.GITEAUSER }}
GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
GITEA_REGISTRY: gitea.engen.priv.no
GITEA_ORG: klauvsteinen
steps:
- name: Install dependencies
run: apt update && apt -y install nodejs bash docker.io
- name: Setup SSH
run: |
mkdir -p ~/.ssh
@@ -25,8 +25,6 @@ jobs:
uses: actions/checkout@v4
- name: ssh repo
run: git config --global url.git@gitea-ssh.engen.priv.no:.insteadOf https://gitea.engen.priv.no/
- name: Install ko
run: go install github.com/google/ko@latest
- name: Extract tag (outside container)
shell: bash
run: |
@@ -35,7 +33,22 @@ jobs:
- name: Docker login
run: echo "${GITEA_TOKEN}" | docker login "${GITEA_REGISTRY}" --username "${GITEA_USER}" --password-stdin
- name: Build
env:
KO_DOCKER_REPO: ${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller
run: |
ko publish ./cmd --tags "$TAG,latest" --bare
export KO_DOCKER_REPO="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller"
ko publish ./cmd \
--tags "$TAG" \
--image-label 'org.opencontainers.image.authors=Klauvsteinen <vegard@engen.priv.no>' \
--image-label 'org.opencontainers.image.vendor=Klauvsteinen' \
--image-label 'org.opencontainers.image.source=https://gitea.engen.priv.no/klauvsteinen/unifi-network-operator' \
--image-label 'org.opencontainers.image.url=https://gitea.engen.priv.no/klauvsteinen/unifi-network-operator' \
--image-label 'dev.chainguard.package.main=' \
--bare
- name: Build manifest
run: |
make IMG="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:$TAG" build-installer
curl -X PUT \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/x-yaml" \
--data-binary @./dist/install.yaml \
https://gitea.engen.priv.no/api/packages/klauvsteinen/generic/unifi-network-operator/$TAG/install.yaml

View File

@@ -1,5 +1,5 @@
# Image URL to use all building/pushing image targets
IMG ?= registry.engen.priv.no/unifi-network-operator-controller:latest
IMG ?= gitea.engen.priv.no/klauvsteinen/unifi-network-operator-controller:latest
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
@@ -8,7 +8,7 @@ else
GOBIN=$(shell go env GOBIN)
endif
export KO_DOCKER_REPO=registry.engen.priv.no/unifi-network-operator-controller
export KO_DOCKER_REPO=gitea.engen.priv.no/klauvsteinen/unifi-network-operator-controller
# CONTAINER_TOOL defines the container tool to be used for building images.
# Be aware that the target commands are only tested with Docker which is

10
PROJECT
View File

@@ -6,7 +6,7 @@ domain: engen.priv.no
layout:
- go.kubebuilder.io/v4
projectName: unifi-network-operator
repo: github.com/vegardengen/unifi-network-operator
repo: gitea.engen.priv.no/klauvsteinen/unifi-network-operator
resources:
- api:
crdVersion: v1
@@ -15,7 +15,7 @@ resources:
domain: engen.priv.no
group: unifi
kind: Networkconfiguration
path: github.com/vegardengen/unifi-network-operator/api/v1beta1
path: gitea.engen.priv.no/klauvsteinen/unifi-network-operator/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
@@ -24,7 +24,7 @@ resources:
domain: engen.priv.no
group: unifi
kind: FirewallZone
path: github.com/vegardengen/unifi-network-operator/api/v1beta1
path: gitea.engen.priv.no/klauvsteinen/unifi-network-operator/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
@@ -33,7 +33,7 @@ resources:
domain: engen.priv.no
group: unifi
kind: FirewallPolicy
path: github.com/vegardengen/unifi-network-operator/api/v1beta1
path: gitea.engen.priv.no/klauvsteinen/unifi-network-operator/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
@@ -42,6 +42,6 @@ resources:
domain: engen.priv.no
group: unifi
kind: PortForward
path: github.com/vegardengen/unifi-network-operator/api/v1beta1
path: gitea.engen.priv.no/klauvsteinen/unifi-network-operator/api/v1beta1
version: v1beta1
version: "3"

View File

@@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: registry.engen.priv.no/unifi-network-operator-controller
newName: gitea.engen.priv.no/klauvsteinen/unifi-network-operator-controller
newTag: latest

2
dist/install.yaml vendored
View File

@@ -915,7 +915,7 @@ spec:
secretKeyRef:
key: UNIFI_PASSWORD
name: unifi-configuration
image: registry.engen.priv.no/unifi-network-operator-controller:latest
image: gitea.engen.priv.no/klauvsteinen/unifi-network-operator-controller:latest
livenessProbe:
httpGet:
path: /healthz

View File

@@ -361,10 +361,10 @@ func (r *FirewallGroupReconciler) Reconcile(ctx context.Context, req reconcile.R
log.Error(err, "Could not list network objects")
return reconcile.Result{}, err
}
ipv4_name := "k8s-" + firewallGroup.Spec.Name + "-ipv4"
ipv6_name := "k8s-" + firewallGroup.Spec.Name + "-ipv6"
tcpports_name := "k8s-" + firewallGroup.Spec.Name + "-tcpports"
udpports_name := "k8s-" + firewallGroup.Spec.Name + "-udpports"
ipv4_name := "k8s-" + firewallGroup.Namespace + "/" + firewallGroup.Name + "-ipv4"
ipv6_name := "k8s-" + firewallGroup.Namespace + "/" + firewallGroup.Name + "-ipv6"
tcpports_name := "k8s-" + firewallGroup.Namespace + "/" + firewallGroup.Name + "-tcpports"
udpports_name := "k8s-" + firewallGroup.Namespace + "/" + firewallGroup.Name + "-udpports"
ipv4_done := false
ipv6_done := false
tcpports_done := false

View File

@@ -285,7 +285,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
// This will be used when running through all firewall groups and servics known, to see if a rule should be added.
for _, dest_group := range firewallPolicy.Spec.Destination.FirewallGroups {
namespace := defaultNs
namespace := firewallPolicy.Namespace
if len(dest_group.Namespace) > 0 {
namespace = dest_group.Namespace
}
@@ -310,7 +310,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
// Run through all firewall groups. Add them to the myFirewallGroups list if they either have an annotations or is specified in the resource.
for _, firewallGroup := range firewallGroupCRDs.Items {
if val, found := firewallGroup.Annotations["unifi.engen.priv.no/firewall-policy"]; found && ((strings.Contains(val, "/") && val == firewallPolicy.Namespace+"/"+firewallPolicy.Name) || (val == firewallPolicy.Name && firewallPolicy.Namespace == defaultNs)) {
if val, found := firewallGroup.Annotations["unifi.engen.priv.no/firewall-policy"]; found && ((strings.Contains(val, "/") && val == firewallPolicy.Namespace+"/"+firewallPolicy.Name) || (val == firewallPolicy.Name && firewallPolicy.Namespace == firewallGroup.Namespace)) {
myFirewallGroups = append(myFirewallGroups, firewallGroup)
} else if _, found := destination_groups[firewallGroup.Namespace+"/"+firewallGroup.Name]; found {
myFirewallGroups = append(myFirewallGroups, firewallGroup)
@@ -340,7 +340,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
skipService = true
}
}
if val, found := service.Annotations["unifi.engen.priv.no/firewall-policy"]; found && ((strings.Contains(val, "/") && val == firewallPolicy.Namespace+"/"+firewallPolicy.Name) || (val == firewallPolicy.Name && firewallPolicy.Namespace == defaultNs)) && !skipService {
if val, found := service.Annotations["unifi.engen.priv.no/firewall-policy"]; found && ((strings.Contains(val, "/") && val == firewallPolicy.Namespace+"/"+firewallPolicy.Name) || (val == firewallPolicy.Name && firewallPolicy.Namespace == service.Namespace)) && !skipService {
myServices = append(myServices, service)
} else if _, found := destination_services[service.Namespace+"/"+service.Name]; found && !skipService {
myServices = append(myServices, service)
@@ -468,7 +468,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
if len(firewallGroup.Status.ResolvedIPV4Addresses) > 0 {
if len(firewallGroup.Status.ResolvedTCPPorts) > 0 {
policyname := "k8s-fw-" + firewallPolicy.Name + "-" + "zone:" + zoneCRDs.Items[zoneIndex].Name + "-" + firewallGroup.Name + "-ipv4-tcp"
policyname := "k8s-fw-" + firewallPolicy.Namespace + "/" + firewallPolicy.Name + "-" + "zone:" + zoneCRDs.Items[zoneIndex].Name + "-" + firewallGroup.Name + "-ipv4-tcp"
if _, found := unifiFirewallpolicyNames[policyname]; !found {
log.Info(fmt.Sprintf("Creating ipv4 tcp firewallpolicy for %s to %s: %s", zoneCRDs.Items[zoneIndex].Name, firewallGroup.Name, policyname))
unifiFirewallPolicy := fillDefaultPolicy()
@@ -503,7 +503,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
}
}
if len(firewallGroup.Status.ResolvedUDPPorts) > 0 {
policyname := "k8s-fw-" + firewallPolicy.Name + "-" + "zone:" + zoneCRDs.Items[zoneIndex].Name + "-" + firewallGroup.Name + "-ipv4-udp"
policyname := "k8s-fw-" + firewallPolicy.Namespace + "/" + firewallPolicy.Name + "-" + "zone:" + zoneCRDs.Items[zoneIndex].Name + "-" + firewallGroup.Name + "-ipv4-udp"
if _, found := unifiFirewallpolicyNames[policyname]; !found {
log.Info(fmt.Sprintf("Creating ipv4 udp firewallpolicy for %s to %s: %s", zoneCRDs.Items[zoneIndex].Name, firewallGroup.Name, policyname))
unifiFirewallPolicy := fillDefaultPolicy()
@@ -541,7 +541,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
}
if len(firewallGroup.Status.ResolvedIPV6Addresses) > 0 {
if len(firewallGroup.Status.ResolvedTCPPorts) > 0 {
policyname := "k8s-fw-" + firewallPolicy.Name + "-" + "zone:" + zoneCRDs.Items[zoneIndex].Name + "-" + firewallGroup.Name + "-ipv6-tcp"
policyname := "k8s-fw-" + firewallPolicy.Namespace + "/" + firewallPolicy.Name + "-" + "zone:" + zoneCRDs.Items[zoneIndex].Name + "-" + firewallGroup.Name + "-ipv6-tcp"
if _, found := unifiFirewallpolicyNames[policyname]; !found {
log.Info(fmt.Sprintf("Creating ipv6 tcp firewallpolicy for %s to %s: %s", zoneCRDs.Items[zoneIndex].Name, firewallGroup.Name, policyname))
unifiFirewallPolicy := fillDefaultPolicy()
@@ -577,7 +577,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
}
}
if len(firewallGroup.Status.ResolvedUDPPorts) > 0 {
policyname := "k8s-fw-" + firewallPolicy.Name + "-" + "zone:" + zoneCRDs.Items[zoneIndex].Name + "-" + firewallGroup.Name + "-ipv6-udp"
policyname := "k8s-fw-" + firewallPolicy.Namespace + "/" + firewallPolicy.Name + "-" + "zone:" + zoneCRDs.Items[zoneIndex].Name + "-" + firewallGroup.Name + "-ipv6-udp"
if _, found := unifiFirewallpolicyNames[policyname]; !found {
log.Info(fmt.Sprintf("Creating ipv6 udp firewallpolicy for %s to %s: %s", zoneCRDs.Items[zoneIndex].Name, firewallGroup.Name, policyname))
unifiFirewallPolicy := fillDefaultPolicy()
@@ -640,7 +640,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
}
if len(firewallGroup.Status.ResolvedIPV4Addresses) > 0 {
if len(firewallGroup.Status.ResolvedTCPPorts) > 0 {
policyname := "k8s-fw-" + firewallPolicy.Name + "-" + "network:" + networkCRDs.Items[networkIndex].Name + "-" + firewallGroup.Name + "-ipv4-tcp"
policyname := "k8s-fw-" + firewallPolicy.Namespace + "/" + firewallPolicy.Name + "-" + "network:" + networkCRDs.Items[networkIndex].Name + "-" + firewallGroup.Name + "-ipv4-tcp"
if _, found := unifiFirewallpolicyNames[policyname]; !found {
log.Info(fmt.Sprintf("Creating ipv4 tcp firewallpolicy for %s to %s: %s", networkCRDs.Items[networkIndex].Name, firewallGroup.Name, policyname))
unifiFirewallPolicy := fillDefaultPolicy()
@@ -677,7 +677,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
}
}
if len(firewallGroup.Status.ResolvedUDPPorts) > 0 {
policyname := "k8s-fw-" + firewallPolicy.Name + "-" + "network:" + networkCRDs.Items[networkIndex].Name + "-" + firewallGroup.Name + "-ipv4-udp"
policyname := "k8s-fw-" + firewallPolicy.Namespace + "/" + firewallPolicy.Name + "-" + "network:" + networkCRDs.Items[networkIndex].Name + "-" + firewallGroup.Name + "-ipv4-udp"
if _, found := unifiFirewallpolicyNames[policyname]; !found {
log.Info(fmt.Sprintf("Creating ipv4 udp firewallpolicy for %s to %s: %s", networkCRDs.Items[networkIndex].Name, firewallGroup.Name, policyname))
unifiFirewallPolicy := fillDefaultPolicy()
@@ -716,7 +716,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
}
if len(firewallGroup.Status.ResolvedIPV6Addresses) > 0 {
if len(firewallGroup.Status.ResolvedTCPPorts) > 0 {
policyname := "k8s-fw-" + firewallPolicy.Name + "-" + "network:" + networkCRDs.Items[networkIndex].Name + "-" + firewallGroup.Name + "-ipv6-tcp"
policyname := "k8s-fw-" + firewallPolicy.Namespace + "/" + firewallPolicy.Name + "-" + "network:" + networkCRDs.Items[networkIndex].Name + "-" + firewallGroup.Name + "-ipv6-tcp"
if _, found := unifiFirewallpolicyNames[policyname]; !found {
log.Info(fmt.Sprintf("Creating ipv6 tcp firewallpolicy for %s to %s: %s", networkCRDs.Items[networkIndex].Name, firewallGroup.Name, policyname))
unifiFirewallPolicy := fillDefaultPolicy()
@@ -753,7 +753,7 @@ func (r *FirewallPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Reque
}
}
if len(firewallGroup.Status.ResolvedUDPPorts) > 0 {
policyname := "k8s-fw-" + firewallPolicy.Name + "-" + "network:" + networkCRDs.Items[networkIndex].Name + "-" + firewallGroup.Name + "-ipv6-udp"
policyname := "k8s-fw-" + firewallPolicy.Namespace + "/" + firewallPolicy.Name + "-" + "network:" + networkCRDs.Items[networkIndex].Name + "-" + firewallGroup.Name + "-ipv6-udp"
if _, found := unifiFirewallpolicyNames[policyname]; !found {
log.Info(fmt.Sprintf("Creating ipv6 udp firewallpolicy for %s to %s: %s", networkCRDs.Items[networkIndex].Name, firewallGroup.Name, policyname))
unifiFirewallPolicy := fillDefaultPolicy()

7
ko.yaml Normal file
View File

@@ -0,0 +1,7 @@
defaultBaseImage: cgr.dev/chainguard/static:latest
labels:
org.opencontainers.image.authors: Vegard Engen <vegard@engen.priv.no>
org.opencontainers.image.source: https://gitea.engen.priv.no/klauvsteinen/unifi-network-operator
org.opencontainers.image.vendor: Klauvsteinen
dev.chainguard.package.main: ""