Skip to content

Commit

Permalink
Merge pull request #164 from elmiko/openshift-rebase-1.19.0
Browse files Browse the repository at this point in the history
Rebase 1.19.0
  • Loading branch information
openshift-merge-robot committed Aug 7, 2020
2 parents c777093 + 88e10aa commit 76b6b5d
Show file tree
Hide file tree
Showing 9,763 changed files with 534,554 additions and 1,297,139 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -6,7 +6,7 @@ services:
language: go

go:
- 1.13.5
- 1.14.x

before_install:
- sudo apt-get install libseccomp-dev -qq
Expand Down
4 changes: 2 additions & 2 deletions addon-resizer/Makefile
Expand Up @@ -48,7 +48,7 @@ container: .container-$(ARCH)
cp -r * $(TEMP_DIR)
cd $(TEMP_DIR) && sed -i 's|BASEIMAGE|$(BASEIMAGE)|g' Dockerfile

docker run --rm -it -v $(TEMP_DIR):$(TEMP_DIR):Z -v `pwd`:/go/src/k8s.io/autoscaler/addon-resizer/:Z \
docker run --rm -v $(TEMP_DIR):$(TEMP_DIR):Z -v `pwd`:/go/src/k8s.io/autoscaler/addon-resizer/:Z \
golang:${GOLANG_VERSION} \
/bin/bash -c "\
go get github.com/tools/godep && \
Expand All @@ -63,7 +63,7 @@ ifeq ($(ARCH), amd64)
endif

test:
docker run --rm -it -v `pwd`:/go/src/k8s.io/autoscaler/addon-resizer/:Z \
docker run --rm -v `pwd`:/go/src/k8s.io/autoscaler/addon-resizer/:Z \
golang:${GOLANG_VERSION} \
/bin/bash -c "\
go get github.com/tools/godep && \
Expand Down
2 changes: 1 addition & 1 deletion builder/Dockerfile
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.13.5
FROM golang:1.14
LABEL maintainer="Marcin Wielgus <mwielgus@google.com>"

ENV GOPATH /gopath/
Expand Down
46 changes: 43 additions & 3 deletions cluster-autoscaler/FAQ.md
Expand Up @@ -326,7 +326,7 @@ number of replicas when cluster grows and decrease the number of replicas if clu

Configuration of dynamic overprovisioning:

1. (For 1.10, and below) Enable priority preemption in your cluster.
1. (For 1.10, and below) Enable priority preemption in your cluster.

For GCE, it can be done by exporting following env
variables before executing kube-up (more details [here](https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/)):
Expand Down Expand Up @@ -677,7 +677,7 @@ The following startup parameters are supported for cluster autoscaler:
| `leader-elect-retry-period` | The duration the clients should wait between attempting acquisition and renewal of a leadership.<br>This is only applicable if leader election is enabled | 2 seconds
| `leader-elect-resource-lock` | The type of resource object that is used for locking during leader election.<br>Supported options are `endpoints` (default) and `configmaps` | "endpoints"
| `aws-use-static-instance-list` | Should CA fetch instance types in runtime or use a static list. AWS only | false
| `skip-nodes-with-system-pods` | If true cluster autoscaler will never delete nodes with pods from kube-system (except for DaemonSet or mirror pods | true
| `skip-nodes-with-system-pods` | If true cluster autoscaler will never delete nodes with pods from kube-system (except for DaemonSet or mirror pods) | true
| `skip-nodes-with-local-storage`| If true cluster autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir or HostPath | true
| `min-replica-count` | Minimum number or replicas that a replica set or replication controller should have to allow their pods deletion in scale down | 0

Expand Down Expand Up @@ -912,4 +912,44 @@ We are aware that this process is tedious and we will work to improve it.

### How can I update CA dependencies (particularly k8s.io/kubernetes)?

TODO - update needed after k8s migrated to go modules
Cluster Autoscaler imports a huge chunk of internal k8s code as it calls out to scheduler implementation.
Therefore we want to keep set of libraries used in CA as close to one used by k8s, to avoid
unexpected problems coming from version incompatibilities.

Cluster Autoscaler depends on `go modules` mechanism for dependency management, but do not use it directly
during build process. `go.mod` file is just used to generate the `vendor` directory and further compilation
is run against set of libraries stored in `vendor`. `vendor` directory can be regenerated using [`update-vendor.sh`](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/hack/update-vendor.sh) script.
The `update-vendor.sh` script is responsible for autogenerating `go.mod` file used by Cluster Autoscaler. The base
of the file is `go.mod` file coming from [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) repository.
On top of that script adds modifications as defined
locally in [`go.mod-extra`](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/go.mod-extra) file.

Note: It is important that one should **never manually edit** `go.mod` file as it is regenerated
on each `update-vendor.sh` call. Any extra libraries or version overrides should be put in `go.mod-extra` file (syntax of the file
is same as syntax of `go.mod` file).

Finally `vendor` directry is materialized and validation tests are run.

If everything completes correctly a commit with updated `vendor` directory is created automatically. The pull-request with changed vendor
must be sent out manually. The PR should include the auto-generated commit as well as commits containing any manual changes/fixes that need to
go together.

Execution of `update-vendor.sh` can be parametrized using command line argumets:
- `-f` - kubernetes/kubernetes fork to use. On `master` it defaults to `git@github.com:kubernetes/kubernetes.git`
- `-r` - revision in kubernetes/kubernetes which should be used to get base `go.mod` file
- `-d` - specifies script workdir; useful to speed up execution if script needs to be run multiple times, because updating vendor resulted in some compilation errors on Cluster-Autoscaler side which need to be fixed
- `-o` - overrides go version check, which may be useful if CA needs to use a different go version than the one in kubernetes go.mod file

Example execution looks like this:
```
./hack/update-vendor.sh -d/tmp/ca-update-vendor.ou1l -fgit@github.com:kubernetes/kubernetes.git -rmaster
```

Caveats:
- `update-vendor.sh` is called directly in shell (no docker is used) therefore its operation may differ from environment to environment.
- It is important that go version, which isn in use in the shell in which `update-vendor.sh` is called, matches the `go <version>` directive specified in `go.mod` file
in `kubernetes/kubernetes` revision against which revendoring is done.
- `update-vendor.sh` automatically runs unit tests as part of verification process. If one needs to suppress that, it can be done by overriding `VERIFY_COMMAND` variable (`VERIFY_COMMAND=true ./hack/update-vendor.sh ...`)
- If one wants to only add new libraries to `go.mod-extra`, but not change the base `go.mod`, `-r` should be used with kubernetes/kubernets revision, which was used last time `update-vendor.sh` was called. One can determine that revision by looking at `git log` in Cluster Autoscaler repository. Following command will do the trick `git log | grep "Updating vendor against"`.


Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/alicloud/alibaba-cloud-sdk-go/sdk/requests"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/alicloud/alibaba-cloud-sdk-go/services/ess"
"k8s.io/klog"
klog "k8s.io/klog/v2"
"time"
)

Expand Down
Expand Up @@ -21,8 +21,8 @@ import (

apiv1 "k8s.io/api/core/v1"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/klog"
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
klog "k8s.io/klog/v2"
schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
)

// Asg implements NodeGroup interface.
Expand Down Expand Up @@ -173,7 +173,7 @@ func (asg *Asg) Nodes() ([]cloudprovider.Instance, error) {
}

// TemplateNodeInfo returns a node template for this node group.
func (asg *Asg) TemplateNodeInfo() (*schedulernodeinfo.NodeInfo, error) {
func (asg *Asg) TemplateNodeInfo() (*schedulerframework.NodeInfo, error) {
template, err := asg.manager.getAsgTemplate(asg.id)
if err != nil {
return nil, err
Expand All @@ -185,7 +185,7 @@ func (asg *Asg) TemplateNodeInfo() (*schedulernodeinfo.NodeInfo, error) {
return nil, err
}

nodeInfo := schedulernodeinfo.NewNodeInfo(cloudprovider.BuildKubeProxy(asg.id))
nodeInfo := schedulerframework.NewNodeInfo(cloudprovider.BuildKubeProxy(asg.id))
nodeInfo.SetNode(node)
return nodeInfo, nil
}
Expand Down
Expand Up @@ -21,7 +21,7 @@ import (
"time"

"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/klog"
klog "k8s.io/klog/v2"
)

type autoScalingGroups struct {
Expand Down
Expand Up @@ -18,7 +18,7 @@ package alicloud

import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/alicloud/metadata"
"k8s.io/klog"
klog "k8s.io/klog/v2"
"os"
)

Expand Down
Expand Up @@ -27,7 +27,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/autoscaler/cluster-autoscaler/config/dynamic"
"k8s.io/autoscaler/cluster-autoscaler/utils/errors"
"k8s.io/klog"
klog "k8s.io/klog/v2"
)

const (
Expand Down
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/alicloud/alibaba-cloud-sdk-go/services/ecs"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/alicloud/alibaba-cloud-sdk-go/services/ess"
"k8s.io/klog"
klog "k8s.io/klog/v2"
"time"
)

Expand Down
Expand Up @@ -26,7 +26,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/alicloud/alibaba-cloud-sdk-go/services/ess"
"k8s.io/klog"
klog "k8s.io/klog/v2"
kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis"
"math/rand"
"time"
Expand Down

0 comments on commit 76b6b5d

Please sign in to comment.