Merge pull request #90247 from liggitt/lifecycle-generator

Lifecycle generator updates
This commit is contained in:
Kubernetes Prow Robot
2020-04-17 19:09:35 -07:00
committed by GitHub
3 changed files with 253 additions and 104 deletions

View File

@@ -77,6 +77,7 @@ type Scale struct {
// +k8s:prerelease-lifecycle-gen:introduced=1.1
// +k8s:prerelease-lifecycle-gen:deprecated=1.8
// +k8s:prerelease-lifecycle-gen:removed=1.18
// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,Deployment
// DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for
// more information.
@@ -313,6 +314,7 @@ type DeploymentCondition struct {
// +k8s:prerelease-lifecycle-gen:introduced=1.1
// +k8s:prerelease-lifecycle-gen:deprecated=1.8
// +k8s:prerelease-lifecycle-gen:removed=1.18
// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,DeploymentList
// DeploymentList is a list of Deployments.
type DeploymentList struct {
@@ -490,6 +492,7 @@ type DaemonSetCondition struct {
// +k8s:prerelease-lifecycle-gen:introduced=1.1
// +k8s:prerelease-lifecycle-gen:deprecated=1.8
// +k8s:prerelease-lifecycle-gen:removed=1.18
// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,DaemonSet
// DEPRECATED - This group version of DaemonSet is deprecated by apps/v1beta2/DaemonSet. See the release notes for
// more information.
@@ -532,6 +535,7 @@ const (
// +k8s:prerelease-lifecycle-gen:introduced=1.1
// +k8s:prerelease-lifecycle-gen:deprecated=1.8
// +k8s:prerelease-lifecycle-gen:removed=1.18
// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,DaemonSetList
// DaemonSetList is a collection of daemon sets.
type DaemonSetList struct {
@@ -550,6 +554,7 @@ type DaemonSetList struct {
// +k8s:prerelease-lifecycle-gen:introduced=1.1
// +k8s:prerelease-lifecycle-gen:deprecated=1.14
// +k8s:prerelease-lifecycle-gen:removed=1.22
// +k8s:prerelease-lifecycle-gen:replacement=networking.k8s.io,v1beta1,Ingress
// Ingress is a collection of rules that allow inbound connections to reach the
// endpoints defined by a backend. An Ingress can be configured to give services
@@ -578,6 +583,7 @@ type Ingress struct {
// +k8s:prerelease-lifecycle-gen:introduced=1.1
// +k8s:prerelease-lifecycle-gen:deprecated=1.14
// +k8s:prerelease-lifecycle-gen:removed=1.22
// +k8s:prerelease-lifecycle-gen:replacement=networking.k8s.io,v1beta1,IngressList
// IngressList is a collection of Ingress.
type IngressList struct {
@@ -803,6 +809,7 @@ type IngressBackend struct {
// +k8s:prerelease-lifecycle-gen:introduced=1.2
// +k8s:prerelease-lifecycle-gen:deprecated=1.8
// +k8s:prerelease-lifecycle-gen:removed=1.18
// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,ReplicaSet
// DEPRECATED - This group version of ReplicaSet is deprecated by apps/v1beta2/ReplicaSet. See the release notes for
// more information.
@@ -834,6 +841,7 @@ type ReplicaSet struct {
// +k8s:prerelease-lifecycle-gen:introduced=1.2
// +k8s:prerelease-lifecycle-gen:deprecated=1.8
// +k8s:prerelease-lifecycle-gen:removed=1.18
// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,ReplicaSetList
// ReplicaSetList is a collection of ReplicaSets.
type ReplicaSetList struct {
@@ -939,6 +947,7 @@ type ReplicaSetCondition struct {
// +k8s:prerelease-lifecycle-gen:introduced=1.2
// +k8s:prerelease-lifecycle-gen:deprecated=1.11
// +k8s:prerelease-lifecycle-gen:removed=1.18
// +k8s:prerelease-lifecycle-gen:replacement=policy,v1beta1,PodSecurityPolicy
// PodSecurityPolicy governs the ability to make requests that affect the Security Context
// that will be applied to a pod and container.
@@ -1300,6 +1309,7 @@ const AllowAllRuntimeClassNames = "*"
// +k8s:prerelease-lifecycle-gen:introduced=1.2
// +k8s:prerelease-lifecycle-gen:deprecated=1.11
// +k8s:prerelease-lifecycle-gen:removed=1.18
// +k8s:prerelease-lifecycle-gen:replacement=policy,v1beta1,PodSecurityPolicyList
// PodSecurityPolicyList is a list of PodSecurityPolicy objects.
// Deprecated: use PodSecurityPolicyList from policy API Group instead.
@@ -1319,6 +1329,7 @@ type PodSecurityPolicyList struct {
// +k8s:prerelease-lifecycle-gen:introduced=1.3
// +k8s:prerelease-lifecycle-gen:deprecated=1.9
// +k8s:prerelease-lifecycle-gen:removed=1.18
// +k8s:prerelease-lifecycle-gen:replacement=networking.k8s.io,v1,NetworkPolicy
// DEPRECATED 1.9 - This group version of NetworkPolicy is deprecated by networking/v1/NetworkPolicy.
// NetworkPolicy describes what network traffic is allowed for a set of Pods
@@ -1492,6 +1503,7 @@ type NetworkPolicyPeer struct {
// +k8s:prerelease-lifecycle-gen:introduced=1.3
// +k8s:prerelease-lifecycle-gen:deprecated=1.9
// +k8s:prerelease-lifecycle-gen:removed=1.18
// +k8s:prerelease-lifecycle-gen:replacement=networking.k8s.io,v1,NetworkPolicyList
// DEPRECATED 1.9 - This group version of NetworkPolicyList is deprecated by networking/v1/NetworkPolicyList.
// Network Policy List is a list of NetworkPolicy objects.

View File

@@ -20,254 +20,330 @@ limitations under the License.
package v1beta1
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
)
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *DaemonSet) Introduced() (int64, int64) {
func (in *DaemonSet) APILifecycleIntroduced() (major, minor int) {
return 1, 1
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *DaemonSet) Deprecated() (int64, int64) {
func (in *DaemonSet) APILifecycleDeprecated() (major, minor int) {
return 1, 8
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *DaemonSet) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "DaemonSet"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *DaemonSet) Removed() (int64, int64) {
func (in *DaemonSet) APILifecycleRemoved() (major, minor int) {
return 1, 18
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *DaemonSetList) Introduced() (int64, int64) {
func (in *DaemonSetList) APILifecycleIntroduced() (major, minor int) {
return 1, 1
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *DaemonSetList) Deprecated() (int64, int64) {
func (in *DaemonSetList) APILifecycleDeprecated() (major, minor int) {
return 1, 8
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *DaemonSetList) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "DaemonSetList"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *DaemonSetList) Removed() (int64, int64) {
func (in *DaemonSetList) APILifecycleRemoved() (major, minor int) {
return 1, 18
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *Deployment) Introduced() (int64, int64) {
func (in *Deployment) APILifecycleIntroduced() (major, minor int) {
return 1, 1
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *Deployment) Deprecated() (int64, int64) {
func (in *Deployment) APILifecycleDeprecated() (major, minor int) {
return 1, 8
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *Deployment) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "Deployment"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *Deployment) Removed() (int64, int64) {
func (in *Deployment) APILifecycleRemoved() (major, minor int) {
return 1, 18
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *DeploymentList) Introduced() (int64, int64) {
func (in *DeploymentList) APILifecycleIntroduced() (major, minor int) {
return 1, 1
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *DeploymentList) Deprecated() (int64, int64) {
func (in *DeploymentList) APILifecycleDeprecated() (major, minor int) {
return 1, 8
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *DeploymentList) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "DeploymentList"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *DeploymentList) Removed() (int64, int64) {
func (in *DeploymentList) APILifecycleRemoved() (major, minor int) {
return 1, 18
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *DeploymentRollback) Introduced() (int64, int64) {
func (in *DeploymentRollback) APILifecycleIntroduced() (major, minor int) {
return 1, 2
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *DeploymentRollback) Deprecated() (int64, int64) {
func (in *DeploymentRollback) APILifecycleDeprecated() (major, minor int) {
return 1, 8
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *DeploymentRollback) Removed() (int64, int64) {
func (in *DeploymentRollback) APILifecycleRemoved() (major, minor int) {
return 1, 18
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *Ingress) Introduced() (int64, int64) {
func (in *Ingress) APILifecycleIntroduced() (major, minor int) {
return 1, 1
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *Ingress) Deprecated() (int64, int64) {
func (in *Ingress) APILifecycleDeprecated() (major, minor int) {
return 1, 14
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *Ingress) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "networking.k8s.io", Version: "v1beta1", Kind: "Ingress"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *Ingress) Removed() (int64, int64) {
func (in *Ingress) APILifecycleRemoved() (major, minor int) {
return 1, 22
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *IngressList) Introduced() (int64, int64) {
func (in *IngressList) APILifecycleIntroduced() (major, minor int) {
return 1, 1
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *IngressList) Deprecated() (int64, int64) {
func (in *IngressList) APILifecycleDeprecated() (major, minor int) {
return 1, 14
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *IngressList) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "networking.k8s.io", Version: "v1beta1", Kind: "IngressList"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *IngressList) Removed() (int64, int64) {
func (in *IngressList) APILifecycleRemoved() (major, minor int) {
return 1, 22
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *NetworkPolicy) Introduced() (int64, int64) {
func (in *NetworkPolicy) APILifecycleIntroduced() (major, minor int) {
return 1, 3
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *NetworkPolicy) Deprecated() (int64, int64) {
func (in *NetworkPolicy) APILifecycleDeprecated() (major, minor int) {
return 1, 9
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *NetworkPolicy) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "networking.k8s.io", Version: "v1", Kind: "NetworkPolicy"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *NetworkPolicy) Removed() (int64, int64) {
func (in *NetworkPolicy) APILifecycleRemoved() (major, minor int) {
return 1, 18
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *NetworkPolicyList) Introduced() (int64, int64) {
func (in *NetworkPolicyList) APILifecycleIntroduced() (major, minor int) {
return 1, 3
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *NetworkPolicyList) Deprecated() (int64, int64) {
func (in *NetworkPolicyList) APILifecycleDeprecated() (major, minor int) {
return 1, 9
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *NetworkPolicyList) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "networking.k8s.io", Version: "v1", Kind: "NetworkPolicyList"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *NetworkPolicyList) Removed() (int64, int64) {
func (in *NetworkPolicyList) APILifecycleRemoved() (major, minor int) {
return 1, 18
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *PodSecurityPolicy) Introduced() (int64, int64) {
func (in *PodSecurityPolicy) APILifecycleIntroduced() (major, minor int) {
return 1, 2
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *PodSecurityPolicy) Deprecated() (int64, int64) {
func (in *PodSecurityPolicy) APILifecycleDeprecated() (major, minor int) {
return 1, 11
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *PodSecurityPolicy) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "policy", Version: "v1beta1", Kind: "PodSecurityPolicy"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *PodSecurityPolicy) Removed() (int64, int64) {
func (in *PodSecurityPolicy) APILifecycleRemoved() (major, minor int) {
return 1, 18
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *PodSecurityPolicyList) Introduced() (int64, int64) {
func (in *PodSecurityPolicyList) APILifecycleIntroduced() (major, minor int) {
return 1, 2
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *PodSecurityPolicyList) Deprecated() (int64, int64) {
func (in *PodSecurityPolicyList) APILifecycleDeprecated() (major, minor int) {
return 1, 11
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *PodSecurityPolicyList) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "policy", Version: "v1beta1", Kind: "PodSecurityPolicyList"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *PodSecurityPolicyList) Removed() (int64, int64) {
func (in *PodSecurityPolicyList) APILifecycleRemoved() (major, minor int) {
return 1, 18
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *ReplicaSet) Introduced() (int64, int64) {
func (in *ReplicaSet) APILifecycleIntroduced() (major, minor int) {
return 1, 2
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *ReplicaSet) Deprecated() (int64, int64) {
func (in *ReplicaSet) APILifecycleDeprecated() (major, minor int) {
return 1, 8
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *ReplicaSet) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "ReplicaSet"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *ReplicaSet) Removed() (int64, int64) {
func (in *ReplicaSet) APILifecycleRemoved() (major, minor int) {
return 1, 18
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *ReplicaSetList) Introduced() (int64, int64) {
func (in *ReplicaSetList) APILifecycleIntroduced() (major, minor int) {
return 1, 2
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *ReplicaSetList) Deprecated() (int64, int64) {
func (in *ReplicaSetList) APILifecycleDeprecated() (major, minor int) {
return 1, 8
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *ReplicaSetList) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "ReplicaSetList"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *ReplicaSetList) Removed() (int64, int64) {
func (in *ReplicaSetList) APILifecycleRemoved() (major, minor int) {
return 1, 18
}
// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *Scale) Introduced() (int64, int64) {
func (in *Scale) APILifecycleIntroduced() (major, minor int) {
return 1, 1
}
// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *Scale) Deprecated() (int64, int64) {
func (in *Scale) APILifecycleDeprecated() (major, minor int) {
return 1, 2
}
// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *Scale) Removed() (int64, int64) {
func (in *Scale) APILifecycleRemoved() (major, minor int) {
return 1, 18
}

View File

@@ -43,6 +43,8 @@ const (
introducedTagName = tagEnabledName + ":introduced"
deprecatedTagName = tagEnabledName + ":deprecated"
removedTagName = tagEnabledName + ":removed"
replacementTagName = tagEnabledName + ":replacement"
)
// enabledTagValue holds parameters from a tagName tag.
@@ -61,7 +63,7 @@ func tagExists(tagName string, t *types.Type) bool {
return rawTag != nil
}
func extractKubeVersionTag(tagName string, t *types.Type) (*tagValue, int64, int64, error) {
func extractKubeVersionTag(tagName string, t *types.Type) (*tagValue, int, int, error) {
comments := append(append([]string{}, t.SecondClosestCommentLines...), t.CommentLines...)
rawTag := extractTag(tagName, comments)
if rawTag == nil || len(rawTag.value) == 0 {
@@ -72,30 +74,66 @@ func extractKubeVersionTag(tagName string, t *types.Type) (*tagValue, int64, int
if len(splitValue) != 2 || len(splitValue[0]) == 0 || len(splitValue[0]) == 0 {
return nil, -1, -1, fmt.Errorf("%v format must match %v=xx.yy tag", t, tagName)
}
major, err := strconv.ParseInt(splitValue[0], 10, 64)
major, err := strconv.ParseInt(splitValue[0], 10, 32)
if err != nil {
return nil, -1, -1, fmt.Errorf("%v format must match %v=xx.yy : %w", t, tagName, err)
}
minor, err := strconv.ParseInt(splitValue[1], 10, 64)
minor, err := strconv.ParseInt(splitValue[1], 10, 32)
if err != nil {
return nil, -1, -1, fmt.Errorf("%v format must match %v=xx.yy : %w", t, tagName, err)
}
return rawTag, major, minor, nil
return rawTag, int(major), int(minor), nil
}
func extractIntroducedTag(t *types.Type) (*tagValue, int64, int64, error) {
func extractIntroducedTag(t *types.Type) (*tagValue, int, int, error) {
return extractKubeVersionTag(introducedTagName, t)
}
func extractDeprecatedTag(t *types.Type) (*tagValue, int64, int64, error) {
func extractDeprecatedTag(t *types.Type) (*tagValue, int, int, error) {
return extractKubeVersionTag(deprecatedTagName, t)
}
func extractRemovedTag(t *types.Type) (*tagValue, int64, int64, error) {
func extractRemovedTag(t *types.Type) (*tagValue, int, int, error) {
return extractKubeVersionTag(removedTagName, t)
}
func extractReplacementTag(t *types.Type) (group, version, kind string, hasReplacement bool, err error) {
comments := append(append([]string{}, t.SecondClosestCommentLines...), t.CommentLines...)
tagVals := types.ExtractCommentTags("+", comments)[replacementTagName]
if len(tagVals) == 0 {
// No match for the tag.
return "", "", "", false, nil
}
// If there are multiple values, abort.
if len(tagVals) > 1 {
return "", "", "", false, fmt.Errorf("Found %d %s tags: %q", len(tagVals), replacementTagName, tagVals)
}
tagValue := tagVals[0]
parts := strings.Split(tagValue, ",")
if len(parts) != 3 {
return "", "", "", false, fmt.Errorf(`%s value must be "<group>,<version>,<kind>", got %q`, replacementTagName, tagValue)
}
group, version, kind = parts[0], parts[1], parts[2]
if len(version) == 0 || len(kind) == 0 {
return "", "", "", false, fmt.Errorf(`%s value must be "<group>,<version>,<kind>", got %q`, replacementTagName, tagValue)
}
// sanity check the group
if strings.ToLower(group) != group {
return "", "", "", false, fmt.Errorf(`replacement group must be all lower-case, got %q`, group)
}
// sanity check the version
if !strings.HasPrefix(version, "v") || strings.ToLower(version) != version {
return "", "", "", false, fmt.Errorf(`replacement version must start with "v" and be all lower-case, got %q`, version)
}
// sanity check the kind
if strings.ToUpper(kind[:1]) != kind[:1] {
return "", "", "", false, fmt.Errorf(`replacement kind must start with uppercase-letter, got %q`, kind)
}
return group, version, kind, true, nil
}
func extractTag(tagName string, comments []string) *tagValue {
tagVals := types.ExtractCommentTags("+", comments)[tagName]
if tagVals == nil {
@@ -182,7 +220,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
klog.V(5).Infof(" skipping package")
continue
}
klog.Infof("Generating package %q", pkg.Path)
klog.V(3).Infof("Generating package %q", pkg.Path)
// If the pkg-scoped tag says to generate, we can skip scanning types.
if !pkgNeedsGeneration {
@@ -356,7 +394,7 @@ func (g *genPreleaseLifecycle) Imports(c *generator.Context) (imports []string)
return importLines
}
func argsFromType(t *types.Type) (generator.Args, error) {
func (g *genPreleaseLifecycle) argsFromType(c *generator.Context, t *types.Type) (generator.Args, error) {
a := generator.Args{
"type": t,
}
@@ -396,6 +434,20 @@ func argsFromType(t *types.Type) (generator.Args, error) {
With("removedMajor", removedMajor).
With("removedMinor", removedMinor)
replacementGroup, replacementVersion, replacementKind, hasReplacement, err := extractReplacementTag(t)
if err != nil {
return nil, err
}
if hasReplacement {
gvkType := c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/runtime/schema", Name: "GroupVersionKind"})
g.imports.AddType(gvkType)
a = a.
With("replacementGroup", replacementGroup).
With("replacementVersion", replacementVersion).
With("replacementKind", replacementKind).
With("GroupVersionKind", gvkType)
}
return a, nil
}
@@ -404,32 +456,41 @@ func (g *genPreleaseLifecycle) Init(c *generator.Context, w io.Writer) error {
}
func (g *genPreleaseLifecycle) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
klog.Infof("Generating prerelease-lifecycle for type %v", t)
klog.V(3).Infof("Generating prerelease-lifecycle for type %v", t)
sw := generator.NewSnippetWriter(w, c, "$", "$")
args, err := argsFromType(t)
args, err := g.argsFromType(c, t)
if err != nil {
return err
}
if versionedMethodOrDie("Introduced", t) == nil {
sw.Do("// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.\n", args)
if versionedMethodOrDie("APILifecycleIntroduced", t) == nil {
sw.Do("// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.\n", args)
sw.Do("// It is controlled by \""+introducedTagName+"\" tags in types.go.\n", args)
sw.Do("func (in *$.type|intrapackage$) Introduced() (int64, int64) {\n", args)
sw.Do("func (in *$.type|intrapackage$) APILifecycleIntroduced() (major, minor int) {\n", args)
sw.Do(" return $.introducedMajor$, $.introducedMinor$\n", args)
sw.Do("}\n\n", nil)
}
if versionedMethodOrDie("Deprecated", t) == nil {
sw.Do("// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.\n", args)
if versionedMethodOrDie("APILifecycleDeprecated", t) == nil {
sw.Do("// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.\n", args)
sw.Do("// It is controlled by \""+deprecatedTagName+"\" tags in types.go or \""+introducedTagName+"\" plus three minor.\n", args)
sw.Do("func (in *$.type|intrapackage$) Deprecated() (int64, int64) {\n", args)
sw.Do("func (in *$.type|intrapackage$) APILifecycleDeprecated() (major, minor int) {\n", args)
sw.Do(" return $.deprecatedMajor$, $.deprecatedMinor$\n", args)
sw.Do("}\n\n", nil)
}
if versionedMethodOrDie("Removed", t) == nil {
sw.Do("// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.\n", args)
if _, hasReplacement := args["replacementKind"]; hasReplacement {
if versionedMethodOrDie("APILifecycleReplacement", t) == nil {
sw.Do("// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.\n", args)
sw.Do("// It is controlled by \""+replacementTagName+"=<group>,<version>,<kind>\" tags in types.go.\n", args)
sw.Do("func (in *$.type|intrapackage$) APILifecycleReplacement() ($.GroupVersionKind|raw$) {\n", args)
sw.Do(" return $.GroupVersionKind|raw${Group:\"$.replacementGroup$\", Version:\"$.replacementVersion$\", Kind:\"$.replacementKind$\"}\n", args)
sw.Do("}\n\n", nil)
}
}
if versionedMethodOrDie("APILifecycleRemoved", t) == nil {
sw.Do("// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.\n", args)
sw.Do("// It is controlled by \""+removedTagName+"\" tags in types.go or \""+deprecatedTagName+"\" plus three minor.\n", args)
sw.Do("func (in *$.type|intrapackage$) Removed() (int64, int64) {\n", args)
sw.Do("func (in *$.type|intrapackage$) APILifecycleRemoved() (major, minor int) {\n", args)
sw.Do(" return $.removedMajor$, $.removedMinor$\n", args)
sw.Do("}\n\n", nil)
}