Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6a7d017
bump version to 1.8.0 (#716)
Daniel-Fan Jul 19, 2021
7c0149e
apply k8s PreserveUnknownFields into API (#702)
Daniel-Fan Jul 19, 2021
80e4524
build(deps): bump golang from 1.15.7 to 1.16.6 (#710)
dependabot[bot] Jul 19, 2021
42f750c
fix: Make probe more loose (#717)
horis233 Jul 20, 2021
00aeb73
change tag back to latest for base image (#685)
Daniel-Fan Jul 21, 2021
96206fc
refactor ODLM cache to use one pattern of design (#721)
Daniel-Fan Jul 27, 2021
c465c79
Get csv even the installPlan requires Approval (#723)
Daniel-Fan Jul 27, 2021
aa1f42c
perf: shorten initial delay of readness probe (#725)
horis233 Jul 27, 2021
1234047
build(deps): bump golang from 1.16.6 to 1.16.7 (#728)
dependabot[bot] Aug 6, 2021
a56e18d
opt-in of ubi base image automated builds (#727)
Daniel-Fan Aug 6, 2021
63f28d4
add relatedImages to operator CSV (#729)
Daniel-Fan Aug 16, 2021
c932ad9
fix base image file name (#732)
Daniel-Fan Aug 16, 2021
629ce42
bump version to 1.9.0 (#734)
Daniel-Fan Aug 17, 2021
6c84aaa
make operatorconfig optional (#733)
ZhuoxiLi Aug 17, 2021
bbc66c8
build(deps): bump golang from 1.16.7 to 1.17.0 (#735)
dependabot[bot] Aug 18, 2021
31f741f
build: bump k8s dependencies to 1.21 (#736)
horis233 Aug 19, 2021
d687e09
fix: Operator only reconciles when watched subscriptions are updated.…
horis233 Aug 23, 2021
23d4afb
Enable Subscription config in OperandRegistry (#738)
horis233 Aug 23, 2021
816e14e
Trigger build with new base image
Aug 25, 2021
20dadf4
Trigger build with new base image
Aug 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
build: bump k8s dependencies to 1.21 (#736)
* build: bump k8s dependencies to 1.21

* Download tools locally

* disable package verification

* unset GOSUMDB
  • Loading branch information
horis233 authored Aug 19, 2021
commit 31f741f6a41be66877d3307ef4cc52dcb1c1fbcd
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*.dylib
bin
testbin
testcrds

# Test binary, build with `go test -c`
*.test
Expand Down
31 changes: 13 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
# Dependence tools
KUBECTL ?= $(shell which kubectl)
OPERATOR_SDK ?= $(shell which operator-sdk)
CONTROLLER_GEN ?= $(shell which controller-gen)
KUSTOMIZE ?= $(shell which kustomize)
OPM ?= $(shell which opm)
KIND ?= $(shell which kind)

ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
ENVCRDS_DIR=$(shell pwd)/testcrds

# Specify whether this repo is build locally or not, default values is '1';
# If set to 1, then you need to also set 'DOCKER_USERNAME' and 'DOCKER_PASSWORD'
Expand Down Expand Up @@ -160,14 +157,13 @@ generate-all: manifests kustomize operator-sdk ## Generate bundle manifests, met

##@ Test

test: ## Run unit test on prow
test: setup-envtest ## Run unit test on prow
@echo "Running unit tests for the controllers."
@mkdir -p ${ENVTEST_ASSETS_DIR}
@test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh \
|| curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/release-0.6/hack/setup-envtest.sh
@test -d ${ENVTEST_ASSETS_DIR}/crds || make fetch-test-crds
@source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); OPERATOR_NAMESPACE="ibm-operators" go test ./controllers/... -coverprofile cover.out
@rm -rf ${ENVTEST_ASSETS_DIR}
@mkdir -p ${ENVCRDS_DIR}
@make fetch-test-crds
@$(ENVTEST) use 1.21
@OPERATOR_NAMESPACE="ibm-operators" go test ./controllers/... -coverprofile cover.out
@rm -rf ${ENVCRDS_DIR}


unit-test: generate code-fmt code-vet manifests ## Run unit test
Expand All @@ -179,14 +175,13 @@ e2e-test:

e2e-test-kind: build-test-operator-image kind-start kind-load-img deploy-e2e e2e-test kind-delete

coverage: ## Run code coverage test
coverage: setup-envtest ## Run code coverage test
@echo "Running unit tests for the controllers."
@mkdir -p ${ENVTEST_ASSETS_DIR}
@test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh \
|| curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/master/hack/setup-envtest.sh
@test -d ${ENVTEST_ASSETS_DIR}/crds || make fetch-test-crds
@source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); OPERATOR_NAMESPACE="ibm-operators" common/scripts/codecov.sh ${BUILD_LOCALLY} "controllers"
@rm -rf ${ENVTEST_ASSETS_DIR}
@mkdir -p ${ENVCRDS_DIR}
@make fetch-test-crds
@$(ENVTEST) use 1.21
OPERATOR_NAMESPACE="ibm-operators" common/scripts/codecov.sh ${BUILD_LOCALLY} "controllers"
@rm -rf ${ENVCRDS_DIR}

scorecard: operator-sdk ## Run scorecard test
@echo ... Running the scorecard test
Expand Down
94 changes: 43 additions & 51 deletions common/Makefile.common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -53,77 +53,53 @@ ifeq (, $(wildcard /usr/local/kubebuilder))
@./common/scripts/install-kubebuilder.sh
endif

# find or download controller-gen
# download controller-gen if necessary
controller-gen:
ifeq (, $(CONTROLLER_GEN))
@{ \
set -e ;\
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/[email protected] ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
# find or download opm
# download opm if necessary
opm:
ifeq (,$(OPM))
@./common/scripts/install-opm.sh
endif

fetch-test-crds:
@{ \
curl -L -O "https://github.com/operator-framework/api/archive/v${OLM_API_VERSION}.tar.gz" ;\
tar -zxf v${OLM_API_VERSION}.tar.gz api-${OLM_API_VERSION}/crds && mv api-${OLM_API_VERSION}/crds ${ENVTEST_ASSETS_DIR}/crds ;\
tar -zxf v${OLM_API_VERSION}.tar.gz api-${OLM_API_VERSION}/crds && mv api-${OLM_API_VERSION}/crds/* ${ENVCRDS_DIR} ;\
rm -rf api-${OLM_API_VERSION} v${OLM_API_VERSION}.tar.gz ;\
}
@{ \
curl -L -O "https://github.com/horis233/jenkins-operator/archive/v0.3.3.tar.gz" ;\
tar -zxf v0.3.3.tar.gz jenkins-operator-0.3.3/deploy/crds && mv jenkins-operator-0.3.3/deploy/crds/jenkins_v1alpha2_jenkins_crd.yaml ${ENVTEST_ASSETS_DIR}/crds/jenkins_v1alpha2_jenkins_crd.yaml ;\
tar -zxf v0.3.3.tar.gz jenkins-operator-0.3.3/deploy/crds && mv jenkins-operator-0.3.3/deploy/crds/jenkins_v1alpha2_jenkins_crd.yaml ${ENVCRDS_DIR}/jenkins_v1alpha2_jenkins_crd.yaml ;\
rm -rf jenkins-operator-0.3.3 v0.3.3.tar.gz ;\
}
@{ \
curl -L -O "https://github.com/horis233/etcd-operator/archive/v0.9.4-crd.tar.gz" ;\
tar -zxf v0.9.4-crd.tar.gz etcd-operator-0.9.4-crd/deploy/crds && mv etcd-operator-0.9.4-crd/deploy/crds/etcdclusters.etcd.database.coreos.com.crd.yaml ${ENVTEST_ASSETS_DIR}/crds/etcdclusters.etcd.database.coreos.com.crd.yaml ;\
tar -zxf v0.9.4-crd.tar.gz etcd-operator-0.9.4-crd/deploy/crds && mv etcd-operator-0.9.4-crd/deploy/crds/etcdclusters.etcd.database.coreos.com.crd.yaml ${ENVCRDS_DIR}/etcdclusters.etcd.database.coreos.com.crd.yaml ;\
rm -rf etcd-operator-0.9.4-crd v0.9.4-crd.tar.gz ;\
}
@{ \
curl -L -O "https://github.com/IBM/ibm-namespace-scope-operator/archive/v${NAMESPACESCOPE_VERSION}.tar.gz" ;\
tar -zxf v${NAMESPACESCOPE_VERSION}.tar.gz ibm-namespace-scope-operator-${NAMESPACESCOPE_VERSION}/bundle/manifests && mv ibm-namespace-scope-operator-${NAMESPACESCOPE_VERSION}/bundle/manifests/operator.ibm.com_namespacescopes.yaml ${ENVTEST_ASSETS_DIR}/crds/operator.ibm.com_namespacescopes.yaml ;\
tar -zxf v${NAMESPACESCOPE_VERSION}.tar.gz ibm-namespace-scope-operator-${NAMESPACESCOPE_VERSION}/bundle/manifests && mv ibm-namespace-scope-operator-${NAMESPACESCOPE_VERSION}/bundle/manifests/operator.ibm.com_namespacescopes.yaml ${ENVCRDS_DIR}/operator.ibm.com_namespacescopes.yaml ;\
rm -rf ibm-namespace-scope-operator-${NAMESPACESCOPE_VERSION} v${NAMESPACESCOPE_VERSION}.tar.gz ;\
}

# find or download kustomize
# download kustomize if necessary
kustomize:
ifeq (, $(KUSTOMIZE))
@{ \
set -e ;\
KUSTOMIZE_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$KUSTOMIZE_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/kustomize/kustomize/[email protected] ;\
rm -rf $$KUSTOMIZE_GEN_TMP_DIR ;\
}
KUSTOMIZE=$(GOBIN)/kustomize
endif

kind:
ifeq (, $(KIND))
@{ \
set -e ;\
ZEN_TMP_DIR=$$(mktemp -d) ;\
cd $$ZEN_TMP_DIR ;\
go mod init tmp ;\
GO111MODULE=on go get sigs.k8s.io/[email protected] ;\
rm -rf $$ZEN_TMP_DIR ;\
}
KIND=$(GOBIN)/kind
endif
CONTROLLER_GEN ?= $(shell pwd)/common/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])

opm:
ifeq (,$(OPM))
@./common/scripts/install-opm.sh
endif
KUSTOMIZE ?= $(shell pwd)/common/bin/kustomize
kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])

KIND ?= $(shell pwd)/common/bin/kind
kind: ## Download kind locally if necessary.
$(call go-get-tool,$(KIND),sigs.k8s.io/[email protected])

ENVTEST = $(shell pwd)/common/bin/setup-envtest
setup-envtest: ## Download envtest-setup locally if necessary.
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)

FINDFILES=find . \( -path ./.git -o -path ./.github -o -path ./testbin \) -prune -o -type f
FINDFILES=find . \( -path ./.git -o -path ./.github -o -path ./testcrds \) -prune -o -type f
XARGS = xargs -0 ${XARGS_FLAGS}
CLEANXARGS = xargs ${XARGS_FLAGS}

Expand All @@ -139,16 +115,32 @@ lint-all: lint-copyright-banner lint-go
# Run go vet for this project. More info: https://golang.org/cmd/vet/
code-vet:
@echo go vet
go vet $$(go list ./... | grep -v /testbin)
go vet $$(go list ./...)

# Run go fmt for this project
code-fmt:
@echo go fmt
go fmt $$(go list ./... | grep -v /testbin)
go fmt $$(go list ./...)

# Run go mod tidy to update dependencies
code-tidy:
@echo go mod tidy
go mod tidy -v

.PHONY: code-vet code-fmt code-tidy code-gen lint-copyright-banner lint-go lint-all config-docker operator-sdk kube-builder opm controller-gen fetch-test-crds kustomize kind
# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
unset GOSUMDB ;\
go env -w GOSUMDB=off ;\
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef

.PHONY: code-vet code-fmt code-tidy code-gen lint-copyright-banner lint-go lint-all config-docker operator-sdk kube-builder opm setup-envtest controller-gen fetch-test-crds kustomize kind
2 changes: 1 addition & 1 deletion controllers/namespacescope/namespacescope_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var _ = BeforeSuite(func(done Done) {
By("bootstrapping test environment")
testEnv = &envtest.Environment{
UseExistingCluster: UseExistingCluster(),
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases"), filepath.Join("../..", "testbin", "crds"),
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases"), filepath.Join("../..", "testcrds"),
filepath.Join("../..", "config", "crd", "namespacescope")},
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/operandbindinfo/operandbindinfo_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ var _ = BeforeSuite(func(done Done) {
By("bootstrapping test environment")
testEnv = &envtest.Environment{
UseExistingCluster: UseExistingCluster(),
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases"), filepath.Join("../..", "testbin", "crds")},
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases"), filepath.Join("../..", "testcrds")},
}

var err error
Expand Down
2 changes: 1 addition & 1 deletion controllers/operandconfig/operandconfig_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var _ = BeforeSuite(func(done Done) {
By("bootstrapping test environment")
testEnv = &envtest.Environment{
UseExistingCluster: UseExistingCluster(),
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases"), filepath.Join("../..", "testbin", "crds")},
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases"), filepath.Join("../..", "testcrds")},
}

var err error
Expand Down
2 changes: 1 addition & 1 deletion controllers/operandregistry/operandregistry_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ var _ = BeforeSuite(func(done Done) {
By("bootstrapping test environment")
testEnv = &envtest.Environment{
UseExistingCluster: UseExistingCluster(),
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases"), filepath.Join("../..", "testbin", "crds")},
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases"), filepath.Join("../..", "testcrds")},
}

var err error
Expand Down
2 changes: 1 addition & 1 deletion controllers/operandrequest/operandrequest_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var _ = BeforeSuite(func(done Done) {
By("bootstrapping test environment")
testEnv = &envtest.Environment{
UseExistingCluster: UseExistingCluster(),
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases"), filepath.Join("../..", "testbin", "crds")},
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases"), filepath.Join("../..", "testcrds")},
}

var err error
Expand Down
2 changes: 1 addition & 1 deletion controllers/operandrequest/reconcile_operand.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (r *Reconciler) reconcileOperand(ctx context.Context, requestInstance *oper
}
} else if apierrors.IsNotFound(err) {
klog.Infof("Not Found OperandConfig: %s/%s", operand.Name, err)
} else if err != nil {
} else {
merr.Add(errors.Wrapf(err, "failed to get the OperandConfig %s", registryKey.String()))
continue
}
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ require (
github.com/IBM/ibm-namespace-scope-operator v1.0.0-alpha
github.com/coreos/etcd-operator v0.9.4
github.com/deckarep/golang-set v1.7.1
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.14.0
github.com/operator-framework/api v0.6.2
github.com/operator-framework/operator-lifecycle-manager v0.17.0
github.com/pkg/errors v0.9.1
k8s.io/api v0.20.5
k8s.io/apimachinery v0.20.5
k8s.io/client-go v0.20.5
k8s.io/api v0.21.3
k8s.io/apimachinery v0.21.3
k8s.io/client-go v0.21.3
k8s.io/klog v1.0.0
sigs.k8s.io/controller-runtime v0.8.0
sigs.k8s.io/controller-runtime v0.9.6
sigs.k8s.io/kubebuilder v1.0.9-0.20200805184228-f7a3b65dd250
)

Expand Down
Loading