Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions hack/lib/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ servicecertsigner/v1alpha1 \
template/v1 \
user/v1 \
machine/v1beta1 \
machine/v1 \
"
API_PACKAGES="\
github.com/openshift/api/apps/v1,\
Expand Down
187 changes: 187 additions & 0 deletions machine/v1/0000_10_awsplacementgroup.crd.yaml
Original file line number Diff line number Diff line change
@@ -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: []
5 changes: 5 additions & 0 deletions machine/v1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,10 @@ var (
func addKnownTypes(scheme *runtime.Scheme) error {
metav1.AddToGroupVersion(scheme, GroupVersion)

scheme.AddKnownTypes(GroupVersion,
&AWSPlacementGroup{},
&AWSPlacementGroupList{},
)

return nil
}
21 changes: 21 additions & 0 deletions machine/v1/types.go
Original file line number Diff line number Diff line change
@@ -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"`
}
Loading