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

Validate if the openshift master is running with mutitenant network plugin #11880

Merged
merged 1 commit into from
Nov 21, 2016

Conversation

xiangpengzhao
Copy link
Contributor

@xiangpengzhao xiangpengzhao commented Nov 11, 2016

If the running network plugin is not OpenShift Multitenant Network Plugin (either redhat/openshift-ovs-subnet or third party plugin), users should not manage pod network.

cc @knobunc Thanks!

@ncdc
Copy link
Contributor

ncdc commented Nov 11, 2016

Did you mean to change the file's mode?

@xiangpengzhao
Copy link
Contributor Author

I changed the file's mode by mistake. Fixed. Andy, thanks for pointing it out! @ncdc

// TODO: Validate if the openshift master is running with mutitenant network plugin
clusterNetwork, err := p.Oclient.ClusterNetwork().Get(sdnapi.ClusterNetworkDefault)
if err != nil {
errList = append(errList, errors.New("could not manage pod network: error on getting the running network plugin"))

Choose a reason for hiding this comment

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

nit: 'could not manage pod network' is redundant, just throw the error msg something like 'Failed to fetch current network plugin info'

if err != nil {
errList = append(errList, errors.New("could not manage pod network: error on getting the running network plugin"))
} else if !sdnapi.IsOpenShiftMultitenantNetworkPlugin(clusterNetwork.PluginName) {
err := fmt.Errorf("could not manage pod network: the running plugin %s is not OpenShift mutitenant network plugin", clusterNetwork.PluginName)

Choose a reason for hiding this comment

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

'Using plugin: %q, managing pod network is only supported for openshift multitenant network plugin'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @pravisankar ! I will fix it as you suggested.

@@ -84,7 +84,14 @@ func (p *ProjectOptions) Validate() error {
errList = append(errList, errors.New("must provide --selector=<project_selector> or projects"))
}

// TODO: Validate if the openshift master is running with mutitenant network plugin

Choose a reason for hiding this comment

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

When we added this CLI functionality, there is no way to fetch network plugin info from the master. Now, ClusterNetwork resource holds the plugin name which enables this validation.
@xiangpengzhao Thanks for your contribution.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we expect this to be able to run against an old apiserver as well?

Copy link
Contributor Author

@xiangpengzhao xiangpengzhao Nov 14, 2016

Choose a reason for hiding this comment

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

Thanks for pointing it out! @liggitt .
If an old apiserver doesn't have Get ClusterNetwork API, the request will get a response with 404 code, then this CLI functionality surely will not work due to the validation. That's not what we expect. But we should not ignore this error in the validation to make the functionality run against the old apiserver, because we also get a 404 code if there is no ClusterNetwork "default" found in a new apiserver which has Get ClusterNetwork API. Is there a way to distinguish the two cases? If not, we may never has the chance to validate the plugin... Feel free to correct me if I'm wrong. Thanks!

Copy link
Contributor Author

@xiangpengzhao xiangpengzhao Nov 14, 2016

Choose a reason for hiding this comment

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

Another issue:
If an old apiserver supports Get ClusterNetwork API but not it's field PluginName, we also don't have a way to distinguish the two cases: a). the old apiserver; b) a new apiserver which supports PluginName but the master uses a third party network plugin. The apiserver will response an empty PluginName in both cases. :(
Should we store a fake clusternetwork info with only the plugin name when using a third party plugin?

Choose a reason for hiding this comment

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

If the user is not using openshift-sdn plugin then "default" cluster network resource won't be present and this validation will be incorrect. So if the error returned from Get(sdnapi.ClusterNetworkDefault) is kerrs.IsNotFound or if the plugin is not openshift multitenant, we should throw an error with message 'managing pod network is only supported for openshift multitenant network plugin'.

For the second issue, AFAIK we don't expect old api server to return ClusterNetwork resource without pluginName as we only allow incremental upgrades i.e. 3.2 to 3.3 and then 3.3 to 3.4 release (#11073 (comment)). PluginName field was added in 3.3 release, so this validation in 3.4 can expect valid plugin name if present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pravisankar Thanks for your comments! Addressed. PTAL.
cc @liggitt

Copy link

@pravisankar pravisankar left a comment

Choose a reason for hiding this comment

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

LGTM

@xiangpengzhao
Copy link
Contributor Author

Squashed. Thanks @pravisankar

Copy link
Contributor

@knobunc knobunc left a comment

Choose a reason for hiding this comment

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

The new version looks good to me too. I'll target this for 3.5 when we open up for development.

@knobunc
Copy link
Contributor

knobunc commented Nov 21, 2016

[merge]

@knobunc
Copy link
Contributor

knobunc commented Nov 21, 2016

Flake #11004 [merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to c80761f

@openshift-bot
Copy link
Contributor

openshift-bot commented Nov 21, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11618/) (Base Commit: ca3d987) (Image: devenv-rhel7_5396)

@openshift-bot openshift-bot merged commit 75aa09c into openshift:master Nov 21, 2016
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