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

deps: update dependency packages #2087

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
GO111MODULE: on
steps:

- name: Set up Go 1.19
- name: Set up Go 1.21
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
id: go

- name: Check out code into the Go module directory
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
- name: go mod tidy
run: |
go clean -modcache
go mod tidy
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.6.0
uses: golangci/golangci-lint-action@v3.7.0
with:
version: v1.50.1
version: v1.55.2
working-directory: ${{matrix.working-directory}}
12 changes: 9 additions & 3 deletions .github/workflows/kubernetes-auto-support.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,28 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Go 1.19
- name: Set up Go 1.21
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
id: go

- name: install dependiencies
run: |
sudo apt update
sudo apt install skopeo -y
pip install natsort
wget https://attack-on-titan.gd2.qingstor.com/qsctl/v2.4.3/qsctl_v2.4.3_linux_amd64.tar.gz
tar -zxvf qsctl_v2.4.3_linux_amd64.tar.gz
mv qsctl_v2.4.3_linux_amd64 /usr/local/bin/qsctl
rm -rf qsctl_v2.4.3_linux_amd64.tar.gz

VERSION="1.1.0"
curl -LO "https://github.com/oras-project/oras/releases/download/v${VERSION}/oras_${VERSION}_linux_amd64.tar.gz"
mkdir -p oras-install/
tar -zxf oras_${VERSION}_*.tar.gz -C oras-install/
sudo mv oras-install/oras /usr/local/bin/
rm -rf oras_${VERSION}_*.tar.gz oras-install/

- name: update components.json
id: get_new_version
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install go
uses: actions/setup-go@v3
with:
go-version: '^1.19'
go-version: '^1.21'
- name: generate release artifacts
run: |
make release
Expand All @@ -28,7 +28,7 @@ jobs:
with:
draft: true
files: out/*

- name: Get Version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
package v1beta1

const (
// KKClusterLabelName is the label set on KKMachines and KKInstances linked to a kkCluster.
KKClusterLabelName = "kkcluster.infrastructure.cluster.x-k8s.io/cluster-name"
// KKClusterNameLabel is the label set on KKMachines and KKInstances linked to a kkCluster.
ClusterNameLabel = "kkcluster.infrastructure.cluster.x-k8s.io/cluster-name"
)
12 changes: 7 additions & 5 deletions api/v1beta1/kkcluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"strings"
"time"

"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

mapset "github.com/deckarep/golang-set"
"github.com/google/go-cmp/cmp"
"github.com/pkg/errors"
Expand Down Expand Up @@ -121,7 +123,7 @@ func defaultInPlaceUpgradeAnnotation(annotation map[string]string) {
var _ webhook.Validator = &KKCluster{}

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

var allErrs field.ErrorList
Expand All @@ -133,13 +135,13 @@ func (k *KKCluster) ValidateCreate() error {
}

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

var allErrs field.ErrorList
oldC, ok := old.(*KKCluster)
if !ok {
return apierrors.NewBadRequest(fmt.Sprintf("expected an KKCluster but got a %T", old))
return nil, apierrors.NewBadRequest(fmt.Sprintf("expected an KKCluster but got a %T", old))
}

newLoadBalancer := &KKLoadBalancerSpec{}
Expand All @@ -165,8 +167,8 @@ func (k *KKCluster) ValidateUpdate(old runtime.Object) error {
}

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

func validateDistribution(spec KKClusterSpec) []*field.Error {
Expand Down
13 changes: 7 additions & 6 deletions api/v1beta1/kkclustertemplate_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"
)

// log is for logging in this package.
Expand Down Expand Up @@ -54,7 +55,7 @@ func (r *KKClusterTemplate) Default() {
var _ webhook.Validator = &KKClusterTemplate{}

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

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

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

oldC := old.(*KKClusterTemplate)
if !cmp.Equal(r.Spec, oldC.Spec) {
return apierrors.NewBadRequest("KKClusterTemplate.Spec is immutable")
return nil, apierrors.NewBadRequest("KKClusterTemplate.Spec is immutable")
}
return nil
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *KKClusterTemplate) ValidateDelete() error {
return nil
func (r *KKClusterTemplate) ValidateDelete() (admission.Warnings, error) {
return nil, nil
}
11 changes: 6 additions & 5 deletions api/v1beta1/kkinstance_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"
)

// log is for logging in this package.
Expand All @@ -49,13 +50,13 @@ func (k *KKInstance) Default() {
var _ webhook.Validator = &KKInstance{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (k *KKInstance) ValidateCreate() error {
func (k *KKInstance) ValidateCreate() (admission.Warnings, error) {
kkinstancelog.Info("validate create", "name", k.Name)
return nil
return admission.Warnings{}, nil
}

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

var allErrs field.ErrorList
Expand Down Expand Up @@ -106,7 +107,7 @@ func (k *KKInstance) ValidateUpdate(old runtime.Object) error {
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (k *KKInstance) ValidateDelete() error {
func (k *KKInstance) ValidateDelete() (admission.Warnings, error) {
kkinstancelog.Info("validate delete", "name", k.Name)
return nil
return nil, nil
}
10 changes: 6 additions & 4 deletions api/v1beta1/kkmachine_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package v1beta1
import (
"strings"

"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -88,7 +90,7 @@ func defaultContainerManager(spec *KKMachineSpec) {
var _ webhook.Validator = &KKMachine{}

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

var allErrs field.ErrorList
Expand All @@ -97,17 +99,17 @@ func (k *KKMachine) ValidateCreate() error {
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (k *KKMachine) ValidateUpdate(old runtime.Object) error {
func (k *KKMachine) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
kkmachinelog.Info("validate update", "name", k.Name)
var allErrs field.ErrorList
allErrs = append(allErrs, validateRepository(k.Spec.Repository)...)
return aggregateObjErrors(k.GroupVersionKind().GroupKind(), k.Name, allErrs)
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (k *KKMachine) ValidateDelete() error {
func (k *KKMachine) ValidateDelete() (admission.Warnings, error) {
kkmachinelog.Info("validate delete", "name", k.Name)
return nil
return nil, nil
}

func validateRepository(repo *Repository) field.ErrorList { //nolint:unparam
Expand Down
9 changes: 5 additions & 4 deletions api/v1beta1/kkmachinetemplate_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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 Down Expand Up @@ -49,7 +50,7 @@ func (k *KKMachineTemplate) Default() {
var _ webhook.Validator = &KKMachineTemplate{}

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

spec := k.Spec.Template.Spec
Expand All @@ -59,7 +60,7 @@ func (k *KKMachineTemplate) ValidateCreate() error {
}

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

spec := k.Spec.Template.Spec
Expand All @@ -69,8 +70,8 @@ func (k *KKMachineTemplate) ValidateUpdate(old runtime.Object) error {
}

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

return nil
return nil, nil
}
7 changes: 4 additions & 3 deletions api/v1beta1/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation/field"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

func aggregateObjErrors(gk schema.GroupKind, name string, allErrs field.ErrorList) error {
func aggregateObjErrors(gk schema.GroupKind, name string, allErrs field.ErrorList) (admission.Warnings, error) {
if len(allErrs) == 0 {
return nil
return nil, nil
}

return apierrors.NewInvalid(
return nil, apierrors.NewInvalid(
gk,
name,
allErrs,
Expand Down
15 changes: 8 additions & 7 deletions bootstrap/k3s/api/v1beta1/k3sconfig_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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 @@ -55,28 +56,28 @@ func DefaultK3sConfigSpec(c *K3sConfigSpec) {
var _ webhook.Validator = &K3sConfig{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (c *K3sConfig) ValidateCreate() error {
func (c *K3sConfig) ValidateCreate() (admission.Warnings, error) {
return c.Spec.validate(c.Name)
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (c *K3sConfig) ValidateUpdate(old runtime.Object) error {
func (c *K3sConfig) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
return c.Spec.validate(c.Name)
}

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

func (c *K3sConfigSpec) validate(name string) error {
func (c *K3sConfigSpec) validate(name string) (admission.Warnings, error) {
allErrs := c.Validate(field.NewPath("spec"))

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

return apierrors.NewInvalid(GroupVersion.WithKind("K3sConfig").GroupKind(), name, allErrs)
return nil, apierrors.NewInvalid(GroupVersion.WithKind("K3sConfig").GroupKind(), name, allErrs)
}

// Validate ensures the K3sConfigSpec is valid.
Expand Down
15 changes: 8 additions & 7 deletions bootstrap/k3s/api/v1beta1/k3sconfigtemplate_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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 *K3sConfigTemplate) SetupWebhookWithManager(mgr ctrl.Manager) error {
Expand All @@ -44,28 +45,28 @@ func (r *K3sConfigTemplate) Default() {
var _ webhook.Validator = &K3sConfigTemplate{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *K3sConfigTemplate) ValidateCreate() error {
func (r *K3sConfigTemplate) ValidateCreate() (admission.Warnings, error) {
return r.Spec.validate(r.Name)
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *K3sConfigTemplate) ValidateUpdate(old runtime.Object) error {
func (r *K3sConfigTemplate) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
return r.Spec.validate(r.Name)
}

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

func (r *K3sConfigTemplateSpec) validate(name string) error {
func (r *K3sConfigTemplateSpec) validate(name string) (admission.Warnings, error) {
var allErrs field.ErrorList

allErrs = append(allErrs, r.Template.Spec.Validate(field.NewPath("spec", "template", "spec"))...)

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

return apierrors.NewInvalid(GroupVersion.WithKind("K3sConfigTemplate").GroupKind(), name, allErrs)
return nil, apierrors.NewInvalid(GroupVersion.WithKind("K3sConfigTemplate").GroupKind(), name, allErrs)
}
Loading
Loading