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
Bug 1880902: automatically set the dnsPolicy with ClusterFirstWithHostNet when endpoint publishing strategy type is set to hostnetwork #492
Conversation
We should add a unit test in |
5ea5f77
to
8a80513
Compare
@Miciah PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some small comments
@@ -38,6 +38,8 @@ func checkDeploymentHasEnvVar(t *testing.T, deployment *appsv1.Deployment, name | |||
actualValue string | |||
foundValue bool | |||
) | |||
//dnsPolicy := deployment.Spec.Template.Spec.DNSPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment necessary?
@@ -229,6 +231,10 @@ func TestDesiredRouterDeployment(t *testing.T) { | |||
t.Error("expected host network to be false") | |||
} | |||
|
|||
if deployment.Spec.Template.Spec.DNSPolicy != corev1.DNSClusterFirst { | |||
t.Errorf("expected dnsPolicy to be #{corev1.DNSClusterFirst}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make the new t.Errorf(...)
calls more verbose somehow.
ie:
t.Errorf("expected dnsPolicy to be #{corev1.DNSClusterFirst}") | |
t.Errorf("expected dnsPolicy to be %q, got %q", corev1.DNSClusterFirst, deployment.Spec.Template.Spec.DNSPolicy) |
@@ -901,6 +930,7 @@ func TestDeploymentConfigChanged(t *testing.T) { | |||
}, | |||
}, | |||
Spec: corev1.PodSpec{ | |||
DNSPolicy: corev1.DNSClusterFirstWithHostNet, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense to set the test deployment's DNSPolicy
to corev1.DNSClusterFirst
since that's the API defaulted value (and then mutate that value to corev1.DNSClusterFirstWithHostNet
in the new test cases)?
After the changes -> Unit tests are passing [miheer@miheer cluster-ingress-operator]$ GO111MODULE=on go test -v -run TestDesiredRouterDeployment ./pkg/operator/controller/ingress/ |
}, | ||
|
||
{ | ||
description: "if dnsPolicy is not changed", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the descriptions for the 2 test cases you added are inaccurate, I believe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes I will add them...just switched the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sgreene570 done
@@ -229,6 +229,10 @@ func TestDesiredRouterDeployment(t *testing.T) { | |||
t.Error("expected host network to be false") | |||
} | |||
|
|||
if deployment.Spec.Template.Spec.DNSPolicy != corev1.DNSClusterFirst { | |||
t.Errorf("expected dnsPolicy to be %q, got %q", corev1.DNSClusterFirst, deployment.Spec.Template.Spec.DNSPolicy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.Errorf("expected dnsPolicy to be %q, got %q", corev1.DNSClusterFirst, deployment.Spec.Template.Spec.DNSPolicy) | |
t.Errorf("expected dnsPolicy to be %s, got %s", corev1.DNSClusterFirst, deployment.Spec.Template.Spec.DNSPolicy) |
@@ -307,6 +311,9 @@ func TestDesiredRouterDeployment(t *testing.T) { | |||
if deployment.Spec.Template.Spec.HostNetwork != false { | |||
t.Error("expected host network to be false") | |||
} | |||
if deployment.Spec.Template.Spec.DNSPolicy != corev1.DNSClusterFirst { | |||
t.Errorf("expected dnsPolicy to be #{corev1.DNSClusterFirst}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.Errorf("expected dnsPolicy to be #{corev1.DNSClusterFirst}") | |
t.Errorf("expected dnsPolicy to be %s, got %s", corev1.DNSClusterFirst, deployment.Spec.Template.Spec.DNSPolicy) |
@@ -459,6 +466,11 @@ func TestDesiredRouterDeployment(t *testing.T) { | |||
if deployment.Spec.Template.Spec.HostNetwork != true { | |||
t.Error("expected host network to be true") | |||
} | |||
|
|||
if deployment.Spec.Template.Spec.DNSPolicy != corev1.DNSClusterFirstWithHostNet { | |||
t.Errorf("expected dnsPolicy to be #{corev1.DNSClusterFirstWithHostNet}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.Errorf("expected dnsPolicy to be #{corev1.DNSClusterFirstWithHostNet}") | |
t.Errorf("expected dnsPolicy to be %s, got %s", corev1.DNSClusterFirstWithHostNet, deployment.Spec.Template.Spec.DNSPolicy) |
@@ -875,6 +887,21 @@ func TestDeploymentConfigChanged(t *testing.T) { | |||
}, | |||
expect: true, | |||
}, | |||
{ | |||
description: "if dnsPolicy is not changed", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think this case is covered by the "if nothing changes" test.
t.Error("expected host network to be false") | ||
t.Errorf("expected dnsPolicy to be %s, got %s", corev1.DNSClusterFirst, deployment.Spec.Template.Spec.DNSPolicy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this change.
… network then we should automatically set the dnsPolicy with ClusterFirstWithHostNet.
/retitle Bug 1880902: automatically set the dnsPolicy with ClusterFirstWithHostNet when endpoint publishing strategy type is set to hostnetwork |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Miciah, miheer 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 |
@miheer: This pull request references Bugzilla bug 1880902, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
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. |
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest Please review the full test history for this PR and help us cut down flakes. |
@miheer: All pull requests linked via external trackers have merged: Bugzilla bug 1880902 has been moved to the MODIFIED state. In response to this:
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. |
Bug 1880902 - If the endpoint publishing strategy type is set to hostnetwork then
we should automatically set the dnsPolicy with ClusterFirstWithHostNet.