diff --git a/Makefile b/Makefile index 6dd9c451a00..f049eda2d7b 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,8 @@ $(call add-crd-gen,cloudnetwork,./cloudnetwork/v1,./cloudnetwork/v1,./cloudnetwo $(call add-crd-gen,network,./network/v1,./network/v1,./network/v1) $(call add-crd-gen,networkoperator,./networkoperator/v1,./networkoperator/v1,./networkoperator/v1) $(call add-crd-gen,operatorcontrolplane,./operatorcontrolplane/v1alpha1,./operatorcontrolplane/v1alpha1,./operatorcontrolplane/v1alpha1) -$(call add-crd-gen,machine,./machine/v1beta1,./machine/v1beta1,./machine/v1beta1) +$(call add-crd-gen,machine-beta,./machine/v1beta1,./machine/v1beta1,./machine/v1beta1) +$(call add-crd-gen,machine,./machine/v1,./machine/v1,./machine/v1) RUNTIME ?= podman RUNTIME_IMAGE_NAME ?= openshift-api-generator diff --git a/hack/lib/init.sh b/hack/lib/init.sh index 43d4bc7ea30..6af5f29a7bf 100644 --- a/hack/lib/init.sh +++ b/hack/lib/init.sh @@ -41,6 +41,7 @@ servicecertsigner/v1alpha1 \ template/v1 \ user/v1 \ machine/v1beta1 \ +machine/v1 \ " API_PACKAGES="\ github.com/openshift/api/apps/v1,\ diff --git a/machine/v1/0000_10_awsplacementgroup.crd.yaml b/machine/v1/0000_10_awsplacementgroup.crd.yaml new file mode 100644 index 00000000000..e6031e16009 --- /dev/null +++ b/machine/v1/0000_10_awsplacementgroup.crd.yaml @@ -0,0 +1,187 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + exclude.release.openshift.io/internal-openshift-hosted: "true" + include.release.openshift.io/self-managed-high-availability: "true" + include.release.openshift.io/single-node-developer: "true" + api-approved.openshift.io: https://github.com/openshift/api/pull/1091 + name: awsplacementgroups.machine.openshift.io +spec: + group: machine.openshift.io + names: + kind: AWSPlacementGroup + listKind: AWSPlacementGroupList + plural: awsplacementgroups + singular: awsplacementgroup + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: Placement Group Type + jsonPath: .status.observedConfiguration.groupType + name: Type + type: string + - description: Management State + jsonPath: .spec.managementSpec.managementState + name: Management + type: string + - description: EC2 Replicas within the Placement Group + jsonPath: .status.replicas + name: Replicas + type: integer + - description: AWSPlacementGroup age + jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 + schema: + openAPIV3Schema: + description: 'AWSPlacementGroup ensures that a placement group matching the given configuration exists within AWS Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).' + type: object + properties: + apiVersion: + description: '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' + type: string + kind: + description: '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' + type: string + metadata: + type: object + spec: + type: object + required: + - managementSpec + properties: + credentialsSecret: + description: CredentialsSecret is a reference to the secret with AWS credentials. The secret must reside in the same namespace as the AWSPlacementGroup resource. Otherwise, the controller will leverage the EC2 instance assigned IAM Role, in OpenShift this will always be the Control Plane Machine IAM Role. + type: object + properties: + name: + description: Name of the Secret. + type: string + managementSpec: + description: AWSPlacementGroupManagementSpec defines the configuration for a managed or unmanaged placement group. + type: object + required: + - managementState + properties: + managed: + description: Managed defines the configuration for the placement groups to be created. Updates to the configuration will not be observed as placement groups are immutable after creation. + type: object + required: + - groupType + properties: + groupType: + description: 'GroupType specifies the type of AWS placement group to use for this Machine. This parameter is only used when a Machine is being created and the named placement group does not exist. Valid values are "Cluster", "Partition", "Spread". This value is required and, in case a placement group already exists, will be validated against the existing placement group. Note: If the value of this field is "Spread", Machines created within the group may no have placement.tenancy set to "dedicated".' + type: string + enum: + - Cluster + - Partition + - Spread + partition: + description: Partition defines the configuration of a partition placement group. + type: object + properties: + count: + description: 'Count specifies the number of partitions for a Partition placement group. This value is only observed when creating a placement group and only when the `groupType` is set to `Partition`. Note the partition count of a placement group cannot be changed after creation. If unset, AWS will provide a default partition count. This default is currently 2. Note: When using more than 2 partitions, the "dedicated" tenancy option on Machines created within the group is unavailable.' + type: integer + format: int32 + maximum: 7 + minimum: 1 + managementState: + description: ManagementState determines whether the placement group is expected to be managed by this CRD or whether it is user managed. A managed placement group may be moved to unmanaged, however an unmanaged group may not be moved back to managed. + type: string + status: + type: object + properties: + conditions: + description: 'Conditions represents the observations of the AWSPlacementGroup''s current state. Known .status.conditions.type are: Ready, Deleting' + type: array + items: + description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" + type: object + required: + - lastTransitionTime + - message + - reason + - status + - type + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + type: string + format: date-time + message: + description: message is a human readable message indicating details about the transition. This may be an empty string. + type: string + maxLength: 32768 + observedGeneration: + description: observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + type: integer + format: int64 + minimum: 0 + reason: + description: reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + type: string + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + status: + description: status of the condition, one of True, False, Unknown. + type: string + enum: + - "True" + - "False" + - Unknown + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + type: string + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + expiresAt: + description: ExpiresAt identifies when the observed configuration is valid until. The observed configuration should not be trusted if this time has passed. The AWSPlacementGroup controller will attempt to update the status before it expires. + type: string + format: date-time + managementState: + description: ManagementState determines whether the placement group is expected to be managed by this CRD or whether it is user managed. A managed placement group may be moved to unmanaged, however an unmanaged group may not be moved back to managed. This value is owned by the controller and may differ from the spec in cases when a user attempts to manage a previously unmanaged placement group. + type: string + observedConfiguration: + description: ObservedConfiguration represents the configuration present on the placement group on AWS. + type: object + required: + - groupType + properties: + groupType: + description: 'GroupType specifies the type of AWS placement group to use for this Machine. This parameter is only used when a Machine is being created and the named placement group does not exist. Valid values are "Cluster", "Partition", "Spread". This value is required and, in case a placement group already exists, will be validated against the existing placement group. Note: If the value of this field is "Spread", Machines created within the group may no have placement.tenancy set to "dedicated".' + type: string + enum: + - Cluster + - Partition + - Spread + partition: + description: Partition defines the configuration of a partition placement group. + type: object + properties: + count: + description: 'Count specifies the number of partitions for a Partition placement group. This value is only observed when creating a placement group and only when the `groupType` is set to `Partition`. Note the partition count of a placement group cannot be changed after creation. If unset, AWS will provide a default partition count. This default is currently 2. Note: When using more than 2 partitions, the "dedicated" tenancy option on Machines created within the group is unavailable.' + type: integer + format: int32 + maximum: 7 + minimum: 1 + replicas: + description: 'Replicas counts how many AWS EC2 instances are present within the placement group. Note: This is a pointer to be able to distinguish between an empty placement group and the status having not yet been observed.' + type: integer + format: int32 + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/machine/v1/register.go b/machine/v1/register.go index 400f9efb001..6df0afa0572 100644 --- a/machine/v1/register.go +++ b/machine/v1/register.go @@ -18,5 +18,10 @@ var ( func addKnownTypes(scheme *runtime.Scheme) error { metav1.AddToGroupVersion(scheme, GroupVersion) + scheme.AddKnownTypes(GroupVersion, + &AWSPlacementGroup{}, + &AWSPlacementGroupList{}, + ) + return nil } diff --git a/machine/v1/types.go b/machine/v1/types.go new file mode 100644 index 00000000000..98c2e17b04f --- /dev/null +++ b/machine/v1/types.go @@ -0,0 +1,21 @@ +package v1 + +// ManagementState denotes whether the resource is expected to be managed by the controller or by the user. +type ManagementState string + +const ( + // ManagedManagementState denotes that the resource is expected to be managed by the controller. + ManagedManagementState ManagementState = "Managed" + + // UnmanagedManagementState denotes that the resource is expected to be managed by the user. + UnmanagedManagementState ManagementState = "Unmanaged" +) + +// LocalSecretReference contains enough information to let you locate the +// referenced Secret inside the same namespace. +// +structType=atomic +type LocalSecretReference struct { + // Name of the Secret. + // +kubebuilder:validation:=Required + Name string `json:"name"` +} diff --git a/machine/v1/types_awsplacementgroup.go b/machine/v1/types_awsplacementgroup.go new file mode 100644 index 00000000000..4a091aec126 --- /dev/null +++ b/machine/v1/types_awsplacementgroup.go @@ -0,0 +1,164 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AWSPlacementGroup ensures that a placement group matching the given configuration exists within AWS +// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). +// +openshift:compatibility-gen:level=1 +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".status.observedConfiguration.groupType",description="Placement Group Type" +// +kubebuilder:printcolumn:name="Management",type="string",JSONPath=".spec.managementSpec.managementState",description="Management State" +// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".status.replicas",description="EC2 Replicas within the Placement Group" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="AWSPlacementGroup age" +type AWSPlacementGroup struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AWSPlacementGroupSpec `json:"spec,omitempty"` + Status AWSPlacementGroupStatus `json:"status,omitempty"` +} + +type AWSPlacementGroupSpec struct { + // AWSPlacementGroupManagementSpec defines the configuration for a managed or unmanaged placement group. + // +kubebuilder:validation:Required + ManagementSpec AWSPlacementGroupManagementSpec `json:"managementSpec"` + + // CredentialsSecret is a reference to the secret with AWS credentials. The secret must reside in the same namespace + // as the AWSPlacementGroup resource. Otherwise, the controller will leverage the EC2 instance assigned IAM Role, + // in OpenShift this will always be the Control Plane Machine IAM Role. + // +optional + CredentialsSecret *LocalSecretReference `json:"credentialsSecret,omitempty"` +} + +// AWSPlacementGroupManagementSpec defines the configuration for a managed or unmanaged placement group. +// +union +type AWSPlacementGroupManagementSpec struct { + // ManagementState determines whether the placement group is expected + // to be managed by this CRD or whether it is user managed. + // A managed placement group may be moved to unmanaged, however an unmanaged + // group may not be moved back to managed. + // +kubebuilder:validation:Required + // +unionDiscriminator + ManagementState ManagementState `json:"managementState"` + + // Managed defines the configuration for the placement groups to be created. + // Updates to the configuration will not be observed as placement groups are immutable + // after creation. + // +optional + Managed *ManagedAWSPlacementGroup `json:"managed,omitempty"` +} + +// AWSPlacementGroupType represents the valid values for the Placement GroupType field. +type AWSPlacementGroupType string + +const ( + // AWSClusterPlacementGroupType is the "Cluster" placement group type. + // Cluster placement groups place instances close together to improve network latency and throughput. + AWSClusterPlacementGroupType AWSPlacementGroupType = "Cluster" + // AWSPartitionPlacementGroupType is the "Partition" placement group type. + // Partition placement groups reduce the likelihood of hardware failures + // disrupting your application's availability. + // Partition placement groups are recommended for use with large scale + // distributed and replicated workloads. + AWSPartitionPlacementGroupType AWSPlacementGroupType = "Partition" + // AWSSpreadPlacementGroupType is the "Spread" placement group type. + // Spread placement groups place instances on distinct racks within the availability + // zone. This ensures instances each have their own networking and power source + // for maximum hardware fault tolerance. + // Spread placement groups are recommended for a small number of critical instances + // which must be kept separate from one another. + // Using a Spread placement group imposes a limit of seven instances within + // the placement group within a single availability zone. + AWSSpreadPlacementGroupType AWSPlacementGroupType = "Spread" +) + +// ManagedAWSPlacementGroup is a discriminated union of placement group configuration. +// +union +type ManagedAWSPlacementGroup struct { + // GroupType specifies the type of AWS placement group to use for this Machine. + // This parameter is only used when a Machine is being created and the named + // placement group does not exist. + // Valid values are "Cluster", "Partition", "Spread". + // This value is required and, in case a placement group already exists, will be + // validated against the existing placement group. + // Note: If the value of this field is "Spread", Machines created within the group + // may no have placement.tenancy set + // to "dedicated". + // +kubebuilder:validation:Enum:="Cluster";"Partition";"Spread" + // +unionDiscriminator + // +kubebuilder:validation:Required + GroupType AWSPlacementGroupType `json:"groupType,omitempty"` + + // Partition defines the configuration of a partition placement group. + // +optional + Partition *AWSPartitionPlacement `json:"partition,omitempty"` +} + +// AWSPartitionPlacement defines the configuration for partition placement groups. +type AWSPartitionPlacement struct { + // Count specifies the number of partitions for a Partition placement + // group. This value is only observed when creating a placement group and + // only when the `groupType` is set to `Partition`. + // Note the partition count of a placement group cannot be changed after creation. + // If unset, AWS will provide a default partition count. + // This default is currently 2. + // Note: When using more than 2 partitions, the "dedicated" tenancy option on Machines + // created within the group is unavailable. + // +kubebuilder:validation:Minimum:=1 + // +kubebuilder:validation:Maximum:=7 + // +optional + Count int32 `json:"count,omitempty"` +} + +type AWSPlacementGroupStatus struct { + // Conditions represents the observations of the AWSPlacementGroup's current state. + // Known .status.conditions.type are: Ready, Deleting + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +optional + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // ExpiresAt identifies when the observed configuration is valid until. + // The observed configuration should not be trusted if this time has passed. + // The AWSPlacementGroup controller will attempt to update the status before it expires. + // +optional + ExpiresAt *metav1.Time `json:"expiresAt,omitempty"` + + // Replicas counts how many AWS EC2 instances are present within the placement group. + // Note: This is a pointer to be able to distinguish between an empty placement group + // and the status having not yet been observed. + // +optional + Replicas *int32 `json:"replicas,omitempty"` + + // ManagementState determines whether the placement group is expected + // to be managed by this CRD or whether it is user managed. + // A managed placement group may be moved to unmanaged, however an unmanaged + // group may not be moved back to managed. + // This value is owned by the controller and may differ from the spec in cases + // when a user attempts to manage a previously unmanaged placement group. + // +optional + ManagementState ManagementState `json:"managementState,omitempty"` + + // ObservedConfiguration represents the configuration present on the placement group on AWS. + // +optional + ObservedConfiguration ManagedAWSPlacementGroup `json:"observedConfiguration,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AWSPlacementGroupList contains a list of AWSPlacementGroup +// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). +// +openshift:compatibility-gen:level=1 +type AWSPlacementGroupList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []AWSPlacementGroup `json:"items"` +} diff --git a/machine/v1/zz_generated.deepcopy.go b/machine/v1/zz_generated.deepcopy.go index 99063423907..47484e7329a 100644 --- a/machine/v1/zz_generated.deepcopy.go +++ b/machine/v1/zz_generated.deepcopy.go @@ -11,6 +11,159 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSPartitionPlacement) DeepCopyInto(out *AWSPartitionPlacement) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSPartitionPlacement. +func (in *AWSPartitionPlacement) DeepCopy() *AWSPartitionPlacement { + if in == nil { + return nil + } + out := new(AWSPartitionPlacement) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSPlacementGroup) DeepCopyInto(out *AWSPlacementGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSPlacementGroup. +func (in *AWSPlacementGroup) DeepCopy() *AWSPlacementGroup { + if in == nil { + return nil + } + out := new(AWSPlacementGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AWSPlacementGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSPlacementGroupList) DeepCopyInto(out *AWSPlacementGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AWSPlacementGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSPlacementGroupList. +func (in *AWSPlacementGroupList) DeepCopy() *AWSPlacementGroupList { + if in == nil { + return nil + } + out := new(AWSPlacementGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AWSPlacementGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSPlacementGroupManagementSpec) DeepCopyInto(out *AWSPlacementGroupManagementSpec) { + *out = *in + if in.Managed != nil { + in, out := &in.Managed, &out.Managed + *out = new(ManagedAWSPlacementGroup) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSPlacementGroupManagementSpec. +func (in *AWSPlacementGroupManagementSpec) DeepCopy() *AWSPlacementGroupManagementSpec { + if in == nil { + return nil + } + out := new(AWSPlacementGroupManagementSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSPlacementGroupSpec) DeepCopyInto(out *AWSPlacementGroupSpec) { + *out = *in + in.ManagementSpec.DeepCopyInto(&out.ManagementSpec) + if in.CredentialsSecret != nil { + in, out := &in.CredentialsSecret, &out.CredentialsSecret + *out = new(LocalSecretReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSPlacementGroupSpec. +func (in *AWSPlacementGroupSpec) DeepCopy() *AWSPlacementGroupSpec { + if in == nil { + return nil + } + out := new(AWSPlacementGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSPlacementGroupStatus) DeepCopyInto(out *AWSPlacementGroupStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ExpiresAt != nil { + in, out := &in.ExpiresAt, &out.ExpiresAt + *out = (*in).DeepCopy() + } + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + in.ObservedConfiguration.DeepCopyInto(&out.ObservedConfiguration) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSPlacementGroupStatus. +func (in *AWSPlacementGroupStatus) DeepCopy() *AWSPlacementGroupStatus { + if in == nil { + return nil + } + out := new(AWSPlacementGroupStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AlibabaCloudMachineProviderConfig) DeepCopyInto(out *AlibabaCloudMachineProviderConfig) { *out = *in @@ -211,6 +364,43 @@ func (in *DataDiskProperties) DeepCopy() *DataDiskProperties { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalSecretReference) DeepCopyInto(out *LocalSecretReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalSecretReference. +func (in *LocalSecretReference) DeepCopy() *LocalSecretReference { + if in == nil { + return nil + } + out := new(LocalSecretReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ManagedAWSPlacementGroup) DeepCopyInto(out *ManagedAWSPlacementGroup) { + *out = *in + if in.Partition != nil { + in, out := &in.Partition, &out.Partition + *out = new(AWSPartitionPlacement) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedAWSPlacementGroup. +func (in *ManagedAWSPlacementGroup) DeepCopy() *ManagedAWSPlacementGroup { + if in == nil { + return nil + } + out := new(ManagedAWSPlacementGroup) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SystemDiskProperties) DeepCopyInto(out *SystemDiskProperties) { *out = *in diff --git a/machine/v1/zz_generated.swagger_doc_generated.go b/machine/v1/zz_generated.swagger_doc_generated.go new file mode 100644 index 00000000000..e560f9f4974 --- /dev/null +++ b/machine/v1/zz_generated.swagger_doc_generated.go @@ -0,0 +1,192 @@ +package v1 + +// This file contains a collection of methods that can be used from go-restful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-swagger-docs.sh + +// AUTO-GENERATED FUNCTIONS START HERE +var map_LocalSecretReference = map[string]string{ + "": "LocalSecretReference contains enough information to let you locate the referenced Secret inside the same namespace.", + "name": "Name of the Secret.", +} + +func (LocalSecretReference) SwaggerDoc() map[string]string { + return map_LocalSecretReference +} + +var map_AlibabaCloudMachineProviderConfig = map[string]string{ + "": "AlibabaCloudMachineProviderConfig is the Schema for the alibabacloudmachineproviderconfig API Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).", + "instanceType": "The instance type of the instance.", + "vpcId": "The ID of the vpc", + "regionId": "The ID of the region in which to create the instance. You can call the DescribeRegions operation to query the most recent region list.", + "zoneId": "The ID of the zone in which to create the instance. You can call the DescribeZones operation to query the most recent region list.", + "imageId": "The ID of the image used to create the instance.", + "dataDisk": "DataDisks holds information regarding the extra disks attached to the instance", + "securityGroups": "SecurityGroups is a list of security group references to assign to the instance. A reference holds either the security group ID, the resource name, or the required tags to search. When more than one security group is returned for a tag search, all the groups are associated with the instance up to the maximum number of security groups to which an instance can belong. For more information, see the \"Security group limits\" section in Limits. https://www.alibabacloud.com/help/en/doc-detail/25412.htm", + "bandwidth": "Bandwidth describes the internet bandwidth strategy for the instance", + "systemDisk": "SystemDisk holds the properties regarding the system disk for the instance", + "vSwitch": "VSwitch is a reference to the vswitch to use for this instance. A reference holds either the vSwitch ID, the resource name, or the required tags to search. When more than one vSwitch is returned for a tag search, only the first vSwitch returned will be used. This parameter is required when you create an instance of the VPC type. You can call the DescribeVSwitches operation to query the created vSwitches.", + "ramRoleName": "RAMRoleName is the name of the instance Resource Access Management (RAM) role. This allows the instance to perform API calls as this specified RAM role.", + "resourceGroup": "ResourceGroup references the resource group to which to assign the instance. A reference holds either the resource group ID, the resource name, or the required tags to search. When more than one resource group are returned for a search, an error will be produced and the Machine will not be created. Resource Groups do not support searching by tags.", + "tenancy": "Tenancy specifies whether to create the instance on a dedicated host. Valid values:\n\ndefault: creates the instance on a non-dedicated host. host: creates the instance on a dedicated host. If you do not specify the DedicatedHostID parameter, Alibaba Cloud automatically selects a dedicated host for the instance. Empty value means no opinion and the platform chooses the a default, which is subject to change over time. Currently the default is `default`.", + "userDataSecret": "UserDataSecret contains a local reference to a secret that contains the UserData to apply to the instance", + "credentialsSecret": "CredentialsSecret is a reference to the secret with alibabacloud credentials. Otherwise, defaults to permissions provided by attached RAM role where the actuator is running.", + "tag": "Tags are the set of metadata to add to an instance.", +} + +func (AlibabaCloudMachineProviderConfig) SwaggerDoc() map[string]string { + return map_AlibabaCloudMachineProviderConfig +} + +var map_AlibabaCloudMachineProviderConfigList = map[string]string{ + "": "AlibabaCloudMachineProviderConfigList contains a list of AlibabaCloudMachineProviderConfig Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).", +} + +func (AlibabaCloudMachineProviderConfigList) SwaggerDoc() map[string]string { + return map_AlibabaCloudMachineProviderConfigList +} + +var map_AlibabaCloudMachineProviderStatus = map[string]string{ + "": "AlibabaCloudMachineProviderStatus is the Schema for the alibabacloudmachineproviderconfig API Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).", + "instanceId": "InstanceID is the instance ID of the machine created in alibabacloud", + "instanceState": "InstanceState is the state of the alibabacloud instance for this machine", + "conditions": "Conditions is a set of conditions associated with the Machine to indicate errors or other status", +} + +func (AlibabaCloudMachineProviderStatus) SwaggerDoc() map[string]string { + return map_AlibabaCloudMachineProviderStatus +} + +var map_AlibabaResourceReference = map[string]string{ + "": "ResourceTagReference is a reference to a specific AlibabaCloud resource by ID, or tags. Only one of ID or Tags may be specified. Specifying more than one will result in a validation error.", + "type": "type identifies the resource reference type for this entry.", + "id": "ID of resource", + "name": "Name of the resource", + "tags": "Tags is a set of metadata based upon ECS object tags used to identify a resource. For details about usage when multiple resources are found, please see the owning parent field documentation.", +} + +func (AlibabaResourceReference) SwaggerDoc() map[string]string { + return map_AlibabaResourceReference +} + +var map_BandwidthProperties = map[string]string{ + "": "Bandwidth describes the bandwidth strategy for the network of the instance", + "internetMaxBandwidthIn": "InternetMaxBandwidthIn is the maximum inbound public bandwidth. Unit: Mbit/s. Valid values: When the purchased outbound public bandwidth is less than or equal to 10 Mbit/s, the valid values of this parameter are 1 to 10. Currently the default is `10` when outbound bandwidth is less than or equal to 10 Mbit/s. When the purchased outbound public bandwidth is greater than 10, the valid values are 1 to the InternetMaxBandwidthOut value. Currently the default is the value used for `InternetMaxBandwidthOut` when outbound public bandwidth is greater than 10.", + "internetMaxBandwidthOut": "InternetMaxBandwidthOut is the maximum outbound public bandwidth. Unit: Mbit/s. Valid values: 0 to 100. When a value greater than 0 is used then a public IP address is assigned to the instance. Empty value means no opinion and the platform chooses the a default, which is subject to change over time. Currently the default is `0`", +} + +func (BandwidthProperties) SwaggerDoc() map[string]string { + return map_BandwidthProperties +} + +var map_DataDiskProperties = map[string]string{ + "": "DataDisk contains the information regarding the datadisk attached to an instance", + "Name": "Name is the name of data disk N. If the name is specified the name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).\n\nEmpty value means the platform chooses a default, which is subject to change over time. Currently the default is `\"\"`.", + "SnapshotID": "SnapshotID is the ID of the snapshot used to create data disk N. Valid values of N: 1 to 16.\n\nWhen the DataDisk.N.SnapshotID parameter is specified, the DataDisk.N.Size parameter is ignored. The data disk is created based on the size of the specified snapshot. Use snapshots created after July 15, 2013. Otherwise, an error is returned and your request is rejected.", + "Size": "Size of the data disk N. Valid values of N: 1 to 16. Unit: GiB. Valid values:\n\nValid values when DataDisk.N.Category is set to cloud_efficiency: 20 to 32768 Valid values when DataDisk.N.Category is set to cloud_ssd: 20 to 32768 Valid values when DataDisk.N.Category is set to cloud_essd: 20 to 32768 Valid values when DataDisk.N.Category is set to cloud: 5 to 2000 The value of this parameter must be greater than or equal to the size of the snapshot specified by the SnapshotID parameter.", + "DiskEncryption": "DiskEncryption specifies whether to encrypt data disk N.\n\nEmpty value means the platform chooses a default, which is subject to change over time. Currently the default is `disabled`.", + "PerformanceLevel": "PerformanceLevel is the performance level of the ESSD used as as data disk N. The N value must be the same as that in DataDisk.N.Category when DataDisk.N.Category is set to cloud_essd. Empty value means no opinion and the platform chooses a default, which is subject to change over time. Currently the default is `PL1`. Valid values:\n\nPL0: A single ESSD can deliver up to 10,000 random read/write IOPS. PL1: A single ESSD can deliver up to 50,000 random read/write IOPS. PL2: A single ESSD can deliver up to 100,000 random read/write IOPS. PL3: A single ESSD can deliver up to 1,000,000 random read/write IOPS. For more information about ESSD performance levels, see ESSDs.", + "Category": "Category describes the type of data disk N. Valid values: cloud_efficiency: ultra disk cloud_ssd: standard SSD cloud_essd: ESSD cloud: basic disk Empty value means no opinion and the platform chooses the a default, which is subject to change over time. Currently for non-I/O optimized instances of retired instance types, the default is `cloud`. Currently for other instances, the default is `cloud_efficiency`.", + "KMSKeyID": "KMSKeyID is the ID of the Key Management Service (KMS) key to be used by data disk N. Empty value means no opinion and the platform chooses the a default, which is subject to change over time. Currently the default is `\"\"` which is interpreted as do not use KMSKey encryption.", + "DiskPreservation": "DiskPreservation specifies whether to release data disk N along with the instance. Empty value means no opinion and the platform chooses the a default, which is subject to change over time. Currently the default is `DeleteWithInstance`", +} + +func (DataDiskProperties) SwaggerDoc() map[string]string { + return map_DataDiskProperties +} + +var map_SystemDiskProperties = map[string]string{ + "": "SystemDiskProperties contains the information regarding the system disk including performance, size, name, and category", + "category": "Category is the category of the system disk. Valid values: cloud_essd: ESSD. When the parameter is set to this value, you can use the SystemDisk.PerformanceLevel parameter to specify the performance level of the disk. cloud_efficiency: ultra disk. cloud_ssd: standard SSD. cloud: basic disk. Empty value means no opinion and the platform chooses the a default, which is subject to change over time. Currently for non-I/O optimized instances of retired instance types, the default is `cloud`. Currently for other instances, the default is `cloud_efficiency`.", + "performanceLevel": "PerformanceLevel is the performance level of the ESSD used as the system disk. Valid values:\n\nPL0: A single ESSD can deliver up to 10,000 random read/write IOPS. PL1: A single ESSD can deliver up to 50,000 random read/write IOPS. PL2: A single ESSD can deliver up to 100,000 random read/write IOPS. PL3: A single ESSD can deliver up to 1,000,000 random read/write IOPS. Empty value means no opinion and the platform chooses a default, which is subject to change over time. Currently the default is `PL1`. For more information about ESSD performance levels, see ESSDs.", + "name": "Name is the name of the system disk. If the name is specified the name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). Empty value means the platform chooses a default, which is subject to change over time. Currently the default is `\"\"`.", + "size": "Size is the size of the system disk. Unit: GiB. Valid values: 20 to 500. The value must be at least 20 and greater than or equal to the size of the image. Empty value means the platform chooses a default, which is subject to change over time. Currently the default is `40` or the size of the image depending on whichever is greater.", +} + +func (SystemDiskProperties) SwaggerDoc() map[string]string { + return map_SystemDiskProperties +} + +var map_Tag = map[string]string{ + "": "Tag The tags of ECS Instance", + "Key": "Key is the name of the key pair", + "Value": "Value is the value or data of the key pair", +} + +func (Tag) SwaggerDoc() map[string]string { + return map_Tag +} + +var map_AWSPartitionPlacement = map[string]string{ + "": "AWSPartitionPlacement defines the configuration for partition placement groups.", + "count": "Count specifies the number of partitions for a Partition placement group. This value is only observed when creating a placement group and only when the `groupType` is set to `Partition`. Note the partition count of a placement group cannot be changed after creation. If unset, AWS will provide a default partition count. This default is currently 2. Note: When using more than 2 partitions, the \"dedicated\" tenancy option on Machines created within the group is unavailable.", +} + +func (AWSPartitionPlacement) SwaggerDoc() map[string]string { + return map_AWSPartitionPlacement +} + +var map_AWSPlacementGroup = map[string]string{ + "": "AWSPlacementGroup ensures that a placement group matching the given configuration exists within AWS Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).", +} + +func (AWSPlacementGroup) SwaggerDoc() map[string]string { + return map_AWSPlacementGroup +} + +var map_AWSPlacementGroupList = map[string]string{ + "": "AWSPlacementGroupList contains a list of AWSPlacementGroup Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).", +} + +func (AWSPlacementGroupList) SwaggerDoc() map[string]string { + return map_AWSPlacementGroupList +} + +var map_AWSPlacementGroupManagementSpec = map[string]string{ + "": "AWSPlacementGroupManagementSpec defines the configuration for a managed or unmanaged placement group.", + "managementState": "ManagementState determines whether the placement group is expected to be managed by this CRD or whether it is user managed. A managed placement group may be moved to unmanaged, however an unmanaged group may not be moved back to managed.", + "managed": "Managed defines the configuration for the placement groups to be created. Updates to the configuration will not be observed as placement groups are immutable after creation.", +} + +func (AWSPlacementGroupManagementSpec) SwaggerDoc() map[string]string { + return map_AWSPlacementGroupManagementSpec +} + +var map_AWSPlacementGroupSpec = map[string]string{ + "managementSpec": "AWSPlacementGroupManagementSpec defines the configuration for a managed or unmanaged placement group.", + "credentialsSecret": "CredentialsSecret is a reference to the secret with AWS credentials. The secret must reside in the same namespace as the AWSPlacementGroup resource. Otherwise, the controller will leverage the EC2 instance assigned IAM Role, in OpenShift this will always be the Control Plane Machine IAM Role.", +} + +func (AWSPlacementGroupSpec) SwaggerDoc() map[string]string { + return map_AWSPlacementGroupSpec +} + +var map_AWSPlacementGroupStatus = map[string]string{ + "conditions": "Conditions represents the observations of the AWSPlacementGroup's current state. Known .status.conditions.type are: Ready, Deleting", + "expiresAt": "ExpiresAt identifies when the observed configuration is valid until. The observed configuration should not be trusted if this time has passed. The AWSPlacementGroup controller will attempt to update the status before it expires.", + "replicas": "Replicas counts how many AWS EC2 instances are present within the placement group. Note: This is a pointer to be able to distinguish between an empty placement group and the status having not yet been observed.", + "managementState": "ManagementState determines whether the placement group is expected to be managed by this CRD or whether it is user managed. A managed placement group may be moved to unmanaged, however an unmanaged group may not be moved back to managed. This value is owned by the controller and may differ from the spec in cases when a user attempts to manage a previously unmanaged placement group.", + "observedConfiguration": "ObservedConfiguration represents the configuration present on the placement group on AWS.", +} + +func (AWSPlacementGroupStatus) SwaggerDoc() map[string]string { + return map_AWSPlacementGroupStatus +} + +var map_ManagedAWSPlacementGroup = map[string]string{ + "": "ManagedAWSPlacementGroup is a discriminated union of placement group configuration.", + "groupType": "GroupType specifies the type of AWS placement group to use for this Machine. This parameter is only used when a Machine is being created and the named placement group does not exist. Valid values are \"Cluster\", \"Partition\", \"Spread\". This value is required and, in case a placement group already exists, will be validated against the existing placement group. Note: If the value of this field is \"Spread\", Machines created within the group may no have placement.tenancy set to \"dedicated\".", + "partition": "Partition defines the configuration of a partition placement group.", +} + +func (ManagedAWSPlacementGroup) SwaggerDoc() map[string]string { + return map_ManagedAWSPlacementGroup +} + +// AUTO-GENERATED FUNCTIONS END HERE diff --git a/machine/v1beta1/types_awsprovider.go b/machine/v1beta1/types_awsprovider.go index a9df9b7758d..eeb3e57c571 100644 --- a/machine/v1beta1/types_awsprovider.go +++ b/machine/v1beta1/types_awsprovider.go @@ -187,6 +187,29 @@ type Placement struct { // supported 3 options: default, dedicated and host. // +optional Tenancy InstanceTenancy `json:"tenancy,omitempty"` + // Group specifies a reference to an AWSPlacementGroup resource to create the Machine within. + // If the group specified does not exist, the Machine will not be created and will enter the failed phase. + // +optional + Group LocalAWSPlacementGroupReference `json:"group,omitempty"` + // PartitionNumber specifies the numbered partition in which instances should be launched. + // It is recommended to only use this value if multiple MachineSets share + // a single Placement Group, in which case, each MachineSet should represent an individual partition number. + // If unset, when a Partition placement group is used, AWS will attempt to + // distribute instances evenly between partitions. + // If PartitionNumber is set when used with a non Partition type Placement Group, this will be considered an error. + // +kubebuilder:validation:Minimum:=1 + // +kubebuilder:validation:Maximum:=7 + // +optional + PartitionNumber int32 `json:"number,omitempty"` +} + +// LocalAWSPlacementGroupReference contains enough information to let you locate the +// referenced AWSPlacementGroup inside the same namespace. +// +structType=atomic +type LocalAWSPlacementGroupReference struct { + // Name of the AWSPlacementGroup. + // +kubebuilder:validation:=Required + Name string `json:"name"` } // Filter is a filter used to identify an AWS resource diff --git a/machine/v1beta1/zz_generated.deepcopy.go b/machine/v1beta1/zz_generated.deepcopy.go index f9bf7ca9862..892ac166a26 100644 --- a/machine/v1beta1/zz_generated.deepcopy.go +++ b/machine/v1beta1/zz_generated.deepcopy.go @@ -897,6 +897,22 @@ func (in *LoadBalancerReference) DeepCopy() *LoadBalancerReference { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalAWSPlacementGroupReference) DeepCopyInto(out *LocalAWSPlacementGroupReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalAWSPlacementGroupReference. +func (in *LocalAWSPlacementGroupReference) DeepCopy() *LocalAWSPlacementGroupReference { + if in == nil { + return nil + } + out := new(LocalAWSPlacementGroupReference) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Machine) DeepCopyInto(out *Machine) { *out = *in @@ -1426,6 +1442,7 @@ func (in *ObjectMeta) DeepCopy() *ObjectMeta { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Placement) DeepCopyInto(out *Placement) { *out = *in + out.Group = in.Group return } diff --git a/machine/v1beta1/zz_generated.swagger_doc_generated.go b/machine/v1beta1/zz_generated.swagger_doc_generated.go index 9302077ac6c..782659436c1 100644 --- a/machine/v1beta1/zz_generated.swagger_doc_generated.go +++ b/machine/v1beta1/zz_generated.swagger_doc_generated.go @@ -123,11 +123,22 @@ func (LoadBalancerReference) SwaggerDoc() map[string]string { return map_LoadBalancerReference } +var map_LocalAWSPlacementGroupReference = map[string]string{ + "": "LocalAWSPlacementGroupReference contains enough information to let you locate the referenced AWSPlacementGroup inside the same namespace.", + "name": "Name of the AWSPlacementGroup.", +} + +func (LocalAWSPlacementGroupReference) SwaggerDoc() map[string]string { + return map_LocalAWSPlacementGroupReference +} + var map_Placement = map[string]string{ "": "Placement indicates where to create the instance in AWS", "region": "Region is the region to use to create the instance", "availabilityZone": "AvailabilityZone is the availability zone of the instance", "tenancy": "Tenancy indicates if instance should run on shared or single-tenant hardware. There are supported 3 options: default, dedicated and host.", + "group": "Group specifies a reference to an AWSPlacementGroup resource to create the Machine within. If the group specified does not exist, the Machine will not be created and will enter the failed phase.", + "number": "PartitionNumber specifies the numbered partition in which instances should be launched. It is recommended to only use this value if multiple MachineSets share a single Placement Group, in which case, each MachineSet should represent an individual partition number. If unset, when a Partition placement group is used, AWS will attempt to distribute instances evenly between partitions. If PartitionNumber is set when used with a non Partition type Placement Group, this will be considered an error.", } func (Placement) SwaggerDoc() map[string]string {