Commit Graph

382 Commits (c2b771d5c46ca3b2f58f72595fe07a4e56a63762)

Author SHA1 Message Date
andrewsykim 4b0f2ab442 compile check to ensure cloud providers implement cloud interfaces 2018-11-30 10:33:34 -05:00
Davanum Srinivas 954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
Martin Vladev 3b0ddbf07e fix openstack provider to handle only Cinder volumes
When the cloud-controller-manager is running with PV label initializing controller
and NFS volume is created, it causes nill reference error.

related to #68996
2018-10-31 01:58:14 +02:00
andrewsykim 2908174517 pass in stopCh to cloud provider Initialize method for custom controllers 2018-10-19 17:51:58 -04:00
Walter Fender f3f46d5f5a Moving the cloudprovider interface to staging.
Individual implementations are not yet being moved.
Fixed all dependencies which call the interface.
Fixed golint exceptions to reflect the move.
Added project info as per @dims and
https://github.com/kubernetes/kubernetes-template-project.
Added dims to the security contacts.
Fixed minor issues.
Added missing template files.
Copied ControllerClientBuilder interface to cp.
This allows us to break the only dependency on K8s/K8s.
Added TODO to ControllerClientBuilder.
Fixed GoDeps.
Factored in feedback from JustinSB.
2018-10-04 14:41:20 -07:00
Eunsoo Park da5618e66b Fixup openstack cloud provider loadbalancer deletion error
This change enables ```getLoadBalancer``` to return the loadbalancer even if no floating ip is associated to the VIP port of the loadbalancer.

Signed-off-by: Eunsoo Park <esevan.park@gmail.com>
2018-09-03 16:25:11 +09:00
Kubernetes Submit Queue e41d9f1553
Merge pull request #67982 from zetaab/isshut
Automatic merge from submit-queue (batch tested with PRs 66577, 67948, 68001, 67982). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

implement InstanceShutdownByProviderID to openstack

**What this PR does / why we need it**: without this openstack cannot get shutdown taint when instance is shutdown (original pr where this feature was added https://github.com/kubernetes/kubernetes/pull/60009)

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Openstack supports now node shutdown taint. Taint is added when instance is shutdown in openstack.
```
2018-08-29 16:33:40 -07:00
Jesse Haka 66b0ac4f57 implement InstanceShutdownByProviderID
return error if instance does not exist

do not export instanceshutoff
2018-08-29 14:35:20 +03:00
Jesse Haka c4ff3d0593 remove : 2018-08-29 14:28:07 +03:00
Jesse Haka 7062cd5700 backport https://github.com/kubernetes/cloud-provider-openstack/pull/43 2018-08-29 14:22:53 +03:00
Kubernetes Submit Queue a431feb24e
Merge pull request #66322 from tanshanshan/fixunused
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>.

ignore unused variable

**What this PR does / why we need it**:
ignore unused variable 

unused err
162655f42f/pkg/cloudprovider/providers/openstack/openstack_routes_test.go (L89)

and
unused instanceId
162655f42f/pkg/cloudprovider/providers/photon/photon_test.go (L143)

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


**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-08-27 02:48:52 -07:00
FengyunPan2 641693ad05 Make OpenStack cloud provider report a node hostname address
Related to: #67714
Cloud-provider-reported addresses are authoritative in 1.12, this
preserves default behavior that used the internal dns name as
the "Hostname" address on Node status.
2018-08-23 13:20:47 +08:00
morrislaw df4f26ef39 Updated cloud providers with todo comment if using DefaultLoadBalancerName 2018-08-15 21:03:44 -04:00
Kubernetes Submit Queue dd4ab76f05
Merge pull request #66589 from MorrisLaw/get_load_balancer_name_per_provider
Automatic merge from submit-queue (batch tested with PRs 67061, 66589, 67121, 67149). 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>.

Get load balancer name per provider

**What this PR does / why we need it**:
GetLoadBalancerName() should be implemented per cloud provider as opposed to one neutral implementation.

This PR will address this by moving `cloudprovider.GetLoadBalancerName()` to the `LoadBalancer interface` and then provide an implementation for each cloud provider, while maintaining previously expected functionality.

**Which issue(s) this PR fixes**:
Fixes  [#43173](https://github.com/kubernetes/kubernetes/issues/43173)

**Special notes for your reviewer**:
This is a work in progress. Looking for feedback as I work on this, from any interested parties.

**Release note**:

```release-note
NONE
```
2018-08-08 16:32:07 -07:00
morrislaw 6ecec23690 Implement GetLoadBalancerName per provider and add DefaultLoadBalancerName. 2018-08-04 00:36:48 -04:00
Tardis Xu f2b0bb9073 Fix that fails to resize pvc of cinder volume. 2018-07-27 16:36:53 +08:00
Matthew Wong 093e231289 Avoid overflowing int64 in RoundUpSize and return error if overflow int 2018-07-23 13:48:45 -04:00
tanshanshan 3676a08690 clean unused variable 2018-07-18 14:39:36 +08:00
Kubernetes Submit Queue 82c986ecbc
Merge pull request #65978 from sngchlko/labeling-region-to-cinder-pv
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>.

Add region label to dynamic provisioned cinder PVs

**What this PR does / why we need it**:
This PR adds region label to dynamic provisioned Cinder PVs at the time of the PV creation.

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2018-07-11 05:28:02 -07:00
Seungcheol Ko 1df1181b4f Add region label to dynamic provisioned cinder PVs 2018-07-09 23:24:11 +09:00
Jesse Haka 955d2c2dc2 fix gofmt 2018-07-04 08:46:41 +03:00
Jesse Haka a78fc5926d if loadbalancer section is not defined in cloudconfig, do not initialize lb support
use reflect because structs with []string cannot be compared
2018-07-03 23:45:42 +03:00
Kubernetes Submit Queue 3d694993d0
Merge pull request #65373 from multi-io/openstack_lbaas_node_secgroup_fix
Automatic merge from submit-queue (batch tested with PRs 65449, 65373, 49410). 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>.

OpenStack LBaaS fix: must use ID, not name, of the node security group

This is a bugfix for the OpenStack LBaaS cloud provider security group management.

A bit of context: When creating a load balancer for a given `type: LoadBalancer` service, the provider will try to:

(see `pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go`/`EnsureLoadBalancer`)

1. create a load balancer (LB) in Openstack with listeners corresponding to the service's ports
2. attach a floating IP to the LB's network port

If `manage-security-groups` is enabled in controller-manager's cloud.conf:

3. create a security group with ingress rules corresponding to the LB's listeners, and attach it to the LB's network port
4. for all nodes of the cluster, pick an existing security group for the nodes ("node security group") and add ingress rules to it exposing the service's NodePorts to the security group created in step 3.

In the current upstream master, steps 1 through 3 work fine, step 4 fails, leading to a service that's not accessible via the LB without further manual intervention.

The bug is in the "pick an existing security group" operation (func `getNodeSecurityGroupIDForLB`), which, contrary to its name, will return the security group's name rather than its ID (actually it returns a list of names rather than IDs, apparently to cover some corner cases where you might have more than one node security group, but anyway). This will then be used when trying to add the ingress rules to the group, which the Openstack API will reject with a 404 (at least on our (fairly standard) Openstack Ocata installation) because we're giving it a name where it expects an ID.

The PR adds a "get ID given a name" lookup to the `getNodeSecurityGroupIDForLB` function, so it actually returns IDs. That's it. I'm not sure if the upstream code wasn't really tested, or maybe other people use other Openstacks with more lenient APIs. The bug and the fix is always reproducible on our installation.

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

Fixes #58145


**Special notes for your reviewer:**

Should we turn `getNodeSecurityGroupIDForLB` into a method with the lbaas as its receiver because it now requires two of the lbaas's attributes? I'm not sure what the conventions are here, if any. 

**Release note**:
```release-note
NONE
```
2018-06-26 02:52:06 -07:00
Olaf Klischat 8ed735d104 BUGFIX: must use ID, not name, of the node security group when adding rules to it 2018-06-25 21:44:59 +02:00
Jeff Grafton 23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Daniel Gonzalez 7b5f3a1dc5 Ensure that only IPs are used as node addresses in OpenStack LBs 2018-05-25 16:34:31 +02:00
Jordan Liggitt 6ab76041b7
Revert "Openstack: register metadata.hostname as node name"
This reverts commit eaac0f5489.
2018-05-15 22:49:21 -04:00
Jordan Liggitt 2f48ad3ff5
Revert "Split out the hostname when default dhcp_domain is used in nova.conf"
This reverts commit 9a8c6db448.
2018-05-15 22:47:02 -04:00
Jordan Liggitt ccc3eb2c31
Revert "Specify DHCP domain for hostname"
This reverts commit da5ccf7fb7.
2018-05-15 22:46:53 -04:00
Davanum Srinivas 2080de6adc log error for os.NewComputeV2
Since we are returning false, we are kind of losing the error message,
so we should at least log it.
2018-05-11 13:39:18 -04:00
Kubernetes Submit Queue 145f0aa5ed
Merge pull request #63091 from gonzolino/lb-member-name
Automatic merge from submit-queue (batch tested with PRs 63138, 63091, 63201, 63341). 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>.

Set names for OpenStack loadbalancer members and monitors

**What this PR does / why we need it**:
This PR sets names for OpenStack loadbalancer members and monitors.
ATM names for members and monitors are empty, making it difficult to identify where they belong.

Healthmonitors will be named `monitor_<lb_name>_<index>` and members
will be named `member_<lb_name>_<index>_<node_name>`.
This naming scheme should in sync with the naming of other LB resources, e.g. pools: `pool_<lb_name>_<index>`.

**Release note**:

```release-note
NONE
```
2018-05-01 16:00:12 -07:00
Kubernetes Submit Queue 7ffd171c29
Merge pull request #62729 from databus23/fix-os-route-deletion
Automatic merge from submit-queue (batch tested with PRs 59879, 62729). 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>.

Openstack: fix orphaned route deletion

This is a follow-up to #56258 which only got half of the work done.
The OpenStack cloud providers DeleteRoute method fails to delete routes when it can’t find the corresponding instance in OpenStack.

```release-note
OpenStack cloudprovider: Fix deletion of orphaned routes
```
2018-04-30 06:58:06 -07:00
Daniel Gonzalez e2ebc5f195 Set names for OpenStack loadbalancer members and monitors
Healthmonitors will be named 'monitor_<lb_name>_<index>' and members
will be named 'member_<lb_name>_<index>_<node_name>'.
2018-04-24 18:27:01 +02:00
Jesse Haka de967b717d PR #59323, fix bug and remove one api call, add node util dependency to cloud controller 2018-04-22 20:32:26 +03:00
Fabian Ruff 65d4147139 ensure we delete orphaned routes with matching next-hops only
There might be a valid route with the same DestinationCIDR pointing to a running node.
2018-04-18 13:19:58 +02:00
Fabian Ruff de15b859ba fix route deletion
This is a follow-up to #56258 which only half of the work done.
The DeleteRoute method failed to delete routes when it can’t find the corresponding node in OpenStack.
2018-04-17 15:34:06 +02:00
Kubernetes Submit Queue 27045d3fcd
Merge pull request #61082 from wenlxie/githubupstream.master.ignorevolumeerrorstatus
Automatic merge from submit-queue (batch tested with PRs 61549, 62230, 62055, 61082, 62212). 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>.

don't do attach and deatch when cinder volume status is error

When cinder volume status is `error`, it is not supposed to handle operation like `attach` and `detach`

@dims  @FengyunPan2

```release-note
cinder volume plugin : 
When the cinder volume status is `error`,  controller will not do `attach ` and `detach ` operation
```
2018-04-10 18:19:16 -07:00
Kubernetes Submit Queue 09ec7bf548
Merge pull request #60692 from adnavare/bug/60466
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>.

Cleanup the use of ExternalID as it is deprecated

The patch removes ExternalID usage from node_controller
and node_lifecycle_oontroller. The code instead uses InstanceID
which returns the cloud provider ID as well.

fixes #60466
2018-04-09 11:58:12 -07:00
FengyunPan2 6f700b1e6e Add subnet-id annotation for openstack cloud provider
Currently user only specify subnet-id in cloud.conf file.
If user want to specify other subnet for some special services,
the subnet-id annotation should be a good choice.
2018-04-04 19:13:48 +08:00
Anup Navare 1335e6e2d4 Cleanup the use of ExternalID as it is deprecated
The patch removes ExternalID usage from node_controller
and node_lifecycle_oontroller. The code instead uses InstanceID
which returns the cloud provider ID as well.
2018-04-02 10:15:32 -07:00
Davanum Srinivas da5ccf7fb7 Specify DHCP domain for hostname
In 9a8c6db448, we looked at the hostname
in the metadata service and used '.' as the delimiter to chop off the
dhcp_domain (specified in nova.conf). However administrators need to
better control the dhcp domain better as there may be a '.' in the host
name itself. So let's introduce a config option that we can use and
default it to what nova uses when dhcp_domain is not specified which is
"novalocal"
2018-03-29 21:31:02 -04:00
Davanum Srinivas 9a8c6db448 Split out the hostname when default dhcp_domain is used in nova.conf
When /etc/nova/nova.conf does not have specify dhcp_domain to empty
string, a default string of '.novalocal' is returned by the meta data
service. So we need to just split the string and pick the first one
in the array.

```
$ curl http://169.254.169.254/latest/meta-data/hostname
testvm-1.novalocal
$ curl http://169.254.169.254/latest/meta-data/public-hostname
testvm-1.novalocal
$ curl http://169.254.169.254/latest/meta-data/local-hostname
testvm-1.novalocal
```
2018-03-27 12:08:48 -04:00
Kubernetes Submit Queue d383ca1062
Merge pull request #60980 from n-marton/master
Automatic merge from submit-queue (batch tested with PRs 60980, 61273, 60811, 61021, 61367). 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>.

fix for openstack member cleanup for multiple port cases

**What this PR does / why we need it**:
Fixing an openstack lb issue.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes: #60976

**Special notes for your reviewer**:
The problem with the code was that if multiple ports were exposed then that created multiple members for each listener, and the deletion process iterated over each listener with an array of every member resulting listener - member mismatch, which caused not found exception from lbaasv2.

**Release note**:

```release-note

```
2018-03-22 02:08:12 -07:00
Kubernetes Submit Queue 33d480b599
Merge pull request #61366 from zetaab/fixnotfound
Automatic merge from submit-queue (batch tested with PRs 61354, 61366, 61386, 61394, 60755). 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>.

fix waitLoadbalancerDeleted timeout always

**What this PR does / why we need it**: waitLoadbalancerDeleted function goes always to timeout because not working check

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-03-21 23:44:10 -07:00
Kubernetes Submit Queue a29b047aa7
Merge pull request #61352 from dims/stabilize-openstack-test-when-running-against-real-openstack-cloud
Automatic merge from submit-queue (batch tested with PRs 60373, 61098, 61352, 61359, 61362). 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>.

Stabilize openstack_test when running against real cloud

**What this PR does / why we need it**:

in TestReadConfig, we are setting some env vars for testing if
we read them back properly. However this interferes with running
the unit test harness against a real openstack cloud where we
source the OS_* environment variables. Adding code here to save
and reset variables.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-03-21 22:39:15 -07:00
Kubernetes Submit Queue e3ac40264f
Merge pull request #61002 from FengyunPan2/fix-isNotFound
Automatic merge from submit-queue (batch tested with PRs 60898, 60912, 60753, 61002, 60796). 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>.

IsNotFound should check ErrDefault404 and ErrUnexpectedResponseCode

Related to: #60658 #60976
Refer to:
 https://github.com/gophercloud/gophercloud/pull/103/files#diff-e8ad71423a1527851f282515739eecc2R265

**Release note**:
```release-note
NONE
```
2018-03-20 17:37:17 -07:00
Kubernetes Submit Queue aeec2953d1
Merge pull request #59931 from zetaab/shutdoos
Automatic merge from submit-queue (batch tested with PRs 60189, 59542, 59931, 60621, 60353). 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>.

do not delete node in openstack, if those still exist in cloudprovider

**What this PR does / why we need it**: Deleting nodes in kubernetes cluster causes problems. It will lead to situations like labels and taints are missing from nodes when node will return online.

**Which issue(s) this PR fixes**:


**Special notes for your reviewer**:

```release-note
Nodes are not deleted from kubernetes anymore if node is shutdown in Openstack.
```
2018-03-20 00:42:12 -07:00
Jesse Haka 70c2baaff8 fix isnotfound
remove changes to isnotfound
2018-03-20 07:08:59 +02:00
Davanum Srinivas 97b4110d9f Stabilize openstack_test when running against real cloud
in TestReadConfig, we are setting some env vars for testing if
we read them back properly. However this interferes with running
the unit test harness against a real openstack cloud where we
source the OS_* environment variables. Adding code here to save
and reset variables.
2018-03-19 10:48:11 -04:00
wenlxie ecfe25d57d don't do attach and deatch when volume status is error 2018-03-13 13:42:23 +08:00