Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency updates + dependabot #537

Merged
merged 4 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
reviewers:
- WanzenBug
schedule:
interval: "weekly"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
reviewers:
- WanzenBug
groups:
ci:
patterns:
- "*" # Include all github-actions update in one PR
4 changes: 2 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.20'
- uses: golangci/golangci-lint-action@v3
with:
args: --timeout=3m
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Setup Go environment
uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.20'
- uses: actions/setup-python@v4
- name: Run pre-commit checks on changes files
uses: pre-commit/[email protected]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.4
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.18 as builder
FROM --platform=$BUILDPLATFORM golang:1.20 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ endif
# Image URL to use all building/pushing image targets
IMG ?= quay.io/piraeusdatastore/piraeus-operator:v$(VERSION)
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.27
ENVTEST_K8S_VERSION = 1.28

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -170,9 +170,9 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
YQ ?= $(LOCALBIN)/yq

## Tool Versions
KUSTOMIZE_VERSION ?= v5.0.3
CONTROLLER_TOOLS_VERSION ?= v0.12.0
YQ_VERSION ?= v4.34.1
KUSTOMIZE_VERSION ?= v5.1.1
CONTROLLER_TOOLS_VERSION ?= v0.13.0
YQ_VERSION ?= v4.35.2

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand Down
25 changes: 13 additions & 12 deletions api/v1/linstorcluster_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"
)

var linstorclusterlog = logf.Log.WithName("linstorcluster-resource")
Expand All @@ -42,44 +43,44 @@ func (r *LinstorCluster) SetupWebhookWithManager(mgr ctrl.Manager) error {
var _ webhook.Validator = &LinstorCluster{}

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

errs := r.validate(nil)
warnings, errs := r.validate(nil)
if len(errs) != 0 {
return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorCluster"}, r.Name, errs)
return warnings, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorCluster"}, r.Name, errs)
}

return nil
return warnings, nil
}

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

errs := r.validate(nil)
warnings, errs := r.validate(nil)
if len(errs) != 0 {
return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorCluster"}, r.Name, errs)
return warnings, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorCluster"}, r.Name, errs)
}

return nil
return warnings, nil
}

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

return nil
return nil, nil
}

func (r *LinstorCluster) validate(old *LinstorCluster) field.ErrorList {
func (r *LinstorCluster) validate(old *LinstorCluster) (admission.Warnings, field.ErrorList) {
errs := ValidateExternalController(r.Spec.ExternalController, field.NewPath("spec", "externalController"))
errs = append(errs, ValidateNodeSelector(r.Spec.NodeSelector, field.NewPath("spec", "nodeSelector"))...)
for i := range r.Spec.Patches {
errs = append(errs, r.Spec.Patches[i].validate(field.NewPath("spec", "patches", strconv.Itoa(i)))...)
}

return errs
return nil, errs
}

func ValidateExternalController(ref *LinstorExternalControllerRef, path *field.Path) field.ErrorList {
Expand Down
25 changes: 13 additions & 12 deletions api/v1/linstornodeconnection_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"
)

var linstornodeconnectionlog = logf.Log.WithName("linstornodeconnection-resource")
Expand All @@ -42,38 +43,38 @@ func (r *LinstorNodeConnection) SetupWebhookWithManager(mgr ctrl.Manager) error
var _ webhook.Validator = &LinstorNodeConnection{}

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

errs := r.validate()
warnings, errs := r.validate()
if len(errs) != 0 {
return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorNodeConnection"}, r.Name, errs)
return warnings, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorNodeConnection"}, r.Name, errs)
}

return nil
return warnings, nil
}

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

errs := r.validate()
warnings, errs := r.validate()
if len(errs) != 0 {
return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorNodeConnection"}, r.Name, errs)
return warnings, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorNodeConnection"}, r.Name, errs)
}

return nil
return warnings, nil
}

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

return nil
return nil, nil
}

func (r *LinstorNodeConnection) validate() field.ErrorList {
return ValidateNodeConnectionSelectors(r.Spec.Selector, field.NewPath("spec", "selector"))
func (r *LinstorNodeConnection) validate() (admission.Warnings, field.ErrorList) {
return nil, ValidateNodeConnectionSelectors(r.Spec.Selector, field.NewPath("spec", "selector"))
}

func ValidateNodeConnectionSelectors(selector []SelectorTerm, path *field.Path) field.ErrorList {
Expand Down
25 changes: 13 additions & 12 deletions api/v1/linstorsatellite_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"
)

var linstorsatellitelog = logf.Log.WithName("linstorsatellite-resource")
Expand All @@ -41,37 +42,37 @@ func (r *LinstorSatellite) SetupWebhookWithManager(mgr ctrl.Manager) error {
var _ webhook.Validator = &LinstorSatellite{}

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

errs := r.validate(nil)
warnings, errs := r.validate(nil)
if len(errs) != 0 {
return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorSatellite"}, r.Name, errs)
return warnings, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorSatellite"}, r.Name, errs)
}

return nil
return warnings, nil
}

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

errs := r.validate(old.(*LinstorSatellite))
warnings, errs := r.validate(old.(*LinstorSatellite))
if len(errs) != 0 {
return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorSatellite"}, r.Name, errs)
return warnings, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorSatellite"}, r.Name, errs)
}

return nil
return warnings, nil
}

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

return nil
return nil, nil
}

func (r *LinstorSatellite) validate(old *LinstorSatellite) field.ErrorList {
func (r *LinstorSatellite) validate(old *LinstorSatellite) (admission.Warnings, field.ErrorList) {
var oldSPs []LinstorStoragePool
if old != nil {
oldSPs = old.Spec.StoragePools
Expand All @@ -84,5 +85,5 @@ func (r *LinstorSatellite) validate(old *LinstorSatellite) field.ErrorList {
errs = append(errs, r.Spec.Patches[i].validate(field.NewPath("spec", "patches", strconv.Itoa(i)))...)
}

return errs
return nil, errs
}
25 changes: 13 additions & 12 deletions api/v1/linstorsatelliteconfiguration_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"
)

var linstorsatelliteconfigurationlog = logf.Log.WithName("linstorsatelliteconfiguration-resource")
Expand All @@ -42,37 +43,37 @@ func (r *LinstorSatelliteConfiguration) SetupWebhookWithManager(mgr ctrl.Manager
var _ webhook.Validator = &LinstorSatelliteConfiguration{}

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

errs := r.validate(nil)
warnings, errs := r.validate(nil)
if len(errs) != 0 {
return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorSatelliteConfiguration"}, r.Name, errs)
return warnings, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorSatelliteConfiguration"}, r.Name, errs)
}

return nil
return warnings, nil
}

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

errs := r.validate(old.(*LinstorSatelliteConfiguration))
warnings, errs := r.validate(old.(*LinstorSatelliteConfiguration))
if len(errs) != 0 {
return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorSatelliteConfiguration"}, r.Name, errs)
return warnings, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "LinstorSatelliteConfiguration"}, r.Name, errs)
}

return nil
return warnings, nil
}

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

return nil
return nil, nil
}

func (r *LinstorSatelliteConfiguration) validate(old *LinstorSatelliteConfiguration) field.ErrorList {
func (r *LinstorSatelliteConfiguration) validate(old *LinstorSatelliteConfiguration) (admission.Warnings, field.ErrorList) {
var oldSPs []LinstorStoragePool
if old != nil {
oldSPs = old.Spec.StoragePools
Expand All @@ -86,7 +87,7 @@ func (r *LinstorSatelliteConfiguration) validate(old *LinstorSatelliteConfigurat
errs = append(errs, r.Spec.Patches[i].validate(field.NewPath("spec", "patches", strconv.Itoa(i)))...)
}

return errs
return nil, errs
}

func ValidateNodeSelector(selector map[string]string, path *field.Path) field.ErrorList {
Expand Down
16 changes: 10 additions & 6 deletions api/v1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
admissionv1 "k8s.io/api/admission/v1"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

//+kubebuilder:scaffold:imports
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -91,12 +93,14 @@ var _ = BeforeSuite(func(_ context.Context) {
// 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
1 change: 0 additions & 1 deletion api/v1/zz_generated.deepcopy.go

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

8 changes: 4 additions & 4 deletions charts/piraeus/templates/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.13.0
name: linstorclusters.piraeus.io
spec:
group: piraeus.io
Expand Down Expand Up @@ -292,7 +292,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.13.0
name: linstornodeconnections.piraeus.io
spec:
group: piraeus.io
Expand Down Expand Up @@ -499,7 +499,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.13.0
name: linstorsatelliteconfigurations.piraeus.io
spec:
group: piraeus.io
Expand Down Expand Up @@ -823,7 +823,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.13.0
name: linstorsatellites.piraeus.io
spec:
group: piraeus.io
Expand Down
Loading
Loading