Skip to content

Commit

Permalink
Update AWS sdk, improve log in machine actuator delete (#747)
Browse files Browse the repository at this point in the history
Signed-off-by: Vince Prignano <[email protected]>
  • Loading branch information
vincepri authored and k8s-ci-robot committed Apr 29, 2019
1 parent 3ee1b3d commit f38fae5
Show file tree
Hide file tree
Showing 29 changed files with 5,695 additions and 464 deletions.
6 changes: 3 additions & 3 deletions Gopkg.lock

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

10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ binaries-dev: ## Builds and installs all development binaries using go get

.PHONY: create-cluster
create-cluster: binaries-dev ## Create a development Kubernetes cluster on AWS using examples
clusterctl create cluster -v 4 \
--provider aws \
--bootstrap-type kind \
-m ./cmd/clusterctl/examples/aws/out/machines.yaml \
-c ./cmd/clusterctl/examples/aws/out/cluster.yaml \
-p ./cmd/clusterctl/examples/aws/out/provider-components.yaml \
-a ./cmd/clusterctl/examples/aws/out/addons.yaml

.PHONY: create-cluster-ha
create-cluste-ha: binaries-dev ## Create a development Kubernetes cluster on AWS using HA examples
clusterctl create cluster -v 4 \
--provider aws \
--bootstrap-type kind \
Expand Down
4 changes: 2 additions & 2 deletions pkg/cloud/aws/actuators/machine/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,15 @@ func (a *Actuator) Delete(ctx context.Context, cluster *clusterv1.Cluster, machi
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html
switch instance.State {
case v1alpha1.InstanceStateShuttingDown, v1alpha1.InstanceStateTerminated:
a.log.Info("Machine instance is shutting down or already terminated", "machine-name", machine.Name, "machine-namespace", machine.Namespace)
a.log.Info("Machine instance is shutting down or already terminated")
return nil
default:
a.log.Info("Terminating machine")
if err := ec2svc.TerminateInstance(instance.ID); err != nil {
return errors.Errorf("failed to terminate instance: %+v", err)
}
}

a.log.Info("Shutdown signal was sent. Shutting down machine.")
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/cloud/aws/services/ec2/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import (

// InstanceByTags returns the existing instance or nothing if it doesn't exist.
func (s *Service) InstanceByTags(machine *actuators.MachineScope) (*v1alpha1.Instance, error) {
s.scope.V(2).Info("Looking for existing machine instance")
s.scope.V(2).Info("Looking for existing machine instance by tags")

input := &ec2.DescribeInstancesInput{
Filters: []*ec2.Filter{
Expand Down Expand Up @@ -79,7 +79,7 @@ func (s *Service) InstanceIfExists(id *string) (*v1alpha1.Instance, error) {
return nil, nil
}

s.scope.V(2).Info("Looking for instance", "instance-id", *id)
s.scope.V(2).Info("Looking for instance by id", "instance-id", *id)

input := &ec2.DescribeInstancesInput{
InstanceIds: []*string{id},
Expand Down
1,660 changes: 1,647 additions & 13 deletions pkg/cloud/aws/services/ec2/mock_ec2iface/ec2api_mock.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/github.com/aws/aws-sdk-go/NOTICE.txt

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

2 changes: 1 addition & 1 deletion vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go

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

6 changes: 6 additions & 0 deletions vendor/github.com/aws/aws-sdk-go/aws/client/logger.go

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

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

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

9 changes: 6 additions & 3 deletions vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go

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

3 changes: 3 additions & 0 deletions vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go

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

Loading

0 comments on commit f38fae5

Please sign in to comment.