forked from kubernetes-sigs/cluster-api-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move types, controller, and manager to kubebuilder v2
Signed-off-by: Chuck Ha <[email protected]>
- Loading branch information
Showing
19 changed files
with
2,281 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,4 @@ kubeconfig | |
# Ignore output manifests | ||
examples/out | ||
examples/provider-components-base.yaml | ||
config/samples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
version: "1" | ||
version: "2" | ||
domain: cluster.x-k8s.io | ||
repo: sigs.k8s.io/cluster-api-provider-aws | ||
resources: | ||
- group: infrastructure | ||
version: v1alpha2 | ||
kind: AWSMachine | ||
- group: infrastructure | ||
version: v1alpha2 | ||
kind: AWSCluster | ||
- group: infrastructure | ||
version: v1alpha2 | ||
kind: AWSMachineTemplate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = [ | ||
"awscluster_types.go", | ||
"awsmachine_types.go", | ||
"awsmachinetemplate_types.go", | ||
"groupversion_info.go", | ||
"tags.go", | ||
"types.go", | ||
"zz_generated.deepcopy.go", | ||
], | ||
importpath = "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha2", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//vendor/k8s.io/api/core/v1:go_default_library", | ||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", | ||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", | ||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", | ||
"//vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2:go_default_library", | ||
"//vendor/sigs.k8s.io/cluster-api/pkg/errors:go_default_library", | ||
"//vendor/sigs.k8s.io/controller-runtime/pkg/scheme:go_default_library", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha2 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
const ( | ||
// ClusterFinalizer allows ReconcileAWSCluster to clean up AWS resources associated with AWSCluster before | ||
// removing it from the apiserver. | ||
ClusterFinalizer = "awscluster.infrastructure.cluster.x-k8s.io" | ||
) | ||
|
||
// AWSClusterSpec defines the desired state of AWSCluster | ||
type AWSClusterSpec struct { | ||
// NetworkSpec encapsulates all things related to AWS network. | ||
NetworkSpec NetworkSpec `json:"networkSpec,omitempty"` | ||
|
||
// The AWS Region the cluster lives in. | ||
Region string `json:"region,omitempty"` | ||
|
||
// SSHKeyName is the name of the ssh key to attach to the bastion host. | ||
SSHKeyName string `json:"sshKeyName,omitempty"` | ||
} | ||
|
||
// AWSClusterStatus defines the observed state of AWSCluster | ||
type AWSClusterStatus struct { | ||
Network Network `json:"network,omitempty"` | ||
Bastion Instance `json:"bastion,omitempty"` | ||
Ready bool `json:"ready"` | ||
// APIEndpoints represents the endpoints to communicate with the control plane. | ||
// +optional | ||
APIEndpoints []APIEndpoint `json:"apiEndpoints,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=awsclusters,scope=Namespaced | ||
// +kubebuilder:storageversion | ||
// +kubebuilder:subresource:status | ||
|
||
// AWSCluster is the Schema for the awsclusters API | ||
type AWSCluster struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec AWSClusterSpec `json:"spec,omitempty"` | ||
Status AWSClusterStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// AWSClusterList contains a list of AWSCluster | ||
type AWSClusterList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []AWSCluster `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&AWSCluster{}, &AWSClusterList{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha2 | ||
|
||
import ( | ||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"sigs.k8s.io/cluster-api/pkg/errors" | ||
) | ||
|
||
const ( | ||
// MachineFinalizer allows ReconcileAWSMachine to clean up AWS resources associated with AWSMachine before | ||
// removing it from the apiserver. | ||
MachineFinalizer = "awsmachine.infrastructure.cluster.x-k8s.io" | ||
) | ||
|
||
// AWSMachineSpec defines the desired state of AWSMachine | ||
type AWSMachineSpec struct { | ||
// ProviderID is the unique identifier as specified by the cloud provider. | ||
ProviderID *string `json:"providerID,omitempty"` | ||
|
||
// AMI is the reference to the AMI from which to create the machine instance. | ||
AMI AWSResourceReference `json:"ami,omitempty"` | ||
|
||
// ImageLookupOrg is the AWS Organization ID to use for image lookup if AMI is not set. | ||
ImageLookupOrg string `json:"imageLookupOrg,omitempty"` | ||
|
||
// InstanceType is the type of instance to create. Example: m4.xlarge | ||
InstanceType string `json:"instanceType,omitempty"` | ||
|
||
// AdditionalTags is the set of tags to add 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. | ||
// +optional | ||
AdditionalTags map[string]string `json:"additionalTags,omitempty"` | ||
|
||
// IAMInstanceProfile is a name of an IAM instance profile to assign to the instance | ||
// +optional | ||
IAMInstanceProfile string `json:"iamInstanceProfile,omitempty"` | ||
|
||
// PublicIP specifies whether the instance should get a public IP. | ||
// Precedence for this setting is as follows: | ||
// 1. This field if set | ||
// 2. Cluster/flavor setting | ||
// 3. Subnet default | ||
// +optional | ||
PublicIP *bool `json:"publicIP,omitempty"` | ||
|
||
// AdditionalSecurityGroups is an array of references to security groups that should be applied to the | ||
// instance. These security groups would be set in addition to any security groups defined | ||
// at the cluster level or in the actuator. | ||
// +optional | ||
AdditionalSecurityGroups []AWSResourceReference `json:"additionalSecurityGroups,omitempty"` | ||
|
||
// AvailabilityZone is references the AWS availability zone to use for this instance. | ||
// If multiple subnets are matched for the availability zone, the first one return is picked. | ||
// +optional | ||
AvailabilityZone *string `json:"availabilityZone,omitempty"` | ||
|
||
// Subnet is a reference to the subnet to use for this instance. If not specified, | ||
// the cluster subnet will be used. | ||
// +optional | ||
Subnet *AWSResourceReference `json:"subnet,omitempty"` | ||
|
||
// KeyName is the name of the SSH key to install on the instance. | ||
// +optional | ||
KeyName string `json:"keyName,omitempty"` | ||
|
||
// RootDeviceSize is the size of the root volume. | ||
// +optional | ||
RootDeviceSize int64 `json:"rootDeviceSize,omitempty"` | ||
} | ||
|
||
// AWSMachineStatus defines the observed state of AWSMachine | ||
type AWSMachineStatus struct { | ||
// Ready is true when the provider resource is ready. | ||
// +optional | ||
Ready bool `json:"ready"` | ||
|
||
// Addresses contains the AWS instance associated addresses. | ||
Addresses []v1.NodeAddress `json:"addresses,omitempty"` | ||
|
||
// InstanceState is the state of the AWS instance for this machine. | ||
// +optional | ||
InstanceState *InstanceState `json:"instanceState,omitempty"` | ||
|
||
// 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 | ||
ErrorReason *errors.MachineStatusError `json:"errorReason,omitempty"` | ||
|
||
// 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 | ||
ErrorMessage *string `json:"errorMessage,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=awsmachines,scope=Namespaced | ||
// +kubebuilder:storageversion | ||
// +kubebuilder:subresource:status | ||
|
||
// AWSMachine is the Schema for the awsmachines API | ||
type AWSMachine struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec AWSMachineSpec `json:"spec,omitempty"` | ||
Status AWSMachineStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// AWSMachineList contains a list of AWSMachine | ||
type AWSMachineList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []AWSMachine `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&AWSMachine{}, &AWSMachineList{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha2 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// AWSMachineTemplateSpec defines the desired state of AWSMachineTemplate | ||
type AWSMachineTemplateSpec struct { | ||
Template AWSMachineTemplateResource `json:"template"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=awsmachinetemplates,scope=Namespaced | ||
// +kubebuilder:storageversion | ||
|
||
// AWSMachineTemplate is the Schema for the awsmachinetemplates API | ||
type AWSMachineTemplate struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec AWSMachineTemplateSpec `json:"spec,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// AWSMachineTemplateList contains a list of AWSMachineTemplate | ||
type AWSMachineTemplateList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []AWSMachineTemplate `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&AWSMachineTemplate{}, &AWSMachineTemplateList{}) | ||
} |
Oops, something went wrong.