Skip to content

Commit 8935025

Browse files
committed
Add rule group e2e test
1 parent 156f772 commit 8935025

File tree

11 files changed

+439
-481
lines changed

11 files changed

+439
-481
lines changed

.github/workflows/e2e-test.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: e2e-test
2+
on:
3+
schedule:
4+
- cron: 0 0 * * *
5+
push:
6+
branches:
7+
- main
8+
paths-ignore:
9+
- "charts/**"
10+
pull_request:
11+
branches:
12+
- main
13+
paths-ignore:
14+
- "charts/**"
15+
16+
jobs:
17+
tests:
18+
name: Tests
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v2
26+
27+
- name: Build the controller-manager Docker image
28+
env:
29+
IMG: tests.com/coralogix-operator:v0.0.1
30+
run: |
31+
make docker-build
32+
33+
- name: Create k8s Kind Cluster
34+
uses: helm/kind-action@v1.4.0
35+
36+
- name: Load the controller-manager image into Kind
37+
run: |
38+
kind load docker-image tests.com/coralogix-operator:v0.0.1 --name chart-testing
39+
40+
- name: Install CRDs
41+
run: make install
42+
43+
- name: Deploy the controller-manager
44+
env:
45+
IMG: tests.com/coralogix-operator:v0.0.1
46+
CORALOGIX_REGION: ${{ secrets.CORALOGIX_REGION }}
47+
CORALOGIX_API_KEY: ${{ secrets.CORALOGIX_API_KEY }}
48+
run: |
49+
make deploy
50+
51+
- name: Running e2e Tests
52+
env:
53+
CORALOGIX_REGION: ${{ secrets.CORALOGIX_REGION }}
54+
CORALOGIX_API_KEY: ${{ secrets.CORALOGIX_API_KEY }}
55+
run: |
56+
make test-e2e

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ vet: ## Run go vet against code.
5656

5757
.PHONY: test
5858
test: manifests generate fmt vet envtest ## Run tests.
59-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
59+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./controllers/ -coverprofile cover.out
60+
61+
test-e2e:
62+
go test ./tests/ -ldflags "-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn" -v -ginkgo.v
6063

6164
##@ Documentation
6265
.PHONY: generate-api-docs
@@ -77,7 +80,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
7780
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
7881
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
7982
.PHONY: docker-build
80-
docker-build: test ## Build docker image with the manager.
83+
docker-build: ## Build docker image with the manager.
8184
docker build -t ${IMG} .
8285

8386
.PHONY: docker-push
@@ -121,7 +124,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
121124
.PHONY: deploy
122125
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
123126
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
124-
$(KUSTOMIZE) build config/default | kubectl apply -f -
127+
$(KUSTOMIZE) build config/default | envsubst | kubectl apply -f -
125128

126129
.PHONY: undeploy
127130
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.

config/default/manager_auth_proxy_patch.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,4 @@ spec:
4747
memory: 128Mi
4848
requests:
4949
cpu: 5m
50-
memory: 64Mi
51-
- name: manager
52-
args:
53-
- "--health-probe-bind-address=:8081"
54-
- "--metrics-bind-address=127.0.0.1:8080"
55-
- "--leader-elect"
56-
- "--api-key=xxx"
57-
- "--region=EU2"
50+
memory: 64Mi

config/manager/manager.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ metadata:
1818
namespace: system
1919
labels:
2020
control-plane: controller-manager
21-
app.kubernetes.io/name: deployment
21+
app.kubernetes.io/name: coralogix-operator-controller-manager
2222
app.kubernetes.io/instance: controller-manager
2323
app.kubernetes.io/component: manager
2424
app.kubernetes.io/created-by: coralogix-operator
@@ -70,6 +70,10 @@ spec:
7070
- /manager
7171
args:
7272
- --leader-elect
73+
- --health-probe-bind-address=:8081
74+
- --metrics-bind-address=127.0.0.1:8080
75+
- --api-key=${CORALOGIX_API_KEY}
76+
- --region=${CORALOGIX_REGION}
7377
image: controller:latest
7478
name: manager
7579
securityContext:

go.mod

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,78 @@
11
module github.com/coralogix/coralogix-operator
22

3-
go 1.22
3+
go 1.22.5
4+
5+
toolchain go1.23.1
46

57
require (
8+
github.com/coralogix/coralogix-management-sdk v0.2.2-0.20241001070251-e6142c657d00
69
github.com/go-logr/logr v1.3.0
710
github.com/golang/protobuf v1.5.4
811
github.com/google/uuid v1.6.0
9-
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
12+
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
1013
github.com/onsi/ginkgo/v2 v2.9.5
1114
github.com/onsi/gomega v1.27.7
1215
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.64.1
13-
github.com/prometheus/alertmanager v0.27.0
14-
github.com/stretchr/testify v1.8.4
16+
github.com/prometheus/common v0.46.0
17+
github.com/stretchr/testify v1.9.0
1518
go.uber.org/mock v0.3.0
1619
go.uber.org/zap v1.24.0
17-
google.golang.org/genproto/googleapis/api v0.0.0-20240730163845-b1a4ccb954bf
20+
google.golang.org/genproto/googleapis/api v0.0.0-20240823204242-4ba0660f739c
1821
google.golang.org/grpc v1.65.0
1922
google.golang.org/protobuf v1.34.2
23+
k8s.io/api v0.27.2
2024
k8s.io/apimachinery v0.27.2
2125
k8s.io/client-go v0.27.2
2226
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
2327
sigs.k8s.io/controller-runtime v0.15.0
2428
)
2529

2630
require (
27-
github.com/armon/go-metrics v0.3.10 // indirect
28-
github.com/aws/aws-sdk-go v1.50.8 // indirect
2931
github.com/benbjohnson/clock v1.3.5 // indirect
3032
github.com/beorn7/perks v1.0.1 // indirect
31-
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
3233
github.com/cespare/xxhash/v2 v2.3.0 // indirect
33-
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
3434
github.com/davecgh/go-spew v1.1.1 // indirect
3535
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
3636
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
3737
github.com/fsnotify/fsnotify v1.6.0 // indirect
38-
github.com/go-kit/log v0.2.1 // indirect
39-
github.com/go-logfmt/logfmt v0.5.1 // indirect
4038
github.com/go-logr/zapr v1.2.4 // indirect
4139
github.com/go-openapi/jsonpointer v0.20.2 // indirect
4240
github.com/go-openapi/jsonreference v0.20.4 // indirect
4341
github.com/go-openapi/swag v0.22.9 // indirect
4442
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
45-
github.com/gofrs/uuid v4.4.0+incompatible // indirect
4643
github.com/gogo/protobuf v1.3.2 // indirect
4744
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
48-
github.com/google/btree v1.0.1 // indirect
4945
github.com/google/gnostic v0.6.9 // indirect
5046
github.com/google/go-cmp v0.6.0 // indirect
5147
github.com/google/gofuzz v1.2.0 // indirect
5248
github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 // indirect
53-
github.com/hashicorp/errwrap v1.1.0 // indirect
54-
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
55-
github.com/hashicorp/go-msgpack v0.5.3 // indirect
56-
github.com/hashicorp/go-multierror v1.1.0 // indirect
57-
github.com/hashicorp/go-sockaddr v1.0.6 // indirect
58-
github.com/hashicorp/golang-lru v0.5.4 // indirect
59-
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
60-
github.com/hashicorp/memberlist v0.5.0 // indirect
6149
github.com/imdario/mergo v0.3.13 // indirect
62-
github.com/jmespath/go-jmespath v0.4.0 // indirect
6350
github.com/josharian/intern v1.0.0 // indirect
64-
github.com/jpillora/backoff v1.0.0 // indirect
6551
github.com/json-iterator/go v1.1.12 // indirect
6652
github.com/mailru/easyjson v0.7.7 // indirect
67-
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
68-
github.com/miekg/dns v1.1.41 // indirect
6953
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
7054
github.com/modern-go/reflect2 v1.0.2 // indirect
7155
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
72-
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
73-
github.com/oklog/run v1.1.0 // indirect
74-
github.com/oklog/ulid v1.3.1 // indirect
7556
github.com/pkg/errors v0.9.1 // indirect
7657
github.com/pmezard/go-difflib v1.0.0 // indirect
7758
github.com/prometheus/client_golang v1.18.0 // indirect
7859
github.com/prometheus/client_model v0.5.0 // indirect
79-
github.com/prometheus/common v0.46.0 // indirect
80-
github.com/prometheus/common/sigv4 v0.1.0 // indirect
81-
github.com/prometheus/exporter-toolkit v0.11.0 // indirect
8260
github.com/prometheus/procfs v0.12.0 // indirect
83-
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
84-
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
85-
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect
8661
github.com/spf13/pflag v1.0.5 // indirect
8762
go.uber.org/atomic v1.11.0 // indirect
8863
go.uber.org/multierr v1.6.0 // indirect
89-
golang.org/x/crypto v0.24.0 // indirect
90-
golang.org/x/net v0.26.0 // indirect
64+
golang.org/x/net v0.28.0 // indirect
9165
golang.org/x/oauth2 v0.20.0 // indirect
92-
golang.org/x/sync v0.7.0 // indirect
93-
golang.org/x/sys v0.21.0 // indirect
94-
golang.org/x/term v0.21.0 // indirect
95-
golang.org/x/text v0.16.0 // indirect
66+
golang.org/x/sys v0.24.0 // indirect
67+
golang.org/x/term v0.23.0 // indirect
68+
golang.org/x/text v0.17.0 // indirect
9669
golang.org/x/time v0.3.0 // indirect
9770
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
9871
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
99-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf // indirect
72+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240823204242-4ba0660f739c // indirect
10073
gopkg.in/inf.v0 v0.9.1 // indirect
10174
gopkg.in/yaml.v2 v2.4.0 // indirect
10275
gopkg.in/yaml.v3 v3.0.1 // indirect
103-
k8s.io/api v0.27.2 // indirect
10476
k8s.io/apiextensions-apiserver v0.27.2 // indirect
10577
k8s.io/component-base v0.27.2 // indirect
10678
k8s.io/klog/v2 v2.90.1 // indirect

0 commit comments

Comments
 (0)