Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supplemental update for v1alpha2 #896

Merged
merged 19 commits into from
Jul 16, 2019
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
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(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed currently, but as we continue to refine for v1alpha2, since we have access to the manager client, we should probably remove the typed clients.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree, once the Cluster actuator is also out, we might be able to get rid of them easily

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/NodeAddress/MachineAddresses or InstanceAddresses since we said that these do not need to align with the reported NodeAddresses from the Cloud Provider integration.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to fork/copy the NodeAddress struct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking it wouldn't hurt to create our own with inspiration from the NodeAddress struct, since we could very well end up with different requirements down the line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll open a PR to CAPI to fork the type, so other providers can use it as well. I can follow-up in a new PR to fixup the CRD/dependency or fix it here, which do you prefer?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

followup is good

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