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

[Windows] Create a common CNI interface and config struct #5276

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

manuelbuil
Copy link
Contributor

@manuelbuil manuelbuil commented Jan 15, 2024

Proposed Changes

As rke2-windows will have two CNI plugin options: calico and flannel, we should abstract the current code so that it gets easier and cleaner to include flannel. This PR tries to achieve that.

Changes:

  • CniPlugin interface which "win.Calico" struct honors
  • CNICommonConfig struct with properties that are shared across CNIplugins and can be important to configure Kubernetes components (e.g. Kube-proxy)
  • PEBinary struct now uses CniPlugin interface instead of "win.Calico"
  • Kube-proxy function in pebinary has stuff related to CNI plugins. Move that to the calico.go
  • A few name changes, which I think are clearer, e.g. CNI ==> CNIName, getCniType ==> getCniPluginName

This is part of the Flannel PR I am preparing but that PR is getting too large, hence I decided to split it into a couple of PRs to simplify reviewing and reduce the risk of introducing bugs

Types of Changes

New Feature

Verification

This is basically a refactoring of code. It does not introduce any new feature. Therefore, what would be great is a verification that rke2-windows-calico is still working and no regression was introduced by this PR

Testing

Linked Issues

#5275
#5215

User-Facing Change


Further Comments

@manuelbuil manuelbuil requested a review from a team as a code owner January 15, 2024 14:31
@@ -60,11 +60,11 @@ users:
calicoConfigTemplate = template.Must(template.New("CalicoConfig").Funcs(replaceSlashWin).Parse(`{
"name": "{{ .Name }}",
"windows_use_single_network": true,
"cniVersion": "{{ .CNI.Version }}",
"cniVersion": "0.3.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

is it necessary to hard-code the CNI version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it is not. I don't know why I thought it was a good idea :). Let me add it as part of the config

@manuelbuil manuelbuil force-pushed the createCNIInterface branch 3 times, most recently from d3df342 to c6fee0e Compare January 18, 2024 12:15
@manuelbuil manuelbuil force-pushed the createCNIInterface branch 2 times, most recently from f827656 to 9d4ea8f Compare January 23, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants