
// This file was autogenerated by go-to-protobuf. Do not edit it manually!

syntax = "proto2";

package github.com.openshift.api.machine.v1beta1;

import "k8s.io/api/core/v1/generated.proto";
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";

// Package-wide variables from generator "generated".
option go_package = "v1beta1";

// AWSMachineProviderCondition is a condition in a AWSMachineProviderStatus.
message AWSMachineProviderCondition {
  // Type is the type of the condition.
  optional string type = 1;

  // Status is the status of the condition.
  optional string status = 2;

  // LastProbeTime is the last time we probed the condition.
  // +optional
  optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastProbeTime = 3;

  // LastTransitionTime is the last time the condition transitioned from one status to another.
  // +optional
  optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 4;

  // Reason is a unique, one-word, CamelCase reason for the condition's last transition.
  // +optional
  optional string reason = 5;

  // Message is a human-readable message indicating details about last transition.
  // +optional
  optional string message = 6;
}

// AWSMachineProviderConfig is the Schema for the awsmachineproviderconfigs API
// Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=2
message AWSMachineProviderConfig {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  // AMI is the reference to the AMI from which to create the machine instance.
  optional AWSResourceReference ami = 2;

  // InstanceType is the type of instance to create. Example: m4.xlarge
  optional string instanceType = 3;

  // Tags is the set of tags to add to apply to an instance, in addition to the ones
  // added by default by the actuator. These tags are additive. The actuator will ensure
  // these tags are present, but will not remove any other tags that may exist on the
  // instance.
  repeated TagSpecification tags = 4;

  // IAMInstanceProfile is a reference to an IAM role to assign to the instance
  optional AWSResourceReference iamInstanceProfile = 5;

  // UserDataSecret contains a local reference to a secret that contains the
  // UserData to apply to the instance
  optional k8s.io.api.core.v1.LocalObjectReference userDataSecret = 6;

  // CredentialsSecret is a reference to the secret with AWS credentials. Otherwise, defaults to permissions
  // provided by attached IAM role where the actuator is running.
  optional k8s.io.api.core.v1.LocalObjectReference credentialsSecret = 7;

  // KeyName is the name of the KeyPair to use for SSH
  optional string keyName = 8;

  // DeviceIndex is the index of the device on the instance for the network interface attachment.
  // Defaults to 0.
  optional int64 deviceIndex = 9;

  // PublicIP specifies whether the instance should get a public IP. If not present,
  // it should use the default of its subnet.
  optional bool publicIp = 10;

  // SecurityGroups is an array of references to security groups that should be applied to the
  // instance.
  repeated AWSResourceReference securityGroups = 11;

  // Subnet is a reference to the subnet to use for this instance
  optional AWSResourceReference subnet = 12;

  // Placement specifies where to create the instance in AWS
  optional Placement placement = 13;

  // LoadBalancers is the set of load balancers to which the new instance
  // should be added once it is created.
  repeated LoadBalancerReference loadBalancers = 14;

  // BlockDevices is the set of block device mapping associated to this instance,
  // block device without a name will be used as a root device and only one device without a name is allowed
  // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html
  repeated BlockDeviceMappingSpec blockDevices = 15;

  // SpotMarketOptions allows users to configure instances to be run using AWS Spot instances.
  optional SpotMarketOptions spotMarketOptions = 16;
}

// AWSMachineProviderConfigList contains a list of AWSMachineProviderConfig
// Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=2
message AWSMachineProviderConfigList {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  repeated AWSMachineProviderConfig items = 2;
}

// AWSMachineProviderStatus is the type that will be embedded in a Machine.Status.ProviderStatus field.
// It contains AWS-specific status information.
// Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=2
message AWSMachineProviderStatus {
  // InstanceID is the instance ID of the machine created in AWS
  // +optional
  optional string instanceId = 1;

  // InstanceState is the state of the AWS instance for this machine
  // +optional
  optional string instanceState = 2;

  // Conditions is a set of conditions associated with the Machine to indicate
  // errors or other status
  repeated AWSMachineProviderCondition conditions = 3;
}

// AWSResourceReference is a reference to a specific AWS resource by ID, ARN, or filters.
// Only one of ID, ARN or Filters may be specified. Specifying more than one will result in
// a validation error.
message AWSResourceReference {
  // ID of resource
  // +optional
  optional string id = 1;

  // ARN of resource
  // +optional
  optional string arn = 2;

  // Filters is a set of filters used to identify a resource
  repeated Filter filters = 3;
}

// BlockDeviceMappingSpec describes a block device mapping
message BlockDeviceMappingSpec {
  // The device name exposed to the machine (for example, /dev/sdh or xvdh).
  optional string deviceName = 1;

  // Parameters used to automatically set up EBS volumes when the machine is
  // launched.
  optional EBSBlockDeviceSpec ebs = 2;

  // Suppresses the specified device included in the block device mapping of the
  // AMI.
  optional string noDevice = 3;

  // The virtual device name (ephemeralN). Machine store volumes are numbered
  // starting from 0. An machine type with 2 available machine store volumes
  // can specify mappings for ephemeral0 and ephemeral1.The number of available
  // machine store volumes depends on the machine type. After you connect to
  // the machine, you must mount the volume.
  //
  // Constraints: For M3 machines, you must specify machine store volumes in
  // the block device mapping for the machine. When you launch an M3 machine,
  // we ignore any machine store volumes specified in the block device mapping
  // for the AMI.
  optional string virtualName = 4;
}

// Condition defines an observation of a Machine API resource operational state.
message Condition {
  // 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.
  // +required
  optional string type = 1;

  // Status of the condition, one of True, False, Unknown.
  // +required
  optional string status = 2;

  // Severity provides an explicit classification of Reason code, so the users or machines can immediately
  // understand the current situation and act accordingly.
  // The Severity field MUST be set only when Status=False.
  // +optional
  optional string severity = 3;

  // 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.
  // +required
  optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 4;

  // The reason for the condition's last transition in CamelCase.
  // The specific API may choose whether or not this field is considered a guaranteed API.
  // This field may not be empty.
  // +optional
  optional string reason = 5;

  // A human readable message indicating details about the transition.
  // This field may be empty.
  // +optional
  optional string message = 6;
}

// EBSBlockDeviceSpec describes a block device for an EBS volume.
// https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EbsBlockDevice
message EBSBlockDeviceSpec {
  // Indicates whether the EBS volume is deleted on machine termination.
  optional bool deleteOnTermination = 1;

  // Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes
  // may only be attached to machines that support Amazon EBS encryption.
  optional bool encrypted = 2;

  // Indicates the KMS key that should be used to encrypt the Amazon EBS volume.
  optional AWSResourceReference kmsKey = 3;

  // The number of I/O operations per second (IOPS) that the volume supports.
  // For io1, this represents the number of IOPS that are provisioned for the
  // volume. For gp2, this represents the baseline performance of the volume and
  // the rate at which the volume accumulates I/O credits for bursting. For more
  // information about General Purpose SSD baseline performance, I/O credits,
  // and bursting, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html)
  // in the Amazon Elastic Compute Cloud User Guide.
  //
  // Minimal and maximal IOPS for io1 and gp2 are constrained. Please, check
  // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
  // for precise boundaries for individual volumes.
  //
  // Condition: This parameter is required for requests to create io1 volumes;
  // it is not used in requests to create gp2, st1, sc1, or standard volumes.
  optional int64 iops = 4;

  // The size of the volume, in GiB.
  //
  // Constraints: 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned
  // IOPS SSD (io1), 500-16384 for Throughput Optimized HDD (st1), 500-16384 for
  // Cold HDD (sc1), and 1-1024 for Magnetic (standard) volumes. If you specify
  // a snapshot, the volume size must be equal to or larger than the snapshot
  // size.
  //
  // Default: If you're creating the volume from a snapshot and don't specify
  // a volume size, the default is the snapshot size.
  optional int64 volumeSize = 5;

  // The volume type: gp2, io1, st1, sc1, or standard.
  // Default: standard
  optional string volumeType = 6;
}

// Filter is a filter used to identify an AWS resource
message Filter {
  // Name of the filter. Filter names are case-sensitive.
  optional string name = 1;

  // Values includes one or more filter values. Filter values are case-sensitive.
  repeated string values = 2;
}

// LastOperation represents the detail of the last performed operation on the MachineObject.
message LastOperation {
  // Description is the human-readable description of the last operation.
  optional string description = 1;

  // LastUpdated is the timestamp at which LastOperation API was last-updated.
  optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastUpdated = 2;

  // State is the current status of the last performed operation.
  // E.g. Processing, Failed, Successful etc
  optional string state = 3;

  // Type is the type of operation which was last performed.
  // E.g. Create, Delete, Update etc
  optional string type = 4;
}

// LoadBalancerReference is a reference to a load balancer on AWS.
message LoadBalancerReference {
  optional string name = 1;

  optional string type = 2;
}

// Machine is the Schema for the machines API
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Phase of machine"
// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".metadata.labels['machine\\.openshift\\.io/instance-type']",description="Type of instance"
// +kubebuilder:printcolumn:name="Region",type="string",JSONPath=".metadata.labels['machine\\.openshift\\.io/region']",description="Region associated with machine"
// +kubebuilder:printcolumn:name="Zone",type="string",JSONPath=".metadata.labels['machine\\.openshift\\.io/zone']",description="Zone associated with machine"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Machine age"
// +kubebuilder:printcolumn:name="Node",type="string",JSONPath=".status.nodeRef.name",description="Node associated with machine",priority=1
// +kubebuilder:printcolumn:name="ProviderID",type="string",JSONPath=".spec.providerID",description="Provider ID of machine created in cloud provider",priority=1
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".metadata.annotations['machine\\.openshift\\.io/instance-state']",description="State of instance",priority=1
// Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=2
message Machine {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  optional MachineSpec spec = 2;

  optional MachineStatus status = 3;
}

// MachineList contains a list of Machine
// Compatibility level 2: Stable within a major release for a minimum of 9 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=2
message MachineList {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  repeated Machine items = 2;
}

// MachineSpec defines the desired state of Machine
message MachineSpec {
  // ObjectMeta will autopopulate the Node created. Use this to
  // indicate what labels, annotations, name prefix, etc., should be used
  // when creating the Node.
  // +optional
  optional ObjectMeta metadata = 1;

  // The list of the taints to be applied to the corresponding Node in additive
  // manner. This list will not overwrite any other taints added to the Node on
  // an ongoing basis by other entities. These taints should be actively reconciled
  // e.g. if you ask the machine controller to apply a taint and then manually remove
  // the taint the machine controller will put it back) but not have the machine controller
  // remove any taints
  // +optional
  repeated k8s.io.api.core.v1.Taint taints = 2;

  // ProviderSpec details Provider-specific configuration to use during node creation.
  // +optional
  optional ProviderSpec providerSpec = 3;

  // ProviderID is the identification ID of the machine provided by the provider.
  // This field must match the provider ID as seen on the node object corresponding to this machine.
  // This field is required by higher level consumers of cluster-api. Example use case is cluster autoscaler
  // with cluster-api as provider. Clean-up logic in the autoscaler compares machines to nodes to find out
  // machines at provider which could not get registered as Kubernetes nodes. With cluster-api as a
  // generic out-of-tree provider for autoscaler, this field is required by autoscaler to be
  // able to have a provider view of the list of machines. Another list of nodes is queried from the k8s apiserver
  // and then a comparison is done to find out unregistered machines and are marked for delete.
  // This field will be set by the actuators and consumed by higher level entities like autoscaler that will
  // be interfacing with cluster-api as generic provider.
  // +optional
  optional string providerID = 4;
}

// MachineStatus defines the observed state of Machine
message MachineStatus {
  // NodeRef will point to the corresponding Node if it exists.
  // +optional
  optional k8s.io.api.core.v1.ObjectReference nodeRef = 1;

  // LastUpdated identifies when this status was last observed.
  // +optional
  optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastUpdated = 2;

  // ErrorReason will be set in the event that there is a terminal problem
  // reconciling the Machine and will contain a succinct value suitable
  // for machine interpretation.
  //
  // This field should not be set for transitive errors that a controller
  // faces that are expected to be fixed automatically over
  // time (like service outages), but instead indicate that something is
  // fundamentally wrong with the Machine's spec or the configuration of
  // the controller, and that manual intervention is required. Examples
  // of terminal errors would be invalid combinations of settings in the
  // spec, values that are unsupported by the controller, or the
  // responsible controller itself being critically misconfigured.
  //
  // Any transient errors that occur during the reconciliation of Machines
  // can be added as events to the Machine object and/or logged in the
  // controller's output.
  // +optional
  optional string errorReason = 3;

  // ErrorMessage will be set in the event that there is a terminal problem
  // reconciling the Machine and will contain a more verbose string suitable
  // for logging and human consumption.
  //
  // This field should not be set for transitive errors that a controller
  // faces that are expected to be fixed automatically over
  // time (like service outages), but instead indicate that something is
  // fundamentally wrong with the Machine's spec or the configuration of
  // the controller, and that manual intervention is required. Examples
  // of terminal errors would be invalid combinations of settings in the
  // spec, values that are unsupported by the controller, or the
  // responsible controller itself being critically misconfigured.
  //
  // Any transient errors that occur during the reconciliation of Machines
  // can be added as events to the Machine object and/or logged in the
  // controller's output.
  // +optional
  optional string errorMessage = 4;

  // ProviderStatus details a Provider-specific status.
  // It is recommended that providers maintain their
  // own versioned API types that should be
  // serialized/deserialized from this field.
  // +optional
  // +kubebuilder:validation:XPreserveUnknownFields
  optional k8s.io.apimachinery.pkg.runtime.RawExtension providerStatus = 5;

  // Addresses is a list of addresses assigned to the machine. Queried from cloud provider, if available.
  // +optional
  repeated k8s.io.api.core.v1.NodeAddress addresses = 6;

  // LastOperation describes the last-operation performed by the machine-controller.
  // This API should be useful as a history in terms of the latest operation performed on the
  // specific machine. It should also convey the state of the latest-operation for example if
  // it is still on-going, failed or completed successfully.
  // +optional
  optional LastOperation lastOperation = 7;

  // Phase represents the current phase of machine actuation.
  // One of: Failed, Provisioning, Provisioned, Running, Deleting
  // +optional
  optional string phase = 8;

  // Conditions defines the current state of the Machine
  repeated Condition conditions = 9;
}

// 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` and `MachineSet.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](https://github.com/kubernetes-sigs/cluster-api/pull/1054)
// for v1alpha2, we noticed a failure would occur running Cluster API test suite against the new CRDs,
// specifically `spec.metadata.creationTimestamp in body must be of type string: "null"`.
// The investigation showed that `controller-tools@v2` behaves differently than its previous version
// when handling types from [metav1](k8s.io/apimachinery/pkg/apis/meta/v1) package.
//
// In more details, we found that embedded (non-top level) types that embedded `metav1.ObjectMeta`
// had validation properties, including for `creationTimestamp` (metav1.Time).
// The `metav1.Time` type specifies a custom json marshaller that, when IsZero() is true, returns `null`
// 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.
message ObjectMeta {
  // Name must be unique within a namespace. Is required when creating resources, although
  // some resources may allow a client to request the generation of an appropriate name
  // automatically. Name is primarily intended for creation idempotence and configuration
  // definition.
  // Cannot be updated.
  // More info: http://kubernetes.io/docs/user-guide/identifiers#names
  // +optional
  optional string name = 1;

  // GenerateName is an optional prefix, used by the server, to generate a unique
  // name ONLY IF the Name field has not been provided.
  // If this field is used, the name returned to the client will be different
  // than the name passed. This value will also be combined with a unique suffix.
  // The provided value has the same validation rules as the Name field,
  // and may be truncated by the length of the suffix required to make the value
  // unique on the server.
  //
  // If this field is specified and the generated name exists, the server will
  // NOT return a 409 - instead, it will either return 201 Created or 500 with Reason
  // ServerTimeout indicating a unique name could not be found in the time allotted, and the client
  // should retry (optionally after the time indicated in the Retry-After header).
  //
  // Applied only if Name is not specified.
  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency
  // +optional
  optional string generateName = 2;

  // Namespace defines the space within each name must be unique. An empty namespace is
  // equivalent to the "default" namespace, but "default" is the canonical representation.
  // Not all objects are required to be scoped to a namespace - the value of this field for
  // those objects will be empty.
  //
  // Must be a DNS_LABEL.
  // Cannot be updated.
  // More info: http://kubernetes.io/docs/user-guide/namespaces
  // +optional
  optional string namespace = 3;

  // 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
  // +optional
  map<string, string> labels = 4;

  // 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
  // +optional
  map<string, string> annotations = 5;

  // List of objects depended by this object. If ALL objects in the list have
  // been deleted, this object will be garbage collected. If this object is managed by a controller,
  // then an entry in this list will point to this controller, with the controller field set to true.
  // There cannot be more than one managing controller.
  // +optional
  // +patchMergeKey=uid
  // +patchStrategy=merge
  repeated k8s.io.apimachinery.pkg.apis.meta.v1.OwnerReference ownerReferences = 6;
}

// Placement indicates where to create the instance in AWS
message Placement {
  // Region is the region to use to create the instance
  optional string region = 1;

  // AvailabilityZone is the availability zone of the instance
  optional string availabilityZone = 2;

  // Tenancy indicates if instance should run on shared or single-tenant hardware. There are
  // supported 3 options: default, dedicated and host.
  optional string tenancy = 3;
}

// ProviderSpec defines the configuration to use during node creation.
message ProviderSpec {
  // Value is an inlined, serialized representation of the resource
  // configuration. It is recommended that providers maintain their own
  // versioned API types that should be serialized/deserialized from this
  // field, akin to component config.
  // +optional
  // +kubebuilder:validation:XPreserveUnknownFields
  optional k8s.io.apimachinery.pkg.runtime.RawExtension value = 1;
}

// SpotMarketOptions defines the options available to a user when configuring
// Machines to run on Spot instances.
// Most users should provide an empty struct.
message SpotMarketOptions {
  // The maximum price the user is willing to pay for their instances
  // Default: On-Demand price
  optional string maxPrice = 1;
}

// TagSpecification is the name/value pair for a tag
message TagSpecification {
  // Name of the tag
  optional string name = 1;

  // Value of the tag
  optional string value = 2;
}

