Skip to content

Commit 168960c

Browse files
authored
✨ Add envtest setup and controller tests (#10)
Adding the envtest setup, that can be triggered by a Make target and allows unit tests for the controllers. Adding a test provider objects TestInfrastructureProviderClusterStackReleaseTemplate to make unit tests indepedent of any specific provider. Adding mocking setup to generate mocks for the interfaces which can be used in unit testing. Adding mocks for Github client and for the kube client. Adding utils package for testing that contains utility functions to work with conditions and checks whether certain objects have a specific condition and how its properties look like. Adding local cluster stacks that have been downloaded from Github SovereignCloudStack/cluster-stacks repository to make unit tests independent of another repository and make it possible to run them locally. Adding unit tests to CI. Signed-off-by: janiskemper <[email protected]>
1 parent 4431f3e commit 168960c

File tree

305 files changed

+71111
-14
lines changed

Some content is hidden

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

305 files changed

+71111
-14
lines changed

.github/workflows/pr-verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
ref: ${{ github.event.pull_request.head.sha }}
2222

2323
- name: Verify Shellcheck
24-
run: make verify-shellcheck
24+
run: make verify-shellcheck

.github/workflows/test.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Test Code
2+
# yamllint disable rule:line-length
3+
on: # yamllint disable-line rule:truthy
4+
workflow_dispatch:
5+
pull_request:
6+
types: [opened, synchronize, reopened, ready_for_review]
7+
branches:
8+
- main
9+
- "releases/**"
10+
paths:
11+
- "**.go"
12+
- "**go.mod"
13+
- "**go.sum"
14+
- ".github/workflows/**"
15+
- "Makefile"
16+
- "images/builder/**"
17+
- "images/**"
18+
- "test/releases/**"
19+
push:
20+
branches:
21+
- main
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }}
24+
cancel-in-progress: true
25+
jobs:
26+
test:
27+
name: Test Code
28+
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 10
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
34+
- name: Coverage result name
35+
id: name
36+
run: |
37+
if [ ${{ github.event.pull_request }} ]; then
38+
NAME=pr-${{ github.event.pull_request.number }}
39+
else
40+
NAME=${{ github.sha }}
41+
fi
42+
echo name=${NAME} >> $GITHUB_OUTPUT
43+
44+
- name: Setup Go
45+
uses: ./.github/actions/setup-go
46+
47+
- name: Install dependencies
48+
run: make gotestsum go-cover-treemap setup-envtest helm
49+
50+
- name: Install go modules for test
51+
shell: bash
52+
run: |
53+
GO111MODULE=on GOPROXY=https://proxy.golang.org go mod download
54+
55+
- name: Running unit tests
56+
env:
57+
GO111MODULE: "on"
58+
run: make test-unit

.golangci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ issues:
267267
# changes in PRs and avoid nitpicking.
268268
exclude-use-default: false
269269
exclude-rules:
270+
- linters:
271+
- wrapcheck
272+
path: _test\.go
270273
- linters:
271274
- revive
272275
text: "exported: exported method .*\\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"

Makefile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,48 @@ $(HELM):
139139
curl -sSL https://get.helm.sh/helm-v3.12.2-linux-amd64.tar.gz | tar xz -C $(TOOLS_BIN_DIR) --strip-components=1 linux-amd64/helm
140140
chmod a+rx $(HELM)
141141

142+
MOCKERY := $(abspath $(TOOLS_BIN_DIR)/mockery)
143+
mockery: $(MOCKERY) ## Download and extract mockery binary from github releases page
144+
$(MOCKERY):
145+
curl -sSL https://github.com/vektra/mockery/releases/download/v2.32.4/mockery_2.32.4_Linux_x86_64.tar.gz | tar xz -C $(TOOLS_BIN_DIR)
146+
147+
148+
149+
mock_dir := $(shell dirname $$(grep -r -w -l -E "type Client interface" --exclude='Makefile' --exclude-dir=vendor))
150+
151+
.PHONY: mock
152+
mock: $(MOCKERY)
153+
@for path in $(mock_dir); do \
154+
echo "Running mockery for $$path"; \
155+
$(MOCKERY) --all --recursive --dir=$$path --output=$$path/mocks; \
156+
done
157+
158+
.PHONY: mock-clean
159+
mock-clean:
160+
@echo "Erasing the directory test/$(mock_test_dir)/mocks"
161+
@rm -rf $(mock_test_dir)/mocks
162+
@for path in $(mock_dir); do \
163+
echo "Erasing this directory $$path/mocks"; \
164+
rm -rf $$path/mocks; \
165+
done
166+
167+
go-binsize-treemap := $(abspath $(TOOLS_BIN_DIR)/go-binsize-treemap)
168+
go-binsize-treemap: $(go-binsize-treemap) # Build go-binsize-treemap from tools folder.
169+
$(go-binsize-treemap):
170+
go install github.com/nikolaydubina/[email protected]
171+
172+
go-cover-treemap := $(abspath $(TOOLS_BIN_DIR)/go-cover-treemap)
173+
go-cover-treemap: $(go-cover-treemap) # Build go-cover-treemap from tools folder.
174+
$(go-cover-treemap):
175+
go install github.com/nikolaydubina/[email protected]
176+
177+
178+
GOTESTSUM := $(abspath $(TOOLS_BIN_DIR)/gotestsum)
179+
gotestsum: $(GOTESTSUM) # Build gotestsum from tools folder.
180+
$(GOTESTSUM):
181+
go install gotest.tools/[email protected]
182+
183+
142184
all-tools: $(KIND) $(KUBECTL) $(CLUSTERCTL) $(CTLPTL) $(SETUP_ENVTEST) $(ENVSUBST) $(KUSTOMIZE) $(CONTROLLER_GEN)
143185
echo 'done'
144186

@@ -277,6 +319,11 @@ $(WORKER_CLUSTER_KUBECONFIG):
277319

278320
KUBEBUILDER_ASSETS ?= $(shell $(SETUP_ENVTEST) use --use-env --bin-dir $(abspath $(TOOLS_BIN_DIR)) -p path $(KUBEBUILDER_ENVTEST_KUBERNETES_VERSION))
279321

322+
.PHONY: test-unit
323+
test-unit: $(SETUP_ENVTEST) $(GOTESTSUM) $(HELM) ## Run unit
324+
@mkdir -p $(shell pwd)/.coverage
325+
KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" $(GOTESTSUM) --junitfile=.coverage/junit.xml --format testname -- -mod=vendor \
326+
-covermode=atomic -coverprofile=.coverage/cover.out -p=4 ./internal/controller/...
280327

281328
##@ Verify
282329
##########

go.mod

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,28 @@ go 1.19
55
require (
66
github.com/go-logr/logr v1.2.4
77
github.com/google/go-github/v52 v52.0.0
8+
github.com/onsi/ginkgo/v2 v2.11.0
9+
github.com/onsi/gomega v1.27.8
10+
github.com/stretchr/testify v1.8.4
11+
golang.org/x/mod v0.12.0
812
golang.org/x/oauth2 v0.10.0
913
k8s.io/api v0.27.2
1014
k8s.io/apimachinery v0.27.2
1115
k8s.io/cli-runtime v0.27.2
1216
k8s.io/client-go v0.27.2
13-
sigs.k8s.io/cluster-api v1.5.1
17+
k8s.io/klog/v2 v2.100.1
18+
sigs.k8s.io/cluster-api v1.5.2
19+
sigs.k8s.io/cluster-api/test v1.5.2
1420
sigs.k8s.io/controller-runtime v0.15.1
1521
)
1622

1723
require (
18-
github.com/onsi/gomega v1.27.8 // indirect
24+
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
25+
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
1926
github.com/pkg/errors v0.9.1 // indirect
27+
github.com/pmezard/go-difflib v1.0.0 // indirect
2028
github.com/stretchr/objx v0.5.1 // indirect
21-
github.com/stretchr/testify v1.8.4 // indirect
22-
k8s.io/klog/v2 v2.100.1 // indirect
29+
k8s.io/cluster-bootstrap v0.27.2 // indirect
2330
)
2431

2532
require (
@@ -39,7 +46,7 @@ require (
3946
github.com/go-openapi/jsonpointer v0.19.6 // indirect
4047
github.com/go-openapi/jsonreference v0.20.1 // indirect
4148
github.com/go-openapi/swag v0.22.3 // indirect
42-
github.com/gobuffalo/flect v1.0.2 // indirect
49+
github.com/gobuffalo/flect v1.0.2
4350
github.com/gogo/protobuf v1.3.2 // indirect
4451
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4552
github.com/golang/protobuf v1.5.3 // indirect
@@ -82,7 +89,7 @@ require (
8289
gopkg.in/inf.v0 v0.9.1 // indirect
8390
gopkg.in/yaml.v2 v2.4.0
8491
gopkg.in/yaml.v3 v3.0.1 // indirect
85-
k8s.io/apiextensions-apiserver v0.27.2 // indirect
92+
k8s.io/apiextensions-apiserver v0.27.2
8693
k8s.io/apiserver v0.27.2 // indirect
8794
k8s.io/component-base v0.27.2 // indirect
8895
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect

go.sum

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ github.com/go-openapi/jsonreference v0.20.1/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En
7373
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
7474
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
7575
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
76+
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
7677
github.com/gobuffalo/flect v1.0.2 h1:eqjPGSo2WmjgY2XlpGwo2NXgL3RucAKo4k4qQMNA5sA=
7778
github.com/gobuffalo/flect v1.0.2/go.mod h1:A5msMlrHtLqh9umBSnvabjsMrCcCpAyzglnDvkbYKHs=
7879
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
@@ -117,13 +118,15 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
117118
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
118119
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
119120
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
121+
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
120122
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
121123
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
122124
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
123125
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
124126
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
125127
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
126128
github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4=
129+
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
127130
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
128131
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
129132
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
@@ -158,6 +161,7 @@ github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod
158161
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
159162
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
160163
github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU=
164+
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM=
161165
github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc=
162166
github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ=
163167
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
@@ -193,6 +197,7 @@ github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0=
193197
github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0=
194198
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
195199
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
200+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
196201
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
197202
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
198203
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
@@ -235,6 +240,8 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl
235240
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
236241
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
237242
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
243+
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
244+
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
238245
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
239246
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
240247
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -266,6 +273,7 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h
266273
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
267274
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
268275
golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
276+
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
269277
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
270278
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
271279
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -370,6 +378,7 @@ k8s.io/cli-runtime v0.27.2/go.mod h1:9UecpyPDTkhiYY4d9htzRqN+rKomJgyb4wi0OfrmCjw
370378
k8s.io/client-go v0.27.2 h1:vDLSeuYvCHKeoQRhCXjxXO45nHVv2Ip4Fe0MfioMrhE=
371379
k8s.io/client-go v0.27.2/go.mod h1:tY0gVmUsHrAmjzHX9zs7eCjxcBsf8IiNe7KQ52biTcQ=
372380
k8s.io/cluster-bootstrap v0.27.2 h1:OL3onrOwrUD7NQxBUqQwTl1Uu2GQKCkw9BMHpc4PbiA=
381+
k8s.io/cluster-bootstrap v0.27.2/go.mod h1:b++PF0mjUOiTKdPQFlDw7p4V2VquANZ8SfhAwzxZJFM=
373382
k8s.io/component-base v0.27.2 h1:neju+7s/r5O4x4/txeUONNTS9r1HsPbyoPBAtHsDCpo=
374383
k8s.io/component-base v0.27.2/go.mod h1:5UPk7EjfgrfgRIuDBFtsEFAe4DAvP3U+M8RTzoSJkpo=
375384
k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg=
@@ -378,8 +387,10 @@ k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5F
378387
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg=
379388
k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU=
380389
k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
381-
sigs.k8s.io/cluster-api v1.5.1 h1:+oO4EbVQcbBJr5wjqmdjvewPHSTbVLigXZqPk3ZO8t0=
382-
sigs.k8s.io/cluster-api v1.5.1/go.mod h1:EGJUNpFWi7dF426tO8MG/jE+w7T0UO5KyMnOwQ5riUY=
390+
sigs.k8s.io/cluster-api v1.5.2 h1:pCsyEHwTBb7n+U5Z2OA5STxdJ1EuSpJv8FLBx4lii3s=
391+
sigs.k8s.io/cluster-api v1.5.2/go.mod h1:EGJUNpFWi7dF426tO8MG/jE+w7T0UO5KyMnOwQ5riUY=
392+
sigs.k8s.io/cluster-api/test v1.5.2 h1:Hlorgn4ebGdSxP4IZAT7eMweAowh4n0/vdhc4HAPNF8=
393+
sigs.k8s.io/cluster-api/test v1.5.2/go.mod h1:mFlsY1y0lApBgQyXbmVprdzCK+9MQNp1C38K+aZdn5A=
383394
sigs.k8s.io/controller-runtime v0.15.1 h1:9UvgKD4ZJGcj24vefUFgZFP3xej/3igL9BsOUTb/+4c=
384395
sigs.k8s.io/controller-runtime v0.15.1/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk=
385396
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=

internal/controller/clusterstack_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (r *ClusterStackReconciler) Reconcile(ctx context.Context, req reconcile.Re
142142
return reconcile.Result{}, fmt.Errorf("failed to get ClusterStackRelease objects that are in use: %w", err)
143143
}
144144

145-
inSpec, err := getClusterStackReleasesInSpec(clusterStack.Spec)
145+
inSpec, err := getClusterStackReleasesInSpec(&clusterStack.Spec)
146146
if err != nil {
147147
return reconcile.Result{}, fmt.Errorf("failed to get ClusterStackReleases from clusterstack.spec.versions: %w", err)
148148
}
@@ -580,7 +580,7 @@ func (r *ClusterStackReconciler) getClusterStackReleasesInUse(ctx context.Contex
580580
return mapUsedClusterClasses, nil
581581
}
582582

583-
func getClusterStackReleasesInSpec(spec csov1alpha1.ClusterStackSpec) (map[string]struct{}, error) {
583+
func getClusterStackReleasesInSpec(spec *csov1alpha1.ClusterStackSpec) (map[string]struct{}, error) {
584584
clusterStackReleaseMap := make(map[string]struct{})
585585

586586
for _, v := range spec.Versions {

0 commit comments

Comments
 (0)