|
| 1 | +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"). You may |
| 4 | +// not use this file except in compliance with the License. A copy of the |
| 5 | +// License is located at |
| 6 | +// |
| 7 | +// http://aws.amazon.com/apache2.0/ |
| 8 | +// |
| 9 | +// or in the "license" file accompanying this file. This file is distributed |
| 10 | +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 11 | +// express or implied. See the License for the specific language governing |
| 12 | +// permissions and limitations under the License. |
| 13 | + |
| 14 | +package v1alpha1 |
| 15 | + |
| 16 | +import ( |
| 17 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 18 | +) |
| 19 | + |
| 20 | +// ObjectMeta is metadata that all persisted resources must have, which includes all objects |
| 21 | +// users must create. |
| 22 | +// It is not possible to use `metav1.ObjectMeta` inside spec, as the controller-gen |
| 23 | +// automatically converts this to an arbitrary string-string map. |
| 24 | +// https://github.com/kubernetes-sigs/controller-tools/issues/385 |
| 25 | +// |
| 26 | +// Active discussion about inclusion of this field in the spec is happening in this PR: |
| 27 | +// https://github.com/kubernetes-sigs/controller-tools/pull/395 |
| 28 | +// |
| 29 | +// Until this is allowed, or if it never is, we will produce a subset of the object meta |
| 30 | +// that contains only the fields which the user is allowed to modify in the metadata. |
| 31 | +type PartialObjectMeta struct { |
| 32 | + // Name must be unique within a namespace. Is required when creating resources, although |
| 33 | + // some resources may allow a client to request the generation of an appropriate name |
| 34 | + // automatically. Name is primarily intended for creation idempotence and configuration |
| 35 | + // definition. |
| 36 | + // Cannot be updated. |
| 37 | + // More info: http://kubernetes.io/docs/user-guide/identifiers#names |
| 38 | + // +optional |
| 39 | + Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` |
| 40 | + |
| 41 | + // GenerateName is an optional prefix, used by the server, to generate a unique |
| 42 | + // name ONLY IF the Name field has not been provided. |
| 43 | + // If this field is used, the name returned to the client will be different |
| 44 | + // than the name passed. This value will also be combined with a unique suffix. |
| 45 | + // The provided value has the same validation rules as the Name field, |
| 46 | + // and may be truncated by the length of the suffix required to make the value |
| 47 | + // unique on the server. |
| 48 | + // |
| 49 | + // If this field is specified and the generated name exists, the server will |
| 50 | + // NOT return a 409 - instead, it will either return 201 Created or 500 with Reason |
| 51 | + // ServerTimeout indicating a unique name could not be found in the time allotted, and the client |
| 52 | + // should retry (optionally after the time indicated in the Retry-After header). |
| 53 | + // |
| 54 | + // Applied only if Name is not specified. |
| 55 | + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency |
| 56 | + // +optional |
| 57 | + GenerateName string `json:"generateName,omitempty" protobuf:"bytes,2,opt,name=generateName"` |
| 58 | + |
| 59 | + // Namespace defines the space within each name must be unique. An empty namespace is |
| 60 | + // equivalent to the "default" namespace, but "default" is the canonical representation. |
| 61 | + // Not all objects are required to be scoped to a namespace - the value of this field for |
| 62 | + // those objects will be empty. |
| 63 | + // |
| 64 | + // Must be a DNS_LABEL. |
| 65 | + // Cannot be updated. |
| 66 | + // More info: http://kubernetes.io/docs/user-guide/namespaces |
| 67 | + // +optional |
| 68 | + Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` |
| 69 | + |
| 70 | + // Map of string keys and values that can be used to organize and categorize |
| 71 | + // (scope and select) objects. May match selectors of replication controllers |
| 72 | + // and services. |
| 73 | + // More info: http://kubernetes.io/docs/user-guide/labels |
| 74 | + // +optional |
| 75 | + Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,4,rep,name=labels"` |
| 76 | + |
| 77 | + // Annotations is an unstructured key value map stored with a resource that may be |
| 78 | + // set by external tools to store and retrieve arbitrary metadata. They are not |
| 79 | + // queryable and should be preserved when modifying objects. |
| 80 | + // More info: http://kubernetes.io/docs/user-guide/annotations |
| 81 | + // +optional |
| 82 | + Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,5,rep,name=annotations"` |
| 83 | + |
| 84 | + // List of objects depended by this object. If ALL objects in the list have |
| 85 | + // been deleted, this object will be garbage collected. If this object is managed by a controller, |
| 86 | + // then an entry in this list will point to this controller, with the controller field set to true. |
| 87 | + // There cannot be more than one managing controller. |
| 88 | + // +optional |
| 89 | + // +patchMergeKey=uid |
| 90 | + // +patchStrategy=merge |
| 91 | + OwnerReferences []metav1.OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,6,rep,name=ownerReferences"` |
| 92 | +} |
0 commit comments