Skip to content

Commit 1f11a6d

Browse files
committed
UPSTREAM: <carry>: Pin IPAM CRD manifests to CAPI from release-4.20
We can't push v1beta2 IPAM to production clusters without also running the conversion webhook, so we pin to the last released version which did not have it. TPNU clusters continue to get the latest CAPI.
1 parent 7daa198 commit 1f11a6d

File tree

6 files changed

+137
-45
lines changed

6 files changed

+137
-45
lines changed

openshift/Makefile

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
BIN_DIR := bin
21
TOOLS_DIR := tools
32

43
$(RELEASE_DIR):
54
mkdir -p $(RELEASE_DIR)/
65

7-
MANIFESTS_GEN := go run ./vendor/github.com/openshift/cluster-capi-operator/manifests-gen/
6+
MANIFESTS_GEN := $(TOOLS_DIR)/bin/manifests-gen
7+
KUSTOMIZE := $(TOOLS_DIR)/bin/kustomize
8+
9+
$(TOOLS_DIR)/bin/%:
10+
$(MAKE) -C $(TOOLS_DIR) bin/$*
811

912
.PHONY: check-env
1013
check-env:
@@ -16,8 +19,21 @@ endif
1619
update-manifests-gen:
1720
cd tools && go get github.com/openshift/cluster-capi-operator/manifests-gen && go mod tidy && go mod vendor
1821

22+
.PHONY: update-ipam-ref
23+
update-ipam-ref:
24+
# Get the current HEAD of the release-4.20 branch
25+
$(eval current_head := $(shell git ls-remote https://github.com/openshift/cluster-api release-4.20 | awk '$$2 == "refs/heads/release-4.20" {print $$1}'))
26+
27+
# Pin the current head in the ipam CRD kustomize resource target
28+
sed -i "s,https://github.com/openshift/cluster-api/config/crd?ref=.*,https://github.com/openshift/cluster-api/config/crd?ref=$(current_head)," ipam/kustomization.yaml
29+
30+
.PHONY: ipam-manifests
31+
ipam-manifests: $(KUSTOMIZE)
32+
$(KUSTOMIZE) build ipam -o manifests/0000_30_cluster-api_04_crd.core-cluster-api.yaml
33+
34+
# Rebasebot runs ocp-manifests, so we make it generate ipam-manifests too
1935
.PHONY: ocp-manifests
20-
ocp-manifests: $(RELEASE_DIR) check-env ## Builds openshift specific manifests
36+
ocp-manifests: ipam-manifests $(MANIFESTS_GEN) check-env | $(RELEASE_DIR) ## Builds openshift specific manifests
2137
# Generate provider manifests.
2238
# TODO: load the provider-version dynamically at rebase time when this is invoked by the Rebase Bot during one of its lifecycle hooks.
23-
cd tools && $(MANIFESTS_GEN) --provider-name "cluster-api" --provider-type "CoreProvider" --provider-version "${PROVIDER_VERSION}" --base-path "../../" --manifests-path "../manifests" --kustomize-dir="openshift"
39+
$(MANIFESTS_GEN) --provider-name "cluster-api" --provider-type "CoreProvider" --provider-version "${PROVIDER_VERSION}" --base-path "../" --manifests-path "./manifests" --kustomize-dir="openshift"

openshift/ipam/kustomization.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
# MAPV uses the CAPI IPAM CRDs. Until CAPI reaches GA, these CRDs must be
5+
# separately installed in production clusters. This workaround can be removed
6+
# when CAPI reaches GA: they will be installed via the CAPI Operator manifests
7+
# along with all other CAPI CRDs.
8+
#
9+
# In 4.21 we bumped CAPI to a version which includes v1beta2, and therefore
10+
# requires a conversion webhook. This would break production vsphere clusters
11+
# using IPAM, because we are not yet deploying this webhook in production
12+
# clusters. As MAPV does not require the v1beta2 IPAM CRDs, we pin them at the
13+
# versions shipped in 4.20 for now.
14+
15+
commonAnnotations:
16+
# Boilerplate annotations
17+
exclude.release.openshift.io/internal-openshift-hosted: "true"
18+
include.release.openshift.io/self-managed-high-availability: "true"
19+
include.release.openshift.io/single-node-developer: "true"
20+
21+
# Instructs CVO to only install these resources in clusters with the Default
22+
# featureset. Specifically this means that they will not be installed in
23+
# (TechPreview|Custom|Dev)NoUpgrade clusters.
24+
release.openshift.io/feature-set: Default
25+
26+
resources:
27+
# Pinned at 4.20, as that was the last release which didn't have v1beta2
28+
- https://github.com/openshift/cluster-api/config/crd?ref=de1db2970e7fede7101e5a8188e74942ab6665e3
29+
30+
# Together these 2 patches remove all CRDs except those with the name suffix
31+
# '.ipam.cluster.x-k8s.io'
32+
patches:
33+
34+
# First add the local-config annotation to all CRDs.
35+
# kustomize will not emit resources with this annotation
36+
- target:
37+
kind: CustomResourceDefinition
38+
patch: |
39+
- op: "add"
40+
path: "/metadata/annotations/config.kubernetes.io~1local-config"
41+
value: "true"
42+
43+
# Then selectively remove the local-config annotation from CRDs in
44+
# ipam.cluster.x-k8s.io, meaning they will be emitted
45+
- target:
46+
kind: CustomResourceDefinition
47+
name: '.*\.ipam\.cluster\.x-k8s\.io$'
48+
patch: |
49+
- op: remove
50+
path: "/metadata/annotations/config.kubernetes.io~1local-config"

openshift/tools/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
bin
2-
bin/*
1+
./bin

openshift/tools/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
BIN_DIR := bin
2+
3+
MANIFESTS_GEN := bin/manifests-gen
4+
KUSTOMIZE := bin/kustomize
5+
6+
$(MANIFESTS_GEN): pkg = github.com/openshift/cluster-capi-operator/manifests-gen
7+
$(KUSTOMIZE): pkg = sigs.k8s.io/kustomize/kustomize/v5
8+
9+
.PHONY: default
10+
default: $(MANIFESTS_GEN) $(KUSTOMIZE)
11+
12+
$(BIN_DIR):
13+
mkdir -p $(BIN_DIR)
14+
15+
$(BIN_DIR)/%: _FORCE | $(BIN_DIR)
16+
go build -o $@ $(pkg)
17+
18+
.PHONY: _FORCE

openshift/tools/go.mod

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ go 1.24.0
44

55
toolchain go1.24.3
66

7-
require github.com/openshift/cluster-capi-operator/manifests-gen v0.0.0-20251128150503-3d0f9cd4dcdf
7+
require (
8+
github.com/openshift/cluster-capi-operator/manifests-gen v0.0.0-20251209152545-de2bd18f0a52
9+
sigs.k8s.io/kustomize/kustomize/v5 v5.8.0
10+
)
811

912
require (
1013
github.com/MakeNowJust/heredoc v1.0.0 // indirect
@@ -20,80 +23,85 @@ require (
2023
github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46 // indirect
2124
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
2225
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
23-
github.com/fsnotify/fsnotify v1.8.0 // indirect
24-
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
26+
github.com/fsnotify/fsnotify v1.9.0 // indirect
27+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
2528
github.com/go-errors/errors v1.4.2 // indirect
2629
github.com/go-logr/logr v1.4.3 // indirect
2730
github.com/go-openapi/jsonpointer v0.21.1 // indirect
2831
github.com/go-openapi/jsonreference v0.21.0 // indirect
2932
github.com/go-openapi/swag v0.23.1 // indirect
30-
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
31-
github.com/gobuffalo/flect v1.0.3 // indirect
33+
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
3234
github.com/gogo/protobuf v1.3.2 // indirect
3335
github.com/google/btree v1.1.3 // indirect
34-
github.com/google/gnostic-models v0.6.9 // indirect
36+
github.com/google/gnostic-models v0.7.0 // indirect
3537
github.com/google/go-cmp v0.7.0 // indirect
3638
github.com/google/go-github/v53 v53.2.0 // indirect
3739
github.com/google/go-querystring v1.1.0 // indirect
38-
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
3940
github.com/google/uuid v1.6.0 // indirect
41+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
4042
github.com/josharian/intern v1.0.0 // indirect
4143
github.com/json-iterator/go v1.1.12 // indirect
4244
github.com/klauspost/compress v1.18.0 // indirect
4345
github.com/mailru/easyjson v0.9.0 // indirect
4446
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
45-
github.com/modern-go/reflect2 v1.0.2 // indirect
47+
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
4648
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
4749
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
50+
github.com/onsi/gomega v1.38.2 // indirect
4851
github.com/opencontainers/go-digest v1.0.0 // indirect
4952
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
5053
github.com/pkg/errors v0.9.1 // indirect
51-
github.com/prometheus/client_golang v1.22.0 // indirect
54+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
55+
github.com/prometheus/client_golang v1.23.2 // indirect
5256
github.com/prometheus/client_model v0.6.2 // indirect
53-
github.com/prometheus/common v0.64.0 // indirect
54-
github.com/prometheus/procfs v0.16.1 // indirect
57+
github.com/prometheus/common v0.66.1 // indirect
58+
github.com/prometheus/procfs v0.17.0 // indirect
5559
github.com/sagikazarmark/locafero v0.7.0 // indirect
60+
github.com/sergi/go-diff v1.4.0 // indirect
5661
github.com/sourcegraph/conc v0.3.0 // indirect
5762
github.com/spf13/afero v1.12.0 // indirect
5863
github.com/spf13/cast v1.7.1 // indirect
59-
github.com/spf13/pflag v1.0.6 // indirect
60-
github.com/spf13/viper v1.20.0 // indirect
64+
github.com/spf13/cobra v1.9.1 // indirect
65+
github.com/spf13/pflag v1.0.10 // indirect
66+
github.com/spf13/viper v1.20.1 // indirect
6167
github.com/subosito/gotenv v1.6.0 // indirect
6268
github.com/x448/float16 v0.8.4 // indirect
6369
github.com/xlab/treeprint v1.2.0 // indirect
64-
go.opentelemetry.io/otel v1.36.0 // indirect
65-
go.opentelemetry.io/otel/trace v1.36.0 // indirect
66-
go.uber.org/automaxprocs v1.6.0 // indirect
70+
go.opentelemetry.io/otel v1.38.0 // indirect
71+
go.opentelemetry.io/otel/trace v1.38.0 // indirect
6772
go.uber.org/multierr v1.11.0 // indirect
68-
golang.org/x/crypto v0.39.0 // indirect
69-
golang.org/x/net v0.41.0 // indirect
70-
golang.org/x/oauth2 v0.30.0 // indirect
71-
golang.org/x/sync v0.15.0 // indirect
72-
golang.org/x/sys v0.33.0 // indirect
73-
golang.org/x/term v0.32.0 // indirect
74-
golang.org/x/text v0.26.0 // indirect
75-
golang.org/x/time v0.11.0 // indirect
73+
go.yaml.in/yaml/v2 v2.4.2 // indirect
74+
go.yaml.in/yaml/v3 v3.0.4 // indirect
75+
golang.org/x/crypto v0.45.0 // indirect
76+
golang.org/x/net v0.47.0 // indirect
77+
golang.org/x/oauth2 v0.32.0 // indirect
78+
golang.org/x/sync v0.18.0 // indirect
79+
golang.org/x/sys v0.38.0 // indirect
80+
golang.org/x/term v0.37.0 // indirect
81+
golang.org/x/text v0.31.0 // indirect
82+
golang.org/x/time v0.14.0 // indirect
7683
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
77-
google.golang.org/protobuf v1.36.6 // indirect
84+
google.golang.org/protobuf v1.36.10 // indirect
7885
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
7986
gopkg.in/inf.v0 v0.9.1 // indirect
8087
gopkg.in/yaml.v3 v3.0.1 // indirect
81-
k8s.io/api v0.33.3 // indirect
82-
k8s.io/apiextensions-apiserver v0.33.3 // indirect
83-
k8s.io/apimachinery v0.33.3 // indirect
84-
k8s.io/client-go v0.33.3 // indirect
85-
k8s.io/cluster-bootstrap v0.32.3 // indirect
86-
k8s.io/component-base v0.33.3 // indirect
88+
k8s.io/api v0.34.1 // indirect
89+
k8s.io/apiextensions-apiserver v0.34.1 // indirect
90+
k8s.io/apimachinery v0.34.1 // indirect
91+
k8s.io/client-go v0.34.1 // indirect
92+
k8s.io/cluster-bootstrap v0.33.3 // indirect
93+
k8s.io/component-base v0.34.1 // indirect
8794
k8s.io/klog/v2 v2.130.1 // indirect
88-
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
89-
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e // indirect
90-
sigs.k8s.io/cluster-api v1.10.4 // indirect
91-
sigs.k8s.io/controller-runtime v0.20.4 // indirect
95+
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
96+
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d // indirect
97+
sigs.k8s.io/cluster-api v1.11.3 // indirect
98+
sigs.k8s.io/controller-runtime v0.22.4 // indirect
9299
sigs.k8s.io/gateway-api v1.1.0 // indirect
93100
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
94-
sigs.k8s.io/kustomize/api v0.19.0 // indirect
95-
sigs.k8s.io/kustomize/kyaml v0.19.0 // indirect
101+
sigs.k8s.io/kustomize/api v0.21.0 // indirect
102+
sigs.k8s.io/kustomize/cmd/config v0.21.0 // indirect
103+
sigs.k8s.io/kustomize/kyaml v0.21.0 // indirect
96104
sigs.k8s.io/randfill v1.0.0 // indirect
97-
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect
98-
sigs.k8s.io/yaml v1.4.0 // indirect
105+
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
106+
sigs.k8s.io/yaml v1.6.0 // indirect
99107
)

openshift/tools/tools.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ package tools
44

55
import (
66
_ "github.com/openshift/cluster-capi-operator/manifests-gen"
7+
_ "sigs.k8s.io/kustomize/kustomize/v5"
78
)

0 commit comments

Comments
 (0)