Commit Graph

96 Commits (865321c2d69d249d95079b7f8e2ca99f5430d79e)

Author SHA1 Message Date
Kubernetes Submit Queue 3ca89a3469
Merge pull request #60125 from vainu-arto/aws-missing-tags-error
Automatic merge from submit-queue (batch tested with PRs 60435, 60334, 60458, 59301, 60125). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Return missing ClusterID error instead of ignoring it

This fixes issue #57382. In the cases I'm aware of kubelet cannot function if it can't detect the cluster it is running in, so the error should be passed up to the caller preventing initialization when kubelet would fail. This way the error can be detected and kubelet startup attempted again later (giving AWS time to apply the tags).

```release-note
On AWS kubelet returns an error when started under conditions that do not allow it to work (AWS has not yet tagged the instance).
```
2018-02-26 17:48:54 -08:00
Arto Jantunen a58f16bdfa Add clusterid tags to the instances in AWS tests
In practice these were in most cases required to exist, but kubelet did not
previously enforce this. It now does, so these tests need to change a bit.
2018-02-26 14:50:58 +02:00
Kubernetes Submit Queue 62c5f21d5d
Merge pull request #58767 from 2rs2ts/tag-elb-sgs
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Tag Security Group created for AWS ELB with same additional tags as ELB

/sig aws

(I worked on this with @bkochendorfer)

Tags the SG created for the ELB with the same additional tags the ELB gets from the `service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags` annotation. This is useful for identifying orphaned resources.

We think that reusing the annotation is a simpler and less intrusive approach than adding a new annotation, and most users will want the same set of tags applied.

We weren't sure how to write a test for this because it looks like the fake EC2 code doesn't store the state of the security groups. If new tests are a requirement for merging, we'll need help writing them.

Fixes #53489

```release-note
AWS Security Groups created for ELBs will now be tagged with the same additional tags as the ELB (i.e. the tags specified by the "service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags" annotation.)
```
2018-02-25 11:59:53 -08:00
Bryce Carman 3b99e1b487 Add AWS cloud provider option for IAM role
Currently the AWS cloud provider uses the EC2 instance role when
interacting with AWS APIs. This change gives the option to provide and IAM
role that the cloud provider will assume before calling the APIs. All
resources created by the role will be owned by that account instead of
the account where the EC2 instance is running.
2018-02-15 21:14:58 -08:00
Walter Fender e18e8ec3c0 Add context to all relevant cloud APIs
This adds context to all the relevant cloud provider interface signatures.
Callers of those APIs are currently satisfied using context.TODO().
There will be follow on PRs to push the context through the stack.
For an idea of the full scope of this change please look at PR #58532.
2018-02-06 12:49:17 -08:00
Andrew Garrett 20a682b643 Tag Security Group created for AWS ELB with same additional tags as ELB
Reuse the
service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags
annotation for these tags.

We think that this is a simpler and less intrusive approach than adding
a new annotation, and most users will want the same set of tags applied.

Signed-off-by: Brett Kochendorfer <brett.kochendorfer@gmail.com>
2018-01-24 20:16:45 +00:00
dimitar 8cf7c5e34a allow ELB HC configuration via Service annotations
The constants which have been used so far have been set as default in
case the annotations have not been set.
2017-11-21 14:34:05 +00:00
georgebuckerfield 36d59704d9 Modify the AWS cloud provider to ensure additional load balancer tags are added to existing load balancers 2017-11-14 21:47:50 +00:00
Robert Rati aa8e14d4fe Moved fakes to a separate file usable by other tests 2017-09-22 13:30:05 -04:00
Kubernetes Submit Queue 9341f22bb6 Merge pull request #50112 from jlz27/multiple-ips
Automatic merge from submit-queue (batch tested with PRs 51301, 50497, 50112, 48184, 50993)

AWS: handle multiple IPs when using more than 1 network interface per ec2 instance

**What this PR does / why we need it**:
Adds support for kubelets running with the AWS cloud provider on ec2 instances with multiple network interfaces. If the active interface is not eth0, the AWS cloud provider currently reports the wrong node IP.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #44686

**Special notes for your reviewer**:
There is also some work necessary for handling multiple DNS names and such but I didn't fix them in this PR.

**Release note**:

```release-note
Fixed bug in AWS provider to handle multiple IPs when using more than 1 network interface per ec2 instance.
```
2017-09-02 23:50:03 -07:00
Jan Safranek 1ea7fa84fc AWS: check validity of KSM key before creating a new encrypted disk.
AWS CreateVolume call does not check if referenced encryption key actually
exists and returns a valid new AWS EBS volume even though an invalid key
was specified. Later on it removes the EBS silently when its encryption fails.

To work around this buggy behavior we manually check that the key exists
before calling CreateVolume.
2017-08-28 12:52:57 +02:00
Jason Zhao 35777b2997 run go fmt 2017-08-21 15:24:44 -07:00
Matt Landis 10794e7f6e Arbitrarily chose first (lexicographically) subnet in AZ on AWS.
When there is more than one subnet for an AZ on AWS choose arbitrarily
chose the first one lexicographically for consistency.
2017-08-07 07:41:47 -07:00
Jason Zhao 43e606a5da support multiple ec2 ips in aws provider 2017-08-03 15:57:59 -07:00
Kubernetes Submit Queue aaa5b2b642 Merge pull request #47575 from justinsb/fix_36902
Automatic merge from submit-queue (batch tested with PRs 47915, 47856, 44086, 47575, 47475)

AWS: Fix suspicious loop comparing permissions

Because we only ever call it with a single UserId/GroupId, this would
not have been a problem in practice, but this fixes the code.

Fix #36902 

```release-note
NONE
```
2017-06-23 04:06:25 -07:00
Chao Xu 60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
Kubernetes Submit Queue 1499b6bddc Merge pull request #45268 from redbaron/aws-elb-attach-sgs
Automatic merge from submit-queue

New annotation to add existing Security Groups to ELBs created by AWS cloudprovider

**What this PR does / why we need it**:
When K8S cluster is deployed in existing VPC there might be a need to attach extra SecurityGroups to ELB created by AWS cloudprovider. Example of it can be cases, where such Security Groups are maintained by another team.

**Special notes for your reviewer**:
For tests to pass depends on https://github.com/kubernetes/kubernetes/pull/45168  and therefore includes it

**Release note**:
```release-note
New 'service.beta.kubernetes.io/aws-load-balancer-extra-security-groups' Service annotation to specify extra Security Groups to be added to ELB created by AWS cloudprovider
```
2017-06-20 18:06:29 -07:00
Justin Santa Barbara 737607ba6b AWS: Fix suspicious loop comparing permissions
Because we only ever call it with a single UserId/GroupId, this would
not have been a problem in practice, but this fixes the code.

Fix #36902
2017-06-15 09:20:41 -04:00
Justin Santa Barbara 3d2b71b78f AWS: Maintain a cache of all instances for ELB
We maintain a cache of all instances, and we invalidate the cache
whenever we see a new instance.  For ELBs that should be sufficient,
because our usage is limited to instance ids and security groups, which
should not change.

Fix #45050
2017-06-14 23:39:18 -04:00
Kubernetes Submit Queue 8e4ec18adf Merge pull request #47516 from gnufied/fix-filter-limit-aws
Automatic merge from submit-queue (batch tested with PRs 47510, 47516, 47482, 47521, 47537)

Batch AWS getInstancesByNodeNames calls with FilterNodeLimit

We are going to limit the getInstancesByNodeNames call with a batch
size of 150.

Fixes - #47271

```release-note
AWS: Batch DescribeInstance calls with nodeNames to 150 limit, to stay within AWS filter limits.
```
2017-06-14 20:32:45 -07:00
Hemant Kumar ffa622f9c7 Batch AWS getInstancesByNodeNames calls with FilterNodeLimit
We are going to limit the getInstancesByNodeNames call with a batch
size of 150
2017-06-14 10:46:46 -04:00
Justin Santa Barbara 30ecfbc7ee aws: remove redundant tests 2017-06-13 01:19:23 -04:00
Maxim Ivanov 2e5773b45d New Service annotation to specify ELB SGs
Service objects can be annotated with
`service.beta.kubernetes.io/aws-load-balancer-extra-security-groups`

to specify existing security groups to be added to ELB
created by AWS cloudprovider
2017-06-09 12:10:33 +01:00
ublubu c261f98a60 bugfix for ProviderID parsing & corresponding unit test 2017-06-08 23:12:28 -04:00
deads2k 954eb3ceb9 move labels to components which own the APIs 2017-05-31 10:32:06 -04:00
Matthew Wong 319c608fdd Get instances of all states in DisksAreAttached, not just "running" 2017-05-25 17:08:30 -04:00
Luis Pabón 67d269749b aws: Support for ELB tagging by users
This PR provides support for tagging AWS ELBs using information in an
annotation and provided as a list of comma separated key-value pairs.

Closes https://github.com/kubernetes/community/pull/404
2017-05-19 16:34:50 -04:00
NickrenREN 7d00e5cfb6 remove deprecated NodeLegacyHostIP 2017-04-24 11:01:25 +08:00
Kubernetes Submit Queue c6d11c778f Merge pull request #41695 from justinsb/shared_tag
Automatic merge from submit-queue (batch tested with PRs 41921, 41695, 42139, 42090, 41949)

AWS: Support shared tag `kubernetes.io/cluster/<clusterid>`

We recognize an additional cluster tag:

kubernetes.io/cluster/<clusterid>

This now allows us to share resources, in particular subnets.

In addition, the value is used to track ownership/lifecycle.  When we
create objects, we record the value as "owned".

We also refactor out tags into its own file & class, as we are touching
most of these functions anyway.

```release-note
AWS: Support shared tag `kubernetes.io/cluster/<clusterid>`
```
2017-03-01 04:10:01 -08:00
Justin Santa Barbara 0b5ae5391e AWS: Support shared tag
We recognize an additional cluster tag:

kubernetes.io/cluster/<clusterid>

This now allows us to share resources, in particular subnets.

In addition, the value is used to track ownership/lifecycle.  When we
create objects, we record the value as "owned".

We also refactor out tags into its own file & class, as we are touching
most of these functions anyway.
2017-02-27 16:30:12 -05:00
Jordan Liggitt e4dc0a1da4
Populate internal/external DNS node addresses for AWS cloud provider 2017-02-01 23:10:32 -05:00
Justin Santa Barbara 04b787b946 AWS: trust region if found from AWS metadata
Means we can run in newly announced regions without a code change.

We don't register the ECR provider in new regions, so we will still need
a code change for now.

This also means we do trust config / instance metadata, and don't reject
incorrectly configured zones.

Fix #35014
2017-01-18 09:17:55 -05:00
Clayton Coleman 9a2a50cda7
refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Angus Lees 8a7e103191 providers: Remove long-deprecated Instances.List()
This method has been unused by k8s for some time, and yet is the last
piece of the cloud provider API that encourages provider names to be
human-friendly strings (this method applies a regex to instance names).

Actually removing this deprecated method is part of a long effort to
migrate from instance names to instance IDs in at least the OpenStack
provider plugin.
2016-12-10 22:36:12 +11:00
Kubernetes Submit Queue cffaf1b71b Merge pull request #31321 from anguslees/lb-nodes
Automatic merge from submit-queue (batch tested with PRs 37328, 38102, 37261, 31321, 38146)

Pass full Node objects to provider LoadBalancer methods
2016-12-05 20:16:53 -08:00
Clayton Coleman 3454a8d52c
refactor: update bazel, codec, and gofmt 2016-12-03 19:10:53 -05:00
Clayton Coleman 5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
Angus Lees 398c62d1ff aws: Update LB API hosts->nodes
Update EnsureLoadBalancer/UpdateLoadBalancer API to use node objects.
2016-12-01 09:53:54 +11:00
Chao Xu c962c2602a dependencies: pkg/cloudprovider 2016-11-23 15:53:09 -08:00
Justin Santa Barbara 3cdbfc98af AWS: strong-typing for k8s vs aws volume ids
We are more liberal in what we accept as a volume id in k8s, and indeed
we ourselves generate names that look like `aws://<zone>/<id>` for
dynamic volumes.

This volume id (hereafter a KubernetesVolumeID) cannot directly be
compared to an AWS volume ID (hereafter an awsVolumeID).

We introduce types for each, to prevent accidental comparison or
confusion.

Issue #35746
2016-11-02 09:42:55 -04:00
Justin Santa Barbara 54195d590f Use strongly-typed types.NodeName for a node name
We had another bug where we confused the hostname with the NodeName.

To avoid this happening again, and to make the code more
self-documenting, we use types.NodeName (a typedef alias for string)
whenever we are referring to the Node.Name.

A tedious but mechanical commit therefore, to change all uses of the
node name to use types.NodeName

Also clean up some of the (many) places where the NodeName is referred
to as a hostname (not true on AWS), or an instanceID (not true on GCE),
etc.
2016-09-27 10:47:31 -04:00
Kubernetes Submit Queue bfafb6f425 Merge pull request #30695 from krancour/manage-elb-attributes
Automatic merge from submit-queue

AWS: More ELB attributes via service annotations

Replaces #25015 and addresses all of @justinsb's feedback therein. This is a new PR because I was unable to reopen #25015 to amend it.

I noticed recently that there is existing (but undocumented) precedent for the AWS cloud provider to manage ELB-specifc load balancer configuration based on service annotations.  In particular, one can _already_ designate an ELB as "internal" or enable PROXY protocol.

This PR extends this capability to the management of ELB attributes, which includes the following items:
* Access logs:
    * Enabled / disabled
    * Emit interval
    * S3 bucket name
    * S3 bucket prefix
* Connection draining:
    * Enabled / disabled
    * Timeout
* Connection:
    * Idle timeout
* Cross-zone load balancing:
    * Enabled / disabled

Some of these are possibly more useful than others.  Use cases that immediately come to mind:

* Enabling cross-zone load balancing is potentially useful for "Ubernetes Light," or anyone otherwise attempting to spread worker nodes around multiple AZs.
* Increasing idle timeout is useful for the benefit of anyone dealing with long-running requests. An example I personally care about would be git pushes to Deis' builder component.
2016-08-22 10:24:12 -07:00
Kent Rancourt 96dad1f0f3 Add support for managing ELB attributes with service annotations 2016-08-16 13:07:49 -04:00
Sascha Hanse 9a111fffc8 enables the aws-load-balancer-backend-protocol annotion to be used without a cert to be able to create an HTTP->HTTP ELB 2016-08-13 02:30:35 +02:00
Cole Mickens 2ebffb431d implement azure cloudprovider 2016-07-26 14:50:33 -07:00
lixiaobing10051267 e3bff25dbb Modify err output format from %s to %v 2016-07-20 15:06:47 +08:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Rudi Chiarito 8db551f674 golint fixes for aws cloudprovider 2016-06-24 17:06:38 -04:00