Skip to content

Commit

Permalink
Merge pull request kubernetes#14368 from clarketm/remove-k8s-client-u…
Browse files Browse the repository at this point in the history
…ploader

Remove old k8s client from "artifact-uploader"
  • Loading branch information
k8s-ci-robot authored Sep 18, 2019
2 parents 8d88940 + e641ebd commit 7672de0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions prow/artifact-uploader/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ go_library(
importpath = "k8s.io/test-infra/prow/artifact-uploader",
visibility = ["//visibility:public"],
deps = [
"//prow/client/clientset/versioned/typed/prowjobs/v1:go_default_library",
"//prow/gcsupload:go_default_library",
"//prow/kube:go_default_library",
"//prow/pod-utils/downwardapi:go_default_library",
Expand Down
8 changes: 4 additions & 4 deletions prow/artifact-uploader/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
core "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"

prowv1 "k8s.io/test-infra/prow/client/clientset/versioned/typed/prowjobs/v1"
"k8s.io/test-infra/prow/gcsupload"
"k8s.io/test-infra/prow/kube"
"k8s.io/test-infra/prow/pod-utils/downwardapi"
Expand All @@ -53,7 +53,7 @@ type item struct {
prowJobId string
}

func NewController(client core.CoreV1Interface, prowJobClient *kube.Client, gcsConfig *gcsupload.Options) Controller {
func NewController(client core.CoreV1Interface, prowJobClient prowv1.ProwJobInterface, gcsConfig *gcsupload.Options) Controller {
queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter())
optionsModifier := func(options *metav1.ListOptions) {
req, _ := labels.NewRequirement(kube.ProwJobIDLabel, selection.Exists, []string{})
Expand Down Expand Up @@ -116,7 +116,7 @@ type Controller struct {
informer cache.Controller

client core.CoreV1Interface
prowJobClient *kube.Client
prowJobClient prowv1.ProwJobInterface

gcsConfig *gcsupload.Options
}
Expand Down Expand Up @@ -153,7 +153,7 @@ func (c *Controller) processNextItem() bool {

workItem := key.(item)

prowJob, err := c.prowJobClient.GetProwJob(workItem.prowJobId)
prowJob, err := c.prowJobClient.Get(workItem.prowJobId, metav1.GetOptions{})
if err != nil {
c.handleErr(err, workItem)
return true
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/artifact-uploader/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ go_library(
visibility = ["//visibility:private"],
deps = [
"//prow/artifact-uploader:go_default_library",
"//prow/client/clientset/versioned:go_default_library",
"//prow/gcsupload:go_default_library",
"//prow/kube:go_default_library",
"//prow/logrusutil:go_default_library",
"//prow/pod-utils/options:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
Expand Down
6 changes: 3 additions & 3 deletions prow/cmd/artifact-uploader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (
"k8s.io/client-go/tools/clientcmd"

artifact_uploader "k8s.io/test-infra/prow/artifact-uploader"
prow "k8s.io/test-infra/prow/client/clientset/versioned"
"k8s.io/test-infra/prow/gcsupload"
"k8s.io/test-infra/prow/kube"
"k8s.io/test-infra/prow/logrusutil"
"k8s.io/test-infra/prow/pod-utils/options"
)
Expand Down Expand Up @@ -135,12 +135,12 @@ func (o *Options) Run() error {
return err
}

prowJobClient, err := kube.NewClientInCluster(o.ProwJobNamespace)
prowJobClient, err := prow.NewForConfig(clusterConfig)
if err != nil {
return err
}

controller := artifact_uploader.NewController(client.CoreV1(), prowJobClient, o.Options)
controller := artifact_uploader.NewController(client.CoreV1(), prowJobClient.ProwV1().ProwJobs(o.ProwJobNamespace), o.Options)

stop := make(chan struct{})
defer close(stop)
Expand Down

0 comments on commit 7672de0

Please sign in to comment.