Skip to content

Commit

Permalink
Merge pull request #651 from bshephar/controller-runtime-update
Browse files Browse the repository at this point in the history
Update controller-runtime and dependencies
  • Loading branch information
openshift-merge-bot[bot] authored Feb 15, 2024
2 parents b11d885 + ce810eb commit 1561059
Show file tree
Hide file tree
Showing 18 changed files with 692 additions and 830 deletions.
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build_root_image:
name: tools
namespace: openstack-k8s-operators
tag: ci-build-root-golang-1.19-sdk-1.31
tag: ci-build-root-golang-1.20-sdk-1.31
2 changes: 1 addition & 1 deletion .github/workflows/build-openstack-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: openstack-k8s-operators/openstack-k8s-operators-ci/.github/workflows/reusable-build-operator.yaml@main
with:
operator_name: openstack
go_version: 1.19.x
go_version: 1.20.x
operator_sdk_version: 1.31.0
bundle_dockerfile: ./custom-bundle.Dockerfile
catalog_extra_bundles_script: ./hack/pin-bundle-images.sh
Expand Down
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOLANG_BUILDER=golang:1.19
ARG GOLANG_BUILDER=golang:1.20
ARG OPERATOR_BASE_IMAGE=gcr.io/distroless/static:nonroot

# Build the manager binary
Expand Down Expand Up @@ -47,12 +47,12 @@ ARG IMAGE_TAGS="cn-openstack openstack"

# Labels required by upstream and osbs build system
LABEL com.redhat.component="${IMAGE_COMPONENT}" \
name="${IMAGE_NAME}" \
version="${IMAGE_VERSION}" \
summary="${IMAGE_SUMMARY}" \
io.k8s.name="${IMAGE_NAME}" \
io.k8s.description="${IMAGE_DESC}" \
io.openshift.tags="${IMAGE_TAGS}"
name="${IMAGE_NAME}" \
version="${IMAGE_VERSION}" \
summary="${IMAGE_SUMMARY}" \
io.k8s.name="${IMAGE_NAME}" \
io.k8s.description="${IMAGE_DESC}" \
io.openshift.tags="${IMAGE_TAGS}"
### DO NOT EDIT LINES ABOVE

ENV USER_UID=$USER_ID
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ OPERATOR_SDK_VERSION ?= v1.31.0
DEFAULT_IMG ?= quay.io/openstack-k8s-operators/openstack-operator:latest
IMG ?= $(DEFAULT_IMG)
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.25.0
ENVTEST_K8S_VERSION = 1.28.0

CRDDESC_OVERRIDE ?= :maxDescLen=0

Expand Down
171 changes: 115 additions & 56 deletions apis/bases/core.openstack.org_openstackcontrolplanes.yaml

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions apis/client/v1beta1/openstackclient_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// OpenStackClientDefaults -
Expand Down Expand Up @@ -73,25 +74,25 @@ func (spec *OpenStackClientSpec) Default() {
var _ webhook.Validator = &OpenStackClient{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *OpenStackClient) ValidateCreate() error {
func (r *OpenStackClient) ValidateCreate() (admission.Warnings, error) {
openstackclientlog.Info("validate create", "name", r.Name)

// TODO(user): fill in your validation logic upon object creation.
return nil
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *OpenStackClient) ValidateUpdate(old runtime.Object) error {
func (r *OpenStackClient) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
openstackclientlog.Info("validate update", "name", r.Name)

// TODO(user): fill in your validation logic upon object update.
return nil
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *OpenStackClient) ValidateDelete() error {
func (r *OpenStackClient) ValidateDelete() (admission.Warnings, error) {
openstackclientlog.Info("validate delete", "name", r.Name)

// TODO(user): fill in your validation logic upon object deletion.
return nil
return nil, nil
}
38 changes: 26 additions & 12 deletions apis/client/v1beta1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
. "github.com/onsi/gomega"

admissionv1beta1 "k8s.io/api/admission/v1beta1"
kscheme "k8s.io/client-go/kubernetes/scheme"

//+kubebuilder:scaffold:imports
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
Expand All @@ -34,16 +36,21 @@ import (
"sigs.k8s.io/controller-runtime/pkg/envtest"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/webhook"

metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
)

// These tests use Ginkgo (BDD-style Go testing framework). Refer to
// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.

var cfg *rest.Config
var k8sClient client.Client
var testEnv *envtest.Environment
var ctx context.Context
var cancel context.CancelFunc
var (
cfg *rest.Config
k8sClient client.Client
testEnv *envtest.Environment
ctx context.Context
cancel context.CancelFunc
)

func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)
Expand Down Expand Up @@ -87,12 +94,20 @@ var _ = BeforeSuite(func() {
// start webhook server using Manager
webhookInstallOptions := &testEnv.WebhookInstallOptions
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme,
Host: webhookInstallOptions.LocalServingHost,
Port: webhookInstallOptions.LocalServingPort,
CertDir: webhookInstallOptions.LocalServingCertDir,
LeaderElection: false,
MetricsBindAddress: "0",
Scheme: kscheme.Scheme,
// NOTE(gibi): disable metrics reporting in test to allow
// parallel test execution. Otherwise each instance would like to
// bind to the same port
Metrics: metricsserver.Options{
BindAddress: "0",
},
WebhookServer: webhook.NewServer(
webhook.Options{
Host: webhookInstallOptions.LocalServingHost,
Port: webhookInstallOptions.LocalServingPort,
CertDir: webhookInstallOptions.LocalServingCertDir,
}),
LeaderElection: false,
})
Expect(err).NotTo(HaveOccurred())

Expand All @@ -118,7 +133,6 @@ var _ = BeforeSuite(func() {
conn.Close()
return nil
}).Should(Succeed())

})

var _ = AfterSuite(func() {
Expand Down
20 changes: 10 additions & 10 deletions apis/core/v1beta1/openstackcontrolplane_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// OpenStackControlPlaneDefaults -
Expand Down Expand Up @@ -56,7 +57,7 @@ func (r *OpenStackControlPlane) SetupWebhookWithManager(mgr ctrl.Manager) error
var _ webhook.Validator = &OpenStackControlPlane{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *OpenStackControlPlane) ValidateCreate() error {
func (r *OpenStackControlPlane) ValidateCreate() (admission.Warnings, error) {
openstackcontrolplanelog.Info("validate create", "name", r.Name)

var allErrs field.ErrorList
Expand All @@ -66,21 +67,21 @@ func (r *OpenStackControlPlane) ValidateCreate() error {
}

if len(allErrs) != 0 {
return apierrors.NewInvalid(
return nil, apierrors.NewInvalid(
schema.GroupKind{Group: "core.openstack.org", Kind: "OpenStackControlPlane"},
r.Name, allErrs)
}

return nil
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *OpenStackControlPlane) ValidateUpdate(old runtime.Object) error {
func (r *OpenStackControlPlane) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
openstackcontrolplanelog.Info("validate update", "name", r.Name)

oldControlPlane, ok := old.(*OpenStackControlPlane)
if !ok || oldControlPlane == nil {
return apierrors.NewInternalError(fmt.Errorf("unable to convert existing object"))
return nil, apierrors.NewInternalError(fmt.Errorf("unable to convert existing object"))
}

var allErrs field.ErrorList
Expand All @@ -90,24 +91,23 @@ func (r *OpenStackControlPlane) ValidateUpdate(old runtime.Object) error {
}

if len(allErrs) != 0 {
return apierrors.NewInvalid(
return nil, apierrors.NewInvalid(
schema.GroupKind{Group: "core.openstack.org", Kind: "OpenStackControlPlane"},
r.Name, allErrs)
}

return nil
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *OpenStackControlPlane) ValidateDelete() error {
func (r *OpenStackControlPlane) ValidateDelete() (admission.Warnings, error) {
openstackcontrolplanelog.Info("validate delete", "name", r.Name)

return nil
return nil, nil
}

// checkDepsEnabled - returns a non-empty string if required services are missing (disabled) for "name" service
func (r *OpenStackControlPlane) checkDepsEnabled(name string) string {

// "msg" will hold any dependency validation error we might find
msg := ""
// "reqs" will be set to the required services for "name" service
Expand Down
118 changes: 55 additions & 63 deletions apis/go.mod
Original file line number Diff line number Diff line change
@@ -1,112 +1,104 @@
module github.com/openstack-k8s-operators/openstack-operator/apis

go 1.19
go 1.20

require (
github.com/onsi/ginkgo/v2 v2.14.0
github.com/onsi/gomega v1.30.0
github.com/openstack-k8s-operators/barbican-operator/api v0.0.0-20240205082437-655a181feae0
github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20240207124115-6572d1bc92c9
github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20240205082155-620a93388acf
github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20240206110918-d3646fda9535
github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20240205114610-35cd4930ad3b
github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20240205092507-ddc6aa0dcf47
github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20240205163532-e4efedde5776
github.com/openstack-k8s-operators/ironic-operator/api v0.3.1-0.20240202131833-8b6a4ca3bdc5
github.com/openstack-k8s-operators/keystone-operator/api v0.3.1-0.20240202140528-34883c60812b
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20240129151020-c9467a8fbbfc
github.com/openstack-k8s-operators/manila-operator/api v0.3.1-0.20240212073017-91c953f42846
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240201121152-3dcb5d5b24f7
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240205081907-ca38cd1c0fd7
github.com/openstack-k8s-operators/nova-operator/api v0.3.1-0.20240206080218-0a39e8ee1c07
github.com/openstack-k8s-operators/octavia-operator/api v0.3.1-0.20240205082155-fca054830e06
github.com/openstack-k8s-operators/ovn-operator/api v0.3.1-0.20240206110402-41e2d7f8870e
github.com/openstack-k8s-operators/placement-operator/api v0.3.1-0.20240209144511-533e51daa424
github.com/openstack-k8s-operators/swift-operator/api v0.3.1-0.20240206105420-de58be701128
github.com/openstack-k8s-operators/telemetry-operator/api v0.3.1-0.20240205163246-3add3edb159c
github.com/openstack-k8s-operators/barbican-operator/api v0.0.0-20240215104355-15c0bf58484e
github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20240215104410-018f30fae19d
github.com/openstack-k8s-operators/designate-operator/api v0.0.0-20240215100610-bb5d6ca25ab6
github.com/openstack-k8s-operators/glance-operator/api v0.3.1-0.20240215100236-2171e1054c96
github.com/openstack-k8s-operators/heat-operator/api v0.3.1-0.20240215094429-f61fb5c56095
github.com/openstack-k8s-operators/horizon-operator/api v0.3.1-0.20240215094438-6ce4220335c2
github.com/openstack-k8s-operators/infra-operator/apis v0.3.1-0.20240214153927-179defb96a33
github.com/openstack-k8s-operators/ironic-operator/api v0.3.1-0.20240215100551-d4f47335d87e
github.com/openstack-k8s-operators/keystone-operator/api v0.3.1-0.20240215143819-e3820696d660
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20240214144842-5dcac51e5b36
github.com/openstack-k8s-operators/manila-operator/api v0.3.1-0.20240215104417-c6d1b337f267
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240215091212-cbf2ad281f43
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240215104837-f2f7715f20b4
github.com/openstack-k8s-operators/nova-operator/api v0.3.1-0.20240215094959-ae7ad704ab84
github.com/openstack-k8s-operators/octavia-operator/api v0.3.1-0.20240215100511-492a87cdffa3
github.com/openstack-k8s-operators/ovn-operator/api v0.3.1-0.20240215101225-3b8e40e6879d
github.com/openstack-k8s-operators/placement-operator/api v0.3.1-0.20240215095019-608567b1a0f1
github.com/openstack-k8s-operators/swift-operator/api v0.3.1-0.20240215100245-513a47c8f96f
github.com/openstack-k8s-operators/telemetry-operator/api v0.3.1-0.20240215101232-18efcbf25ef5
github.com/rabbitmq/cluster-operator/v2 v2.5.0
k8s.io/apimachinery v0.27.7
sigs.k8s.io/controller-runtime v0.15.1
k8s.io/apimachinery v0.28.6
sigs.k8s.io/controller-runtime v0.16.4
)

require (
github.com/go-logr/zapr v1.2.4 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/pprof v0.0.0-20230510103437-eeec1cb781c3 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.64.1-rhobs3 // indirect
github.com/rhobs/observability-operator v0.0.20 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
golang.org/x/tools v0.17.0 // indirect
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
golang.org/x/tools v0.18.0 // indirect
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.4 // indirect
github.com/go-openapi/swag v0.22.9 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gophercloud/gophercloud v1.8.0 // indirect
github.com/gophercloud/gophercloud v1.9.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/openshift/api v3.9.0+incompatible // indirect
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.3.1-0.20240129151020-c9467a8fbbfc //indirect
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20240129151020-c9467a8fbbfc
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.3.1-0.20240214144842-5dcac51e5b36 //indirect
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20240214144842-5dcac51e5b36
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.0 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.46.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/time v0.5.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.27.7
k8s.io/apiextensions-apiserver v0.27.7 //indirect
k8s.io/client-go v0.27.7
k8s.io/component-base v0.27.7 //indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230525220651-2546d827e515 //indirect
k8s.io/api v0.28.6
k8s.io/apiextensions-apiserver v0.28.3 //indirect
k8s.io/client-go v0.28.6
k8s.io/component-base v0.28.3 //indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240209001042-7a0d5b415232 //indirect
k8s.io/utils v0.0.0-20240102154912-e7106e64919e //indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd //indirect
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace ( //allow-merging
// pin to k8s 0.26.x for now
k8s.io/api => k8s.io/api v0.26.9
k8s.io/apimachinery => k8s.io/apimachinery v0.26.9
k8s.io/client-go => k8s.io/client-go v0.26.9
sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.14.6
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

// mschuppert: map to latest commit from release-4.13 tag
Expand Down
Loading

0 comments on commit 1561059

Please sign in to comment.