mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 11:28:58 +00:00
admission: mark review fields optional
This commit is contained in:
@@ -215,7 +215,7 @@ linters:
|
||||
# OptionalOrRequired is being enabled over time. For now, each API group should be added to this list until we comb through each group and fix the missing tags.
|
||||
# The nonpointerstructs linter is included here as well as these two should be enabled hand-in-hand on each API group.
|
||||
- text: "must be marked as optional or required|is a non-pointer struct with no required fields."
|
||||
path: "staging/src/k8s.io/api/(admission|apidiscovery|apps|authorization|autoscaling|batch|certificates|core|discovery|events|extensions|flowcontrol|networking|resource|storage)"
|
||||
path: "staging/src/k8s.io/api/(apidiscovery|apps|authorization|autoscaling|batch|certificates|core|discovery|events|extensions|flowcontrol|networking|resource|storage)"
|
||||
|
||||
# OptionalOrRequired - Existing fields that are marked as both optional and required (based on standard optional vs kubebuilder:validation:Required) and should not be fixed.
|
||||
- text: "field (PortStatus|IngressPortStatus)\\.Error must not be marked as both optional and required"
|
||||
|
||||
@@ -230,7 +230,7 @@ linters:
|
||||
# OptionalOrRequired is being enabled over time. For now, each API group should be added to this list until we comb through each group and fix the missing tags.
|
||||
# The nonpointerstructs linter is included here as well as these two should be enabled hand-in-hand on each API group.
|
||||
- text: "must be marked as optional or required|is a non-pointer struct with no required fields."
|
||||
path: "staging/src/k8s.io/api/(admission|apidiscovery|apps|authorization|autoscaling|batch|certificates|core|discovery|events|extensions|flowcontrol|networking|resource|storage)"
|
||||
path: "staging/src/k8s.io/api/(apidiscovery|apps|authorization|autoscaling|batch|certificates|core|discovery|events|extensions|flowcontrol|networking|resource|storage)"
|
||||
|
||||
# OptionalOrRequired - Existing fields that are marked as both optional and required (based on standard optional vs kubebuilder:validation:Required) and should not be fixed.
|
||||
- text: "field (PortStatus|IngressPortStatus)\\.Error must not be marked as both optional and required"
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
# OptionalOrRequired is being enabled over time. For now, each API group should be added to this list until we comb through each group and fix the missing tags.
|
||||
# The nonpointerstructs linter is included here as well as these two should be enabled hand-in-hand on each API group.
|
||||
- text: "must be marked as optional or required|is a non-pointer struct with no required fields."
|
||||
path: "staging/src/k8s.io/api/(admission|apidiscovery|apps|authorization|autoscaling|batch|certificates|core|discovery|events|extensions|flowcontrol|networking|resource|storage)"
|
||||
path: "staging/src/k8s.io/api/(apidiscovery|apps|authorization|autoscaling|batch|certificates|core|discovery|events|extensions|flowcontrol|networking|resource|storage)"
|
||||
|
||||
# OptionalOrRequired - Existing fields that are marked as both optional and required (based on standard optional vs kubebuilder:validation:Required) and should not be fixed.
|
||||
- text: "field (PortStatus|IngressPortStatus)\\.Error must not be marked as both optional and required"
|
||||
|
||||
@@ -43,10 +43,13 @@ type AdmissionRequest struct {
|
||||
// otherwise identical (parallel requests, requests when earlier requests did not modify etc)
|
||||
// The UID is meant to track the round trip (request/response) between the KAS and the WebHook, not the user request.
|
||||
// It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging.
|
||||
// +optional
|
||||
UID types.UID `json:"uid" protobuf:"bytes,1,opt,name=uid"`
|
||||
// kind is the fully-qualified type of object being submitted (for example, v1.Pod or autoscaling.v1.Scale)
|
||||
// +optional
|
||||
Kind metav1.GroupVersionKind `json:"kind" protobuf:"bytes,2,opt,name=kind"`
|
||||
// resource is the fully-qualified resource being requested (for example, v1.pods)
|
||||
// +optional
|
||||
Resource metav1.GroupVersionResource `json:"resource" protobuf:"bytes,3,opt,name=resource"`
|
||||
// subResource is the subresource being requested, if any (for example, "status" or "scale")
|
||||
// +optional
|
||||
@@ -91,8 +94,10 @@ type AdmissionRequest struct {
|
||||
Namespace string `json:"namespace,omitempty" protobuf:"bytes,6,opt,name=namespace"`
|
||||
// operation is the operation being performed. This may be different than the operation
|
||||
// requested. e.g. a patch can result in either a CREATE or UPDATE Operation.
|
||||
// +optional
|
||||
Operation Operation `json:"operation" protobuf:"bytes,7,opt,name=operation"`
|
||||
// userInfo is information about the requesting user
|
||||
// +optional
|
||||
UserInfo authenticationv1.UserInfo `json:"userInfo" protobuf:"bytes,8,opt,name=userInfo"`
|
||||
// object is the object from the incoming request.
|
||||
// +optional
|
||||
@@ -117,9 +122,11 @@ type AdmissionRequest struct {
|
||||
type AdmissionResponse struct {
|
||||
// uid is an identifier for the individual request/response.
|
||||
// This must be copied over from the corresponding AdmissionRequest.
|
||||
// +optional
|
||||
UID types.UID `json:"uid" protobuf:"bytes,1,opt,name=uid"`
|
||||
|
||||
// allowed indicates whether or not the admission request was permitted.
|
||||
// +optional
|
||||
Allowed bool `json:"allowed" protobuf:"varint,2,opt,name=allowed"`
|
||||
|
||||
// status is the result contains extra details into why an admission request was denied.
|
||||
|
||||
@@ -47,10 +47,13 @@ type AdmissionRequest struct {
|
||||
// otherwise identical (parallel requests, requests when earlier requests did not modify etc)
|
||||
// The UID is meant to track the round trip (request/response) between the KAS and the WebHook, not the user request.
|
||||
// It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging.
|
||||
// +optional
|
||||
UID types.UID `json:"uid" protobuf:"bytes,1,opt,name=uid"`
|
||||
// kind is the fully-qualified type of object being submitted (for example, v1.Pod or autoscaling.v1.Scale)
|
||||
// +optional
|
||||
Kind metav1.GroupVersionKind `json:"kind" protobuf:"bytes,2,opt,name=kind"`
|
||||
// resource is the fully-qualified resource being requested (for example, v1.pods)
|
||||
// +optional
|
||||
Resource metav1.GroupVersionResource `json:"resource" protobuf:"bytes,3,opt,name=resource"`
|
||||
// subResource is the subresource being requested, if any (for example, "status" or "scale")
|
||||
// +optional
|
||||
@@ -95,8 +98,10 @@ type AdmissionRequest struct {
|
||||
Namespace string `json:"namespace,omitempty" protobuf:"bytes,6,opt,name=namespace"`
|
||||
// operation is the operation being performed. This may be different than the operation
|
||||
// requested. e.g. a patch can result in either a CREATE or UPDATE Operation.
|
||||
// +optional
|
||||
Operation Operation `json:"operation" protobuf:"bytes,7,opt,name=operation"`
|
||||
// userInfo is information about the requesting user
|
||||
// +optional
|
||||
UserInfo authenticationv1.UserInfo `json:"userInfo" protobuf:"bytes,8,opt,name=userInfo"`
|
||||
// object is the object from the incoming request.
|
||||
// +optional
|
||||
@@ -121,9 +126,11 @@ type AdmissionRequest struct {
|
||||
type AdmissionResponse struct {
|
||||
// uid is an identifier for the individual request/response.
|
||||
// This should be copied over from the corresponding AdmissionRequest.
|
||||
// +optional
|
||||
UID types.UID `json:"uid" protobuf:"bytes,1,opt,name=uid"`
|
||||
|
||||
// allowed indicates whether or not the admission request was permitted.
|
||||
// +optional
|
||||
Allowed bool `json:"allowed" protobuf:"varint,2,opt,name=allowed"`
|
||||
|
||||
// status is the result contains extra details into why an admission request was denied.
|
||||
|
||||
Reference in New Issue
Block a user