Files
spark-operator/internal/webhook/scheduledsparkapplication_defaulter.go
Shingo OmuraandGitHub 566d62aa81 Bump k8s to v1.35.4 and controller-runtime to v0.23.3 (#2946)
* Bump k8s api to 0.35.4, and controller runtime to v0.23.3

Signed-off-by: Shingo Omura <[email protected]>

* Migrated defaulter/validator to be Generic ones

Signed-off-by: Shingo Omura <[email protected]>

* Fixed Endpoints deprecation lint errors (replaced with EndpointSlice)

Signed-off-by: Shingo Omura <[email protected]>

* Deleted unused internal/controller/sparkapplication/validator.go

Signed-off-by: Shingo Omura <[email protected]>

* Add SA1019 exclusion to golangci-lint config so to preserve Requeue behavior of controllers

Signed-off-by: Shingo Omura <[email protected]>

* Fixed util.WriteObjectToFile test. Null creationTimestamp is not marshalled anymore.

Signed-off-by: Shingo Omura <[email protected]>

* Updated codegen and API definitions

Signed-off-by: Shingo Omura <[email protected]>

* Fixed mgr.GetEventRecorderFor() deprecation (replace with mgr.GetEventRecorder())

Signed-off-by: Shingo Omura <[email protected]>

---------

Signed-off-by: Shingo Omura <[email protected]>
2026-06-18 15:36:34 +00:00

55 lines
2.2 KiB
Go

/*
Copyright 2024 The Kubeflow authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package webhook
import (
"context"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
"github.com/kubeflow/spark-operator/v2/api/v1beta2"
)
// +kubebuilder:webhook:admissionReviewVersions=v1,failurePolicy=fail,groups=sparkoperator.k8s.io,matchPolicy=Exact,mutating=true,name=mutate-scheduledsparkapplication.sparkoperator.k8s.io,path=/mutate-sparkoperator-k8s-io-v1beta2-scheduledsparkapplication,reinvocationPolicy=Never,resources=scheduledsparkapplications,sideEffects=None,verbs=create;update,versions=v1beta2,webhookVersions=v1
// ScheduledSparkApplicationDefaulter sets default values for a ScheduledSparkApplication.
type ScheduledSparkApplicationDefaulter struct{}
// NewScheduledSparkApplicationDefaulter creates a new ScheduledSparkApplicationDefaulter instance.
func NewScheduledSparkApplicationDefaulter() *ScheduledSparkApplicationDefaulter {
return &ScheduledSparkApplicationDefaulter{}
}
// ScheduledSparkApplicationDefaulter implements admission.Defaulter.
var _ admission.Defaulter[*v1beta2.ScheduledSparkApplication] = &ScheduledSparkApplicationDefaulter{}
// Default implements admission.Defaulter.
// This is currently a no-op placeholder. Concrete defaulting logic (e.g., calling
// operatorscheme.WebhookScheme.Default) will be added in a future PR.
// The webhook is registered now so that the manifest path is correct and
// ready when defaulting is implemented.
func (d *ScheduledSparkApplicationDefaulter) Default(ctx context.Context, obj *v1beta2.ScheduledSparkApplication) error {
if obj == nil {
return nil
}
logger := log.FromContext(ctx)
logger.Info("Mutating ScheduledSparkApplication")
return nil
}