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

make ovs socket file path as configurable property #142

Merged
merged 3 commits into from
Nov 27, 2020

Conversation

pperiyasamy
Copy link
Collaborator

The ovs-cni currently hardcodes the ovs unix socket file path to /var/run/openvswitch/db.sock.
But this would change across deployments. Hence introducing a global flat file configuration so that
socket_file path can be specified and this is applied for all network attachment definition objects.

Signed-off-by: Periyasamy Palanisamy periyasamy.palanisamy@est.tech

Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@est.tech>
@kubevirt-bot kubevirt-bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 18, 2020
@pperiyasamy
Copy link
Collaborator Author

/release-note-none

@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 18, 2020
Copy link
Member

@phoracek phoracek left a comment

Choose a reason for hiding this comment

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

I like what you did there. I just have a couple of comments with concerns for readability of the new function. Overall it looks good. Thanks.


Any options added to the `ovs.conf` are overridden by configuration options that are in the
CNI configuration (e.g. in a custom resource `NetworkAttachmentDefinition` used by Multus CNI
or in the first file ASCII-betically in the CNI configuration directory -- which is
Copy link
Member

Choose a reason for hiding this comment

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

"ASCII-betically"

:D

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

Oh, that was not a request for change, I just liked the way you name it :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok ;) actually this doc and implementation approach inspired from whereabouts cni!

Copy link
Member

Choose a reason for hiding this comment

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

Whereabouts rocks!

if os.IsNotExist(err) {
return false
}
return true
Copy link
Member

Choose a reason for hiding this comment

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

This happens if the path maybe exists, however, we are not able to stat it. Does it make sense to continue with the execution of CNI in this case? I would vote to either return the error or just panic right away.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, Correct! done.

@@ -109,9 +114,50 @@ func loadNetConf(bytes []byte) (*netConf, error) {
return nil, fmt.Errorf("failed to load netconf: %v", err)
}

// default config file dir paths
confdirs := []string{"/etc/kubernetes/cni/net.d/ovs.d/ovs.conf", "/etc/cni/net.d/ovs.d/ovs.conf"}
Copy link
Member

Choose a reason for hiding this comment

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

Could we make this a constant on the top of the file? For better visibility.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is a slice of string type, can't make it as a constant. just moved it into a method.

@@ -109,9 +114,50 @@ func loadNetConf(bytes []byte) (*netConf, error) {
return nil, fmt.Errorf("failed to load netconf: %v", err)
}

// default config file dir paths
Copy link
Member

Choose a reason for hiding this comment

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

I think this is redundant

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

break
}
}
// merge both netconf and flatnetConf configurations
Copy link
Member

Choose a reason for hiding this comment

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

Redundant

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -109,9 +114,50 @@ func loadNetConf(bytes []byte) (*netConf, error) {
return nil, fmt.Errorf("failed to load netconf: %v", err)
}

// default config file dir paths
Copy link
Member

Choose a reason for hiding this comment

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

Can we move this whole new block loading the file to a separate function? And then have one top level function which would merge loadNetConf and loadFlatNetConf? Would be easier to follow IMO.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good Point! done it now.

Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@est.tech>
@pperiyasamy
Copy link
Collaborator Author

/cc @JanScheurich

@kubevirt-bot
Copy link
Collaborator

@pperiyasamy: GitHub didn't allow me to request PR reviews from the following users: JanScheurich.

Note that only kubevirt members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @JanScheurich

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@phoracek phoracek left a comment

Choose a reason for hiding this comment

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

Just a nit. Other than that, I like the PR. I will give chance until the end of the week for Jan to comment.

@@ -112,6 +117,61 @@ func loadNetConf(bytes []byte) (*netConf, error) {
return netconf, nil
}

func loadFlatNetConf(configPath string) (*netConf, error) {
confDirs := getOvsConfDir()
Copy link
Member

Choose a reason for hiding this comment

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

These are not directories but files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, that makes sense. changed it.

Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@est.tech>
@phoracek
Copy link
Member

/lgtm
/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 27, 2020
@kubevirt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: phoracek, pperiyasamy

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 27, 2020
@kubevirt-bot kubevirt-bot merged commit 8bf4250 into k8snetworkplumbingwg:master Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants