mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-01 22:34:14 +00:00
Move pkg/api.{Context,RequestContextMapper} into pkg/genericapiserver/api/request
This commit is contained in:
@@ -28,6 +28,7 @@ import (
|
||||
metav1 "k8s.io/kubernetes/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/pkg/controller/deployment/util"
|
||||
"k8s.io/kubernetes/pkg/fields"
|
||||
genericapirequest "k8s.io/kubernetes/pkg/genericapiserver/api/request"
|
||||
"k8s.io/kubernetes/pkg/labels"
|
||||
"k8s.io/kubernetes/pkg/registry/generic"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
@@ -57,14 +58,14 @@ func (deploymentStrategy) NamespaceScoped() bool {
|
||||
}
|
||||
|
||||
// PrepareForCreate clears fields that are not allowed to be set by end users on creation.
|
||||
func (deploymentStrategy) PrepareForCreate(ctx api.Context, obj runtime.Object) {
|
||||
func (deploymentStrategy) PrepareForCreate(ctx genericapirequest.Context, obj runtime.Object) {
|
||||
deployment := obj.(*extensions.Deployment)
|
||||
deployment.Status = extensions.DeploymentStatus{}
|
||||
deployment.Generation = 1
|
||||
}
|
||||
|
||||
// Validate validates a new deployment.
|
||||
func (deploymentStrategy) Validate(ctx api.Context, obj runtime.Object) field.ErrorList {
|
||||
func (deploymentStrategy) Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList {
|
||||
deployment := obj.(*extensions.Deployment)
|
||||
return validation.ValidateDeployment(deployment)
|
||||
}
|
||||
@@ -79,7 +80,7 @@ func (deploymentStrategy) AllowCreateOnUpdate() bool {
|
||||
}
|
||||
|
||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
||||
func (deploymentStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) {
|
||||
func (deploymentStrategy) PrepareForUpdate(ctx genericapirequest.Context, obj, old runtime.Object) {
|
||||
newDeployment := obj.(*extensions.Deployment)
|
||||
oldDeployment := old.(*extensions.Deployment)
|
||||
newDeployment.Status = oldDeployment.Status
|
||||
@@ -103,7 +104,7 @@ func (deploymentStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Obj
|
||||
}
|
||||
|
||||
// ValidateUpdate is the default update validation for an end user.
|
||||
func (deploymentStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList {
|
||||
func (deploymentStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {
|
||||
return validation.ValidateDeploymentUpdate(obj.(*extensions.Deployment), old.(*extensions.Deployment))
|
||||
}
|
||||
|
||||
@@ -118,7 +119,7 @@ type deploymentStatusStrategy struct {
|
||||
var StatusStrategy = deploymentStatusStrategy{Strategy}
|
||||
|
||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update of status
|
||||
func (deploymentStatusStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) {
|
||||
func (deploymentStatusStrategy) PrepareForUpdate(ctx genericapirequest.Context, obj, old runtime.Object) {
|
||||
newDeployment := obj.(*extensions.Deployment)
|
||||
oldDeployment := old.(*extensions.Deployment)
|
||||
newDeployment.Spec = oldDeployment.Spec
|
||||
@@ -126,7 +127,7 @@ func (deploymentStatusStrategy) PrepareForUpdate(ctx api.Context, obj, old runti
|
||||
}
|
||||
|
||||
// ValidateUpdate is the default update validation for an end user updating status
|
||||
func (deploymentStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList {
|
||||
func (deploymentStatusStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {
|
||||
return validation.ValidateDeploymentStatusUpdate(obj.(*extensions.Deployment), old.(*extensions.Deployment))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user