Skip to content

should not create k8s client if config dir is provided#3779

Merged
istio-merge-robot merged 4 commits intoistio:masterfrom
GregHanson:fileadapter-bugfix
Feb 27, 2018
Merged

should not create k8s client if config dir is provided#3779
istio-merge-robot merged 4 commits intoistio:masterfrom
GregHanson:fileadapter-bugfix

Conversation

@GregHanson
Copy link
Copy Markdown
Member

@GregHanson GregHanson commented Feb 26, 2018

in response to istio-users question here: https://groups.google.com/forum/#!topic/istio-users/52SiQkkTq2A

pilot should not need to create a k8s client (and therefor provide a kubeconfig file) when the --configDir flag is provided. This is currently blocking the use of pilot's filewatcher adapter. The way we are currently checking for whether a k8s client needs to be created has a bug and needs to be corrected - this will be addressed in an additional PR

// initKubeClient creates the k8s client if running in an k8s environment.
func (s *Server) initKubeClient(args *PilotArgs) error {
needToCreateClient := false
// FIXME: in the case of multiple registries, we are currently only checking needToCreateClient for the last one
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

add a break anyplace you set needToCreateClient = true?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

break the for loop with a label, otherwise it just breaks the switch statement.

case EurekaRegistry:
needToCreateClient = true
}
case CloudFoundryRegistry:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if you have multiple registries, you want to create a client if ANY of the registries need it, so we shouldn't explicitly set needToCreateClient = false here

//valid registry, but does not need to create client
continue
default:
errs = multierror.Append(errs, fmt.Errorf("Service registry %s is not supported.", r))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove the errs and default case. Right now if you had k8s + Consul, it would fail because it won't accept ConsulRegistry.

needToCreateClient = true
case EurekaRegistry:
needToCreateClient = true
case CloudFoundryRegistry:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

delete this case

@costinm
Copy link
Copy Markdown
Contributor

costinm commented Feb 27, 2018

This doesn't seem to be a P0 or even P1 - we currently don't support file based config, it's mostly for testing.

@rshriram
Copy link
Copy Markdown
Member

We are trying to support it in Consul. And this bug is preventing it.. Either way, its a bug isn't it ?

@rshriram
Copy link
Copy Markdown
Member

/lgtm

@istio-merge-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rshriram

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@istio-merge-robot
Copy link
Copy Markdown

/test all [submit-queue is verifying that this PR is safe to merge]

@istio-merge-robot
Copy link
Copy Markdown

Automatic merge from submit-queue.

@istio-merge-robot istio-merge-robot merged commit 6d53121 into istio:master Feb 27, 2018
@GregHanson GregHanson deleted the fileadapter-bugfix branch February 28, 2018 15:13
PetrMc added a commit to PetrMc/istio-petrmc-upstream-fork that referenced this pull request Jan 14, 2026
Signed-off-by: Petr McAllister <petr.mcallister@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants