Skip to content

Commit

Permalink
Fix build (#26)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Dec 31, 2023
1 parent ddd8566 commit e1cceca
Show file tree
Hide file tree
Showing 125 changed files with 19,812 additions and 4,131 deletions.
7 changes: 7 additions & 0 deletions .config/api-rules/violation_exceptions.list
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,X509Subject,
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,X509Subject,PostalCodes
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,X509Subject,Provinces
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,X509Subject,StreetAddresses
API rule violation: list_type_missing,kubeops.dev/supervisor/apis/supervisor/v1alpha1,ApprovalPolicy,Targets
API rule violation: list_type_missing,kubeops.dev/supervisor/apis/supervisor/v1alpha1,ApprovedWindow,Dates
API rule violation: list_type_missing,kubeops.dev/supervisor/apis/supervisor/v1alpha1,CVEReport,Vulnerabilities
API rule violation: list_type_missing,kubeops.dev/supervisor/apis/supervisor/v1alpha1,MaintenanceWindowSpec,Dates
API rule violation: list_type_missing,kubeops.dev/supervisor/apis/supervisor/v1alpha1,MaintenanceWindowStatus,Conditions
API rule violation: list_type_missing,kubeops.dev/supervisor/apis/supervisor/v1alpha1,RecommendationStatus,Conditions
API rule violation: list_type_missing,kubeops.dev/supervisor/apis/supervisor/v1alpha1,TargetRef,Operations
API rule violation: names_match,k8s.io/api/core/v1,AzureDiskVolumeSource,DataDiskURI
API rule violation: names_match,k8s.io/api/core/v1,ContainerStatus,LastTerminationState
API rule violation: names_match,k8s.io/api/core/v1,DaemonEndpoint,Port
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ BIN_PLATFORMS := $(DOCKER_PLATFORMS)
OS := $(if $(GOOS),$(GOOS),$(shell go env GOOS))
ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))

BASEIMAGE_PROD ?= gcr.io/distroless/static-debian11
BASEIMAGE_DBG ?= debian:bullseye
BASEIMAGE_PROD ?= gcr.io/distroless/static-debian12
BASEIMAGE_DBG ?= debian:bookworm

IMAGE := $(REGISTRY)/$(BIN)
VERSION_PROD := $(VERSION)
Expand Down Expand Up @@ -151,7 +151,7 @@ clientset:
--env HTTPS_PROXY=$(HTTPS_PROXY) \
$(CODE_GENERATOR_IMAGE) \
/go/src/k8s.io/code-generator/generate-groups.sh \
"deepcopy,defaulter" \
deepcopy \
$(GO_PKG)/$(REPO)/client \
$(GO_PKG)/$(REPO)/apis \
"$(API_GROUPS)" \
Expand Down Expand Up @@ -398,7 +398,7 @@ e2e-tests: $(BUILD_DIRS)
e2e-parallel:
@$(MAKE) e2e-tests GINKGO_ARGS="-p -stream --flakeAttempts=2" --no-print-directory

ADDTL_LINTERS := goconst,gofmt,goimports,unparam
ADDTL_LINTERS := gofmt,goimports,unparam

.PHONY: lint
lint: $(BUILD_DIRS)
Expand Down
2 changes: 2 additions & 0 deletions apis/supervisor/v1alpha1/approvalpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const (
ResourceApprovalPolicies = "approvalpolicies"
)

//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

Expand Down Expand Up @@ -57,6 +58,7 @@ type TargetRef struct {
Operations []Operation `json:"operations,omitempty"`
}

//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
//+kubebuilder:object:root=true

// ApprovalPolicyList contains a list of ApprovalPolicy
Expand Down
2 changes: 2 additions & 0 deletions apis/supervisor/v1alpha1/clustermaintenancewindow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
ResourceClusterMaintenanceWindows = "clustermaintenancewindows"
)

//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
Expand All @@ -44,6 +45,7 @@ type ClusterMaintenanceWindow struct {
Status MaintenanceWindowStatus `json:"status,omitempty"`
}

//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
//+kubebuilder:object:root=true

// ClusterMaintenanceWindowList contains a list of ClusterMaintenanceWindow
Expand Down
15 changes: 7 additions & 8 deletions apis/supervisor/v1alpha1/clustermaintenancewindow_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ 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"
)

// log is for logging in this package.
var (
clustermaintenancewindowlog = logf.Log.WithName("clustermaintenancewindow-resource")
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

//+kubebuilder:webhook:path=/mutate-supervisor-appscode-com-v1alpha1-clustermaintenancewindow,mutating=true,failurePolicy=fail,sideEffects=None,groups=supervisor.appscode.com,resources=clustermaintenancewindows,verbs=create;update,versions=v1alpha1,name=mclustermaintenancewindow.kb.io,admissionReviewVersions={v1,v1beta1}

var _ webhook.Defaulter = &ClusterMaintenanceWindow{}
Expand All @@ -52,24 +51,24 @@ func (r *ClusterMaintenanceWindow) Default() {
var _ webhook.Validator = &ClusterMaintenanceWindow{}

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

return r.validateClusterMaintenanceWindow(context.TODO())
return nil, r.validateClusterMaintenanceWindow(context.TODO())
}

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

return r.validateClusterMaintenanceWindow(context.TODO())
return nil, r.validateClusterMaintenanceWindow(context.TODO())
}

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

return nil
return nil, nil
}

func (r *ClusterMaintenanceWindow) validateClusterMaintenanceWindow(ctx context.Context) error {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated

/*
Copyright AppsCode Inc. and Contributors.
Copyright AppsCode Inc. and Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -17,17 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Code generated by defaulter-gen. DO NOT EDIT.

package v1alpha1
// Package v1alpha1 is the v1alpha1 version of the API.

import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=kubeops.dev/supervisor/apis/supervisor
// +k8s:openapi-gen=true
// +k8s:defaulter-gen=TypeMeta

// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
return nil
}
// +groupName=supervisor.appscode.com
package v1alpha1
2 changes: 2 additions & 0 deletions apis/supervisor/v1alpha1/maintenancewindow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ type MaintenanceWindowStatus struct {
Conditions []kmapi.Condition `json:"conditions,omitempty"`
}

//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Default",type="boolean",JSONPath=".spec.isDefault"
Expand All @@ -115,6 +116,7 @@ type MaintenanceWindow struct {
Status MaintenanceWindowStatus `json:"status,omitempty"`
}

//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
//+kubebuilder:object:root=true

// MaintenanceWindowList contains a list of MaintenanceWindow
Expand Down
15 changes: 7 additions & 8 deletions apis/supervisor/v1alpha1/maintenancewindow_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ 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"
)

// log is for logging in this package.
var (
maintenancewindowlog = logf.Log.WithName("maintenancewindow-resource")
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

//+kubebuilder:webhook:path=/mutate-supervisor-appscode-com-v1alpha1-maintenancewindow,mutating=true,failurePolicy=fail,sideEffects=None,groups=supervisor.appscode.com,resources=maintenancewindows,verbs=create;update,versions=v1alpha1,name=mmaintenancewindow.kb.io,admissionReviewVersions={v1,v1beta1}

var _ webhook.Defaulter = &MaintenanceWindow{}
Expand All @@ -54,24 +53,24 @@ func (r *MaintenanceWindow) Default() {
var _ webhook.Validator = &MaintenanceWindow{}

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

return r.validateMaintenanceWindow(context.TODO())
return nil, r.validateMaintenanceWindow(context.TODO())
}

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

return r.validateMaintenanceWindow(context.TODO())
return nil, r.validateMaintenanceWindow(context.TODO())
}

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

return nil
return nil, nil
}

func (r *MaintenanceWindow) validateMaintenanceWindow(ctx context.Context) error {
Expand Down
Loading

0 comments on commit e1cceca

Please sign in to comment.