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

multus: allow using NADs without inspectable CIDRs #12778

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

BlaineEXE
Copy link
Member

@BlaineEXE BlaineEXE commented Aug 22, 2023

Description of your changes:

Change how Rook detects network CIDRs for Multus networks. The IPAM
configuration is only defined as an arbitrary string JSON blob with a
"type" field and nothing more. Rook's detection of CIDRs for whereabouts
had already grown out of date since the initial implementation.
Additionally, Rook did not support DHCP IPAM, which is a reasonable
choice for users. And more, Rook did not support CNI plugin chaining,
which further complicates NADs. Based on the CNI spec, network chaning
can result in any changes to network CIDRs from the first-given plugin.

All these problems make it more and more difficult for Rook to support
Multus by inspecting the NAD itself to predict network CIDRs. Instead,
it is better for Rook to treat the CNI process as a black box. To
preserve legacy functionality of auto-detecting networks and to make
that as robust as possible, change to a canary-style architecture like
that used for Ceph mons, from which Rook will detect the network CIDRs
if possible.

Also allow users to specify overrides for CIDR ranges. This allows Rook
to still support esoteric and unexpected NAD or network configurations
where a CIDR range is not detectable or where the range detected would
be incomplete. Because it may be impossible for Rook to understand the
network CIDRs wholistically while residing only on a portion of the
network, this feature should have been present from Multus's inception.

Improving CIDR auto-detection and allowing users to specify overrides
for auto-detected CIDRs rounds out Rook's Multus support for CephCluster
(core/RADOS) installations. No further architectural changes should be
needed for CephClusters as regards application of public/cluster network
CIDRs for Multus networks.

Signed-off-by: Blaine Gardner blaine.gardner@ibm.com

Which issue is resolved by this Pull Request:
Resolves #12459

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the developer guide.
  • Skip Tests for Docs: If this is only a documentation change, add the label skip-ci on the PR.
  • Reviewed the developer guide on Submitting a Pull Request
  • Pending release notes updated with breaking and/or notable changes for the next minor release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

@BlaineEXE BlaineEXE requested a review from travisn August 22, 2023 20:29
pkg/apis/ceph.rook.io/v1/types.go Show resolved Hide resolved
pkg/apis/ceph.rook.io/v1/network.go Show resolved Hide resolved
pkg/apis/ceph.rook.io/v1/types.go Outdated Show resolved Hide resolved
Comment on lines 30 to 33
network:
provider: "multus"
selectors:
public: public-net
Copy link
Member Author

Choose a reason for hiding this comment

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

Note to self: TODO: remove this

@BlaineEXE BlaineEXE force-pushed the multus-allow-cidr-spec branch 2 times, most recently from 8b8ee8e to d9e543e Compare September 1, 2023 18:54
@BlaineEXE BlaineEXE marked this pull request as ready for review September 1, 2023 18:56
@BlaineEXE BlaineEXE added the do-not-merge DO NOT MERGE :) label Sep 1, 2023
@BlaineEXE
Copy link
Member Author

This is ready for review, but I am adding do not merge label while I test this for DHCP networks. Results of this testing may inform some doc or minor code changes.

rookVersion: "myversion",
rookImage: "myversion",
Copy link
Member Author

Choose a reason for hiding this comment

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

These changes may not be technically necessary, but I wasted at least 5 hours adding the operator config to this struct and all of the code places where it is called by parents before I realized that rookVersion was being used to hold the rook image string. I'd rather this not happen to anyone else.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, I have been confused by this as well

Comment on lines +223 to +239
// This job is complex to overcome 2 specific limitations:
// - CNI/Multus' `k8s.v1.cni.cncf.io/network-status` annotation only reports IP addrs, not CIDRs
// - `ip addr show` in the pod shows CIDRs but also contains extra IPv6 SLAAC addrs in addition
// to the addr(s) attached by CNI/Multus
// Rook must cross-reference both pieces of info to accurately read the CIDR(s) for the net.
// Both pieces of info must come from the same Pod+Container in order to be cross-ref'd.
// Use downward API to allow the cmd reporter job to report both pieces of info at the same time
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 suggest reading this before reviewing.

Comment on lines 262 to 273
// TODO: do we need resource requests/requirements? it's just sleeping
// ... if needed, maybe logcollector, with small requirements would be a good option?
Copy link
Member Author

Choose a reason for hiding this comment

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

@travisn thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

Some environments are strict about requiring resource requests/limits on all pods, so we at least need an option. The requirements are going to be very low. I'd suggest we define a new category of resources for this in the cluster CR, though by default I'd say we don't need to set them.

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 removed this todo without resolving it in this PR. It looks like the cmd reporter doesn't set any resource requests/requirements at all, and it looks like DetectCephVersion() also doesn't set any resources. Can we instead take an item to handle resources for the cmd-reporter as a general work item? I think it'll bloat this more, and it seems like we don't have anyone with any big problems around this today.

Copy link
Member

Choose a reason for hiding this comment

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

Oh interesting, if the cmd reporter already doesn't set requests/requirements, then we can skip it for now.

@BlaineEXE BlaineEXE force-pushed the multus-allow-cidr-spec branch 5 times, most recently from 3220bee to 48176d5 Compare September 1, 2023 20:57
Copy link
Contributor

@subhamkrai subhamkrai left a comment

Choose a reason for hiding this comment

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

Some issue with crds, maybe try make crds again?

@BlaineEXE BlaineEXE force-pushed the multus-allow-cidr-spec branch 2 times, most recently from f05f38d to c898c3b Compare September 5, 2023 15:18
@travisn
Copy link
Member

travisn commented Sep 5, 2023

The multus cluster test is failing:

+ sed -i 's|#deviceFilter:|deviceFilter: sdb|g' cluster-multus-test.yaml
sed: can't read cluster-multus-test.yaml: No such file or directory
Error: Process completed with exit code 2.

Copy link
Member

@travisn travisn left a comment

Choose a reason for hiding this comment

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

Looks great overall, just some minor comments and questions.

Documentation/CRDs/Cluster/ceph-cluster-crd.md Outdated Show resolved Hide resolved
Comment on lines 262 to 273
// TODO: do we need resource requests/requirements? it's just sleeping
// ... if needed, maybe logcollector, with small requirements would be a good option?
Copy link
Member

Choose a reason for hiding this comment

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

Some environments are strict about requiring resource requests/limits on all pods, so we at least need an option. The requirements are going to be very low. I'd suggest we define a new category of resources for this in the cluster CR, though by default I'd say we don't need to set them.

}}}}}}
mnt := corev1.VolumeMount{
Name: "network-status",
MountPath: "/tmp",
Copy link
Member

Choose a reason for hiding this comment

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

nit: What about a path like this? Maybe I just think of /tmp as a scratch folder for someone connecting to the pod.

Suggested change
MountPath: "/tmp",
MountPath: "/var/lib/rook/multus",

@@ -1,49 +0,0 @@
#################################################################################################################
Copy link
Member

Choose a reason for hiding this comment

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

The only multus examples are in the docs now? What about updating this example to match the doc example?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was an accidental deletion. The file should be back now, but let me know if you see it disappear again. I have been having trouble getting it to stay put for some reason

pkg/apis/ceph.rook.io/v1/network.go Show resolved Hide resolved
pkg/apis/ceph.rook.io/v1/types.go Outdated Show resolved Hide resolved
// A list of CIDRs.
type CIDRList []CIDR

// ^ Note on kubebuilder:validation:Pattern above:
Copy link
Member

Choose a reason for hiding this comment

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

Can the note be placed next to the pattern above? It seems disconnected to be several lines below.

rookVersion: "myversion",
rookImage: "myversion",
Copy link
Member

Choose a reason for hiding this comment

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

Agreed, I have been confused by this as well

@BlaineEXE
Copy link
Member Author

Working to address feedback now, but I was able to confirm that the new auto-detection method is successfully able to get a valid CIDR when the DHCP IPAM is used. 🎉
I am not sure how to set this up in CI. I borrowed someone's home kube lab for the day to validate that.

Copy link
Contributor

@subhamkrai subhamkrai left a comment

Choose a reason for hiding this comment

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

@BlaineEXE multus ci is failing because

pod/rook-ceph-network-cluster-canary-mgsqm          0/1     Init:1/2   0          6m18s   10.244.246.151   fv-az1031-835   <none>           <none>
pod/rook-ceph-network-public-canary-vk4nr           0/1     Init:1/2   0          6m18s   10.244.246.150   fv-az1031-835   <none>           <none>
 status:
    conditions:
    - lastProbeTime: null
      lastTransitionTime: "2023-09-06T00:15:59Z"
      message: 'containers with incomplete status: [wait-for-network-status-annotation]'
      reason: ContainersNotInitialized
      status: "False"
      type: Initialized

@BlaineEXE BlaineEXE force-pushed the multus-allow-cidr-spec branch 2 times, most recently from 5d4a322 to 0ba1578 Compare September 6, 2023 16:30
Copy link
Member

@travisn travisn left a comment

Choose a reason for hiding this comment

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

The CI is looking good, just reran a few tests to confirm they're intermittent. Good to see the multus test passing. I'm ready to approve assuming manual testing is completed.

@@ -363,12 +363,17 @@ ceph osd primary-affinity osd.0 0

## OSD Dedicated Network

!!! outdated
Copy link
Member

Choose a reason for hiding this comment

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

outdated is one of the rendered keywords? I'm not even sure where the list is defined.

Copy link
Member Author

@BlaineEXE BlaineEXE Sep 7, 2023

Choose a reason for hiding this comment

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

Good point. It looks like these are the ones we can use: https://squidfunk.github.io/mkdocs-material/reference/admonitions/

I think info, tip (more catching icon than info), or warning could be good choices.

Copy link
Contributor

@subhamkrai subhamkrai left a comment

Choose a reason for hiding this comment

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

I'm putting LGTM, I had a few questions that have been addressed. Thanks

Change how Rook detects network CIDRs for Multus networks. The IPAM
configuration is only defined as an arbitrary string JSON blob with a
"type" field and nothing more. Rook's detection of CIDRs for whereabouts
had already grown out of date since the initial implementation.
Additionally, Rook did not support DHCP IPAM, which is a reasonable
choice for users. And more, Rook did not support CNI plugin chaining,
which further complicates NADs. Based on the CNI spec, network chaning
can result in any changes to network CIDRs from the first-given plugin.

All these problems make it more and more difficult for Rook to support
Multus by inspecting the NAD itself to predict network CIDRs. Instead,
it is better for Rook to treat the CNI process as a black box. To
preserve legacy functionality of auto-detecting networks and to make
that as robust as possible, change to a canary-style architecture like
that used for Ceph mons, from which Rook will detect the network CIDRs
if possible.

Also allow users to specify overrides for CIDR ranges. This allows Rook
to still support esoteric and unexpected NAD or network configurations
where a CIDR range is not detectable or where the range detected would
be incomplete. Because it may be impossible for Rook to understand the
network CIDRs wholistically while residing only on a portion of the
network, this feature should have been present from Multus's inception.

Improving CIDR auto-detection and allowing users to specify overrides
for auto-detected CIDRs rounds out Rook's Multus support for CephCluster
(core/RADOS) installations. No further architectural changes should be
needed for CephClusters as regards application of public/cluster network
CIDRs for Multus networks.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
@BlaineEXE BlaineEXE added backport-release-1.12 and removed do-not-merge DO NOT MERGE :) labels Sep 7, 2023
@BlaineEXE BlaineEXE merged commit 17f0072 into rook:master Sep 7, 2023
48 of 50 checks passed
@BlaineEXE BlaineEXE deleted the multus-allow-cidr-spec branch September 7, 2023 19:57
BlaineEXE added a commit that referenced this pull request Sep 7, 2023
multus: allow using NADs without inspectable CIDRs (backport #12778)
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.

multus NADs do not support multiple plugins or arbitrary network types
3 participants