Skip to content

Commit af30456

Browse files
Merge pull request #189 from raghavendra-talur/rtalur-fix-4.15-go-version
Bug 2255411: Backport of upstream PRs 1171, 1173, 1174
2 parents 4a80046 + 85558eb commit af30456

Some content is hidden

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

44 files changed

+1902
-2066
lines changed

.github/workflows/ci.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ env:
2323
IMAGE_NAME: ${{ vars.IMAGE_NAME || 'ramen' }}
2424
OPERATOR_SUGGESTED_NAMESPACE: ${{ vars.OPERATOR_SUGGESTED_NAMESPACE || 'ramen-system' }}
2525
# Constants
26-
GO_VERSION: "1.19"
26+
GO_VERSION: "1.20"
2727
IMAGE_REGISTRY: "quay.io"
2828
IMAGE_TAG: "ci"
2929
DOCKERCMD: "podman"
@@ -39,6 +39,11 @@ jobs:
3939
- name: Checkout source
4040
uses: actions/checkout@v3
4141

42+
- name: Setup go
43+
uses: actions/setup-go@v4
44+
with:
45+
go-version: ${{ env.GO_VERSION }}
46+
4247
- name: Install prereqs
4348
run: |
4449
echo 'APT::Acquire::Retries "5";' | sudo tee /etc/apt/apt.conf.d/80-retries

Dockerfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Build the manager binary
5-
FROM golang:1.19.1 as builder
5+
FROM docker.io/library/golang:1.20 as builder
66

77
WORKDIR /workspace
88
# Copy the Go Modules manifests
99
COPY go.mod go.mod
1010
COPY go.sum go.sum
11+
COPY api/ api/
1112
# cache deps before building and copying source so that we don't need to re-download as much
1213
# and so that source changes don't invalidate our downloaded layer
1314
RUN go mod download
1415

1516
# Copy the go source
1617
COPY main.go main.go
17-
COPY api/ api/
1818
COPY controllers/ controllers/
1919

2020
# Build
21-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
21+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
2222

23-
FROM registry.access.redhat.com/ubi8/ubi
23+
FROM registry.access.redhat.com/ubi8/ubi-minimal
2424
WORKDIR /
2525
COPY --from=builder /workspace/manager .
2626

Makefile

+7-47
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ IMAGE_NAME ?= ramen
3838
IMAGE_TAG ?= latest
3939
PLATFORM ?= k8s
4040
IMAGE_TAG_BASE = $(IMAGE_REGISTRY)/$(IMAGE_REPOSITORY)/$(IMAGE_NAME)
41-
RBAC_PROXY_IMG ?= "gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0"
41+
RBAC_PROXY_IMG ?= "gcr.io/kubebuilder/kube-rbac-proxy:v0.13.1"
4242
OPERATOR_SUGGESTED_NAMESPACE ?= ramen-system
4343
AUTO_CONFIGURE_DR_CLUSTER ?= true
4444
KUBE_OBJECT_PROTECTION_DISABLED ?= false
@@ -126,7 +126,7 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and
126126

127127
.PHONY: golangci-bin
128128
golangci-bin:
129-
hack/install-golangci-lint.sh
129+
@hack/install-golangci-lint.sh
130130

131131
.PHONY: lint
132132
lint: golangci-bin ## Run configured golangci-lint and pre-commit.sh linters against the code.
@@ -255,48 +255,20 @@ undeploy-dr-cluster: kustomize ## Undeploy dr-cluster controller from the K8s cl
255255
##@ Tools
256256

257257
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
258-
controller_gen_version=v0.9.2
259258
controller-gen: ## Download controller-gen locally if necessary.
260-
@test '$(shell $(CONTROLLER_GEN) --version)' = 'Version: $(controller_gen_version)' ||\
261-
$(call go-get-tool,sigs.k8s.io/controller-tools/cmd/controller-gen@$(controller_gen_version))
259+
@hack/install-controller-gen.sh
262260

261+
.PHONY: kustomize
263262
KUSTOMIZE = $(shell pwd)/bin/kustomize
264263
kustomize: ## Download kustomize locally if necessary.
265-
@test -f $(KUSTOMIZE) ||\
266-
$(call go-get-tool,sigs.k8s.io/kustomize/kustomize/[email protected])
267-
268-
# go-get-tool will 'go get' any package $1 and install it to bin/.
269-
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
270-
define go-get-tool
271-
{ \
272-
set -e ;\
273-
TMP_DIR=$$(mktemp -d) ;\
274-
cd $$TMP_DIR ;\
275-
go mod init tmp ;\
276-
echo "Downloading $(1)" ;\
277-
GOBIN=$(PROJECT_DIR)/bin go install $(1) ;\
278-
rm -rf $$TMP_DIR ;\
279-
}
280-
endef
264+
@hack/install-kustomize.sh
281265

282266
##@ Bundle
283267

284268
.PHONY: operator-sdk
285269
OSDK = ./bin/operator-sdk
286270
operator-sdk: ## Download operator-sdk locally if necessary.
287-
ifeq (,$(wildcard $(OSDK)))
288-
ifeq (,$(shell which operator-sdk 2>/dev/null))
289-
@{ \
290-
set -e ;\
291-
mkdir -p $(dir $(OSDK)) ;\
292-
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
293-
curl -sSLo $(OSDK) https://github.com/operator-framework/operator-sdk/releases/download/v1.24.0/operator-sdk_$${OS}_$${ARCH} ;\
294-
chmod +x $(OSDK) ;\
295-
}
296-
else
297-
OSDK = $(shell which operator-sdk)
298-
endif
299-
endif
271+
@hack/install-operator-sdk.sh
300272

301273
.PHONY: bundle
302274
bundle: bundle-hub bundle-dr-cluster ## Generate all bundle manifests and metadata, then validate generated files.
@@ -355,19 +327,7 @@ bundle-dr-cluster-push: ## Push the dr-cluster bundle image.
355327
.PHONY: opm
356328
OPM = ./bin/opm
357329
opm: ## Download opm locally if necessary.
358-
ifeq (,$(wildcard $(OPM)))
359-
ifeq (,$(shell which opm 2>/dev/null))
360-
@{ \
361-
set -e ;\
362-
mkdir -p $(dir $(OPM)) ;\
363-
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
364-
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.2/$${OS}-$${ARCH}-opm ;\
365-
chmod +x $(OPM) ;\
366-
}
367-
else
368-
OPM = $(shell which opm)
369-
endif
370-
endif
330+
@./hack/install-opm.sh
371331

372332
# A comma-separated list of bundle images (e.g. make catalog-build BUNDLE_IMGS=example.com/operator-bundle:v0.1.0,example.com/operator-bundle:v0.2.0).
373333
# These images MUST exist in a registry and be pull-able.

api/go.mod

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
module github.com/ramendr/ramen/api
2+
3+
go 1.20
4+
5+
require (
6+
github.com/stolostron/multicloud-operators-placementrule v1.2.4-1-20220311-8eedb3f.0.20230828200208-cd3c119a7fa0
7+
k8s.io/api v0.29.0
8+
k8s.io/apimachinery v0.29.0
9+
sigs.k8s.io/controller-runtime v0.16.3
10+
)
11+
12+
require (
13+
github.com/beorn7/perks v1.0.1 // indirect
14+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
15+
github.com/davecgh/go-spew v1.1.1 // indirect
16+
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
17+
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
18+
github.com/fsnotify/fsnotify v1.6.0 // indirect
19+
github.com/go-logr/logr v1.3.0 // indirect
20+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
21+
github.com/go-openapi/jsonreference v0.20.2 // indirect
22+
github.com/go-openapi/swag v0.22.3 // indirect
23+
github.com/gogo/protobuf v1.3.2 // indirect
24+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
25+
github.com/golang/protobuf v1.5.3 // indirect
26+
github.com/google/gnostic-models v0.6.8 // indirect
27+
github.com/google/go-cmp v0.6.0 // indirect
28+
github.com/google/gofuzz v1.2.0 // indirect
29+
github.com/google/uuid v1.3.0 // indirect
30+
github.com/imdario/mergo v0.3.12 // indirect
31+
github.com/josharian/intern v1.0.0 // indirect
32+
github.com/json-iterator/go v1.1.12 // indirect
33+
github.com/mailru/easyjson v0.7.7 // indirect
34+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
35+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
36+
github.com/modern-go/reflect2 v1.0.2 // indirect
37+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
38+
github.com/pkg/errors v0.9.1 // indirect
39+
github.com/prometheus/client_golang v1.16.0 // indirect
40+
github.com/prometheus/client_model v0.4.0 // indirect
41+
github.com/prometheus/common v0.44.0 // indirect
42+
github.com/prometheus/procfs v0.10.1 // indirect
43+
github.com/spf13/pflag v1.0.5 // indirect
44+
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
45+
golang.org/x/net v0.17.0 // indirect
46+
golang.org/x/oauth2 v0.10.0 // indirect
47+
golang.org/x/sys v0.13.0 // indirect
48+
golang.org/x/term v0.13.0 // indirect
49+
golang.org/x/text v0.13.0 // indirect
50+
golang.org/x/time v0.3.0 // indirect
51+
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
52+
google.golang.org/appengine v1.6.7 // indirect
53+
google.golang.org/protobuf v1.31.0 // indirect
54+
gopkg.in/inf.v0 v0.9.1 // indirect
55+
gopkg.in/yaml.v2 v2.4.0 // indirect
56+
gopkg.in/yaml.v3 v3.0.1 // indirect
57+
k8s.io/apiextensions-apiserver v0.28.3 // indirect
58+
k8s.io/client-go v12.0.0+incompatible // indirect
59+
k8s.io/component-base v0.28.3 // indirect
60+
k8s.io/klog/v2 v2.110.1 // indirect
61+
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
62+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
63+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
64+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
65+
sigs.k8s.io/yaml v1.3.0 // indirect
66+
)
67+
68+
// replace directives to accommodate for stolostron
69+
replace k8s.io/client-go v12.0.0+incompatible => k8s.io/client-go v0.29.0

0 commit comments

Comments
 (0)