Skip to content

Commit

Permalink
Merge pull request #111 from razo7/update-tools-apis-24.1
Browse files Browse the repository at this point in the history
Update Tools & APIs
  • Loading branch information
openshift-merge-bot[bot] authored Jan 16, 2024
2 parents db8546f + 8392799 commit 761b790
Show file tree
Hide file tree
Showing 1,676 changed files with 119,406 additions and 79,648 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
# See https://github.com/kubernetes-sigs/kustomize for the last version
KUSTOMIZE_VERSION ?= [email protected]
# https://github.com/kubernetes-sigs/controller-tools/releases for the last version
CONTROLLER_GEN_VERSION ?= v0.12.0
CONTROLLER_GEN_VERSION ?= v0.14.0
# See https://pkg.go.dev/sigs.k8s.io/controller-runtime/tools/setup-envtest?tab=versions for the last version
ENVTEST_VERSION ?= v0.0.0-20230307042619-c304e7ec2ee7
ENVTEST_VERSION ?= v0.0.0-20240112123317-48d9a7b44e54
# See https://pkg.go.dev/golang.org/x/tools/cmd/goimports?tab=versions for the last version
GOIMPORTS_VERSION ?= v0.10.0
GOIMPORTS_VERSION ?= v0.17.0
# See https://github.com/onsi/ginkgo/releases for the last version
GINKGO_VERSION ?= v2.11.0
GINKGO_VERSION ?= v2.14.0
# See github.com/operator-framework/operator-registry/releases for the last version
OPM_VERSION ?= v1.28.0
OPM_VERSION ?= v1.35.0
# See github.com/operator-framework/operator-sdk/releases for the last version
OPERATOR_SDK_VERSION ?= v1.30.0
OPERATOR_SDK_VERSION ?= v1.32.0
# GO_VERSION refers to the version of Golang to be downloaded when running dockerized version
GO_VERSION = 1.20
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.26
ENVTEST_K8S_VERSION = 1.28
# See https://github.com/slintes/sort-imports/releases for the last version
SORT_IMPORTS_VERSION = v0.2.1

Expand Down
19 changes: 10 additions & 9 deletions api/v1beta1/nodemaintenance_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

const (
Expand Down Expand Up @@ -76,33 +77,33 @@ func (r *NodeMaintenance) SetupWebhookWithManager(mgr ctrl.Manager) error {
var _ webhook.Validator = &NodeMaintenance{}

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

if validator == nil {
return fmt.Errorf("nodemaintenance validator isn't initialized yet")
return nil, fmt.Errorf("nodemaintenance validator isn't initialized yet")
}
return validator.ValidateCreate(r)
return nil, validator.ValidateCreate(r)
}

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

if validator == nil {
return fmt.Errorf("nodemaintenance validator isn't initialized yet")
return nil, fmt.Errorf("nodemaintenance validator isn't initialized yet")
}
return validator.ValidateUpdate(r, old.(*NodeMaintenance))
return nil, validator.ValidateUpdate(r, old.(*NodeMaintenance))
}

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

if validator == nil {
return fmt.Errorf("nodemaintenance validator isn't initialized yet")
return nil, fmt.Errorf("nodemaintenance validator isn't initialized yet")
}
return nil
return nil, nil
}

func (v *NodeMaintenanceValidator) ValidateCreate(nm *NodeMaintenance) error {
Expand Down
15 changes: 9 additions & 6 deletions api/v1beta1/nodemaintenance_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var _ = Describe("NodeMaintenance Validation", func() {

It("should be rejected", func() {
nm := getTestNMO(nonExistingNodeName)
err := nm.ValidateCreate()
_, err := nm.ValidateCreate()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring(ErrorNodeNotExists, nonExistingNodeName))
})
Expand Down Expand Up @@ -71,7 +71,8 @@ var _ = Describe("NodeMaintenance Validation", func() {
It("should be rejected", func() {
nm := getTestNMO(existingNodeName)
Eventually(func() error {
return nm.ValidateCreate()
_, err := nm.ValidateCreate()
return err
}, time.Second, 200*time.Millisecond).Should(And(
HaveOccurred(),
WithTransform(func(err error) string { return err.Error() }, ContainSubstring(ErrorNodeMaintenanceExists, existingNodeName)),
Expand Down Expand Up @@ -112,7 +113,7 @@ var _ = Describe("NodeMaintenance Validation", func() {

It("should be rejected", func() {
nm := getTestNMO(existingNodeName)
err := nm.ValidateCreate()
_, err := nm.ValidateCreate()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring(ErrorControlPlaneQuorumViolation))
})
Expand Down Expand Up @@ -141,7 +142,8 @@ var _ = Describe("NodeMaintenance Validation", func() {
It("should not be rejected", func() {
nm := getTestNMO(existingNodeName)
Eventually(func() error {
return nm.ValidateCreate()
_, err := nm.ValidateCreate()
return err
}, time.Second, 200*time.Millisecond).ShouldNot(HaveOccurred())
})

Expand All @@ -152,7 +154,8 @@ var _ = Describe("NodeMaintenance Validation", func() {
It("should not be rejected", func() {
nm := getTestNMO(existingNodeName)
Eventually(func() error {
return nm.ValidateCreate()
_, err := nm.ValidateCreate()
return err
}, time.Second, 200*time.Millisecond).ShouldNot(HaveOccurred())
})

Expand All @@ -168,7 +171,7 @@ var _ = Describe("NodeMaintenance Validation", func() {
It("should be rejected", func() {
nmOld := getTestNMO(existingNodeName)
nm := getTestNMO("newNodeName")
err := nm.ValidateUpdate(nmOld)
_, err := nm.ValidateUpdate(nmOld)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring(ErrorNodeNameUpdateForbidden))
})
Expand Down
15 changes: 9 additions & 6 deletions api/v1beta1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,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"
)

// These tests use Ginkgo (BDD-style Go testing framework). Refer to
Expand Down Expand Up @@ -98,12 +100,13 @@ 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
2 changes: 1 addition & 1 deletion bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=node-maintenance-operator
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.30.0
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.32.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ metadata:
olm.skipRange: '>=0.12.0'
operatorframework.io/suggested-namespace: openshift-workload-availability
operatorframework.io/suggested-namespace-template: '{"kind":"Namespace","apiVersion":"v1","metadata":{"name":"openshift-workload-availability","annotations":{"openshift.io/node-selector":""}}}'
operators.operatorframework.io/builder: operator-sdk-v1.30.0
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/medik8s/node-maintenance-operator
support: Medik8s
Expand Down
19 changes: 12 additions & 7 deletions bundle/manifests/nodemaintenance.medik8s.io_nodemaintenances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.14.0
creationTimestamp: null
labels:
node-maintenance-operator: ""
Expand All @@ -24,14 +24,19 @@ spec:
description: NodeMaintenance is the Schema for the nodemaintenances API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand Down
2 changes: 1 addition & 1 deletion bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ annotations:
operators.operatorframework.io.bundle.package.v1: node-maintenance-operator
operators.operatorframework.io.bundle.channels.v1: stable
operators.operatorframework.io.bundle.channel.default.v1: stable
operators.operatorframework.io.metrics.builder: operator-sdk-v1.30.0
operators.operatorframework.io.metrics.builder: operator-sdk-v1.32.0
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3

Expand Down
12 changes: 6 additions & 6 deletions bundle/tests/scorecard/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ stages:
- entrypoint:
- scorecard-test
- basic-check-spec
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: basic
test: basic-check-spec-test
Expand All @@ -18,7 +18,7 @@ stages:
- entrypoint:
- scorecard-test
- olm-bundle-validation
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: olm
test: olm-bundle-validation-test
Expand All @@ -28,7 +28,7 @@ stages:
- entrypoint:
- scorecard-test
- olm-crds-have-validation
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: olm
test: olm-crds-have-validation-test
Expand All @@ -38,7 +38,7 @@ stages:
- entrypoint:
- scorecard-test
- olm-crds-have-resources
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: olm
test: olm-crds-have-resources-test
Expand All @@ -48,7 +48,7 @@ stages:
- entrypoint:
- scorecard-test
- olm-spec-descriptors
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: olm
test: olm-spec-descriptors-test
Expand All @@ -58,7 +58,7 @@ stages:
- entrypoint:
- scorecard-test
- olm-status-descriptors
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: olm
test: olm-status-descriptors-test
Expand Down
19 changes: 12 additions & 7 deletions config/crd/bases/nodemaintenance.medik8s.io_nodemaintenances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.14.0
name: nodemaintenances.nodemaintenance.medik8s.io
spec:
group: nodemaintenance.medik8s.io
Expand All @@ -22,14 +22,19 @@ spec:
description: NodeMaintenance is the Schema for the nodemaintenances API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand Down
2 changes: 1 addition & 1 deletion config/scorecard/patches/basic.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
entrypoint:
- scorecard-test
- basic-check-spec
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: basic
test: basic-check-spec-test
10 changes: 5 additions & 5 deletions config/scorecard/patches/olm.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
entrypoint:
- scorecard-test
- olm-bundle-validation
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: olm
test: olm-bundle-validation-test
Expand All @@ -14,7 +14,7 @@
entrypoint:
- scorecard-test
- olm-crds-have-validation
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: olm
test: olm-crds-have-validation-test
Expand All @@ -24,7 +24,7 @@
entrypoint:
- scorecard-test
- olm-crds-have-resources
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: olm
test: olm-crds-have-resources-test
Expand All @@ -34,7 +34,7 @@
entrypoint:
- scorecard-test
- olm-spec-descriptors
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: olm
test: olm-spec-descriptors-test
Expand All @@ -44,7 +44,7 @@
entrypoint:
- scorecard-test
- olm-status-descriptors
image: quay.io/operator-framework/scorecard-test:v1.30.0
image: quay.io/operator-framework/scorecard-test:v1.32.0
labels:
suite: olm
test: olm-status-descriptors-test
5 changes: 3 additions & 2 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ 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"

nodemaintenancev1beta1 "github.com/medik8s/node-maintenance-operator/api/v1beta1"
//+kubebuilder:scaffold:imports
Expand Down Expand Up @@ -79,8 +80,8 @@ func startTestEnv() {
Expect(k8sClient).NotTo(BeNil())

k8sManager, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme.Scheme,
MetricsBindAddress: "0",
Scheme: scheme.Scheme,
Metrics: metricsServer.Options{BindAddress: "0"},
})
Expect(err).ToNot(HaveOccurred())

Expand Down
Loading

0 comments on commit 761b790

Please sign in to comment.