Skip to content

Commit

Permalink
Merge pull request #236 from wanjunlei/master
Browse files Browse the repository at this point in the history
update dependencies
  • Loading branch information
benjaminhuo authored Jan 15, 2024
2 parents d662f44 + 3adef75 commit 61848e6
Show file tree
Hide file tree
Showing 61 changed files with 8,340 additions and 7,835 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
go-version: 1.20.x

- uses: actions/cache@v2
with:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
go-version: 1.20.x

- uses: actions/cache@v2
with:
Expand All @@ -86,7 +86,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
go-version: 1.20.x

- uses: actions/cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-nm-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.20.x

- uses: actions/cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-operator-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.20.x

- uses: actions/cache@v2
with:
Expand Down
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ REGISTRY?=kubesphere
IMG ?= $(REGISTRY)/notification-manager-operator:$(VERSION)
NM_IMG ?= $(REGISTRY)/notification-manager:$(VERSION)
AMD64 ?= -amd64
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -69,7 +67,7 @@ undeploy:

# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=controller-role webhook paths=./pkg/apis/v2beta2 paths=./controllers output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=controller-role webhook crd paths=./apis/... paths=./controllers output:crd:artifacts:config=config/crd/bases
cd config/manager && kustomize edit set image controller=${IMG} && cd ../../
kustomize build config/default | sed -e '/creationTimestamp/d' > config/bundle.yaml
kustomize build config/samples | sed -e '/creationTimestamp/d' > config/samples/bundle.yaml
Expand All @@ -85,7 +83,7 @@ vet:

# Generate code
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./pkg/apis/v2beta2"
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./apis/v2beta2"

helm: controller-gen
kustomize build config/helm | sed -e '/creationTimestamp/d' > helm/crds/bundle.yaml
Expand Down Expand Up @@ -130,7 +128,7 @@ ifeq (, $(shell which controller-gen))
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1 ;\
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

func (r *Config) SetupWebhookWithManager(mgr ctrl.Manager) error {
Expand All @@ -35,22 +36,21 @@ func (r *Config) SetupWebhookWithManager(mgr ctrl.Manager) error {
var _ webhook.Validator = &Config{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *Config) ValidateCreate() error {

func (r *Config) ValidateCreate() (warnings admission.Warnings, err error) {
return r.validateConfig()
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *Config) ValidateUpdate(_ runtime.Object) error {
func (r *Config) ValidateUpdate(_ runtime.Object) (warnings admission.Warnings, err error) {
return r.validateConfig()
}

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

func (r *Config) validateConfig() error {
func (r *Config) validateConfig() (warnings admission.Warnings, err error) {
var allErrs field.ErrorList
var credentials []map[string]interface{}

Expand Down Expand Up @@ -220,10 +220,10 @@ func (r *Config) validateConfig() error {
}

if allErrs == nil || len(allErrs) == 0 {
return nil
return admission.Warnings{}, nil
}

return errors.NewInvalid(
return admission.Warnings{}, errors.NewInvalid(
schema.GroupKind{Group: "notification.kubesphere.io", Kind: "Config"},
r.Name, allErrs)
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

var (
Expand Down Expand Up @@ -67,22 +68,22 @@ func (r *Receiver) SetupWebhookWithManager(mgr ctrl.Manager) error {
var _ webhook.Validator = &Receiver{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *Receiver) ValidateCreate() error {
func (r *Receiver) ValidateCreate() (warnings admission.Warnings, err error) {

return r.validateReceiver()
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *Receiver) ValidateUpdate(_ runtime.Object) error {
func (r *Receiver) ValidateUpdate(_ runtime.Object) (warnings admission.Warnings, err error) {
return r.validateReceiver()
}

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

func (r *Receiver) validateReceiver() error {
func (r *Receiver) validateReceiver() (warnings admission.Warnings, err error) {
var allErrs field.ErrorList
var credentials []map[string]interface{}

Expand Down Expand Up @@ -379,10 +380,10 @@ func (r *Receiver) validateReceiver() error {
}

if len(allErrs) == 0 {
return nil
return admission.Warnings{}, nil
}

return errors.NewInvalid(
return admission.Warnings{}, errors.NewInvalid(
schema.GroupKind{Group: "notification.kubesphere.io", Kind: "Receiver"},
r.Name, allErrs)
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

func (r *Router) SetupWebhookWithManager(mgr ctrl.Manager) error {
Expand All @@ -37,22 +38,22 @@ func (r *Router) SetupWebhookWithManager(mgr ctrl.Manager) error {
var _ webhook.Validator = &Router{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *Router) ValidateCreate() error {
func (r *Router) ValidateCreate() (warnings admission.Warnings, err error) {

return r.validateRouter()
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *Router) ValidateUpdate(_ runtime.Object) error {
func (r *Router) ValidateUpdate(_ runtime.Object) (warnings admission.Warnings, err error) {
return r.validateRouter()
}

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

func (r *Router) validateRouter() error {
func (r *Router) validateRouter() (warnings admission.Warnings, err error) {
var allErrs field.ErrorList

if err := validateSelector(r.Spec.AlertSelector); err != nil {
Expand All @@ -70,10 +71,10 @@ func (r *Router) validateRouter() error {
}

if allErrs == nil || len(allErrs) == 0 {
return nil
return admission.Warnings{}, nil
}

return errors.NewInvalid(
return admission.Warnings{}, errors.NewInvalid(
schema.GroupKind{Group: "notification.kubesphere.io", Kind: "Receiver"},
r.Name, allErrs)
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

func (r *Silence) SetupWebhookWithManager(mgr ctrl.Manager) error {
Expand All @@ -36,22 +37,22 @@ func (r *Silence) SetupWebhookWithManager(mgr ctrl.Manager) error {
var _ webhook.Validator = &Silence{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (s *Silence) ValidateCreate() error {
func (s *Silence) ValidateCreate() (warnings admission.Warnings, err error) {

return s.validateSilence()
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (s *Silence) ValidateUpdate(_ runtime.Object) error {
func (s *Silence) ValidateUpdate(_ runtime.Object) (warnings admission.Warnings, err error) {
return s.validateSilence()
}

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

func (s *Silence) validateSilence() error {
func (s *Silence) validateSilence() (warnings admission.Warnings, err error) {
var allErrs field.ErrorList

if err := validateSelector(s.Spec.Matcher); err != nil {
Expand All @@ -65,10 +66,10 @@ func (s *Silence) validateSilence() error {
}

if allErrs == nil || len(allErrs) == 0 {
return nil
return admission.Warnings{}, nil
}

return errors.NewInvalid(
return admission.Warnings{}, errors.NewInvalid(
schema.GroupKind{Group: "notification.kubesphere.io", Kind: "Receiver"},
s.Name, allErrs)
}

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

3 changes: 2 additions & 1 deletion cmd/notification-manager/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG GOPROXY="https://goproxy.io"
# Build the manager binary
FROM golang:1.17 as builder
FROM golang:1.20 as builder
ARG GOPROXY

WORKDIR /workspace
Expand All @@ -15,6 +15,7 @@ RUN GOPROXY=$GOPROXY go mod download
# Copy the go source
COPY cmd/notification-manager/main.go main.go
COPY pkg/ pkg/
COPY apis/ apis/

# Build
RUN CGO_ENABLED=0 GO111MODULE=on go build -a -o notification-manager main.go
Expand Down
3 changes: 2 additions & 1 deletion cmd/operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG GOPROXY="https://goproxy.io"
# Build the manager binary
FROM golang:1.17 as builder
FROM golang:1.20 as builder
ARG GOPROXY

WORKDIR /workspace
Expand All @@ -16,6 +16,7 @@ RUN GOPROXY=$GOPROXY go mod download
COPY cmd/operator/main.go main.go
COPY controllers/ controllers/
COPY pkg/ pkg/
COPY apis/ apis/

# Build
RUN GOPROXY=$GOPROXY CGO_ENABLED=0 GO111MODULE=on go build -a -o notification-manager-operator main.go
Expand Down
2 changes: 1 addition & 1 deletion cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"flag"
"os"

"github.com/kubesphere/notification-manager/apis/v2beta2"
"github.com/kubesphere/notification-manager/controllers"
"github.com/kubesphere/notification-manager/pkg/apis/v2beta2"
"k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
Expand Down
Loading

0 comments on commit 61848e6

Please sign in to comment.