Skip to content

Commit 03fe8b4

Browse files
tmshortci-robot
authored andcommitted
UPSTREAM: <carry>: OTE: rewrite the upgrade incompatible operator test
This test replaces the existing upgrade incompatible test. The main change is that operator and catalog bundles are created on-the-fly to support OCP 4.20. This means we are no longer dependent on public operators for this test. This creates new bundles in the OCP ImageRegistry, this requires using a number of OCP APIs, including using a raw API URL to invoke the build. This is done by invoking an external k8s client (either `oc` or `kubectl`), and passing it a tarball of the bundle to be created. So, it can't be done by the golang k8sClient normally available (i.e. the create input is a tarball not a YAML file). This introduces the use of go-bindata to store the bundle contents. It also pulls in openshift mage, buld and operator APIs. Signed-off-by: Todd Short <todd.short@me.com>
1 parent fb7c104 commit 03fe8b4

File tree

95 files changed

+56530
-97
lines changed

Some content is hidden

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

95 files changed

+56530
-97
lines changed

openshift/.bingo/Variables.mk

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.8. DO NOT EDIT.
1+
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.9. DO NOT EDIT.
22
# All tools are designed to be build inside $GOBIN.
33
BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
44
GOPATH ?= $(shell go env GOPATH)
@@ -7,16 +7,28 @@ GO ?= $(shell which go)
77

88
# Below generated variables ensure that every time a tool under each variable is invoked, the correct version
99
# will be used; reinstalling only if needed.
10-
# For example for kustomize variable:
10+
# For example for go-bindata variable:
1111
#
1212
# In your main Makefile (for non array binaries):
1313
#
1414
#include .bingo/Variables.mk # Assuming -dir was set to .bingo .
1515
#
16-
#command: $(KUSTOMIZE)
17-
# @echo "Running kustomize"
18-
# @$(KUSTOMIZE) <flags/args..>
16+
#command: $(GO_BINDATA)
17+
# @echo "Running go-bindata"
18+
# @$(GO_BINDATA) <flags/args..>
1919
#
20+
GO_BINDATA := $(GOBIN)/go-bindata-v3.1.2+incompatible
21+
$(GO_BINDATA): $(BINGO_DIR)/go-bindata.mod
22+
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
23+
@echo "(re)installing $(GOBIN)/go-bindata-v3.1.2+incompatible"
24+
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=go-bindata.mod -o=$(GOBIN)/go-bindata-v3.1.2+incompatible "github.com/go-bindata/go-bindata/go-bindata"
25+
26+
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v2.1.6
27+
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
28+
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
29+
@echo "(re)installing $(GOBIN)/golangci-lint-v2.1.6"
30+
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v2.1.6 "github.com/golangci/golangci-lint/v2/cmd/golangci-lint"
31+
2032
KUSTOMIZE := $(GOBIN)/kustomize-v5.0.1
2133
$(KUSTOMIZE): $(BINGO_DIR)/kustomize.mod
2234
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.

openshift/.bingo/go-bindata.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
2+
3+
go 1.24.4
4+
5+
require github.com/go-bindata/go-bindata v3.1.2+incompatible // go-bindata

openshift/.bingo/go-bindata.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE=
2+
github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=

openshift/.bingo/golangci-lint.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
2+
3+
go 1.24.4
4+
5+
require github.com/golangci/golangci-lint/v2 v2.1.6 // cmd/golangci-lint

openshift/.bingo/golangci-lint.sum

Lines changed: 952 additions & 0 deletions
Large diffs are not rendered by default.

openshift/.bingo/variables.env

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.8. DO NOT EDIT.
1+
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.9. DO NOT EDIT.
22
# All tools are designed to be build inside $GOBIN.
33
# Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk.
44
GOBIN=${GOBIN:=$(go env GOBIN)}
@@ -8,6 +8,10 @@ if [ -z "$GOBIN" ]; then
88
fi
99

1010

11+
GO_BINDATA="${GOBIN}/go-bindata-v3.1.2+incompatible"
12+
13+
GOLANGCI_LINT="${GOBIN}/golangci-lint-v2.1.6"
14+
1115
KUSTOMIZE="${GOBIN}/kustomize-v5.0.1"
1216

1317
YQ="${GOBIN}/yq-v4.34.2"

openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"name": "[sig-olmv1] OLMv1 should pass a trivial sanity check",
3+
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 operator installation should block cluster upgrades if an incompatible operator is installed",
44
"labels": {},
55
"resources": {
66
"isolation": {}
@@ -10,7 +10,7 @@
1010
"environmentSelector": {}
1111
},
1212
{
13-
"name": "[sig-olmv1][OCPFeatureGate:NewOLM] OLMv1 CRDs should be installed",
13+
"name": "[sig-olmv1] OLMv1 should pass a trivial sanity check",
1414
"labels": {},
1515
"resources": {
1616
"isolation": {}
@@ -20,7 +20,7 @@
2020
"environmentSelector": {}
2121
},
2222
{
23-
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 operator installation should install a cluster extension",
23+
"name": "[sig-olmv1][OCPFeatureGate:NewOLM] OLMv1 CRDs should be installed",
2424
"labels": {},
2525
"resources": {
2626
"isolation": {}
@@ -30,7 +30,7 @@
3030
"environmentSelector": {}
3131
},
3232
{
33-
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 operator installation should fail to install a non-existing cluster extension",
33+
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 operator installation should install a cluster extension",
3434
"labels": {},
3535
"resources": {
3636
"isolation": {}
@@ -40,7 +40,7 @@
4040
"environmentSelector": {}
4141
},
4242
{
43-
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 operator installation should block cluster upgrades if an incompatible operator is installed",
43+
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 operator installation should fail to install a non-existing cluster extension",
4444
"labels": {},
4545
"resources": {
4646
"isolation": {}

openshift/tests-extension/Makefile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Get the directory where this Makefile is, so we can use it below for including
22
# Include the same Bingo variables used by the project
33
DIR := $(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))
4-
include $(DIR)/../../.bingo/Variables.mk
4+
# Use openshift's Bingo variables
5+
include $(DIR)/../.bingo/Variables.mk
56

67
# Definitions for the extended tests
78

@@ -63,11 +64,27 @@ lint: $(GOLANGCI_LINT) #HELP Run golangci linter.
6364
fix-lint: $(GOLANGCI_LINT) #HELP Fix lint issues
6465
$(GOLANGCI_LINT) run --fix
6566

67+
# Bindata generation
68+
.PHONY: bindata
69+
bindata: $(GO_BINDATA)
70+
71+
bindata: pkg/bindata/operator/operator.go
72+
pkg/bindata/operator/operator.go: $(shell find testdata/operator -type f)
73+
mkdir -p $(@D)
74+
$(GO_BINDATA) -pkg operator -o $@ -prefix "testdata/operator" testdata/operator/...
75+
go fmt ./$(@D)/...
76+
77+
bindata: pkg/bindata/catalog/catalog.go
78+
pkg/bindata/catalog/catalog.go: $(shell find testdata/catalog -type f)
79+
mkdir -p $(@D)
80+
$(GO_BINDATA) -pkg catalog -o $@ -prefix "testdata/catalog" testdata/catalog/...
81+
go fmt ./$(@D)/...
82+
6683
# GO_COMPLIANCE_POLICY="exempt_all" must only be used for test related binaries.
6784
# It prevents various FIPS compliance policies from being applied to this compilation.
6885
# Do not set globally.
6986
.PHONY: build
70-
build: #HELP Build the extended tests binary
87+
build: bindata #HELP Build the extended tests binary
7188
@mkdir -p $(TOOLS_BIN_DIR)
7289
GO_COMPLIANCE_POLICY="exempt_all" go build -ldflags "$(LDFLAGS)" -mod=vendor -o $(TOOLS_BIN_DIR)/olmv1-tests-ext ./cmd/...
7390

openshift/tests-extension/go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ module github/operator-framework-operator-controller/openshift/tests-extension
33
go 1.24.3
44

55
require (
6+
github.com/blang/semver/v4 v4.0.0
67
github.com/onsi/ginkgo/v2 v2.23.3
78
github.com/onsi/gomega v1.37.0
89
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250722101414-8083129ab8f9
9-
github.com/openshift/api v0.0.0-20250718204806-3333746edfbf
10+
github.com/openshift/api v0.0.0-20250808142411-c974eeafe3f1
1011
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee
1112
github.com/operator-framework/operator-controller v1.3.0
1213
github.com/spf13/cobra v1.9.1
1314
k8s.io/api v0.33.2
1415
k8s.io/apiextensions-apiserver v0.33.2
1516
k8s.io/apimachinery v0.33.3
1617
k8s.io/client-go v0.33.2
18+
k8s.io/utils v0.0.0-20241210054802-24370beab758
1719
sigs.k8s.io/controller-runtime v0.21.0
1820
)
1921

@@ -62,7 +64,6 @@ require (
6264
gopkg.in/yaml.v3 v3.0.1 // indirect
6365
k8s.io/klog/v2 v2.130.1 // indirect
6466
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
65-
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
6667
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
6768
sigs.k8s.io/randfill v1.0.0 // indirect
6869
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect

openshift/tests-extension/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ github.com/openshift-eng/openshift-tests-extension v0.0.0-20250522124649-4ffcd15
5353
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250522124649-4ffcd156ec7c/go.mod h1:6gkP5f2HL0meusT0Aim8icAspcD1cG055xxBZ9yC68M=
5454
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250722101414-8083129ab8f9 h1:4ZeSM80DVCb5WWB3Q/fyCI9jYXAl9bfrGnFvFONqzN4=
5555
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250722101414-8083129ab8f9/go.mod h1:6gkP5f2HL0meusT0Aim8icAspcD1cG055xxBZ9yC68M=
56-
github.com/openshift/api v0.0.0-20250718204806-3333746edfbf h1:NFtgSlz4oqI8CHOenkBK5Xq+hLJhe3c9fkyxMSysgIA=
57-
github.com/openshift/api v0.0.0-20250718204806-3333746edfbf/go.mod h1:SPLf21TYPipzCO67BURkCfK6dcIIxx0oNRVWaOyRcXM=
56+
github.com/openshift/api v0.0.0-20250808142411-c974eeafe3f1 h1:VElrUno5AG2Zl6M+2pYPiXXPfNGpeb+0v95sl8AAczw=
57+
github.com/openshift/api v0.0.0-20250808142411-c974eeafe3f1/go.mod h1:SPLf21TYPipzCO67BURkCfK6dcIIxx0oNRVWaOyRcXM=
5858
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee h1:tOtrrxfDEW8hK3eEsHqxsXurq/D6LcINGfprkQC3hqY=
5959
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee/go.mod h1:zhRiYyNMk89llof2qEuGPWPD+joQPhCRUc2IK0SB510=
6060
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12 h1:AKx/w1qpS8We43bsRgf8Nll3CGlDHpr/WAXvuedTNZI=

0 commit comments

Comments
 (0)