mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-17 07:39:22 +00:00
Add initializers and includeUninitialized to the API
This commit is contained in:
parent
0765740eb9
commit
668442321e
@ -166,6 +166,17 @@ type ObjectMeta struct {
|
|||||||
// +optional
|
// +optional
|
||||||
OwnerReferences []metav1.OwnerReference
|
OwnerReferences []metav1.OwnerReference
|
||||||
|
|
||||||
|
// An initializer is a controller which enforces some system invariant at object creation time.
|
||||||
|
// This field is a list of initializers that have not yet acted on this object. If nil or empty,
|
||||||
|
// this object has been completely initialized. Otherwise, the object is considered uninitialized
|
||||||
|
// and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to
|
||||||
|
// observe uninitialized objects.
|
||||||
|
//
|
||||||
|
// When an object is created, the system will populate this list with the current set of initializers.
|
||||||
|
// Only privileged users may set or modify this list. Once it is empty, it may not be modified further
|
||||||
|
// by any user.
|
||||||
|
Initializers *metav1.Initializers
|
||||||
|
|
||||||
// Must be empty before the object is deleted from the registry. Each entry
|
// Must be empty before the object is deleted from the registry. Each entry
|
||||||
// is an identifier for the responsible component that will remove the entry
|
// is an identifier for the responsible component that will remove the entry
|
||||||
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
||||||
@ -3152,6 +3163,10 @@ type ListOptions struct {
|
|||||||
LabelSelector labels.Selector
|
LabelSelector labels.Selector
|
||||||
// A selector based on fields
|
// A selector based on fields
|
||||||
FieldSelector fields.Selector
|
FieldSelector fields.Selector
|
||||||
|
|
||||||
|
// If true, partially initialized resources are included in the response.
|
||||||
|
IncludeUninitialized bool
|
||||||
|
|
||||||
// If true, watch for changes to this list
|
// If true, watch for changes to this list
|
||||||
Watch bool
|
Watch bool
|
||||||
// When specified with a watch call, shows changes that occur after that particular version of a resource.
|
// When specified with a watch call, shows changes that occur after that particular version of a resource.
|
||||||
|
@ -55,8 +55,12 @@ func (meta *ObjectMeta) GetLabels() map[string]string { return m
|
|||||||
func (meta *ObjectMeta) SetLabels(labels map[string]string) { meta.Labels = 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) GetAnnotations() map[string]string { return meta.Annotations }
|
||||||
func (meta *ObjectMeta) SetAnnotations(annotations map[string]string) { meta.Annotations = annotations }
|
func (meta *ObjectMeta) SetAnnotations(annotations map[string]string) { meta.Annotations = annotations }
|
||||||
func (meta *ObjectMeta) GetFinalizers() []string { return meta.Finalizers }
|
func (meta *ObjectMeta) GetInitializers() *metav1.Initializers { return meta.Initializers }
|
||||||
func (meta *ObjectMeta) SetFinalizers(finalizers []string) { meta.Finalizers = finalizers }
|
func (meta *ObjectMeta) SetInitializers(initializers *metav1.Initializers) {
|
||||||
|
meta.Initializers = initializers
|
||||||
|
}
|
||||||
|
func (meta *ObjectMeta) GetFinalizers() []string { return meta.Finalizers }
|
||||||
|
func (meta *ObjectMeta) SetFinalizers(finalizers []string) { meta.Finalizers = finalizers }
|
||||||
|
|
||||||
func (meta *ObjectMeta) GetOwnerReferences() []metav1.OwnerReference {
|
func (meta *ObjectMeta) GetOwnerReferences() []metav1.OwnerReference {
|
||||||
ret := make([]metav1.OwnerReference, len(meta.OwnerReferences))
|
ret := make([]metav1.OwnerReference, len(meta.OwnerReferences))
|
||||||
|
@ -201,6 +201,17 @@ type ObjectMeta struct {
|
|||||||
// +patchStrategy=merge
|
// +patchStrategy=merge
|
||||||
OwnerReferences []metav1.OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"`
|
OwnerReferences []metav1.OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"`
|
||||||
|
|
||||||
|
// An initializer is a controller which enforces some system invariant at object creation time.
|
||||||
|
// This field is a list of initializers that have not yet acted on this object. If nil or empty,
|
||||||
|
// this object has been completely initialized. Otherwise, the object is considered uninitialized
|
||||||
|
// and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to
|
||||||
|
// observe uninitialized objects.
|
||||||
|
//
|
||||||
|
// When an object is created, the system will populate this list with the current set of initializers.
|
||||||
|
// Only privileged users may set or modify this list. Once it is empty, it may not be modified further
|
||||||
|
// by any user.
|
||||||
|
Initializers *metav1.Initializers `json:"initializers,omitempty" patchStrategy:"merge" protobuf:"bytes,16,rep,name=initializers"`
|
||||||
|
|
||||||
// Must be empty before the object is deleted from the registry. Each entry
|
// Must be empty before the object is deleted from the registry. Each entry
|
||||||
// is an identifier for the responsible component that will remove the entry
|
// is an identifier for the responsible component that will remove the entry
|
||||||
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
||||||
@ -3619,6 +3630,9 @@ type ListOptions struct {
|
|||||||
// Defaults to everything.
|
// Defaults to everything.
|
||||||
// +optional
|
// +optional
|
||||||
FieldSelector string `json:"fieldSelector,omitempty" protobuf:"bytes,2,opt,name=fieldSelector"`
|
FieldSelector string `json:"fieldSelector,omitempty" protobuf:"bytes,2,opt,name=fieldSelector"`
|
||||||
|
// If true, partially initialized resources are included in the response.
|
||||||
|
// +optional
|
||||||
|
IncludeUninitialized bool `json:"includeUninitialized,omitempty" protobuf:"varint,6,opt,name=includeUninitialized"`
|
||||||
// Watch for changes to the described resources and return them as a stream of
|
// Watch for changes to the described resources and return them as a stream of
|
||||||
// add, update, and remove notifications. Specify resourceVersion.
|
// add, update, and remove notifications. Specify resourceVersion.
|
||||||
// +optional
|
// +optional
|
||||||
|
@ -31,6 +31,9 @@ type ListOptions struct {
|
|||||||
LabelSelector labels.Selector
|
LabelSelector labels.Selector
|
||||||
// A selector based on fields
|
// A selector based on fields
|
||||||
FieldSelector fields.Selector
|
FieldSelector fields.Selector
|
||||||
|
// If true, partially initialized resources are included in the response.
|
||||||
|
// +optional
|
||||||
|
IncludeUninitialized bool `json:"includeUninitialized,omitempty"`
|
||||||
// If true, watch for changes to this list
|
// If true, watch for changes to this list
|
||||||
Watch bool
|
Watch bool
|
||||||
// When specified with a watch call, shows changes that occur after that particular version of a resource.
|
// When specified with a watch call, shows changes that occur after that particular version of a resource.
|
||||||
|
@ -55,6 +55,8 @@ type Object interface {
|
|||||||
SetLabels(labels map[string]string)
|
SetLabels(labels map[string]string)
|
||||||
GetAnnotations() map[string]string
|
GetAnnotations() map[string]string
|
||||||
SetAnnotations(annotations map[string]string)
|
SetAnnotations(annotations map[string]string)
|
||||||
|
GetInitializers() *Initializers
|
||||||
|
SetInitializers(initializers *Initializers)
|
||||||
GetFinalizers() []string
|
GetFinalizers() []string
|
||||||
SetFinalizers(finalizers []string)
|
SetFinalizers(finalizers []string)
|
||||||
GetOwnerReferences() []OwnerReference
|
GetOwnerReferences() []OwnerReference
|
||||||
@ -141,6 +143,8 @@ func (meta *ObjectMeta) GetLabels() map[string]string { return m
|
|||||||
func (meta *ObjectMeta) SetLabels(labels map[string]string) { meta.Labels = 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) GetAnnotations() map[string]string { return meta.Annotations }
|
||||||
func (meta *ObjectMeta) SetAnnotations(annotations map[string]string) { meta.Annotations = annotations }
|
func (meta *ObjectMeta) SetAnnotations(annotations map[string]string) { meta.Annotations = annotations }
|
||||||
|
func (meta *ObjectMeta) GetInitializers() *Initializers { return meta.Initializers }
|
||||||
|
func (meta *ObjectMeta) SetInitializers(initializers *Initializers) { meta.Initializers = initializers }
|
||||||
func (meta *ObjectMeta) GetFinalizers() []string { return meta.Finalizers }
|
func (meta *ObjectMeta) GetFinalizers() []string { return meta.Finalizers }
|
||||||
func (meta *ObjectMeta) SetFinalizers(finalizers []string) { meta.Finalizers = finalizers }
|
func (meta *ObjectMeta) SetFinalizers(finalizers []string) { meta.Finalizers = finalizers }
|
||||||
|
|
||||||
|
@ -213,6 +213,17 @@ type ObjectMeta struct {
|
|||||||
// +patchStrategy=merge
|
// +patchStrategy=merge
|
||||||
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"`
|
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"`
|
||||||
|
|
||||||
|
// An initializer is a controller which enforces some system invariant at object creation time.
|
||||||
|
// This field is a list of initializers that have not yet acted on this object. If nil or empty,
|
||||||
|
// this object has been completely initialized. Otherwise, the object is considered uninitialized
|
||||||
|
// and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to
|
||||||
|
// observe uninitialized objects.
|
||||||
|
//
|
||||||
|
// When an object is created, the system will populate this list with the current set of initializers.
|
||||||
|
// Only privileged users may set or modify this list. Once it is empty, it may not be modified further
|
||||||
|
// by any user.
|
||||||
|
Initializers *Initializers `json:"initializers,omitempty" protobuf:"bytes,16,opt,name=initializers"`
|
||||||
|
|
||||||
// Must be empty before the object is deleted from the registry. Each entry
|
// Must be empty before the object is deleted from the registry. Each entry
|
||||||
// is an identifier for the responsible component that will remove the entry
|
// is an identifier for the responsible component that will remove the entry
|
||||||
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
||||||
@ -228,6 +239,24 @@ type ObjectMeta struct {
|
|||||||
ClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`
|
ClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initializers tracks the progress of initialization.
|
||||||
|
type Initializers struct {
|
||||||
|
// Pending is a list of initializers that must execute in order before this object is visible.
|
||||||
|
// When the last pending initializer is removed, and no failing result is set, the initializers
|
||||||
|
// struct will be set to nil and the object is considered as initialized and visible to all
|
||||||
|
// clients.
|
||||||
|
Pending []Initializer `json:"pending" protobuf:"bytes,1,rep,name=pending"`
|
||||||
|
// If result is set with the Failure field, the object will be persisted to storage and then deleted,
|
||||||
|
// ensuring that other clients can observe the deletion.
|
||||||
|
Result *Status `json:"result,omitempty" protobuf:"bytes,2,opt,name=result"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initializer is information about an initializer that has not yet completed.
|
||||||
|
type Initializer struct {
|
||||||
|
// name of the process that is responsible for initializing this object.
|
||||||
|
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// NamespaceDefault means the object is in the default namespace which is applied when not specified by clients
|
// NamespaceDefault means the object is in the default namespace which is applied when not specified by clients
|
||||||
NamespaceDefault string = "default"
|
NamespaceDefault string = "default"
|
||||||
@ -281,6 +310,9 @@ type ListOptions struct {
|
|||||||
// Defaults to everything.
|
// Defaults to everything.
|
||||||
// +optional
|
// +optional
|
||||||
FieldSelector string `json:"fieldSelector,omitempty" protobuf:"bytes,2,opt,name=fieldSelector"`
|
FieldSelector string `json:"fieldSelector,omitempty" protobuf:"bytes,2,opt,name=fieldSelector"`
|
||||||
|
// If true, partially initialized resources are included in the response.
|
||||||
|
// +optional
|
||||||
|
IncludeUninitialized bool `json:"includeUninitialized,omitempty" protobuf:"varint,6,opt,name=includeUninitialized"`
|
||||||
// Watch for changes to the described resources and return them as a stream of
|
// Watch for changes to the described resources and return them as a stream of
|
||||||
// add, update, and remove notifications. Specify resourceVersion.
|
// add, update, and remove notifications. Specify resourceVersion.
|
||||||
// +optional
|
// +optional
|
||||||
@ -315,6 +347,9 @@ type GetOptions struct {
|
|||||||
// - if it's 0, then we simply return what we currently have in cache, no guarantee;
|
// - if it's 0, then we simply return what we currently have in cache, no guarantee;
|
||||||
// - if set to non zero, then the result is at least as fresh as given rv.
|
// - if set to non zero, then the result is at least as fresh as given rv.
|
||||||
ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,1,opt,name=resourceVersion"`
|
ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,1,opt,name=resourceVersion"`
|
||||||
|
// If true, partially initialized resources are included in the response.
|
||||||
|
// +optional
|
||||||
|
IncludeUninitialized bool `json:"includeUninitialized,omitempty" protobuf:"varint,2,opt,name=includeUninitialized"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeletionPropagation decides if a deletion will propagate to the dependents of
|
// DeletionPropagation decides if a deletion will propagate to the dependents of
|
||||||
|
@ -452,6 +452,14 @@ func (u *Unstructured) GroupVersionKind() schema.GroupVersionKind {
|
|||||||
return gvk
|
return gvk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *Unstructured) GetInitializers() *metav1.Initializers {
|
||||||
|
panic("not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *Unstructured) SetInitializers(initializers *metav1.Initializers) {
|
||||||
|
panic("not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
func (u *Unstructured) GetFinalizers() []string {
|
func (u *Unstructured) GetFinalizers() []string {
|
||||||
return getNestedSlice(u.Object, "metadata", "finalizers")
|
return getNestedSlice(u.Object, "metadata", "finalizers")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user