Skip to content

Commit

Permalink
Add initial controllers implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Mateusz Gozdek <[email protected]>
  • Loading branch information
invidian committed Dec 18, 2020
1 parent d8e1343 commit 8ee2b5c
Show file tree
Hide file tree
Showing 20 changed files with 1,751 additions and 201 deletions.
18 changes: 8 additions & 10 deletions api/v1alpha3/tinkerbellcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha3

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
Expand All @@ -27,16 +28,13 @@ import (
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file.
type TinkerbellClusterSpec struct {
// HardwareDiscoveryStrategy is a switch we have to implement more advacned
// discovery strategy. The unique one we have today is the default one
// obviously and it uses the two lists of hardware IDs specified down here.
HardwareDiscoveryStrategy string `json:"hardwareDiscoveryStrategy,omitempty"`
// ControlPlaneHardwareIDs contains a list of hardware IDs used as pool for
// control plane kubernetes instances.
ControlPlaneHardwareIDs []string `json:"controlPlaneHardwareIDs,omitempty"`
// MachineHardwareIDs contains a list of hardware IDs used as pool for data
// plane kubernetes instances.
MachineHardwareIDs []string `json:"machineHardwareIDs,omitempty"`
// ControlPlaneEndpoint is a required field by ClusterAPI v1alpha3.
//
// See https://cluster-api.sigs.k8s.io/developer/architecture/controllers/cluster.html
// for more details.
//
// +optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint,omitempty"`
}

// TinkerbellClusterStatus defines the observed state of TinkerbellCluster.
Expand Down
10 changes: 9 additions & 1 deletion api/v1alpha3/tinkerbellmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ const (

// TinkerbellMachineSpec defines the desired state of TinkerbellMachine.
type TinkerbellMachineSpec struct {
HardwareID string `json:"hardwareReservationID,omitempty"`
// List of SSH public keys to allow root user to log in as.
SSHPublicKeys []string `json:"sshPublicKeys,omitempty"`

// TODO: Those fields are not intended to be filled in by the user, but by the controller.
// Should we move them to Status struct?
HardwareID string `json:"hardwareID,omitempty"`
TemplateID string `json:"templateID,omitempty"`
WorkflowID string `json:"workflowID,omitempty"`
ProviderID string `json:"providerID,omitempty"`
}

// TinkerbellMachineStatus defines the observed state of TinkerbellMachine.
Expand Down
26 changes: 11 additions & 15 deletions api/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,30 @@ spec:
description: TinkerbellCluster is the Schema for the tinkerbellclusters API.
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'
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'
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:
description: 'TinkerbellClusterSpec defines the desired state of TinkerbellCluster
INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important:
Run "make" to regenerate code after modifying this file.'
description: 'TinkerbellClusterSpec defines the desired state of TinkerbellCluster INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "make" to regenerate code after modifying this file.'
properties:
controlPlaneHardwareIDs:
description: ControlPlaneHardwareIDs contains a list of hardware IDs
used as pool for control plane kubernetes instances.
items:
type: string
type: array
hardwareDiscoveryStrategy:
description: HardwareDiscoveryStrategy is a switch we have to implement
more advacned discovery strategy. The unique one we have today is
the default one obviously and it uses the two lists of hardware
IDs specified down here.
type: string
machineHardwareIDs:
description: MachineHardwareIDs contains a list of hardware IDs used
as pool for data plane kubernetes instances.
items:
type: string
type: array
controlPlaneEndpoint:
description: "ControlPlaneEndpoint is a required field by ClusterAPI v1alpha3. \n See https://cluster-api.sigs.k8s.io/developer/architecture/controllers/cluster.html for more details."
properties:
host:
description: The hostname on which the API server is serving.
type: string
port:
description: The port on which the API server is serving.
format: int32
type: integer
required:
- host
- port
type: object
type: object
status:
description: TinkerbellClusterStatus defines the observed state of TinkerbellCluster.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,29 @@ spec:
description: TinkerbellMachine is the Schema for the tinkerbellmachines API.
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'
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'
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:
description: TinkerbellMachineSpec defines the desired state of TinkerbellMachine.
properties:
hardwareReservationID:
hardwareID:
description: 'TODO: Those fields are not intended to be filled in by the user, but by the controller. Should we move them to Status struct?'
type: string
providerID:
type: string
sshPublicKeys:
description: List of SSH public keys to allow root user to log in as.
items:
type: string
type: array
templateID:
type: string
workflowID:
type: string
type: object
status:
Expand All @@ -74,37 +82,21 @@ spec:
description: The node address.
type: string
type:
description: Node address type, one of Hostname, ExternalIP
or InternalIP.
description: Node address type, one of Hostname, ExternalIP or InternalIP.
type: string
required:
- address
- type
type: object
type: array
errorMessage:
description: "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. \n 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. \n 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."
description: "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. \n 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. \n 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."
type: string
errorReason:
description: 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.
description: 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.
type: string
instanceStatus:
description: InstanceStatus is the status of the Tinkerbell device
instance for this machine.
description: InstanceStatus is the status of the Tinkerbell device instance for this machine.
type: integer
ready:
description: Ready is true when the provider resource is ready.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,38 @@ spec:
- name: v1alpha3
schema:
openAPIV3Schema:
description: TinkerbellMachineTemplate is the Schema for the tinkerbellmachinetemplates
API.
description: TinkerbellMachineTemplate is the Schema for the tinkerbellmachinetemplates API.
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'
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'
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:
description: TinkerbellMachineTemplateSpec defines the desired state of
TinkerbellMachineTemplate.
description: TinkerbellMachineTemplateSpec defines the desired state of TinkerbellMachineTemplate.
properties:
template:
description: TinkerbellMachineTemplateResource describes the data
needed to create am TinkerbellMachine from a template.
description: TinkerbellMachineTemplateResource describes the data needed to create am TinkerbellMachine from a template.
properties:
spec:
description: Spec is the specification of the desired behavior
of the machine.
description: Spec is the specification of the desired behavior of the machine.
properties:
hardwareReservationID:
hardwareID:
description: 'TODO: Those fields are not intended to be filled in by the user, but by the controller. Should we move them to Status struct?'
type: string
providerID:
type: string
sshPublicKeys:
description: List of SSH public keys to allow root user to log in as.
items:
type: string
type: array
templateID:
type: string
workflowID:
type: string
type: object
required:
Expand Down
Loading

0 comments on commit 8ee2b5c

Please sign in to comment.