This repository was archived by the owner on Dec 15, 2021. It is now read-only.
Disable runtime check if has no permissions to do so#992
Merged
andresmgot merged 3 commits intovmware-archive:masterfrom Jan 31, 2019
Merged
Disable runtime check if has no permissions to do so#992andresmgot merged 3 commits intovmware-archive:masterfrom
andresmgot merged 3 commits intovmware-archive:masterfrom
Conversation
andresmgot
approved these changes
Jan 28, 2019
Contributor
andresmgot
left a comment
There was a problem hiding this comment.
Thanks for the PR @dimm0! I have a small suggestion to make the code a bit safer for others to extend.
cmd/kubeless/function/deploy.go
Outdated
| if runtime != "" && !lr.IsValidRuntime(runtime) { | ||
| logrus.Fatalf("Invalid runtime: %s. Supported runtimes are: %s", | ||
| runtime, strings.Join(lr.GetRuntimes(), ", ")) | ||
| if checkRuntime { |
Contributor
There was a problem hiding this comment.
this is fine but since config is initialized way above some other function may try to use that variable that may be nil. To make a bit more clear that the config is only used for the runtime check I would move the initialization here:
apiExtensionsClientset := kubelessUtils.GetAPIExtensionsClientOutOfCluster()
config, err := kubelessUtils.GetKubelessConfig(cli, apiExtensionsClientset)
if config != nil {
lr := langruntime.New(config)
lr.ReadConfigMap()
if runtime ...
} else {
logrus.Warnf("%v. Runtime check is disabled.", err)
}
Contributor
Author
There was a problem hiding this comment.
@andresmgot Thanks, please look at my changes
andresmgot
approved these changes
Jan 31, 2019
Contributor
andresmgot
left a comment
There was a problem hiding this comment.
Great, thank you for the changes!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Ref: [Issue number related to this PR or None]
#989
Description:
In RBAC-restricted cluster user might have no permissions to see cluster-scoped things
[PR Description]
I was not sure whether you still want to leave the warning and do that check.
TODOs: