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

Add new CNI Spec and Type to Installation #699

Merged
merged 1 commit into from
Jul 15, 2020

Conversation

tmjd
Copy link
Member

@tmjd tmjd commented Jul 14, 2020

Description

For PR author

  • Tests for change.
  • If changing pkg/apis/, run make gen-files
  • If changing versions, run make gen-versions

For PR reviewers

A note for code reviewers - all pull requests must have the following:

  • Milestone set according to targeted release.
  • Appropriate labels:
    • kind/bug if this is a bugfix.
    • kind/enhancement if this is a a new feature.
    • enterprise if this PR applies to Calico Enterprise only.

}

// If CalicoNetwork is specified, then use Calico networking.
if install.Spec.CalicoNetwork == nil {
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused, the comment says If CalicoNetwork is specified, but then the function checks if it's nil...

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure what I was thinking here. I'm removing that if and the associated code block.

Copy link
Member Author

Choose a reason for hiding this comment

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

I found why that was needed. Need to skip the rest of the processing if no CalicoNetwork exists.

Copy link
Member

Choose a reason for hiding this comment

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

Ok. One other concern I have about this function:

Based on the single switch case, it looks like we intend on this function growing as we add more CNI plugins. And it seems a bit fragile that developers need to know whether to add that logic before or after this nil check / return depending on the situation. The comment you've added does help, but worth considering if we can make this less fragile. Not sure what I'd suggest to accomplish that, so I'm fine merging as is and we can re-evaluate as those new cases appear.

Copy link
Member Author

Choose a reason for hiding this comment

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

I could switch the check to if install.Spec.CalicoNetwork != nil and then move all the remainder of the code into the code block.

PluginAzureVNET CNIPluginType = "AzureVNET"
)

var CNIPluginTypes []CNIPluginType = []CNIPluginType{
Copy link
Member

Choose a reason for hiding this comment

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

Is this used anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if it is. But perhaps I should use it to validate the PluginType.

@tmjd tmjd merged commit 35dfb53 into tigera:master Jul 15, 2020
@tmjd tmjd deleted the api-new-cni-options branch July 15, 2020 17:24
@tmjd tmjd added this to the v1.9.0 milestone Jul 16, 2020
@tmjd tmjd added the kind/enhancement New feature or request label Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants