Skip to content

Commit

Permalink
Merge pull request #220 from 3scale-ops/controller-runtime/v0.17.2
Browse files Browse the repository at this point in the history
controller-runtime/v0.17.2
  • Loading branch information
3scale-robot authored Mar 22, 2024
2 parents b52c1c5 + d318db8 commit ff64589
Show file tree
Hide file tree
Showing 36 changed files with 782 additions and 547 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bundle/** linguist-generated=true
bundle.Dockerfile linguist-generated=true
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.12.3
VERSION ?= 0.13.0-alpha.1

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
Expand Down Expand Up @@ -213,7 +213,7 @@ KIND ?= $(LOCALBIN)/kind
## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
CONTROLLER_TOOLS_VERSION ?= v0.11.3
GINKGO_VERSION ?= v2.9.1
GINKGO_VERSION ?= v2.14.0
CRD_REFDOCS_VERSION ?= v0.0.8
KIND_VERSION ?= v0.16.0

Expand Down
15 changes: 8 additions & 7 deletions apis/marin3r/v1alpha1/envoyconfig_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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"
)

// log is for logging in this package.
Expand All @@ -43,25 +44,25 @@ func (r *EnvoyConfig) SetupWebhookWithManager(mgr ctrl.Manager) error {
var _ webhook.Validator = &EnvoyConfig{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *EnvoyConfig) ValidateCreate() error {
func (r *EnvoyConfig) ValidateCreate() (admission.Warnings, error) {
validationlog.Info("ValidateCreate", "type", "EnvoyConfig", "resource", util.ObjectKey(r).String())
if err := r.Validate(); err != nil {
return err
return nil, err
}
return nil
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *EnvoyConfig) ValidateUpdate(old runtime.Object) error {
func (r *EnvoyConfig) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
validationlog.Info("validateUpdate", "type", "EnvoyConfig", "resource", util.ObjectKey(r).String())
if err := r.Validate(); err != nil {
return err
return nil, err
}
return nil
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *EnvoyConfig) ValidateDelete() error { return nil }
func (r *EnvoyConfig) ValidateDelete() (admission.Warnings, error) { return nil, nil }

// Validates the EnvoyConfig resource
func (r *EnvoyConfig) Validate() error {
Expand Down
11 changes: 6 additions & 5 deletions apis/operator.marin3r/v1alpha1/envoydeployment_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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"
)

// log is for logging in this package.
Expand All @@ -38,21 +39,21 @@ func (r *EnvoyDeployment) SetupWebhookWithManager(mgr ctrl.Manager) error {
var _ webhook.Validator = &EnvoyDeployment{}

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

return r.Validate()
return nil, r.Validate()
}

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

return r.Validate()
return nil, r.Validate()
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *EnvoyDeployment) ValidateDelete() error { return nil }
func (r *EnvoyDeployment) ValidateDelete() (admission.Warnings, error) { return nil, nil }

// Validate checks that the spec of the EnvoyDeployment resource is correct
func (r *EnvoyDeployment) Validate() error {
Expand Down
18 changes: 12 additions & 6 deletions apis/operator.marin3r/v1alpha1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/envtest"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"
//+kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -98,12 +100,16 @@ 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: scheme,
WebhookServer: webhook.NewServer(webhook.Options{
Host: webhookInstallOptions.LocalServingHost,
Port: webhookInstallOptions.LocalServingPort,
CertDir: webhookInstallOptions.LocalServingCertDir,
}),
LeaderElection: false,
Metrics: metricsserver.Options{
BindAddress: "0",
},
})
Expect(err).NotTo(HaveOccurred())

Expand Down
3 changes: 1 addition & 2 deletions bundle.Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions bundle/manifests/marin3r.clusterserviceversion.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ff64589

Please sign in to comment.