Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Feb 21, 2025
1 parent dfde555 commit c12a263
Show file tree
Hide file tree
Showing 198 changed files with 9,205 additions and 4,183 deletions.
8 changes: 4 additions & 4 deletions apis/core/v1alpha1/backupbatch_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,26 @@ func (r *BackupBatch) SetupWebhookWithManager(mgr ctrl.Manager) error {
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-core-kubestash-com-v1alpha1-backupbatch,mutating=false,failurePolicy=fail,sideEffects=None,groups=core.kubestash.com,resources=backupbatches,verbs=create;update,versions=v1alpha1,name=vbackupbatch.kb.io,admissionReviewVersions=v1

var _ webhook.Validator = &BackupBatch{}
var _ webhook.CustomValidator = &BackupBatch{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *BackupBatch) ValidateCreate() (admission.Warnings, error) {
func (r *BackupBatch) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {

Check failure on line 44 in apis/core/v1alpha1/backupbatch_webhook.go

View workflow job for this annotation

GitHub Actions / Build

undefined: context
backupbatchlog.Info("validate create", "name", r.Name)

// TODO(user): fill in your validation logic upon object creation.
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *BackupBatch) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
func (r *BackupBatch) ValidateUpdate(ctx context.Context, old, newObj runtime.Object) (admission.Warnings, error) {

Check failure on line 52 in apis/core/v1alpha1/backupbatch_webhook.go

View workflow job for this annotation

GitHub Actions / Build

undefined: context
backupbatchlog.Info("validate update", "name", r.Name)

// TODO(user): fill in your validation logic upon object update.
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *BackupBatch) ValidateDelete() (admission.Warnings, error) {
func (r *BackupBatch) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {

Check failure on line 60 in apis/core/v1alpha1/backupbatch_webhook.go

View workflow job for this annotation

GitHub Actions / Build

undefined: context
backupbatchlog.Info("validate delete", "name", r.Name)

// TODO(user): fill in your validation logic upon object deletion.
Expand Down
12 changes: 6 additions & 6 deletions apis/core/v1alpha1/backupblueprint_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ func (r *BackupBlueprint) SetupWebhookWithManager(mgr ctrl.Manager) error {

//+kubebuilder:webhook:path=/mutate-core-kubestash-com-v1alpha1-backupblueprint,mutating=true,failurePolicy=fail,sideEffects=None,groups=core.kubestash.com,resources=backupblueprints,verbs=create;update,versions=v1alpha1,name=mbackupblueprint.kb.io,admissionReviewVersions=v1

var _ webhook.Defaulter = &BackupBlueprint{}
var _ webhook.CustomDefaulter = &BackupBlueprint{}

// Default implements webhook.Defaulter so a webhook will be registered for the type
func (r *BackupBlueprint) Default() {
func (r *BackupBlueprint) Default(ctx context.Context, obj runtime.Object) error {
backupblueprintlog.Info("default", "name", r.Name)

if r.Spec.UsagePolicy == nil {
Expand All @@ -60,10 +60,10 @@ func (r *BackupBlueprint) Default() {
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-core-kubestash-com-v1alpha1-backupblueprint,mutating=false,failurePolicy=fail,sideEffects=None,groups=core.kubestash.com,resources=backupblueprints,verbs=create;update,versions=v1alpha1,name=vbackupblueprint.kb.io,admissionReviewVersions=v1

var _ webhook.Validator = &BackupBlueprint{}
var _ webhook.CustomValidator = &BackupBlueprint{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *BackupBlueprint) ValidateCreate() (admission.Warnings, error) {
func (r *BackupBlueprint) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
backupblueprintlog.Info("validate create", "name", r.Name)

if err := r.validateUsagePolicy(); err != nil {
Expand All @@ -74,7 +74,7 @@ func (r *BackupBlueprint) ValidateCreate() (admission.Warnings, error) {
}

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

if err := r.validateUsagePolicy(); err != nil {
Expand All @@ -85,7 +85,7 @@ func (r *BackupBlueprint) ValidateUpdate(old runtime.Object) (admission.Warnings
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *BackupBlueprint) ValidateDelete() (admission.Warnings, error) {
func (r *BackupBlueprint) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
backupblueprintlog.Info("validate delete", "name", r.Name)

// TODO(user): fill in your validation logic upon object deletion.
Expand Down
12 changes: 6 additions & 6 deletions apis/core/v1alpha1/backupconfiguration_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ func (b *BackupConfiguration) SetupWebhookWithManager(mgr ctrl.Manager) error {

//+kubebuilder:webhook:path=/mutate-core-kubestash-com-v1alpha1-backupconfiguration,mutating=true,failurePolicy=fail,sideEffects=None,groups=core.kubestash.com,resources=backupconfigurations,verbs=create;update,versions=v1alpha1,name=mbackupconfiguration.kb.io,admissionReviewVersions=v1

var _ webhook.Defaulter = &BackupConfiguration{}
var _ webhook.CustomDefaulter = &BackupConfiguration{}

// Default implements webhook.Defaulter so a webhook will be registered for the type
func (b *BackupConfiguration) Default() {
func (b *BackupConfiguration) Default(ctx context.Context, obj runtime.Object) error {
backupconfigurationlog.Info("default", "name", b.Name)

c := apis.GetRuntimeClient()
Expand Down Expand Up @@ -180,10 +180,10 @@ func (b *BackupConfiguration) getDefaultRetentionPolicy(ctx context.Context, c c
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-core-kubestash-com-v1alpha1-backupconfiguration,mutating=false,failurePolicy=fail,sideEffects=None,groups=core.kubestash.com,resources=backupconfigurations,verbs=create;update,versions=v1alpha1,name=vbackupconfiguration.kb.io,admissionReviewVersions=v1

var _ webhook.Validator = &BackupConfiguration{}
var _ webhook.CustomValidator = &BackupConfiguration{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (b *BackupConfiguration) ValidateCreate() (admission.Warnings, error) {
func (b *BackupConfiguration) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
backupconfigurationlog.Info("validate create", apis.KeyName, b.Name)

c := apis.GetRuntimeClient()
Expand Down Expand Up @@ -600,7 +600,7 @@ func (b *BackupConfiguration) getHookTemplatesFromHookInfo(hooks []HookInfo) []H
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (b *BackupConfiguration) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
func (b *BackupConfiguration) ValidateUpdate(ctx context.Context, old, newObj runtime.Object) (admission.Warnings, error) {
backupconfigurationlog.Info("validate update", apis.KeyName, b.Name)
c := apis.GetRuntimeClient()
if err := b.validateBackends(); err != nil {
Expand All @@ -619,7 +619,7 @@ func (b *BackupConfiguration) ValidateUpdate(old runtime.Object) (admission.Warn
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (b *BackupConfiguration) ValidateDelete() (admission.Warnings, error) {
func (b *BackupConfiguration) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
backupconfigurationlog.Info("validate delete", apis.KeyName, b.Name)

// TODO(user): fill in your validation logic upon object deletion.
Expand Down
8 changes: 4 additions & 4 deletions apis/core/v1alpha1/backupsession_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ func (r *BackupSession) SetupWebhookWithManager(mgr ctrl.Manager) error {
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-core-kubestash-com-v1alpha1-backupsession,mutating=false,failurePolicy=fail,sideEffects=None,groups=core.kubestash.com,resources=backupsessions,verbs=create;update,versions=v1alpha1,name=vbackupsession.kb.io,admissionReviewVersions=v1

var _ webhook.Validator = &BackupSession{}
var _ webhook.CustomValidator = &BackupSession{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *BackupSession) ValidateCreate() (admission.Warnings, error) {
func (r *BackupSession) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {

Check failure on line 46 in apis/core/v1alpha1/backupsession_webhook.go

View workflow job for this annotation

GitHub Actions / Build

undefined: context
backupsessionlog.Info("validate create", "name", r.Name)

// TODO(user): fill in your validation logic upon object creation.
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *BackupSession) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
func (r *BackupSession) ValidateUpdate(ctx context.Context, old, newObj runtime.Object) (admission.Warnings, error) {

Check failure on line 54 in apis/core/v1alpha1/backupsession_webhook.go

View workflow job for this annotation

GitHub Actions / Build

undefined: context
backupsessionlog.Info("validate update", "name", r.Name)

oldBS := old.(*BackupSession)
Expand All @@ -63,7 +63,7 @@ func (r *BackupSession) ValidateUpdate(old runtime.Object) (admission.Warnings,
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *BackupSession) ValidateDelete() (admission.Warnings, error) {
func (r *BackupSession) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {

Check failure on line 66 in apis/core/v1alpha1/backupsession_webhook.go

View workflow job for this annotation

GitHub Actions / Build

undefined: context
backupsessionlog.Info("validate delete", "name", r.Name)

// TODO(user): fill in your validation logic upon object deletion.
Expand Down
8 changes: 4 additions & 4 deletions apis/core/v1alpha1/backupverificationsession_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ func (r *BackupVerificationSession) SetupWebhookWithManager(mgr ctrl.Manager) er
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-core-kubestash-com-v1alpha1-backupverificationsession,mutating=false,failurePolicy=fail,sideEffects=None,groups=core.kubestash.com,resources=backupverificationsessions,verbs=create;update,versions=v1alpha1,name=vbackupverificationsession.kb.io,admissionReviewVersions=v1

var _ webhook.Validator = &BackupVerificationSession{}
var _ webhook.CustomValidator = &BackupVerificationSession{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *BackupVerificationSession) ValidateCreate() (admission.Warnings, error) {
func (r *BackupVerificationSession) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {

Check failure on line 46 in apis/core/v1alpha1/backupverificationsession_webhook.go

View workflow job for this annotation

GitHub Actions / Build

undefined: context
backupverificationsessionlog.Info("validate create", "name", r.Name)

// TODO(user): fill in your validation logic upon object creation.
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *BackupVerificationSession) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
func (r *BackupVerificationSession) ValidateUpdate(ctx context.Context, old, newObj runtime.Object) (admission.Warnings, error) {

Check failure on line 54 in apis/core/v1alpha1/backupverificationsession_webhook.go

View workflow job for this annotation

GitHub Actions / Build

undefined: context
backupverificationsessionlog.Info("validate update", "name", r.Name)

oldBVS := old.(*BackupVerificationSession)
Expand All @@ -63,7 +63,7 @@ func (r *BackupVerificationSession) ValidateUpdate(old runtime.Object) (admissio
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *BackupVerificationSession) ValidateDelete() (admission.Warnings, error) {
func (r *BackupVerificationSession) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {

Check failure on line 66 in apis/core/v1alpha1/backupverificationsession_webhook.go

View workflow job for this annotation

GitHub Actions / Build

undefined: context
backupverificationsessionlog.Info("validate delete", "name", r.Name)

// TODO(user): fill in your validation logic upon object deletion.
Expand Down
8 changes: 4 additions & 4 deletions apis/core/v1alpha1/backupverifier_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ func (v *BackupVerifier) SetupWebhookWithManager(mgr ctrl.Manager) error {
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-core-kubestash-com-v1alpha1-backupverifier,mutating=false,failurePolicy=fail,sideEffects=None,groups=core.kubestash.com,resources=backupverifiers,verbs=create;update,versions=v1alpha1,name=vbackupverifier.kb.io,admissionReviewVersions=v1

var _ webhook.Validator = &BackupVerifier{}
var _ webhook.CustomValidator = &BackupVerifier{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (v *BackupVerifier) ValidateCreate() (admission.Warnings, error) {
func (v *BackupVerifier) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {

Check failure on line 45 in apis/core/v1alpha1/backupverifier_webhook.go

View workflow job for this annotation

GitHub Actions / Build

undefined: context
backupverifierlog.Info("validate create", "name", v.Name)

if err := v.validateVerifier(); err != nil {
Expand All @@ -53,7 +53,7 @@ func (v *BackupVerifier) ValidateCreate() (admission.Warnings, error) {
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (v *BackupVerifier) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
func (v *BackupVerifier) ValidateUpdate(ctx context.Context, old, newObj runtime.Object) (admission.Warnings, error) {
backupverifierlog.Info("validate update", "name", v.Name)

if err := v.validateVerifier(); err != nil {
Expand All @@ -64,7 +64,7 @@ func (v *BackupVerifier) ValidateUpdate(old runtime.Object) (admission.Warnings,
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (v *BackupVerifier) ValidateDelete() (admission.Warnings, error) {
func (v *BackupVerifier) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
backupverifierlog.Info("validate delete", "name", v.Name)

// TODO(user): fill in your validation logic upon object deletion.
Expand Down
12 changes: 6 additions & 6 deletions apis/core/v1alpha1/hooktemplate_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ func (r *HookTemplate) SetupWebhookWithManager(mgr ctrl.Manager) error {

//+kubebuilder:webhook:path=/mutate-core-kubestash-com-v1alpha1-hooktemplate,mutating=true,failurePolicy=fail,sideEffects=None,groups=core.kubestash.com,resources=hooktemplates,verbs=create;update,versions=v1alpha1,name=mhooktemplate.kb.io,admissionReviewVersions=v1

var _ webhook.Defaulter = &HookTemplate{}
var _ webhook.CustomDefaulter = &HookTemplate{}

// Default implements webhook.Defaulter so a webhook will be registered for the type
func (r *HookTemplate) Default() {
func (r *HookTemplate) Default(ctx context.Context, obj runtime.Object) error {
hooktemplatelog.Info("default", "name", r.Name)

if r.Spec.UsagePolicy == nil {
Expand All @@ -54,10 +54,10 @@ func (r *HookTemplate) Default() {
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-core-kubestash-com-v1alpha1-hooktemplate,mutating=false,failurePolicy=fail,sideEffects=None,groups=core.kubestash.com,resources=hooktemplates,verbs=create;update,versions=v1alpha1,name=vhooktemplate.kb.io,admissionReviewVersions=v1

var _ webhook.Validator = &HookTemplate{}
var _ webhook.CustomValidator = &HookTemplate{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *HookTemplate) ValidateCreate() (admission.Warnings, error) {
func (r *HookTemplate) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
hooktemplatelog.Info("validate create", "name", r.Name)

if r.Spec.Executor == nil {
Expand All @@ -76,7 +76,7 @@ func (r *HookTemplate) ValidateCreate() (admission.Warnings, error) {
}

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

if r.Spec.Executor == nil {
Expand All @@ -95,7 +95,7 @@ func (r *HookTemplate) ValidateUpdate(old runtime.Object) (admission.Warnings, e
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *HookTemplate) ValidateDelete() (admission.Warnings, error) {
func (r *HookTemplate) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
hooktemplatelog.Info("validate delete", "name", r.Name)

// TODO(user): fill in your validation logic upon object deletion.
Expand Down
8 changes: 4 additions & 4 deletions apis/core/v1alpha1/restoresession_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ func (r *RestoreSession) SetupWebhookWithManager(mgr ctrl.Manager) error {
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-core-kubestash-com-v1alpha1-restoresession,mutating=false,failurePolicy=fail,sideEffects=None,groups=core.kubestash.com,resources=restoresessions,verbs=create;update,versions=v1alpha1,name=vrestoresession.kb.io,admissionReviewVersions=v1

var _ webhook.Validator = &RestoreSession{}
var _ webhook.CustomValidator = &RestoreSession{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *RestoreSession) ValidateCreate() (admission.Warnings, error) {
func (r *RestoreSession) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
restoresessionlog.Info("validate create", "name", r.Name)

if err := r.ValidateDataSource(); err != nil {
Expand All @@ -59,7 +59,7 @@ func (r *RestoreSession) ValidateCreate() (admission.Warnings, error) {
}

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

if err := r.ValidateDataSource(); err != nil {
Expand All @@ -70,7 +70,7 @@ func (r *RestoreSession) ValidateUpdate(old runtime.Object) (admission.Warnings,
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *RestoreSession) ValidateDelete() (admission.Warnings, error) {
func (r *RestoreSession) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
restoresessionlog.Info("validate delete", "name", r.Name)

// TODO(user): fill in your validation logic upon object deletion.
Expand Down
Loading

0 comments on commit c12a263

Please sign in to comment.