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

[1.6] StatefulSet: Set Pod hostname/subdomain fields. #50942

Merged

Conversation

enisoc
Copy link
Member

@enisoc enisoc commented Aug 18, 2017

This is a partial, manual cherrypick of #44137 to provide a path to mitigate #48327.

To prepare for upgrading to 1.7+ in which the hostname/subdomain annotations are removed, we should have started setting the corresponding fields in a prior version. Pods that are freshly created by StatefulSet after updating to v1.6.9 will continue to function after upgrading to Kubernetes v1.7.x.

StatefulSet: Set hostname/subdomain fields on new Pods in addition to the deprecated annotations, to allow mitigation of Pod DNS issues upon upgrading to Kubernetes v1.7.x.

To prepare for upgrading to 1.7+ in which the hostname/subdomain
annotations are removed, we should have started setting the
corresponding fields in a prior version.
@enisoc enisoc added cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. kind/bug Categorizes issue or PR as related to a bug. sig/apps Categorizes an issue or PR as relevant to SIG Apps. labels Aug 18, 2017
@enisoc enisoc added this to the v1.6 milestone Aug 18, 2017
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 18, 2017
@k8s-github-robot k8s-github-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Aug 18, 2017
@@ -80,11 +80,13 @@ func TestIdentityMatches(t *testing.T) {
}
pod = newStatefulSetPod(set, 1)
delete(pod.Annotations, podapi.PodHostnameAnnotation)
pod.Spec.Hostname = ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't the field default to "" anyway?

Copy link
Member Author

Choose a reason for hiding this comment

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

The field is set during newStatefulSetPod. This test is intentionally clearing the annotation/field to verify that causes the match to fail.

@foxish
Copy link
Contributor

foxish commented Aug 18, 2017

LGTM

@kow3ns
Copy link
Member

kow3ns commented Aug 19, 2017

/approve

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enisoc, kow3ns

Associated issue: 44137

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@enisoc enisoc added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 21, 2017
@enisoc
Copy link
Member Author

enisoc commented Aug 21, 2017

/retest

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 8af8abe into kubernetes:release-1.6 Aug 21, 2017
@enisoc enisoc deleted the sts-pod-hostname-1.6 branch August 23, 2017 23:05
k8s-github-robot pushed a commit that referenced this pull request Sep 27, 2017
Automatic merge from submit-queue.

Allow Hostname and Subdomain to be set if empty

**What this PR does / why we need it**:
This PR allows the Hostname and Subdomain field of v1.PodSpec to be set when empty, and modifies the StatefulSet controller to set them when empty. 

For #48327: 
We have merged #50942 to ensure that the Hostname and Subdomain fields are set when a new Pod is created. Users should upgrade to 1.6.9 and perform a rolling restart of all Pods in their StatefulSets to ensure that these fields are set prior to an upgrade to 1.7.5.
We have merged #51149 and #51044 to rollback the attempted mutation introduced in #44137.
This PR allows the Hostname and Subdomain field to be set exactly once, so that when users fail to read the notes, and encounter this issue, their clusters should self heal (even though they will experience a temporary network disruption for Pods in their StatefulSets.)

```release-note
StatefulSet will now fill the `hostname` and `subdomain` fields if they're empty on existing Pods it owns. This allows it to self-correct the issue where StatefulSet Pod DNS entries disappear after upgrading to v1.7.x (#48327).
```
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. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants