Skip to content

Commit 2f43687

Browse files
committed
Remove goreleaser and fix helm packaging
1 parent 3716e5d commit 2f43687

File tree

22 files changed

+239
-347
lines changed

22 files changed

+239
-347
lines changed

.github/workflows/docker.yml

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@ on:
88
- main
99
pull_request:
1010

11-
env:
12-
GORELEASER_VER: "v2.3.2"
13-
1411
jobs:
1512
release:
16-
env:
17-
flags: ""
1813
runs-on: ubuntu-latest
1914
permissions:
2015
contents: read
@@ -24,51 +19,42 @@ jobs:
2419
id-token: write
2520

2621
steps:
27-
- name: Parse semver string
28-
id: semver_parser
29-
uses: booxmedialtd/ws-action-parse-semver@v1
22+
- name: Docker meta
23+
id: meta
24+
uses: docker/metadata-action@v5
3025
with:
31-
input_string: ${{ (startsWith(github.ref, 'refs/tags/v') && github.ref) || 'refs/tags/v0.0.0' }}
32-
version_extractor_regex: '\/v(.*)$'
33-
34-
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
35-
run: echo "flags=--snapshot" >> $GITHUB_ENV
36-
37-
- name: Checkout repository
38-
uses: actions/checkout@v4
39-
with:
40-
fetch-depth: 0 # It is required for GoReleaser to work properly
41-
42-
- name: Install modules
43-
run: go mod tidy
44-
45-
- name: check git status
46-
run: git --no-pager diff --exit-code
47-
# Set up BuildKit Docker container builder to be able to build
48-
# multi-platform images and export cache
49-
# https://github.com/docker/setup-buildx-action
50-
- name: Set up Docker Buildx
51-
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
52-
53-
# Login against a Docker registry except on PR
54-
# https://github.com/docker/login-action
55-
- name: Login to Docker hub
26+
# list of Docker images to use as base name for tags
27+
images: |
28+
netbirdio/kubernetes-operator
29+
# generate Docker tags based on the following events/attributes
30+
tags: |
31+
type=ref,event=pr
32+
type=ref,event=branch
33+
type=semver,pattern={{version}}
34+
35+
- name: Login to Docker Hub
5636
if: github.repository == github.event.pull_request.head.repo.full_name || !github.head_ref
57-
uses: docker/login-action@v1
37+
uses: docker/login-action@v3
5838
with:
5939
username: ${{ secrets.DOCKER_USER }}
6040
password: ${{ secrets.DOCKER_TOKEN }}
6141

62-
- name: Install OS build dependencies
63-
run: sudo apt update && sudo apt install -y -q gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
42+
- name: Set up QEMU
43+
uses: docker/setup-qemu-action@v3
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
6447

65-
- name: Install goversioninfo
66-
run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@233067e
67-
68-
- name: Run GoReleaser
69-
uses: goreleaser/goreleaser-action@v4
48+
- name: Build and push
49+
uses: docker/build-push-action@v6
7050
with:
71-
version: ${{ env.GORELEASER_VER }}
72-
args: release --clean ${{ env.flags }}
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
platforms: linux/amd64,linux/arm64
52+
push: true
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: |
55+
"org.opencontainers.image.created={{.Date}}"
56+
"org.opencontainers.image.title={{.ProjectName}}"
57+
"org.opencontainers.image.version={{.Version}}"
58+
"org.opencontainers.image.revision={{.FullCommit}}"
59+
"org.opencontainers.image.version={{.Version}}"
60+

.github/workflows/helm.yml

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
paths:
66
# update this file to trigger helm chart release
7-
- 'helm/netbird-operator/Chart.yaml'
7+
- 'helm/kubernetes-operator/Chart.yaml'
88
branches:
99
- main
1010

@@ -18,49 +18,25 @@ jobs:
1818
contents: write
1919
pages: write
2020
steps:
21-
- name: Checkout repository
22-
uses: actions/checkout@v4
21+
- name: Checkout
22+
uses: actions/checkout@v3.1.0
2323
with:
2424
fetch-depth: 0
2525

26-
- name: Set ENVs
27-
id: env-setup
26+
- name: Configure Git
2827
run: |
29-
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
3028
git config user.name "$GITHUB_ACTOR"
3129
git config user.email "[email protected]"
3230
33-
- name: Package Charts
34-
run: |
35-
# Package charts
36-
mkdir -p charts/.ci-build
37-
echo "Setting chart version to ${{ steps.env-setup.outputs.CHART_VERSION }}"
38-
39-
for DIR in $CHART_BASE_DIR/*; do
40-
# Check if Chart.yaml exists in this directory
41-
if [ -f "${DIR}/Chart.yaml" ]; then
42-
echo "Packaging ${DIR}"
43-
helm dependency update $DIR
44-
helm lint $DIR
45-
helm package $DIR --destination charts/.ci-build
46-
fi
47-
done
48-
git fetch --all
49-
50-
- name: Upload chart artifacts
51-
uses: actions/upload-artifact@v4
31+
- name: Install Helm
32+
uses: azure/[email protected]
5233
with:
53-
name: helm-charts-${{ github.ref_name }}
54-
path: charts/.ci-build/*
55-
retention-days: 30
34+
version: v3.4.2
5635

57-
- name: Publish to GH-Pages
58-
id: ghpublish
59-
run: |
60-
git checkout $GH_PAGES_BRANCH --force
61-
helm repo index charts/.ci-build/ --merge index.yaml --url ${{ github.server_url }}/${{github.repository}}/releases/download/${{ github.ref_name }}
62-
cp charts/.ci-build/index.yaml index.yaml
63-
echo "New index:" && cat index.yaml
64-
git add index.yaml charts
65-
git commit -a -m "bot: update pages index for helm charts"
66-
git push origin $GH_PAGES_BRANCH
36+
- name: Run chart-releaser
37+
uses: helm/[email protected]
38+
with:
39+
charts_dir: helm
40+
env:
41+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
42+
CR_RELEASE_NAME_TEMPLATE: "helm-v{{ .Version }}"

.github/workflows/test-chart.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444

4545
- name: Lint Helm Chart
4646
run: |
47-
helm lint ./helm/netbird-operator
47+
helm lint ./helm/kubernetes-operator
4848
4949
- name: Install cert-manager via Helm
5050
run: |
@@ -60,7 +60,7 @@ jobs:
6060
6161
- name: Install Helm chart for project
6262
run: |
63-
helm install test-chart --create-namespace --namespace netbird --set 'operator.image.tag=debug' ./helm/netbird-operator
63+
helm install test-chart --create-namespace --namespace netbird --set 'operator.image.tag=debug' ./helm/kubernetes-operator
6464
6565
- name: Check Helm release status
6666
run: |

.goreleaser.yaml

Lines changed: 0 additions & 86 deletions
This file was deleted.

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ help: ## Display this help.
4343

4444
.PHONY: manifests
4545
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
46-
$(CONTROLLER_GEN) crd paths="./..." output:crd:artifacts:config=helm/netbird-operator/crds
46+
$(CONTROLLER_GEN) crd paths="./..." output:crd:artifacts:config=helm/kubernetes-operator/crds
4747

4848
.PHONY: generate
4949
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -126,7 +126,7 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
126126
.PHONY: build-installer
127127
build-installer: manifests ## Generate a consolidated YAML with CRDs and deployment.
128128
mkdir -p manifests
129-
$(HELM) template --include-crds netbird-operator helm/netbird-operator > manifests/install.yaml
129+
$(HELM) template --include-crds kubernetes-operator helm/kubernetes-operator > manifests/install.yaml
130130

131131
##@ Deployment
132132

@@ -136,19 +136,19 @@ endif
136136

137137
.PHONY: install
138138
install: manifests ## Install CRDs into the K8s cluster specified in ~/.kube/config.
139-
$(KUBECTL) apply -f helm/netbird-operator/crds
139+
$(KUBECTL) apply -f helm/kubernetes-operator/crds
140140

141141
.PHONY: uninstall
142142
uninstall: manifests ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
143-
$(KUBECTL) delete -f helm/netbird-operator/crds
143+
$(KUBECTL) delete -f helm/kubernetes-operator/crds
144144

145145
.PHONY: deploy
146146
deploy: manifests ## Deploy controller to the K8s cluster specified in ~/.kube/config.
147-
$(HELM) install -n netbird --create-namespace netbird-operator --set operator.image.tag=$(word 2,$(subst :, ,${IMG})) helm/netbird-operator
147+
$(HELM) install -n netbird --create-namespace kubernetes-operator --set operator.image.tag=$(word 2,$(subst :, ,${IMG})) helm/kubernetes-operator
148148

149149
.PHONY: undeploy
150150
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
151-
$(HELM) uninstall -n netbird netbird-operator
151+
$(HELM) uninstall -n netbird kubernetes-operator
152152

153153
##@ Dependencies
154154

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ kubectl apply -n netbird -f https://github.com/netbirdio/kubernetes-operator/rel
2626

2727
```sh
2828
helm repo add netbirdio https://netbirdio.github.io/kubernetes-operator
29-
helm install -n netbird netbird-operator netbirdio/netbird-operator
29+
helm install -n netbird kubernetes-operator netbirdio/kubernetes-operator
3030
```
3131

3232
For more options, check the default values by running
3333
```sh
34-
helm show values netbirdio/netbird-operator
34+
helm show values netbirdio/kubernetes-operator
3535
```
3636

3737
### To Uninstall
@@ -45,7 +45,7 @@ kubectl delete namespace netbird
4545
**Using helm**
4646

4747
```sh
48-
helm uninstall -n netbird netbird-operator
48+
helm uninstall -n netbird kubernetes-operator
4949
```
5050

5151
### Provision pods with NetBird access
File renamed without changes.

helm/netbird-operator/Chart.yaml renamed to helm/kubernetes-operator/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v2
2-
name: netbird-operator
2+
name: kubernetes-operator
33
description: A Helm chart for Kubernetes
44
type: application
55
version: 0.1.0
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
netbirdAPI:
2+
key: "nbp_1TpgsCUaF2BU3NVZfaDrGpoY1jx2iT2g7rWj"
3+
4+
operator:
5+
image:
6+
tag: "v0.1.0"
7+
8+
ingress:
9+
enabled: true
10+
router:
11+
enabled: true
12+
policies:
13+
default:
14+
name: Kubernetes Default Policy
15+
sourceGroups:
16+
- All

0 commit comments

Comments
 (0)