Skip to content

Commit

Permalink
Supplemental update for v1alpha2 (#896)
Browse files Browse the repository at this point in the history
* Supplemental update for v1alpha2

Signed-off-by: Vince Prignano <[email protected]>

* Check that bootstrap.data is populated and available

Signed-off-by: Vince Prignano <[email protected]>

* Add finalizer

Signed-off-by: Vince Prignano <[email protected]>

* Migrate actuator logic

Signed-off-by: Vince Prignano <[email protected]>

* Move controlplane init locker, fix cluster actuator

Signed-off-by: Vince Prignano <[email protected]>

* Fixup actuator client and uncomment code

Signed-off-by: Vince Prignano <[email protected]>

* Remove code that should be in bootstrap controller

Signed-off-by: Vince Prignano <[email protected]>

* Move const at the top of the file

Signed-off-by: Vince Prignano <[email protected]>

* rename scope to cluster scope

Signed-off-by: Vince Prignano <[email protected]>

* Add helper methods to scope

Signed-off-by: Vince Prignano <[email protected]>

* update vendored version of capi

Signed-off-by: Vince Prignano <[email protected]>

* update controller to use map func

Signed-off-by: Vince Prignano <[email protected]>

* Retrieve cluster on machine scope, update tests, update vendor

Signed-off-by: Vince Prignano <[email protected]>

* Update rbac

Signed-off-by: Vince Prignano <[email protected]>

* rename annotation group

Signed-off-by: Vince Prignano <[email protected]>

* address actuator feedback

Signed-off-by: Vince Prignano <[email protected]>

* Use utils to get owner Machine in scope

Signed-off-by: Vince Prignano <[email protected]>

* update vendor and add status.errors for awsmachine

Signed-off-by: Vince Prignano <[email protected]>

* fix tests

Signed-off-by: Vince Prignano <[email protected]>
  • Loading branch information
vincepri authored and k8s-ci-robot committed Jul 16, 2019
1 parent 8521364 commit 8347a46
Show file tree
Hide file tree
Showing 164 changed files with 13,251 additions and 608 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ cluster on AWS.

This provider's versions are compatible with the following versions of Cluster API:

||Cluster API v1alpha1 (v0.1)|
|-|-|
|AWS Provider v1alpha1 (v0.2)||
|AWS Provider v1alpha1 (v0.3)||
||Cluster API v1alpha1 (v0.1)|Cluster API v1alpha2 (unreleased)|
|-|-|-|
|AWS Provider v1alpha1 (v0.2)|||
|AWS Provider v1alpha1 (v0.3)|||
|AWS Provider v1alpha2 (unreleased)|||

This provider's versions are able to install and manage the following versions of Kubernetes:

Expand Down
3 changes: 3 additions & 0 deletions cmd/manager/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ go_library(
deps = [
"//pkg/apis:go_default_library",
"//pkg/cloud/aws/actuators/cluster:go_default_library",
"//pkg/controller:go_default_library",
"//pkg/record:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
"//vendor/k8s.io/klog/klogr:go_default_library",
"//vendor/sigs.k8s.io/cluster-api/pkg/apis:go_default_library",
"//vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common:go_default_library",
"//vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset:go_default_library",
"//vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster:go_default_library",
"//vendor/sigs.k8s.io/controller-runtime/pkg/client/config:go_default_library",
"//vendor/sigs.k8s.io/controller-runtime/pkg/manager:go_default_library",
"//vendor/sigs.k8s.io/controller-runtime/pkg/runtime/log:go_default_library",
"//vendor/sigs.k8s.io/controller-runtime/pkg/runtime/signals:go_default_library",
],
)
Expand Down
40 changes: 25 additions & 15 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ import (

corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/klog"
"sigs.k8s.io/cluster-api-provider-aws/pkg/apis"
"k8s.io/klog/klogr"
capa "sigs.k8s.io/cluster-api-provider-aws/pkg/apis"
"sigs.k8s.io/cluster-api-provider-aws/pkg/cloud/aws/actuators/cluster"
"sigs.k8s.io/cluster-api-provider-aws/pkg/controller"
"sigs.k8s.io/cluster-api-provider-aws/pkg/record"
clusterapis "sigs.k8s.io/cluster-api/pkg/apis"
capi "sigs.k8s.io/cluster-api/pkg/apis"
"sigs.k8s.io/cluster-api/pkg/apis/cluster/common"
"sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset"
capicluster "sigs.k8s.io/cluster-api/pkg/controller/cluster"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/runtime/log"
"sigs.k8s.io/controller-runtime/pkg/runtime/signals"
)

Expand All @@ -46,8 +49,9 @@ func main() {
profilerAddress := flag.String("profiler-address", "", "Bind address to expose the pprof profiler (e.g. localhost:6060)")

flag.Parse()

cfg := config.GetConfigOrDie()
if *watchNamespace != "" {
klog.Infof("Watching cluster-api objects only in namespace %q for reconciliation", *watchNamespace)
}

if *profilerAddress != "" {
klog.Infof("Profiler listening for requests at %s", *profilerAddress)
Expand All @@ -58,16 +62,16 @@ func main() {

// Setup a Manager
syncPeriod := 10 * time.Minute
opts := manager.Options{
SyncPeriod: &syncPeriod,
}

if *watchNamespace != "" {
opts.Namespace = *watchNamespace
klog.Infof("Watching cluster-api objects only in namespace %q for reconciliation.", opts.Namespace)
}
// Setup controller-runtime logger.
log.SetLogger(klogr.New())

mgr, err := manager.New(cfg, opts)
// Get a config to talk to the api-server.
cfg := config.GetConfigOrDie()
mgr, err := manager.New(cfg, manager.Options{
SyncPeriod: &syncPeriod,
Namespace: *watchNamespace,
})
if err != nil {
klog.Fatalf("Failed to set up overall controller manager: %v", err)
}
Expand All @@ -87,24 +91,30 @@ func main() {

// Initialize cluster actuator.
clusterActuator := cluster.NewActuator(cluster.ActuatorParams{
Client: mgr.GetClient(),
CoreClient: coreClient,
Client: cs.ClusterV1alpha2(),
ClusterClient: cs.ClusterV1alpha2(),
LoggingContext: "[cluster-actuator]",
})

// Register our cluster deployer (the interface is in clusterctl and we define the Deployer interface on the actuator)
common.RegisterClusterProvisioner("aws", clusterActuator)

if err := apis.AddToScheme(mgr.GetScheme()); err != nil {
if err := capi.AddToScheme(mgr.GetScheme()); err != nil {
klog.Fatal(err)
}

if err := clusterapis.AddToScheme(mgr.GetScheme()); err != nil {
if err := capa.AddToScheme(mgr.GetScheme()); err != nil {
klog.Fatal(err)
}

capicluster.AddWithActuator(mgr, clusterActuator)

// Setup all Controllers.
if err := controller.AddToManager(mgr); err != nil {
klog.Fatal(err)
}

if err := mgr.Start(signals.SetupSignalHandler()); err != nil {
klog.Fatalf("Failed to run manager: %v", err)
}
Expand Down
102 changes: 47 additions & 55 deletions config/crds/infrastructure.cluster.sigs.k8s.io_awsmachines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -447,34 +447,6 @@ spec:
are additive. The actuator will ensure these tags are present, but
will not remove any other tags that may exist on the instance.
type: object
additionalUserDataFiles:
description: AdditionalUserDataFiles specifies extra files to be passed
to user_data upon creation.
items:
description: Files defines the input for generating write_files in
cloud-init.
properties:
content:
description: Content is the actual content of the file.
type: string
owner:
description: Owner specifies the ownership of the file, e.g. "root:root".
type: string
path:
description: Path specifies the full path on disk where to store
the file.
type: string
permissions:
description: Permissions specifies the permissions to assign to
the file, e.g. "0640".
type: string
required:
- content
- owner
- path
- permissions
type: object
type: array
ami:
description: AMI is the reference to the AMI from which to create the
machine instance.
Expand Down Expand Up @@ -527,6 +499,10 @@ spec:
keyName:
description: KeyName is the name of the SSH key to install on the instance.
type: string
providerID:
description: ProviderID is the unique identifier as specified by the
cloud provider.
type: string
publicIP:
description: 'PublicIP specifies whether the instance should get a public
IP. Precedence for this setting is as follows: 1. This field if set
Expand Down Expand Up @@ -572,48 +548,64 @@ spec:
status:
description: AWSMachineStatus defines the observed state of AWSMachine
properties:
conditions:
description: Conditions is a set of conditions associated with the Machine
to indicate errors or other status
addresses:
description: Addresses contains the AWS instance associated addresses.
items:
description: AWSMachineProviderCondition is a condition in a AWSMachineProviderStatus
description: NodeAddress contains information for the node's address.
properties:
lastProbeTime:
description: LastProbeTime is the last time we probed the condition.
format: date-time
type: string
lastTransitionTime:
description: LastTransitionTime is the last time the condition
transitioned from one status to another.
format: date-time
type: string
message:
description: Message is a human-readable message indicating details
about last transition.
type: string
reason:
description: Reason is a unique, one-word, CamelCase reason for
the condition's last transition.
type: string
status:
description: Status is the status of the condition.
address:
description: The node address.
type: string
type:
description: Type is the type of the condition.
description: Node address type, one of Hostname, ExternalIP or
InternalIP.
type: string
required:
- status
- 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."
type: string
errorReason:
description: "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. \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
instanceID:
description: InstanceID is the instance ID of the machine created in
AWS
AWS.
type: string
instanceState:
description: InstanceState is the state of the AWS instance for this
machine
machine.
type: string
ready:
description: Ready is true when the provider resource is ready.
type: boolean
type: object
type: object
versions:
Expand Down
Loading

0 comments on commit 8347a46

Please sign in to comment.