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

pick up a random port for metrics when MountPod using hostNetwork #586

Merged
merged 1 commit into from
Mar 1, 2023

Conversation

fungaren
Copy link
Contributor

@fungaren fungaren commented Feb 28, 2023

As the MountPod can inherit some attributes from juicefs-csi-node daemonset:

	// inherit attr from csi
	jfsSetting.Attr = PodAttr{
		Namespace:            Namespace,
		MountPointPath:       MountPointPath,
		JFSConfigPath:        JFSConfigPath,
		JFSMountPriorityName: JFSMountPriorityName,
		Image:                MountImage,
		HostNetwork:          CSIPod.Spec.HostNetwork,
		HostAliases:          CSIPod.Spec.HostAliases,
		HostPID:              CSIPod.Spec.HostPID,
		HostIPC:              CSIPod.Spec.HostIPC,
		DNSConfig:            CSIPod.Spec.DNSConfig,
		DNSPolicy:            CSIPod.Spec.DNSPolicy,
		ImagePullSecrets:     CSIPod.Spec.ImagePullSecrets,
		PreemptionPolicy:     CSIPod.Spec.PreemptionPolicy,
		Tolerations:          CSIPod.Spec.Tolerations,
	}

So if we make juicefs-csi-node to be hostNetwork: true, those MountPods will also be hostNetwork: true. What makes the problem is those metrics exported by juicefs mount if these MountPods listen at the same port.

kube-system   juicefs-e-node-s19inspur-36c7-pvc-36e2d025-c704-45e1-8784-43b63daa9092-sugiun   1/1     Running             0          9m13s   x.x.x.x   e-node-s19inspur-36c7    <none>           <none>
kube-system   juicefs-e-node-s19inspur-36c7-pvc-e2ee0faf-6642-4128-9917-f656b4d9aec1-tccate   0/1     NodePorts           0          12s     <none>           e-node-s19inspur-36c7    <none>           <none>
Status:               Failed
Reason:               NodePorts
Message:              Pod Predicate NodePorts failed

This PR makes these MountPods listen at a random port when they are in hostNetwork mode, and we also do not proclaim any container port.

@codecov-commenter
Copy link

Codecov Report

Base: 41.52% // Head: 41.44% // Decreases project coverage by -0.08% ⚠️

Coverage data is based on head (2cc6adb) compared to base (173a77d).
Patch coverage: 33.33% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #586      +/-   ##
==========================================
- Coverage   41.52%   41.44%   -0.08%     
==========================================
  Files          32       32              
  Lines        3374     3380       +6     
==========================================
  Hits         1401     1401              
- Misses       1851     1853       +2     
- Partials      122      126       +4     
Impacted Files Coverage Δ
pkg/juicefs/mount/builder/pod.go 55.88% <33.33%> (-2.58%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@zwwhdls zwwhdls requested review from zwwhdls and Hexilee March 1, 2023 05:29
Copy link
Contributor

@Hexilee Hexilee left a comment

Choose a reason for hiding this comment

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

LGTM

@zwwhdls zwwhdls merged commit a12af86 into juicedata:master Mar 1, 2023
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.

4 participants