Skip to content

Commit e71c372

Browse files
authored
Merge branch 'main' into feat/service-catalog-registration-design
2 parents ba65ae5 + 5013a86 commit e71c372

143 files changed

Lines changed: 13452 additions & 2325 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
- name: Setup Go
1616
uses: actions/setup-go@v5
1717
with:
18-
go-version: '~1.24'
18+
go-version: '~1.26'
1919

2020
- name: Run linter
2121
uses: golangci/golangci-lint-action@v7
2222
with:
23-
version: v2.1.6
23+
version: v2.12.2

.github/workflows/publish.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,26 @@ jobs:
1616
contents: read
1717
packages: write
1818
attestations: write
19-
uses: datum-cloud/actions/.github/workflows/publish-docker.yaml@v1.14.0
19+
uses: datum-cloud/actions/.github/workflows/publish-docker.yaml@v1.15.0
2020
with:
2121
image-name: network-services-operator
2222
platforms: linux/amd64,linux/arm64
2323
secrets: inherit
2424

2525
publish-kustomize-bundles:
26+
# The bundle pins image references to this build, so only publish it once
27+
# the container image has been built and pushed.
28+
needs: publish-container-image
2629
permissions:
2730
id-token: write
2831
contents: read
2932
packages: write
30-
uses: datum-cloud/actions/.github/workflows/publish-kustomize-bundle.yaml@v1.14.0
33+
uses: datum-cloud/actions/.github/workflows/publish-kustomize-bundle.yaml@v1.15.0
3134
with:
3235
bundle-name: ghcr.io/datum-cloud/network-services-operator-kustomize
3336
bundle-path: config
3437
image-name: ghcr.io/datum-cloud/network-services-operator
35-
image-overlays: config/manager
38+
# Both overlays run the same image (single binary, subcommand selects role),
39+
# so pin both to the release tag in the published bundle.
40+
image-overlays: config/manager,config/extension-server
3641
secrets: inherit

.github/workflows/test-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Go
2222
uses: actions/setup-go@v5
2323
with:
24-
go-version: '~1.24'
24+
go-version: '~1.26'
2525

2626
- name: Verify kind installation
2727
run: kind version

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Go
1616
uses: actions/setup-go@v5
1717
with:
18-
go-version: '~1.24'
18+
go-version: '~1.26'
1919

2020
- name: Running Tests
2121
run: |

.github/workflows/validate-kustomize.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ on:
55

66
jobs:
77
validate-kustomize:
8-
uses: datum-cloud/actions/.github/workflows/validate-kustomize.yaml@v1.6.1
8+
uses: datum-cloud/actions/.github/workflows/validate-kustomize.yaml@v1.16.0

.golangci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ linters:
3737
- dupl
3838
- lll
3939
path: internal/*
40+
# Repeated string literals in tests are usually fixture/table data;
41+
# extracting them to constants hurts readability more than it helps.
42+
- linters:
43+
- goconst
44+
path: _test\.go
45+
# The validation packages are built almost entirely from field.ErrorList
46+
# accumulators that hold a handful of errors; preallocating them adds noise
47+
# without meaningful benefit.
48+
- linters:
49+
- prealloc
50+
path: internal/validation
4051
paths:
4152
- third_party$
4253
- builtin$

Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM --platform=$BUILDPLATFORM golang:1.24 AS builder
2+
FROM --platform=$BUILDPLATFORM golang:1.26 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55
ARG VERSION=dev
@@ -31,13 +31,18 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build \
3131
-X main.gitCommit=${GIT_COMMIT} \
3232
-X main.gitTreeState=${GIT_TREE_STATE} \
3333
-X main.buildDate=${BUILD_DATE}" \
34-
-o manager cmd/main.go
34+
-o network-services cmd/main.go
3535

36-
# Use distroless as minimal base image to package the manager binary
36+
# Use distroless as minimal base image to package the manager binary.
37+
# static-debian12:nonroot is explicit about the Debian variant to avoid silent
38+
# drift if the :nonroot alias resolves to a different Debian release in future.
39+
# For reproducible builds, pin to a SHA digest via:
40+
# FROM gcr.io/distroless/static-debian12:nonroot@sha256:<digest>
41+
# and update via Dependabot or `cosign verify`.
3742
# Refer to https://github.com/GoogleContainerTools/distroless for more details
38-
FROM gcr.io/distroless/static:nonroot
43+
FROM gcr.io/distroless/static-debian12:nonroot
3944
WORKDIR /
40-
COPY --from=builder /workspace/manager .
45+
COPY --from=builder /workspace/network-services .
4146
USER 65532:65532
4247

43-
ENTRYPOINT ["/manager"]
48+
ENTRYPOINT ["/network-services"]

Makefile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
109109

110110
.PHONY: build
111111
build: manifests generate fmt vet ## Build manager binary.
112-
go build -o bin/manager cmd/main.go
112+
go build -o bin/network-services cmd/main.go
113113

114114
.PHONY: run
115115
run: manifests generate fmt vet ## Run a controller from your host.
116-
go run ./cmd/main.go -health-probe-bind-address 0 --server-config ./config/dev/config.yaml
116+
go run ./cmd/main.go manager --health-probe-bind-address=0 --server-config=./config/dev/config.yaml
117117

118118
# If you wish to build the manager image targeting other platforms you can use the --platform flag.
119119
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
@@ -153,7 +153,13 @@ set-image-controller: manifests kustomize
153153
cd config/manager && $(KUSTOMIZE) edit set image ghcr.io/datum-cloud/network-services-operator=${IMG}
154154

155155
.PHONY: prepare-infra-cluster
156-
prepare-infra-cluster: cert-manager envoy-gateway external-dns
156+
prepare-infra-cluster: cert-manager envoy-gateway external-dns downstream-crds
157+
158+
.PHONY: downstream-crds
159+
downstream-crds: ## Install NSO CRDs on the downstream (infra) cluster that the replicator mirrors into it.
160+
$(KUBECTL) apply -f config/crd/bases/networking.datumapis.com_connectors.yaml
161+
$(KUBECTL) apply -f config/crd/bases/networking.datumapis.com_httpproxies.yaml
162+
$(KUBECTL) apply -f config/crd/bases/networking.datumapis.com_trafficprotectionpolicies.yaml
157163

158164
.PHONY: prepare-e2e
159165
prepare-e2e: chainsaw set-image-controller cert-manager load-image-all deploy-e2e
@@ -241,7 +247,7 @@ KUSTOMIZE_VERSION ?= v5.5.0
241247
CONTROLLER_TOOLS_VERSION ?= v0.16.4
242248
DEFAULTER_GEN_VERSION ?= v0.32.3
243249
ENVTEST_VERSION ?= release-0.19
244-
GOLANGCI_LINT_VERSION ?= v2.1.6
250+
GOLANGCI_LINT_VERSION ?= v2.12.2
245251

246252
# renovate: datasource=go depName=github.com/cert-manager/cert-manager
247253
CERTMANAGER_VERSION ?= 1.17.1
@@ -253,7 +259,7 @@ CRDOC_VERSION ?= v0.6.4
253259
KIND_VERSION ?= v0.27.0
254260

255261
# renovate: datasource=go depName=github.com/kyverno/chainsaw
256-
CHAINSAW_VERSION ?= v0.2.13
262+
CHAINSAW_VERSION ?= v0.2.15
257263

258264
# renovate: datasource=go depName=github.com/cert-manager/cmctl/v2
259265
CMCTL_VERSION ?= v2.1.1

Taskfile.dev.yaml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
version: '3'
2+
3+
vars:
4+
TMP_DIR:
5+
sh: echo "${TMPDIR:-/tmp}"
6+
7+
tasks:
8+
bootstrap:
9+
desc: "Bootstrap the multi-cluster dev environment (nso-standard and nso-infra) for local testing"
10+
cmds:
11+
- echo "🚀 Bootstrapping dev environment..."
12+
- task: create-clusters
13+
- task: prep-upstream
14+
- task: prep-downstream
15+
- task: link-clusters
16+
- echo "🎉 Dev environment bootstrapped successfully! Context is now kind-nso-standard."
17+
18+
create-clusters:
19+
desc: "Create Kind upstream (standard) and downstream (infra) clusters"
20+
cmds:
21+
- echo "🧹 Cleaning up any existing clusters..."
22+
- kind delete cluster --name nso-standard || true
23+
- kind delete cluster --name nso-infra || true
24+
- echo "🏗️ Creating upstream (nso-standard) cluster..."
25+
- make kind-standard-cluster
26+
- echo "🏗️ Creating downstream (nso-infra) cluster..."
27+
- make kind-infra-cluster
28+
29+
prep-upstream:
30+
desc: "Prepare the upstream cluster with Operator and cert-manager"
31+
cmds:
32+
- echo "🔧 Preparing upstream (nso-standard)..."
33+
- kubectl config use-context kind-nso-standard
34+
- make prepare-e2e
35+
36+
prep-downstream:
37+
desc: "Prepare the downstream cluster with cert-manager, envoy-gateway, and external-dns"
38+
cmds:
39+
- echo "🔧 Preparing downstream (nso-infra)..."
40+
- kubectl config use-context kind-nso-infra
41+
- make prepare-infra-cluster
42+
43+
link-clusters:
44+
desc: "Link upstream and downstream clusters using kubeconfig secret"
45+
cmds:
46+
- echo "🔗 Linking clusters..."
47+
- kind get kubeconfig --name nso-infra --internal > {{.TMP_DIR}}/.kind-nso-infra-internal.yaml
48+
- kubectl config use-context kind-nso-standard
49+
- |
50+
kubectl create namespace network-services-operator-system --dry-run=client -o yaml | kubectl apply -f -
51+
kubectl create secret -n network-services-operator-system \
52+
generic downstream-cluster-kubeconfig \
53+
--save-config \
54+
--dry-run=client -o yaml \
55+
--from-file=kubeconfig={{.TMP_DIR}}/.kind-nso-infra-internal.yaml | kubectl apply -f -
56+
- echo "⏳ Waiting for operator controller manager deployment to be ready..."
57+
- |
58+
kubectl -n network-services-operator-system \
59+
wait deploy network-services-operator-controller-manager \
60+
--for=condition=Available \
61+
--timeout=180s
62+
63+
redeploy-operator:
64+
desc: "Rebuild the operator image, load it into nso-standard, and roll out the deployed controller"
65+
cmds:
66+
- echo "🔨 Building operator image and loading it into nso-standard..."
67+
# docker-build + kind load docker-image $(IMG) -n nso-standard
68+
- make load-image-operator
69+
- echo "♻️ Restarting the controller-manager to pick up the new image..."
70+
- kubectl config use-context kind-nso-standard
71+
- |
72+
kubectl -n network-services-operator-system \
73+
rollout restart deploy network-services-operator-controller-manager
74+
- echo "⏳ Waiting for the new controller-manager rollout to complete..."
75+
- |
76+
kubectl -n network-services-operator-system \
77+
rollout status deploy network-services-operator-controller-manager \
78+
--timeout=180s
79+
- echo "✅ Operator redeployed with the freshly built image."
80+
81+
destroy:
82+
desc: "Tear down the multi-cluster dev environment"
83+
cmds:
84+
- echo "💥 Destroying clusters..."
85+
- kind delete cluster --name nso-standard || true
86+
- kind delete cluster --name nso-infra || true
87+
- rm -f {{.TMP_DIR}}/.kind-nso-infra-internal.yaml
88+
- echo "✨ Cleanup finished."
89+
90+
test:
91+
desc: "Run E2E tests using chainsaw on the local multi-cluster setup"
92+
cmds:
93+
- echo "🧪 Running E2E tests..."
94+
- |
95+
if [ -n "{{.CLI_ARGS}}" ]; then
96+
if [[ "{{.CLI_ARGS}}" == test/e2e/* || "{{.CLI_ARGS}}" == ./test/e2e/* ]]; then
97+
make test-e2e TEST_DIR="{{.CLI_ARGS}}"
98+
else
99+
make test-e2e TEST_DIR="./test/e2e/{{.CLI_ARGS}}"
100+
fi
101+
else
102+
make test-e2e
103+
fi

Taskfile.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
version: '3'
22

3+
includes:
4+
dev:
5+
taskfile: ./Taskfile.dev.yaml
6+
37
tasks:
48
validate-kustomizations:
59
desc: Validate all kustomization.yaml files using kustomize build

0 commit comments

Comments
 (0)