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

fix: set default podspec for staticpod podtemplatespec #1404

Merged
merged 1 commit into from
Apr 22, 2023

Conversation

y-ykcir
Copy link
Member

@y-ykcir y-ykcir commented Apr 21, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

If not set default PodSpec for staticpod PodTemplateSpec, then when applying staticpod, it may be rejected due to PodTemplateSpec validation not passing.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


other Note

@openyurt-bot
Copy link
Collaborator

@y-ykcir: GitHub didn't allow me to assign the following users: your_reviewer.

Note that only openyurtio members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

What type of PR is this?

/kind bug

What this PR does / why we need it:

If not set default PodSpec for staticpod PodTemplateSpec, then when applying staticpod, it may be rejected due to PodTemplateSpec validation not passing.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


other Note

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.

@openyurt-bot openyurt-bot added kind/bug kind/bug size/XS size/XS: 0-9 labels Apr 21, 2023
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
3.7% 3.7% Duplication

@openyurt-bot openyurt-bot requested review from DrmagicE and qclc April 21, 2023 13:10
@codecov
Copy link

codecov bot commented Apr 21, 2023

Codecov Report

Merging #1404 (a636707) into master (a65b31c) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1404   +/-   ##
=======================================
  Coverage   51.05%   51.05%           
=======================================
  Files         132      132           
  Lines       15568    15568           
=======================================
  Hits         7949     7949           
  Misses       6895     6895           
  Partials      724      724           
Flag Coverage Δ
unittests 51.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@xavier-hou
Copy link
Member

@y-ykcir Would you explain more about this case? From my point, I think we do need to set the PodSpec in order to pass the validation. When will we need staticpod just have metav1.ObjectMeta~?

@y-ykcir
Copy link
Member Author

y-ykcir commented Apr 21, 2023

@xavier-hou When I apply yurthub-staticpod.yaml. The following validation error occurred:

The StaticPod "yurt-hub" is invalid:
* template.spec.containers[0].livenessProbe.httpGet.scheme: Unsupported value: "": supported values: "HTTP", "HTTPS"
* template.spec.containers[0].livenessProbe.successThreshold: Invalid value: 0: must be 1
* template.spec.containers[0].terminationMessagePolicy: Required value: must be 'File' or 'FallbackToLogsOnError'
* template.spec.containers[0].env[0].valueFrom.fieldRef.apiVersion: Required value
* template.spec.restartPolicy: Required value
* template.spec.dnsPolicy: Required value

This should be because the validation requirement here is a complete template, and users may not always add default values when writing yaml. Therefore, it may be appropriate to add default values to fields that the user did not fill in during the mutate phase

@xavier-hou
Copy link
Member

@y-ykcir Really appreciate for your information~

@openyurt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rambohe-ch, y-ykcir

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rambohe-ch
Copy link
Member

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved approved kind/bug kind/bug lgtm lgtm size/XS size/XS: 0-9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants