StaticMachineTemplate
Scope: Namespaced
Version: v1alpha1
StaticMachineTemplate is the Schema for the Cluster API Provider Static
- apiVersion
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
- kind
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
- metadata
- spec
StaticMachineTemplateSpec defines the desired state of StaticMachineTemplate
- spec.template
Required value
- spec.template.metadata
ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create. This is a copy of customizable fields from metav1.ObjectMeta. ObjectMeta is embedded in
Machine.Spec
,MachineDeployment.Template
andMachineSet.Template
, which are not top-level Kubernetes objects. Given that metav1.ObjectMeta has lots of special cases and read-only fields which end up in the generated CRD validation, having it as a subset simplifies the API and some issues that can impact user experience. During the upgrade to controller-tools@v2 for v1alpha2, we noticed a failure would occur running Cluster API test suite against the new CRDs, specificallyspec.metadata.creationTimestamp in body must be of type string: "null"
. The investigation showed thatcontroller-tools@v2
behaves differently than its previous version when handling types from metav1 package. In more details, we found that embedded (non-top level) types that embeddedmetav1.ObjectMeta
had validation properties, including forcreationTimestamp
(metav1.Time). Themetav1.Time
type specifies a custom json marshaller that, when IsZero() is true, returnsnull
which breaks validation because the field isn’t marked as nullable. In future versions, controller-tools@v2 might allow overriding the type and validation for embedded types. When that happens, this hack should be revisited.- spec.template.metadata.annotations
Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations
- spec.template.metadata.labels
Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels
- spec.template.spec
Required value
- spec.template.spec.labelSelector
A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.
- spec.template.spec.labelSelector.matchExpressions
matchExpressions is a list of label selector requirements. The requirements are ANDed.
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
- spec.template.spec.labelSelector.matchExpressions.key
Required value
key is the label key that the selector applies to.
- spec.template.spec.labelSelector.matchExpressions.operator
Required value
operator represents a key’s relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
- spec.template.spec.labelSelector.matchExpressions.values
values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
- spec.template.spec.labelSelector.matchLabels
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is “key”, the operator is “In”, and the values array contains only “value”. The requirements are ANDed.