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

Add HostAliases to PodSpec to support adding entires to a Pod's hosts file #44641

Merged
merged 4 commits into from
Apr 29, 2017

Conversation

evie404
Copy link
Contributor

@evie404 evie404 commented Apr 18, 2017

What this PR does / why we need it:
Adds a new field to PodSpec HostAliases to support adding entries to a Pod's hosts file. A PR to incorporate this logic into ensureHostsFile in kubelet will be next in order to isolate the discussion on the API.

Which issue this PR fixes:
A step into fixing #43632

Special notes for your reviewer:

Release note:

A new field `hostAliases` has been added to `pod.spec` to support adding entries to a Pod's /etc/hosts file.

Testing done:

  • Unit tests pass for validations
  • Ran all automated updates, and compared against another PR which added a field in PodSpec to make sure the PR contains all the updated generated code

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 18, 2017
@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Apr 18, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-ci-robot
Copy link
Contributor

Hi @rickypai. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot ok to test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 18, 2017
@evie404
Copy link
Contributor Author

evie404 commented Apr 18, 2017

Btw, this should probably inherit the same labels as #43632:

  • area/kubelet
  • kind/enhancement
  • sig/node

@evie404
Copy link
Contributor Author

evie404 commented Apr 21, 2017

@thockin hi tim, is it possible for you to help me look at this change? it implements the proposed type for host mapping in /etc/hosts: #43632 (comment)

@dims
Copy link
Member

dims commented Apr 24, 2017

@k8s-bot ok to test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 24, 2017
@evie404
Copy link
Contributor Author

evie404 commented Apr 24, 2017

seems like I forgot to generate federation docs and also one of the fields do not conform to convention. updating those.

@evie404 evie404 force-pushed the rpai/host_mappings_type branch 2 times, most recently from 5cf7e3f to 3be8711 Compare April 25, 2017 17:44
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 26, 2017
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 27, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 27, 2017
Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

I'll approve and let the reviewer's LGTM

allErrors := field.ErrorList{}
if hostNetwork {
if len(hostMappings) > 0 {
allErrors = append(allErrors, field.Invalid(fldPath, hostMappings, "no `hostMappings` allowed when `hostNetwork` is true"))
Copy link
Member

Choose a reason for hiding this comment

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

field.Forbidden(..."may not be set when hostNetwork is true")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@thockin
Copy link
Member

thockin commented Apr 27, 2017

/approve

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 27, 2017
@thockin
Copy link
Member

thockin commented Apr 27, 2017

@yujuhong I'm open to better names, and if you want to discuss this more, that's fair - just hold off on the LGTM.

@evie404
Copy link
Contributor Author

evie404 commented Apr 28, 2017

Updating the name to HostAliases per discussion in #43632 (comment)

@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 29, 2017
@evie404
Copy link
Contributor Author

evie404 commented Apr 29, 2017

@k8s-bot unit test this

@evie404 evie404 closed this Apr 29, 2017
@evie404 evie404 deleted the rpai/host_mappings_type branch April 29, 2017 07:14
@evie404 evie404 restored the rpai/host_mappings_type branch April 29, 2017 07:14
@evie404 evie404 reopened this Apr 29, 2017
@evie404
Copy link
Contributor Author

evie404 commented Apr 29, 2017

@k8s-bot kubemark e2e test this

@thockin
Copy link
Member

thockin commented Apr 29, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 29, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rickypai, thockin

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

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 194a069 into kubernetes:master Apr 29, 2017
@evie404 evie404 deleted the rpai/host_mappings_type branch April 29, 2017 18:31
k8s-github-robot pushed a commit that referenced this pull request May 1, 2017
Automatic merge from submit-queue (batch tested with PRs 45110, 45148)

write HostAliases to hosts file

**What this PR does / why we need it**: using the PodSpec's `HostAliases`, we write entries into the Kubernetes-managed hosts file.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #43632

**Special notes for your reviewer**:
Previous PRs in this series:
- #44572 isolates the logic of creating the file and writing the file
- #44641 introduces the `HostAliases` field in PodSpec along with validations

**Release note**:
```release-note
PodSpec's `HostAliases` now write entries into the Kubernetes-managed hosts file.
```

@thockin @yujuhong 

Thanks for reviewing!
@evie404
Copy link
Contributor Author

evie404 commented May 1, 2017 via email

@evie404
Copy link
Contributor Author

evie404 commented May 1, 2017 via email

k8s-github-robot pushed a commit that referenced this pull request Jun 7, 2017
…ias_hostnames

Automatic merge from submit-queue (batch tested with PRs 46977, 47005, 47018, 47061, 46809)

Fix HostAlias to validate against DNS1123 hostname instead of just labels

**What this PR does / why we need it**: the validation for HostAlias was validating the hostnames against DNS labels instead of hostnames. This means hostnames like `foo.bar` would fail. I did not catch this because unit test cases only had hostnames like `foo`.

**Which issue this PR fixes**: fixes issue introduced in #44641

**Release note**:
```release-note
fixed HostAlias in PodSpec to allow `foo.bar` hostnames instead of just `foo` DNS labels.
```
k8s-github-robot pushed a commit that referenced this pull request Jun 22, 2017
Automatic merge from submit-queue (batch tested with PRs 42252, 42251, 42249, 47512, 47887)

fix HostAliases' json keys to be hostAlias instead of hostMapping to reflect actual feature name

**What this PR does / why we need it**: a rename was introduce during the middle of #44641 to change from `hostMappings` to `hostAliases`. the Go structs were updated, but I neglected to update the json keys. They should be in sync.

**Special notes for your reviewer**:  I messed up. This is an API change. I hope this is still ok to be in the 1.7 release.

**Release note**:
```release-note
HostAliases is now parsed with `hostAliases` json keys to be in line with the feature's name.
```
@WanLinghao
Copy link
Contributor

@rickypai thanks for your well done job!
And may I ask you that file like pkg/api/v1/types.generated.go was auto-generated by what tool?
thanks a lot!

@evie404
Copy link
Contributor Author

evie404 commented Nov 24, 2017

@WanLinghao
Copy link
Contributor

@rickypai Thanks!

@evie404 evie404 mentioned this pull request Jun 7, 2023
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API 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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants