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

feat(dependencies): Update k8s dependencies to 19.3. Fixes #4425 #4426

Closed
Closed
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
2 changes: 1 addition & 1 deletion cmd/argo/commands/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ See %s`, help.ArgoSever),
}
}
}
server, err := apiserver.NewArgoServer(opts)
server, err := apiserver.NewArgoServer(ctx, opts)
errors.CheckError(err)
server.Run(ctx, port, browserOpenFunc)
},
Expand Down
15 changes: 8 additions & 7 deletions config/controller.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"context"
"fmt"
"strings"

Expand All @@ -18,8 +19,8 @@ import (
)

type Controller interface {
Run(stopCh <-chan struct{}, onChange func(config interface{}) error)
Get() (interface{}, error)
Run(ctx context.Context, stopCh <-chan struct{}, onChange func(config interface{}) error)
Get(ctx context.Context) (interface{}, error)
}

type controller struct {
Expand Down Expand Up @@ -73,7 +74,7 @@ func (cc *controller) parseConfigMap(cm *apiv1.ConfigMap) (interface{}, error) {
return config, err
}

func (cc *controller) Run(stopCh <-chan struct{}, onChange func(config interface{}) error) {
func (cc *controller) Run(ctx context.Context, stopCh <-chan struct{}, onChange func(config interface{}) error) {
restClient := cc.kubeclientset.CoreV1().RESTClient()
resource := "configmaps"
fieldSelector := fields.ParseSelectorOrDie(fmt.Sprintf("metadata.name=%s", cc.configMap))
Expand All @@ -83,7 +84,7 @@ func (cc *controller) Run(stopCh <-chan struct{}, onChange func(config interface
Namespace(cc.namespace).
Resource(resource).
VersionedParams(&options, metav1.ParameterCodec)
return req.Do().Get()
return req.Do(ctx).Get()
}
watchFunc := func(options metav1.ListOptions) (watch.Interface, error) {
options.Watch = true
Expand All @@ -92,7 +93,7 @@ func (cc *controller) Run(stopCh <-chan struct{}, onChange func(config interface
Namespace(cc.namespace).
Resource(resource).
VersionedParams(&options, metav1.ParameterCodec)
return req.Watch()
return req.Watch(ctx)
}
source := &cache.ListWatch{ListFunc: listFunc, WatchFunc: watchFunc}
_, controller := cache.NewInformer(
Expand All @@ -119,9 +120,9 @@ func (cc *controller) Run(stopCh <-chan struct{}, onChange func(config interface
log.Info("Watching config map updates")
}

func (cc *controller) Get() (interface{}, error) {
func (cc *controller) Get(ctx context.Context) (interface{}, error) {
cmClient := cc.kubeclientset.CoreV1().ConfigMaps(cc.namespace)
cm, err := cmClient.Get(cc.configMap, metav1.GetOptions{})
cm, err := cmClient.Get(ctx, cc.configMap, metav1.GetOptions{})
if err != nil && !apierr.IsNotFound(err) {
return cc.emptyConfigFunc(), err
}
Expand Down
4 changes: 3 additions & 1 deletion config/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package config

import (
"testing"
"context"

"github.com/stretchr/testify/assert"
apiv1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -45,8 +46,9 @@ func Test_parseConfigMap(t *testing.T) {

func Test_controller_Get(t *testing.T) {
kube := fake.NewSimpleClientset()
ctx := context.Background()
c := controller{configMap: "my-config-map", kubeclientset: kube, emptyConfigFunc: EmptyConfigFunc}
config, err := c.Get()
config, err := c.Get(ctx)
if assert.NoError(t, err) {
assert.Empty(t, config)
}
Expand Down
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/colinmarc/hdfs v1.1.4-0.20180805212432-9746310a4d31
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
github.com/evanphx/json-patch v4.5.0+incompatible
github.com/evanphx/json-patch v4.9.0+incompatible
github.com/fatih/structs v1.1.0 // indirect
github.com/gavv/httpexpect/v2 v2.0.3
github.com/go-openapi/jsonreference v0.19.3
Expand Down Expand Up @@ -55,8 +55,8 @@ require (
github.com/valyala/fasttemplate v1.1.0
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
golang.org/x/net v0.0.0-20200602114024-627f9648deb9
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/net v0.0.0-20200707034311-ab3426394381
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a
golang.org/x/tools v0.0.0-20200630154851-b2d8b0336632
Expand All @@ -69,12 +69,12 @@ require (
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
gopkg.in/square/go-jose.v2 v2.4.1
gopkg.in/src-d/go-git.v4 v4.13.1
k8s.io/api v0.17.8
k8s.io/apimachinery v0.17.8
k8s.io/client-go v0.17.8
k8s.io/code-generator v0.17.5
k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29
k8s.io/utils v0.0.0-20200327001022-6496210b90e8
k8s.io/api v0.19.3
k8s.io/apimachinery v0.19.3
k8s.io/client-go v0.19.3
k8s.io/code-generator v0.19.3
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6
k8s.io/utils v0.0.0-20201027101359-01387209bb0d
sigs.k8s.io/controller-tools v0.3.0
sigs.k8s.io/yaml v1.2.0
upper.io/db.v3 v3.6.3+incompatible
Expand Down
Loading