Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/test-e2e-cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and IronCore contributors
# SPDX-License-Identifier: Apache-2.0

name: Test E2E (Cluster)

on:
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- '**/*.md'

jobs:
test-e2e-cluster:
name: Run E2E Tests (Cluster)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Create kind cluster
uses: helm/kind-action@v1
with:
version: v0.31.0
kubectl_version: v1.35.0
cluster_name: network
- name: Running E2E Cluster Tests
run: |
go mod download
make test-e2e-cluster GINKGO_PROCS=8
26 changes: 26 additions & 0 deletions .github/workflows/test-e2e-envtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and IronCore contributors
# SPDX-License-Identifier: Apache-2.0

name: Test E2E (Envtest)

on:
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- '**/*.md'

jobs:
test-e2e-envtest:
name: Run E2E Tests (Envtest)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Running E2E Envtest Tests
run: |
go mod download
make test-e2e-envtest
1 change: 1 addition & 0 deletions .license-scan-overrides.jsonl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{"name": "github.com/chzyer/logex", "licenceType": "MIT"}
{"name": "github.com/grpc-ecosystem/go-grpc-middleware/v2", "licenceType": "Apache-2.0"}
{"name": "github.com/hashicorp/vault/api/auth/approle", "licenceType": "MPL-2.0"}
{"name": "github.com/ironcore-dev/gnmi-test-server", "licenceType": "Apache-2.0"}
{"name": "github.com/jpillora/longestcommon", "licenceType": "MIT"}
{"name": "github.com/logrusorgru/aurora", "licenceType": "Unlicense"}
{"name": "github.com/mattn/go-localereader", "licenceType": "MIT"}
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ WORKDIR /workspace
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=bind,source=go.mod,target=go.mod \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=test/gnmi,target=test/gnmi \
go mod download -x

RUN --mount=type=bind,target=. \
Expand Down
40 changes: 34 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ $(LOCALBIN):
install-gofumpt: FORCE
@if ! hash gofumpt 2>/dev/null; then printf "\e[1;36m>> Installing gofumpt...\e[0m\n"; go install mvdan.cc/gofumpt@latest; fi

install-ginkgo: FORCE
@if ! hash ginkgo 2>/dev/null; then printf "\e[1;36m>> Installing ginkgo...\e[0m\n"; go install github.com/onsi/ginkgo/v2/ginkgo@latest; fi

install-kubebuilder: FORCE
@set -eou pipefail; if ! hash kubebuilder 2>/dev/null; then printf "\e[1;36m>> Installing kubebuilder...\e[0m\n"; if command -v curl >/dev/null 2>&1; then GET="curl -sLo"; elif command -v wget >/dev/null 2>&1; then GET="wget -O"; else echo "Didn't find curl or wget to download kubebuilder"; exit 2; fi; BIN=$$(go env GOBIN); if [[ -z $$BIN ]]; then BIN=$$(go env GOPATH)/bin; fi; $$GET "$$BIN/kubebuilder" "https://go.kubebuilder.io/dl/latest/$$(go env GOOS)/$$(go env GOARCH)"; chmod +x "$$BIN/kubebuilder"; fi

Expand All @@ -72,7 +75,11 @@ fmt: FORCE install-gofumpt
@printf "\e[1;36m>> gofumpt -l -w .\e[0m\n"
@gofumpt -l -w $(shell git ls-files '*.go' | grep -v '^internal/provider/openconfig')

# Run the e2e tests against a k8s cluster.
# PROVIDER defines which provider to test (cisco-nxos-gnmi, cisco-iosxr-gnmi, openconfig).
# Used by test-e2e-cluster and test-e2e-envtest to filter tests.
PROVIDER ?= cisco-nxos-gnmi

# Run the scaffolded e2e tests (unchanged from Kubebuilder).
test-e2e: FORCE
@command -v kind >/dev/null 2>&1 || { \
echo "Kind is not installed. Please install Kind manually."; \
Expand All @@ -85,6 +92,26 @@ test-e2e: FORCE
@printf "\e[1;36m>> go test ./test/e2e/ -v -ginkgo.v\e[0m\n"
@KIND_CLUSTER=$(KIND_CLUSTER) go test ./test/e2e/ -v -ginkgo.v

# Run gNMI controller tests in cluster mode (requires Kind cluster).
# Uses ginkgo for parallel execution.
GINKGO_PROCS ?= 4
test-e2e-cluster: FORCE install-ginkgo
@command -v kind >/dev/null 2>&1 || { \
echo "Kind is not installed. Please install Kind manually."; \
exit 1; \
}
@kind get clusters | grep -q $(KIND_CLUSTER) || { \
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
exit 1; \
}
@printf "\e[1;36m>> ginkgo -procs=$(GINKGO_PROCS) -tags=cluster -timeout=20m -v ./test/e2e/ (PROVIDER=$(PROVIDER))\e[0m\n"
@KIND_CLUSTER=$(KIND_CLUSTER) E2E_PROVIDER=$(PROVIDER) ginkgo -procs=$(GINKGO_PROCS) -tags=cluster -timeout=20m -v ./test/e2e/

# Run gNMI controller tests in envtest mode (no cluster required).
test-e2e-envtest: FORCE install-setup-envtest
@printf "\e[1;36m>> go test ./test/e2e/ -tags=envtest -v -ginkgo.v (PROVIDER=$(PROVIDER))\e[0m\n"
@KUBEBUILDER_ASSETS=$$(setup-envtest use 1.32 -p path) E2E_PROVIDER=$(PROVIDER) go test ./test/e2e/ -tags=envtest -v -ginkgo.v

docker-build: FORCE
@printf "\e[1;36m>> $(CONTAINER_TOOL) build --tag=$(IMG) .\e[0m\n"
@$(CONTAINER_TOOL) build --build-arg=BININFO_BUILD_DATE=$(BININFO_BUILD_DATE) --build-arg=BININFO_COMMIT_HASH=$(BININFO_COMMIT_HASH) --build-arg=BININFO_VERSION=$(BININFO_VERSION) --tag=$(IMG) .
Expand All @@ -98,15 +125,16 @@ build-installer: FORCE generate install-kustomize
@printf "\e[1;36m>> kustomize build config/default > dist/install.yaml\e[0m\n"
@mkdir -p dist; kustomize build config/default > dist/install.yaml

# Deploy controller to the k8s cluster
# Deploy controller to the k8s cluster.
# Use PROVIDER to set the provider (default: cisco-nxos-gnmi).
deploy: FORCE generate install-kustomize
@printf "\e[1;36m>> kustomize build config/default | kubectl apply -f -\e[0m\n"
@kustomize build config/default | kubectl apply -f -
@printf "\e[1;36m>> deploying controller-manager (PROVIDER=$(PROVIDER))\e[0m\n"
@kustomize build config/develop | sed 's/--provider=openconfig/--provider=$(PROVIDER)/' | kubectl apply -f -

# Undeploy controller from the k8s cluster
undeploy: FORCE install-kustomize
@printf "\e[1;36m>> kustomize build config/default | kubectl delete -f -\e[0m\n"
@kustomize build config/default | kubectl delete --ignore-not-found=true -f -
@printf "\e[1;36m>> undeploying controller-manager\e[0m\n"
@kustomize build config/develop | kubectl delete --ignore-not-found=true -f -

# Install CRDs into the k8s cluster
deploy-crds: FORCE generate install-kustomize
Expand Down
40 changes: 34 additions & 6 deletions Makefile.maker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ verbatim: |
install-gofumpt: FORCE
@if ! hash gofumpt 2>/dev/null; then printf "\e[1;36m>> Installing gofumpt...\e[0m\n"; go install mvdan.cc/gofumpt@latest; fi

install-ginkgo: FORCE
@if ! hash ginkgo 2>/dev/null; then printf "\e[1;36m>> Installing ginkgo...\e[0m\n"; go install github.com/onsi/ginkgo/v2/ginkgo@latest; fi

install-kubebuilder: FORCE
@set -eou pipefail; if ! hash kubebuilder 2>/dev/null; then printf "\e[1;36m>> Installing kubebuilder...\e[0m\n"; if command -v curl >/dev/null 2>&1; then GET="curl -sLo"; elif command -v wget >/dev/null 2>&1; then GET="wget -O"; else echo "Didn't find curl or wget to download kubebuilder"; exit 2; fi; BIN=$$(go env GOBIN); if [[ -z $$BIN ]]; then BIN=$$(go env GOPATH)/bin; fi; $$GET "$$BIN/kubebuilder" "https://go.kubebuilder.io/dl/latest/$$(go env GOOS)/$$(go env GOARCH)"; chmod +x "$$BIN/kubebuilder"; fi

Expand All @@ -114,7 +117,11 @@ verbatim: |
@printf "\e[1;36m>> gofumpt -l -w .\e[0m\n"
@gofumpt -l -w $(shell git ls-files '*.go' | grep -v '^internal/provider/openconfig')

# Run the e2e tests against a k8s cluster.
# PROVIDER defines which provider to test (cisco-nxos-gnmi, cisco-iosxr-gnmi, openconfig).
# Used by test-e2e-cluster and test-e2e-envtest to filter tests.
PROVIDER ?= cisco-nxos-gnmi

# Run the scaffolded e2e tests (unchanged from Kubebuilder).
test-e2e: FORCE
@command -v kind >/dev/null 2>&1 || { \
echo "Kind is not installed. Please install Kind manually."; \
Expand All @@ -127,6 +134,26 @@ verbatim: |
@printf "\e[1;36m>> go test ./test/e2e/ -v -ginkgo.v\e[0m\n"
@KIND_CLUSTER=$(KIND_CLUSTER) go test ./test/e2e/ -v -ginkgo.v

# Run gNMI controller tests in cluster mode (requires Kind cluster).
# Uses ginkgo for parallel execution.
GINKGO_PROCS ?= 4
test-e2e-cluster: FORCE install-ginkgo
@command -v kind >/dev/null 2>&1 || { \
echo "Kind is not installed. Please install Kind manually."; \
exit 1; \
}
@kind get clusters | grep -q $(KIND_CLUSTER) || { \
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
exit 1; \
}
@printf "\e[1;36m>> ginkgo -procs=$(GINKGO_PROCS) -tags=cluster -timeout=20m -v ./test/e2e/ (PROVIDER=$(PROVIDER))\e[0m\n"
@KIND_CLUSTER=$(KIND_CLUSTER) E2E_PROVIDER=$(PROVIDER) ginkgo -procs=$(GINKGO_PROCS) -tags=cluster -timeout=20m -v ./test/e2e/

# Run gNMI controller tests in envtest mode (no cluster required).
test-e2e-envtest: FORCE install-setup-envtest
@printf "\e[1;36m>> go test ./test/e2e/ -tags=envtest -v -ginkgo.v (PROVIDER=$(PROVIDER))\e[0m\n"
@KUBEBUILDER_ASSETS=$$(setup-envtest use 1.32 -p path) E2E_PROVIDER=$(PROVIDER) go test ./test/e2e/ -tags=envtest -v -ginkgo.v

docker-build: FORCE
@printf "\e[1;36m>> $(CONTAINER_TOOL) build --tag=$(IMG) .\e[0m\n"
@$(CONTAINER_TOOL) build --build-arg=BININFO_BUILD_DATE=$(BININFO_BUILD_DATE) --build-arg=BININFO_COMMIT_HASH=$(BININFO_COMMIT_HASH) --build-arg=BININFO_VERSION=$(BININFO_VERSION) --tag=$(IMG) .
Expand All @@ -140,15 +167,16 @@ verbatim: |
@printf "\e[1;36m>> kustomize build config/default > dist/install.yaml\e[0m\n"
@mkdir -p dist; kustomize build config/default > dist/install.yaml

# Deploy controller to the k8s cluster
# Deploy controller to the k8s cluster.
# Use PROVIDER to set the provider (default: cisco-nxos-gnmi).
deploy: FORCE generate install-kustomize
@printf "\e[1;36m>> kustomize build config/default | kubectl apply -f -\e[0m\n"
@kustomize build config/default | kubectl apply -f -
@printf "\e[1;36m>> deploying controller-manager (PROVIDER=$(PROVIDER))\e[0m\n"
@kustomize build config/develop | sed 's/--provider=openconfig/--provider=$(PROVIDER)/' | kubectl apply -f -

# Undeploy controller from the k8s cluster
undeploy: FORCE install-kustomize
@printf "\e[1;36m>> kustomize build config/default | kubectl delete -f -\e[0m\n"
@kustomize build config/default | kubectl delete --ignore-not-found=true -f -
@printf "\e[1;36m>> undeploying controller-manager\e[0m\n"
@kustomize build config/develop | kubectl delete --ignore-not-found=true -f -

# Install CRDs into the k8s cluster
deploy-crds: FORCE generate install-kustomize
Expand Down
2 changes: 1 addition & 1 deletion config/develop/gnmi-test-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
containers:
- name: gnmi-test-server
image: ghcr.io/ironcore-dev/gnmi-test-server:latest
imagePullPolicy: IfNotPresent
imagePullPolicy: Never
ports:
- containerPort: 9339
name: grpc
Expand Down
1 change: 1 addition & 0 deletions config/develop/manager_patch.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- op: replace
path: /spec/template/spec/containers/0/args
value:
- --metrics-bind-address=:8443
- --leader-elect=false
- --health-probe-bind-address=:8081
- --provider=openconfig
Expand Down
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ironcore-dev/gnmi-test-server v0.0.0-00010101000000-000000000000 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -90,6 +91,7 @@ require (
github.com/stretchr/objx v0.5.2 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect
Expand Down Expand Up @@ -129,3 +131,5 @@ require (
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect
)

replace github.com/ironcore-dev/gnmi-test-server => ./test/gnmi
2 changes: 2 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading