Skip to content

Commit

Permalink
added-all
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Jan 29, 2024
1 parent 1a9f28d commit 5e389a1
Show file tree
Hide file tree
Showing 20 changed files with 175 additions and 608 deletions.
24 changes: 18 additions & 6 deletions apis/apps/v1/statefulset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ type ObjectMeta struct {
// Null for lists.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
// CreationTimestamp metav1.Time `json:"creationTimestamp,omitempty" protobuf:"bytes,8,opt,name=creationTimestamp"`
CreationTimestamp metav1.Time `json:"creationTimestamp,omitempty" protobuf:"bytes,8,opt,name=creationTimestamp"`

// DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This
// field is set by the server when a graceful deletion is requested by the user, and is not
Expand All @@ -241,14 +241,14 @@ type ObjectMeta struct {
// Read-only.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
// DeletionTimestamp *metav1.Time `json:"deletionTimestamp,omitempty" protobuf:"bytes,9,opt,name=deletionTimestamp"`
DeletionTimestamp *metav1.Time `json:"deletionTimestamp,omitempty" protobuf:"bytes,9,opt,name=deletionTimestamp"`

// Number of seconds allowed for this object to gracefully terminate before
// it will be removed from the system. Only set when deletionTimestamp is also set.
// May only be shortened.
// Read-only.
// +optional
// DeletionGracePeriodSeconds *int64 `json:"deletionGracePeriodSeconds,omitempty" protobuf:"varint,10,opt,name=deletionGracePeriodSeconds"`
DeletionGracePeriodSeconds *int64 `json:"deletionGracePeriodSeconds,omitempty" protobuf:"varint,10,opt,name=deletionGracePeriodSeconds"`

// Map of string keys and values that can be used to organize and categorize
// (scope and select) objects. May match selectors of replication controllers
Expand Down Expand Up @@ -289,6 +289,21 @@ type ObjectMeta struct {
// +optional
// +patchStrategy=merge
Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`

// Tombstone: ClusterName was a legacy field that was always cleared by
// the system and never used.
// ClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`

// ManagedFields maps workflow-id and version to the set of fields
// that are managed by that workflow. This is mostly for internal
// housekeeping, and users typically shouldn't need to set or
// understand this field. A workflow can be the user's name, a
// controller's name, or the name of a specific apply path like
// "ci-cd". The set of fields is always in the version that the
// workflow used when modifying the object.
//
// +optional
ManagedFields []metav1.ManagedFieldsEntry `json:"managedFields,omitempty" protobuf:"bytes,17,rep,name=managedFields"`
}

// PodTemplateSpec describes the data a pod should have when created from a template
Expand All @@ -304,9 +319,6 @@ type PodTemplateSpec struct {
Spec v1.PodSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
}

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// PersistentVolumeClaim is a user's request for and claim to a persistent volume
type PersistentVolumeClaim struct {
metav1.TypeMeta `json:",inline"`
Expand Down
108 changes: 108 additions & 0 deletions apis/apps/v1/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package v1

import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)

func (obj *ObjectMeta) GetObjectMeta() metav1.Object { return obj }

// Namespace implements metav1.Object for any object with an ObjectMeta typed field. Allows
// fast, direct access to metadata fields for API objects.
func (meta *ObjectMeta) GetNamespace() string { return meta.Namespace }
func (meta *ObjectMeta) SetNamespace(namespace string) { meta.Namespace = namespace }
func (meta *ObjectMeta) GetName() string { return meta.Name }
func (meta *ObjectMeta) SetName(name string) { meta.Name = name }
func (meta *ObjectMeta) GetGenerateName() string { return meta.GenerateName }
func (meta *ObjectMeta) SetGenerateName(generateName string) { meta.GenerateName = generateName }
func (meta *ObjectMeta) GetUID() types.UID { return meta.UID }
func (meta *ObjectMeta) SetUID(uid types.UID) { meta.UID = uid }
func (meta *ObjectMeta) GetResourceVersion() string { return meta.ResourceVersion }
func (meta *ObjectMeta) SetResourceVersion(version string) { meta.ResourceVersion = version }
func (meta *ObjectMeta) GetGeneration() int64 { return meta.Generation }
func (meta *ObjectMeta) SetGeneration(generation int64) { meta.Generation = generation }
func (meta *ObjectMeta) GetSelfLink() string { return meta.SelfLink }
func (meta *ObjectMeta) SetSelfLink(selfLink string) { meta.SelfLink = selfLink }
func (meta *ObjectMeta) GetCreationTimestamp() metav1.Time { return meta.CreationTimestamp }
func (meta *ObjectMeta) SetCreationTimestamp(creationTimestamp metav1.Time) {
meta.CreationTimestamp = creationTimestamp
}
func (meta *ObjectMeta) GetDeletionTimestamp() *metav1.Time { return meta.DeletionTimestamp }
func (meta *ObjectMeta) SetDeletionTimestamp(deletionTimestamp *metav1.Time) {
meta.DeletionTimestamp = deletionTimestamp
}

func (meta *ObjectMeta) GetDeletionGracePeriodSeconds() *int64 {
return meta.DeletionGracePeriodSeconds
}

func (meta *ObjectMeta) SetDeletionGracePeriodSeconds(deletionGracePeriodSeconds *int64) {
meta.DeletionGracePeriodSeconds = deletionGracePeriodSeconds
}
func (meta *ObjectMeta) GetLabels() map[string]string { return meta.Labels }
func (meta *ObjectMeta) SetLabels(labels map[string]string) { meta.Labels = labels }
func (meta *ObjectMeta) GetAnnotations() map[string]string { return meta.Annotations }
func (meta *ObjectMeta) SetAnnotations(annotations map[string]string) { meta.Annotations = annotations }
func (meta *ObjectMeta) GetFinalizers() []string { return meta.Finalizers }
func (meta *ObjectMeta) SetFinalizers(finalizers []string) { meta.Finalizers = finalizers }
func (meta *ObjectMeta) GetOwnerReferences() []metav1.OwnerReference { return meta.OwnerReferences }
func (meta *ObjectMeta) SetOwnerReferences(references []metav1.OwnerReference) {
meta.OwnerReferences = references
}
func (meta *ObjectMeta) GetManagedFields() []metav1.ManagedFieldsEntry { return meta.ManagedFields }
func (meta *ObjectMeta) SetManagedFields(managedFields []metav1.ManagedFieldsEntry) {
meta.ManagedFields = managedFields
}

func (meta *ObjectMeta) ToAPI() metav1.ObjectMeta {
return metav1.ObjectMeta{
Name: meta.Name,
GenerateName: meta.GenerateName,
Namespace: meta.Namespace,
SelfLink: meta.SelfLink,
UID: meta.UID,
ResourceVersion: meta.ResourceVersion,
Generation: meta.Generation,
CreationTimestamp: meta.CreationTimestamp,
DeletionTimestamp: meta.DeletionTimestamp,
DeletionGracePeriodSeconds: meta.DeletionGracePeriodSeconds,
Labels: meta.Labels,
Annotations: meta.Annotations,
OwnerReferences: meta.OwnerReferences,
Finalizers: meta.Finalizers,
ManagedFields: meta.ManagedFields,
}
}

func (meta *ObjectMeta) FromAPI(other metav1.ObjectMeta) {
meta.Name = other.Name
meta.GenerateName = other.GenerateName
meta.Namespace = other.Namespace
meta.SelfLink = other.SelfLink
meta.UID = other.UID
meta.ResourceVersion = other.ResourceVersion
meta.Generation = other.Generation
meta.CreationTimestamp = other.CreationTimestamp
meta.DeletionTimestamp = other.DeletionTimestamp
meta.DeletionGracePeriodSeconds = other.DeletionGracePeriodSeconds
meta.Labels = other.Labels
meta.Annotations = other.Annotations
meta.OwnerReferences = other.OwnerReferences
meta.Finalizers = other.Finalizers
meta.ManagedFields = other.ManagedFields
}

func (meta *PersistentVolumeClaim) ToAPI() v1.PersistentVolumeClaim {
return v1.PersistentVolumeClaim{
ObjectMeta: meta.ObjectMeta.ToAPI(),
Spec: meta.Spec,
Status: meta.Status,
}
}

func (meta *PersistentVolumeClaim) FromAPI(other v1.PersistentVolumeClaim) {
meta.ObjectMeta.FromAPI(other.ObjectMeta)
meta.Spec = other.Spec
meta.Status = other.Status
}
8 changes: 0 additions & 8 deletions apis/apps/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions client/clientset/versioned/typed/apps/v1/apps_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5e389a1

Please sign in to comment.