Skip to content

Commit ce2c2d1

Browse files
Merge pull request #365 from shiftstack/4.18-sync-from-upstream-0.11
OCPBUGS-44458: Merge https://github.com/kubernetes-sigs/cluster-api-provider-openstack:release-0.11 into release-4.18
2 parents b0f0dc4 + 4be4e67 commit ce2c2d1

File tree

1,988 files changed

+63422
-182746
lines changed

Some content is hidden

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

1,988 files changed

+63422
-182746
lines changed

.github/workflows/pr-dependabot.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424
id: vars
2525
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
2626
- name: Set up Go
27-
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # tag=v5.2.0
27+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # tag=v5.5.0
2828
with:
2929
go-version: ${{ steps.vars.outputs.go_version }}
30-
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # tag=v4.2.0
30+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # tag=v4.2.3
3131
name: Restore go cache
3232
with:
3333
path: |

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Calculate go version
2424
run: echo "go_version=$(make go-version)" >> $GITHUB_ENV
2525
- name: Set up Go
26-
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # tag=v5.2.0
26+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # tag=v5.5.0
2727
with:
2828
go-version: ${{ env.go_version }}
2929
- name: generate release artifacts
@@ -37,7 +37,7 @@ jobs:
3737
env:
3838
GH_TOKEN: ${{ github.token }}
3939
- name: Release
40-
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # tag=v2.2.0
40+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # tag=v2.2.2
4141
with:
4242
draft: true
4343
files: out/*

.github/workflows/security-scan.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Weekly security scan
2+
3+
on:
4+
schedule:
5+
# Cron for every Monday at 9:12 UTC.
6+
- cron: "12 9 * * 1"
7+
8+
# Remove all permissions from GITHUB_TOKEN except metadata.
9+
permissions: {}
10+
11+
jobs:
12+
scan:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
branch: [main, release-0.12, release-0.11, release-0.10]
17+
name: Trivy
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Check out code
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2
22+
with:
23+
ref: ${{ matrix.branch }}
24+
- name: Calculate go version
25+
id: vars
26+
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
27+
- name: Set up Go
28+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # tag=v5.5.0
29+
with:
30+
go-version: ${{ steps.vars.outputs.go_version }}
31+
- name: Run verify security target
32+
run: make verify-security

.trivyignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These require updating the go version to 1.23.
2+
# According to govulncheck we are not using code that is affected by them anyway
3+
CVE-2025-22870
4+
CVE-2025-22872

Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
# limitations under the License.
1414

1515
# Build the manager binary
16-
FROM golang:1.22.0 as builder
16+
ARG GO_VERSION
17+
FROM golang:${GO_VERSION} AS builder
1718
WORKDIR /workspace
1819

1920
# Run this with docker build --build_arg goproxy=$(go env GOPROXY) to override the goproxy
@@ -30,7 +31,7 @@ COPY orc/go.sum orc/go.sum
3031
# Cache deps before building and copying source so that we don't need to re-download as much
3132
# and so that source changes don't invalidate our downloaded layer
3233
RUN --mount=type=cache,target=/go/pkg/mod \
33-
go mod download
34+
go mod download
3435

3536
# Copy the sources
3637
COPY ./ ./
@@ -42,10 +43,10 @@ ARG ldflags
4243

4344
# Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder
4445
RUN --mount=type=cache,target=/root/.cache/go-build \
45-
--mount=type=cache,target=/go/pkg/mod \
46-
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
47-
go build -ldflags "${ldflags} -extldflags '-static'" \
48-
-o manager ${package}
46+
--mount=type=cache,target=/go/pkg/mod \
47+
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
48+
go build -ldflags "${ldflags} -extldflags '-static'" \
49+
-o manager ${package}
4950

5051
# Production image
5152
FROM gcr.io/distroless/static:nonroot

Makefile

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@ include $(ROOT_DIR_RELATIVE)/common.mk
2323
export GO111MODULE=on
2424
unexport GOPATH
2525

26+
# Enables shell script tracing. Enable by running: TRACE=1 make <target>
27+
TRACE ?= 0
28+
2629
# Go
27-
GO_VERSION ?= 1.22.7
30+
GO_VERSION ?= 1.23.8
2831

2932
# Directories.
3033
ARTIFACTS ?= $(REPO_ROOT)/_artifacts
3134
TOOLS_DIR := hack/tools
35+
BIN_DIR := bin
3236
TOOLS_DIR_DEPS := $(TOOLS_DIR)/go.sum $(TOOLS_DIR)/go.mod $(TOOLS_DIR)/Makefile
33-
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
37+
TOOLS_BIN_DIR := $(TOOLS_DIR)/$(BIN_DIR)
3438

35-
BIN_DIR := bin
3639
REPO_ROOT := $(shell git rev-parse --show-toplevel)
3740
GH_REPO ?= kubernetes-sigs/cluster-api-provider-openstack
3841
TEST_E2E_DIR := test/e2e
@@ -49,6 +52,13 @@ GO_APIDIFF_VER := v0.8.2
4952
GO_APIDIFF_BIN := go-apidiff
5053
GO_APIDIFF_PKG := github.com/joelanford/go-apidiff
5154

55+
# govulncheck
56+
GOVULNCHECK_VER := v1.1.4
57+
GOVULNCHECK_BIN := govulncheck
58+
GOVULNCHECK_PKG := golang.org/x/vuln/cmd/govulncheck
59+
60+
TRIVY_VER := 0.49.1
61+
5262
# Binaries.
5363
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
5464
CONVERSION_GEN := $(TOOLS_BIN_DIR)/conversion-gen
@@ -63,6 +73,7 @@ RELEASE_NOTES := $(TOOLS_BIN_DIR)/release-notes
6373
SETUP_ENVTEST := $(TOOLS_BIN_DIR)/setup-envtest
6474
GEN_CRD_API_REFERENCE_DOCS := $(TOOLS_BIN_DIR)/gen-crd-api-reference-docs
6575
GO_APIDIFF := $(TOOLS_BIN_DIR)/$(GO_APIDIFF_BIN)-$(GO_APIDIFF_VER)
76+
GOVULNCHECK := $(TOOLS_BIN_DIR)/$(GOVULNCHECK_BIN)-$(GOVULNCHECK_VER)
6677

6778
# Kubebuilder
6879
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.28.0
@@ -209,9 +220,9 @@ e2e-image: docker-build
209220

210221
# Pull all the images references in test/e2e/data/e2e_conf.yaml
211222
test-e2e-image-prerequisites:
212-
docker pull registry.k8s.io/cluster-api/cluster-api-controller:v1.8.6
213-
docker pull registry.k8s.io/cluster-api/kubeadm-bootstrap-controller:v1.8.6
214-
docker pull registry.k8s.io/cluster-api/kubeadm-control-plane-controller:v1.8.6
223+
docker pull registry.k8s.io/cluster-api/cluster-api-controller:v1.8.8
224+
docker pull registry.k8s.io/cluster-api/kubeadm-bootstrap-controller:v1.8.8
225+
docker pull registry.k8s.io/cluster-api/kubeadm-control-plane-controller:v1.8.8
215226

216227
CONFORMANCE_E2E_ARGS ?= -kubetest.config-file=$(KUBETEST_CONF_PATH)
217228
CONFORMANCE_E2E_ARGS += $(E2E_ARGS)
@@ -252,6 +263,12 @@ $(GO_APIDIFF_BIN): $(GO_APIDIFF)
252263
$(GO_APIDIFF): # Build go-apidiff.
253264
GOBIN=$(abspath $(TOOLS_BIN_DIR)) $(GO_INSTALL) $(GO_APIDIFF_PKG) $(GO_APIDIFF_BIN) $(GO_APIDIFF_VER)
254265

266+
.PHONY: $(GOVULNCHECK_BIN)
267+
$(GOVULNCHECK_BIN): $(GOVULNCHECK) ## Build a local copy of govulncheck.
268+
269+
$(GOVULNCHECK): # Build govulncheck.
270+
GOBIN=$(abspath $(TOOLS_BIN_DIR)) $(GO_INSTALL) $(GOVULNCHECK_PKG) $(GOVULNCHECK_BIN) $(GOVULNCHECK_VER)
271+
255272
## --------------------------------------
256273
##@ Linting
257274
## --------------------------------------
@@ -358,7 +375,7 @@ generate-api-docs-%: $(GEN_CRD_API_REFERENCE_DOCS) FORCE
358375

359376
.PHONY: docker-build
360377
docker-build: ## Build the docker image for controller-manager
361-
docker build -f Dockerfile --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg ldflags="$(LDFLAGS)" . -t $(CONTROLLER_IMG_TAG)
378+
docker build -f Dockerfile --build-arg GO_VERSION=$(GO_VERSION) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg ldflags="$(LDFLAGS)" . -t $(CONTROLLER_IMG_TAG)
362379

363380
.PHONY: docker-push
364381
docker-push: ## Push the docker image
@@ -579,8 +596,12 @@ clean-temporary: ## Remove all temporary files and folders
579596
clean-release: ## Remove the release folder
580597
rm -rf $(RELEASE_DIR)
581598

599+
.PHONY: clean-release-git
600+
clean-release-git: ## Restores the git files usually modified during a release
601+
git restore ./*manager_image_patch.yaml ./*manager_pull_policy.yaml
602+
582603
.PHONY: verify
583-
verify: verify-boilerplate verify-modules verify-gen verify-orc
604+
verify: verify-boilerplate verify-modules verify-gen verify-orc verify-govulncheck
584605

585606
.PHONY: verify-boilerplate
586607
verify-boilerplate:
@@ -604,6 +625,27 @@ verify-gen: generate
604625
verify-orc:
605626
$(MAKE) -C $(REPO_ROOT)/orc verify-generated
606627

628+
.PHONY: verify-container-images
629+
verify-container-images: ## Verify container images
630+
TRACE=$(TRACE) ./hack/verify-container-images.sh $(TRIVY_VER)
631+
632+
.PHONY: verify-govulncheck
633+
verify-govulncheck: $(GOVULNCHECK) ## Verify code for vulnerabilities
634+
$(GOVULNCHECK) ./... && R1=$$? || R1=$$?; \
635+
$(GOVULNCHECK) -C "$(TOOLS_DIR)" ./... && R2=$$? || R2=$$?; \
636+
if [ "$$R1" -ne "0" ] || [ "$$R2" -ne "0" ]; then \
637+
exit 1; \
638+
fi
639+
640+
.PHONY: verify-security
641+
verify-security: ## Verify code and images for vulnerabilities
642+
$(MAKE) verify-container-images && R1=$$? || R1=$$?; \
643+
$(MAKE) verify-govulncheck && R2=$$? || R2=$$?; \
644+
if [ "$$R1" -ne "0" ] || [ "$$R2" -ne "0" ]; then \
645+
echo "Check for vulnerabilities failed! There are vulnerabilities to be fixed"; \
646+
exit 1; \
647+
fi
648+
607649
.PHONY: vendor verify-vendoring
608650
vendor:
609651
go mod vendor

OWNERS_ALIASES

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ aliases:
2020
- vincepri
2121
cluster-api-openstack-maintainers:
2222
- emilienm
23-
- jichenjc
2423
- lentzi90
2524
- mdbooth
2625
cluster-api-openstack-reviewers:
26+
cluster-api-openstack-emeritus-maintainers:
27+
- jichenjc

cloudbuild-nightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ options:
44
substitution_option: ALLOW_LOOSE
55
machineType: 'N1_HIGHCPU_8'
66
steps:
7-
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20220609-2e4c91eb7e'
7+
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20241229-5dc092c636'
88
entrypoint: make
99
env:
1010
- DOCKER_CLI_EXPERIMENTAL=enabled

cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ options:
44
substitution_option: ALLOW_LOOSE
55
machineType: 'N1_HIGHCPU_8'
66
steps:
7-
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20220609-2e4c91eb7e'
7+
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20241229-5dc092c636'
88
entrypoint: make
99
env:
1010
- DOCKER_CLI_EXPERIMENTAL=enabled

controllers/openstackcluster_controller.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,11 +627,15 @@ func resolveLoadBalancerNetwork(openStackCluster *infrav1.OpenStackCluster, netw
627627
for _, s := range lbSpec.Subnets {
628628
matchFound := false
629629
for _, subnetID := range lbNet.Subnets {
630-
if s.ID != nil && subnetID == *s.ID {
630+
subnet, err := networkingService.GetSubnetByParam(&s)
631+
if s.ID != nil && subnetID == *s.ID && err == nil {
631632
matchFound = true
632633
lbNetStatus.Subnets = append(
633634
lbNetStatus.Subnets, infrav1.Subnet{
634-
ID: *s.ID,
635+
ID: subnet.ID,
636+
Name: subnet.Name,
637+
CIDR: subnet.CIDR,
638+
Tags: subnet.Tags,
635639
})
636640
}
637641
}
@@ -640,6 +644,8 @@ func resolveLoadBalancerNetwork(openStackCluster *infrav1.OpenStackCluster, netw
640644
return fmt.Errorf("no subnet match was found in the specified network (specified subnet: %v, available subnets: %v)", s, lbNet.Subnets)
641645
}
642646
}
647+
648+
openStackCluster.Status.APIServerLoadBalancer.LoadBalancerNetwork = lbNetStatus
643649
}
644650
}
645651

0 commit comments

Comments
 (0)