From 2e18314918952873c882da8d591ff50a1df64cea Mon Sep 17 00:00:00 2001 From: Jefftree Date: Mon, 5 Apr 2021 13:46:37 -0700 Subject: [PATCH] Tag certain non-selector structs as atomic --- api/api-rules/violation_exceptions.list | 2 -- staging/src/k8s.io/api/autoscaling/v1/types.go | 1 + staging/src/k8s.io/api/core/v1/types.go | 7 +++++++ staging/src/k8s.io/api/discovery/v1/types.go | 1 + staging/src/k8s.io/api/rbac/v1/types.go | 2 ++ staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go | 1 + 6 files changed, 12 insertions(+), 2 deletions(-) diff --git a/api/api-rules/violation_exceptions.list b/api/api-rules/violation_exceptions.list index 4e58149d9e7..834c277e282 100644 --- a/api/api-rules/violation_exceptions.list +++ b/api/api-rules/violation_exceptions.list @@ -256,14 +256,12 @@ API rule violation: list_type_missing,k8s.io/api/rbac/v1beta1,Role,Rules API rule violation: list_type_missing,k8s.io/api/rbac/v1beta1,RoleBinding,Subjects API rule violation: list_type_missing,k8s.io/api/storage/v1,CSINodeDriver,TopologyKeys API rule violation: list_type_missing,k8s.io/api/storage/v1,CSINodeSpec,Drivers -API rule violation: list_type_missing,k8s.io/api/storage/v1,StorageClass,AllowedTopologies API rule violation: list_type_missing,k8s.io/api/storage/v1,StorageClass,MountOptions API rule violation: list_type_missing,k8s.io/api/storage/v1alpha1,CSIStorageCapacityList,Items API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,CSIDriverSpec,VolumeLifecycleModes API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,CSINodeDriver,TopologyKeys API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,CSINodeSpec,Drivers API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,CSIStorageCapacityList,Items -API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,StorageClass,AllowedTopologies API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,StorageClass,MountOptions API rule violation: list_type_missing,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,ConversionRequest,Objects API rule violation: list_type_missing,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,ConversionResponse,ConvertedObjects diff --git a/staging/src/k8s.io/api/autoscaling/v1/types.go b/staging/src/k8s.io/api/autoscaling/v1/types.go index 3343177b2ad..93b1efb51cc 100644 --- a/staging/src/k8s.io/api/autoscaling/v1/types.go +++ b/staging/src/k8s.io/api/autoscaling/v1/types.go @@ -23,6 +23,7 @@ import ( ) // CrossVersionObjectReference contains enough information to let you identify the referred resource. +// +structType=atomic type CrossVersionObjectReference struct { // Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` diff --git a/staging/src/k8s.io/api/core/v1/types.go b/staging/src/k8s.io/api/core/v1/types.go index 2863d9c520d..3d48cfbc3bd 100644 --- a/staging/src/k8s.io/api/core/v1/types.go +++ b/staging/src/k8s.io/api/core/v1/types.go @@ -861,6 +861,7 @@ type CephFSVolumeSource struct { // SecretReference represents a Secret Reference. It has enough information to retrieve secret // in any namespace +// +structType=atomic type SecretReference struct { // Name is unique within a namespace to reference a secret resource. // +optional @@ -2629,6 +2630,7 @@ type NodeSelector struct { // A null or empty node selector term matches no objects. The requirements of // them are ANDed. // The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. +// +structType=atomic type NodeSelectorTerm struct { // A list of node selector requirements by node's labels. // +optional @@ -4531,6 +4533,7 @@ type EndpointSubset struct { } // EndpointAddress is a tuple that describes single IP address. +// +structType=atomic type EndpointAddress struct { // The IP of this endpoint. // May not be loopback (127.0.0.0/8), link-local (169.254.0.0/16), @@ -4551,6 +4554,7 @@ type EndpointAddress struct { } // EndpointPort is a tuple that describes a single port. +// +structType=atomic type EndpointPort struct { // The name of this port. This must match the 'name' field in the // corresponding ServicePort. @@ -5370,6 +5374,7 @@ type ServiceProxyOptions struct { // Instead of using this type, create a locally provided and used type that is well-focused on your reference. // For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 . // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +structType=atomic type ObjectReference struct { // Kind of the referent. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds @@ -5409,6 +5414,7 @@ type ObjectReference struct { // LocalObjectReference contains enough information to let you locate the // referenced object inside the same namespace. +// +structType=atomic type LocalObjectReference struct { // Name of the referent. // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names @@ -5419,6 +5425,7 @@ type LocalObjectReference struct { // TypedLocalObjectReference contains enough information to let you locate the // typed referenced object inside the same namespace. +// +structType=atomic type TypedLocalObjectReference struct { // APIGroup is the group for the resource being referenced. // If APIGroup is not specified, the specified Kind must be in the core API group. diff --git a/staging/src/k8s.io/api/discovery/v1/types.go b/staging/src/k8s.io/api/discovery/v1/types.go index fa990efdb73..b66fdd88495 100644 --- a/staging/src/k8s.io/api/discovery/v1/types.go +++ b/staging/src/k8s.io/api/discovery/v1/types.go @@ -153,6 +153,7 @@ type ForZone struct { } // EndpointPort represents a Port used by an EndpointSlice +// +structType=atomic type EndpointPort struct { // The name of this port. All ports in an EndpointSlice must have a unique // name. If the EndpointSlice is dervied from a Kubernetes service, this diff --git a/staging/src/k8s.io/api/rbac/v1/types.go b/staging/src/k8s.io/api/rbac/v1/types.go index 7ba7d05435e..6129bb2d50f 100644 --- a/staging/src/k8s.io/api/rbac/v1/types.go +++ b/staging/src/k8s.io/api/rbac/v1/types.go @@ -70,6 +70,7 @@ type PolicyRule struct { // Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, // or a value for non-objects such as user and group names. +// +structType=atomic type Subject struct { // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. @@ -88,6 +89,7 @@ type Subject struct { } // RoleRef contains information that points to the role being used +// +structType=atomic type RoleRef struct { // APIGroup is the group for the resource being referenced APIGroup string `json:"apiGroup" protobuf:"bytes,1,opt,name=apiGroup"` diff --git a/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go b/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go index 79e2ad48a04..8b0057d8cde 100644 --- a/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go +++ b/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go @@ -303,6 +303,7 @@ const ( // OwnerReference contains enough information to let you identify an owning // object. An owning object must be in the same namespace as the dependent, or // be cluster-scoped, so there is no namespace field. +// +structType=atomic type OwnerReference struct { // API version of the referent. APIVersion string `json:"apiVersion" protobuf:"bytes,5,opt,name=apiVersion"`