Merge pull request #116397 from jiahuif-forks/feature/validating-admission-policy/message-expression

MessageExpression for ValidatingAdmissionPolicy

Kubernetes-commit: 6b3e2b7873f8518b95f5b09fa04f5f316669c7b2
This commit is contained in:
Kubernetes Publisher 2023-03-13 19:31:08 -07:00
commit b5e4a5a9c3
4 changed files with 19 additions and 7 deletions

View File

@ -28,6 +28,7 @@ type ValidationApplyConfiguration struct {
Expression *string `json:"expression,omitempty"`
Message *string `json:"message,omitempty"`
Reason *v1.StatusReason `json:"reason,omitempty"`
MessageExpression *string `json:"messageExpression,omitempty"`
}
// ValidationApplyConfiguration constructs an declarative configuration of the Validation type for use with
@ -59,3 +60,11 @@ func (b *ValidationApplyConfiguration) WithReason(value v1.StatusReason) *Valida
b.Reason = &value
return b
}
// WithMessageExpression sets the MessageExpression field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the MessageExpression field is set to the value of the last call.
func (b *ValidationApplyConfiguration) WithMessageExpression(value string) *ValidationApplyConfiguration {
b.MessageExpression = &value
return b
}

View File

@ -404,6 +404,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: message
type:
scalar: string
- name: messageExpression
type:
scalar: string
- name: reason
type:
scalar: string

4
go.mod
View File

@ -24,7 +24,7 @@ require (
golang.org/x/term v0.5.0
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
google.golang.org/protobuf v1.28.1
k8s.io/api v0.0.0-20230314010636-4c844db47d54
k8s.io/api v0.0.0-20230314051611-bd0ab2c00ff0
k8s.io/apimachinery v0.0.0-20230314010357-128166500c57
k8s.io/klog/v2 v2.90.1
k8s.io/kube-openapi v0.0.0-20230308215209-15aac26d736a
@ -59,6 +59,6 @@ require (
)
replace (
k8s.io/api => k8s.io/api v0.0.0-20230314010636-4c844db47d54
k8s.io/api => k8s.io/api v0.0.0-20230314051611-bd0ab2c00ff0
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20230314010357-128166500c57
)

4
go.sum
View File

@ -473,8 +473,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20230314010636-4c844db47d54 h1:0VSpq40qYJx9GN/G+BzJiVgcz3cR3xPc+xn3nQLAoZ8=
k8s.io/api v0.0.0-20230314010636-4c844db47d54/go.mod h1:YsFNxBfPYQZAIBg0XvL94rxDDVZvQQQUlo4KbwEEqNU=
k8s.io/api v0.0.0-20230314051611-bd0ab2c00ff0 h1:cklt3bA2So9x6tHCIjg2iGCS6K5bRv/aYPR0/KIah3U=
k8s.io/api v0.0.0-20230314051611-bd0ab2c00ff0/go.mod h1:YsFNxBfPYQZAIBg0XvL94rxDDVZvQQQUlo4KbwEEqNU=
k8s.io/apimachinery v0.0.0-20230314010357-128166500c57 h1:Vr1geeI+at1NNCWyTN70NtPSNcveZ+fAcbZivzwHknM=
k8s.io/apimachinery v0.0.0-20230314010357-128166500c57/go.mod h1:1AlvkfXatlv5Kq9dCZg3Ksdu/DyrZ31Q0CncRqQ8Q9I=
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=