Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Added import for all client-go auth plugins #991

Merged
merged 4 commits into from
Feb 4, 2019

Conversation

mpalumbo7
Copy link
Contributor

@mpalumbo7 mpalumbo7 commented Jan 25, 2019

Issue Ref: #990

Description

In the first commit, I made the changes necessary to support all auth plugins (especially Azure). It just required some small tweaks to an import and updating Gopkg.toml versions.

The second commit, I need some advice on. I don't know the pattern that is to be followed for /vendor packages. I just ran dep ensure and committed everything.

I tested this manually and am now able to connect to my Kubernetes cluster secured by Azure AD.

Testing

Original error:

$ kubeless get-server-config
FATA[0000] Can not get kubernetes client: No Auth Provider found for name "azure"

After making the change and compiling locally:

$ $GOPATH/bin/kubeless get-server-config
INFO[0000] Current Server Config:
INFO[0000] Supported Runtimes are: ballerina0.981.0, dotnetcore2.0, dotnetcore2.1, go1.10, java1.8, nodejs6, nodejs8, php7.2, python2.7, python3.4, python3.6, python3.7, ruby2.3, ruby2.4, ruby2.5, jvm1.8, nodejs_distroless8, nodejsCE8

TODOs:

  • Ready to review
  • Automated Tests
  • Docs

Gopkg.toml Outdated
@@ -54,23 +54,23 @@
version = "0.1.10"

[[constraint]]
branch = "master"
branch = "latestKubeless"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rest of the changes are fine but this should still be master to get updates for the different triggers. Can you post the error you receive here if you let this master? We should try to fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I just run a dep ensure and then make binary on the master branch without any modifications, I get the following:

$ make binary
CGO_ENABLED=0 ./script/binary
Removing Old Kubeless binaries
Build Kubeless Components binaries
# github.com/kubeless/kubeless/cmd/kubeless/trigger/http
cmd/kubeless/trigger/http/create.go:158:22: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/http-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/http/delete.go:46:22: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/http-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/http/list.go:46:22: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/http-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/http/update.go:51:22: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/http-trigger/pkg/utils".GetKubelessClientOutCluster
# github.com/kubeless/kubeless/cmd/kubeless/trigger/nats
cmd/kubeless/trigger/nats/create.go:76:22: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/nats-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/nats/delete.go:46:22: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/nats-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/nats/list.go:48:22: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/nats-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/nats/update.go:48:22: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/nats-trigger/pkg/utils".GetKubelessClientOutCluster
# github.com/kubeless/kubeless/cmd/kubeless/trigger/kafka
cmd/kubeless/trigger/kafka/create.go:100:23: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/kafka-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/kafka/delete.go:46:23: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/kafka-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/kafka/list.go:48:23: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/kafka-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/kafka/update.go:48:23: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/kafka-trigger/pkg/utils".GetKubelessClientOutCluster
# github.com/kubeless/kubeless/cmd/kubeless/trigger/kinesis
cmd/kubeless/trigger/kinesis/create.go:140:25: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/kinesis-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/kinesis/delete.go:46:25: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/kinesis-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/kinesis/list.go:48:25: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/kinesis-trigger/pkg/utils".GetKubelessClientOutCluster
cmd/kubeless/trigger/kinesis/update.go:51:25: undefined: "github.com/kubeless/kubeless/vendor/github.com/kubeless/kinesis-trigger/pkg/utils".GetKubelessClientOutCluster
Makefile:29: recipe for target 'binary' failed
make: *** [binary] Error 2

So there must be an issue with the *-trigger master branches. It looks like PR #871 is the cause.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, the problem is that that function is now only in the core of kubeless. It should be easy to fix as well, you need to go over those files and change the the package of the call:

- 		natsClient, err := natsUtils.GetKubelessClientOutCluster()
+		natsClient, err := kubelessUtils.GetKubelessClientOutCluster()

Usually kubelessUtils is already defined, if not it should be added as:

import (
	"github.com/sirupsen/logrus"
	"github.com/spf13/cobra"

+	kubelessUtils "github.com/kubeless/kubeless/pkg/utils"
	natsUtils "github.com/kubeless/nats-trigger/pkg/utils"
)

Copy link
Contributor Author

@mpalumbo7 mpalumbo7 Jan 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I replace kafkaUtils.GetKubelessClientOutCluster() for kubelessUtils.GetKubelessClientOutcluster() I get the following error:

# github.com/kubeless/kubeless/cmd/kubeless/trigger/kafka
cmd/kubeless/trigger/kafka/create.go:104:52: cannot use kafkaClient (type "github.com/kubeless/kubeless/pkg/client/clientset/versioned".Interface) as type "github.com/kubeless/kubeless/vendor/github.com/kubeless/kafka-trigger/pkg/client/clientset/versioned".Interface in argument to "github.com/kubeless/kubeless/vendor/github.com/kubeless/kafka-trigger/pkg/utils".CreateKafkaTriggerCustomResource:
        "github.com/kubeless/kubeless/pkg/client/clientset/versioned".Interface does not implement "github.com/kubeless/kubeless/vendor/github.com/kubeless/kafka-trigger/pkg/client/clientset/versioned".Interface (wrong type for Kubeless method)
                have Kubeless() "github.com/kubeless/kubeless/pkg/client/clientset/versioned/typed/kubeless/v1beta1".KubelessV1beta1Interface
                want Kubeless() "github.com/kubeless/kubeless/vendor/github.com/kubeless/kafka-trigger/pkg/client/clientset/versioned/typed/kubeless/v1beta1".KubelessV1beta1Interface

So, does this mean I need to fix the trigger repos before fixing this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my previous comment was wrong. Calls should indeed be natsUtils.GetKubelessClientOutCluster so you should not need to change any code. The problem is that the Gopkg.lock contains an old commit for those repositories. The only thing you need to do is delete the Gopkg.lock file and it will download the latest commit which will fix the issue you are seeing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That did the trick!

@mpalumbo7
Copy link
Contributor Author

After fixing the dependency issue with the triggers, I used the updated kubeless binary to walk through the https://kubeless.io/docs/quick-start/ and https://kubeless.io/docs/http-triggers/.

Everything is working.

Should we add a note to https://kubeless.io/docs/kubeless-on-AKS/ explaining that clusters which use the azure auth-provider need to use version > v1.0.1 of the kubeless CLI?

@andresmgot
Copy link
Contributor

Should we add a note to https://kubeless.io/docs/kubeless-on-AKS/ explaining that clusters which use the azure auth-provider need to use version > v1.0.1 of the kubeless CLI?

Yes, that note would be great.

Thanks for the changes! When you add that we can merge this PR.

Added a note about the addition of the Azure AD auth provider in CLI version > 1.0.1
@mpalumbo7
Copy link
Contributor Author

@andresmgot Added the note! Ready to merge.

@andresmgot andresmgot merged commit 8b433ef into vmware-archive:master Feb 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants