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

V1RollingUpdateDaemonSet maxUnavailable is 'String' but API specifies 'IntOrString' #721

Closed
bcoughlan opened this issue Oct 1, 2019 · 13 comments
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@bcoughlan
Copy link

V1beta2RollingUpdateDaemonSet has IntOrString maxUnavailable but V1RollingUpdateDaemonSet has String maxUnavailable, even though the swagger.json specifies it as an IntOrString.

This causes an issue that when trying to use the integer form for maxUnavailable, because the API assumes that if it is a string then it should be treated as a percentage.

spec.updateStrategy.rollingUpdate.maxUnavailable: Invalid value: intstr.IntOrString{Type:1, IntVal:0, StrVal:\"1\"}: a valid percent string must be a numeric string followed by an ending '%'
@brendandburns
Copy link
Contributor

This is weird. Looking at the Swagger I don't see any reason why this should be true, and yet there it is... This may be a bug in the code generator, we'll have to investigate more.

@yue9944882
Copy link
Member

    "io.k8s.api.apps.v1.RollingUpdateDaemonSet": {
      "description": "Spec to control the desired behavior of daemon set rolling update.",
      "type": "object",
      "properties": {
        "maxUnavailable": {
          "description": "The maximum number of DaemonSet pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of total number of DaemonSet pods at the start of the update (ex: 10%). Absolute number is calculated from percentage by rounding up. This cannot be 0. Default value is 1. Example: when this is set to 30%, at most 30% of the total number of nodes that should be running the daemon pod (i.e. status.desiredNumberScheduled) can have their pods stopped for an update at any given time. The update starts by stopping at most 30% of those DaemonSet pods and then brings up new DaemonSet pods in their place. Once the new pods are available, it then proceeds onto other DaemonSet pods, thus ensuring that at least 70% of original number of DaemonSet pods are available at all times during the update.",
          "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString"
        }
      }
    },

sth must be wrong w/ the code-generator, the openapi spec from kubernetes cluster is correct.

@yue9944882
Copy link
Member

yue9944882 commented Oct 9, 2019

let me check if migrating to openapi-generator will solve the issue..

UPDATE: the openapi-generator doesn't actually solve this..

@bcoughlan
Copy link
Author

FWIW, I tried generating the code using the instructions in the README (even after deleting the old V1RollingUpdateDaemonSet.java file) with the latest release-1.14, and it still generated it as type String. So it's probably not related to any issues around incremental building or caching.

@yue9944882
Copy link
Member

UPDATE: OpenAPITools/openapi-generator#4182 will be fixing this

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 21, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 20, 2020
@GeneralKenobi
Copy link

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Feb 20, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 20, 2020
@brendandburns
Copy link
Contributor

/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 22, 2020
@brendandburns
Copy link
Contributor

@huhu-sky
Copy link

huhu-sky commented Jul 8, 2020

{
	"kind": "Status",
	"apiVersion": "v1",
	"metadata": {},
	"status": "Failure",
	"message": "Deployment.apps \"ingress-gateway-test\" is invalid: [spec.strategy.rollingUpdate.maxUnavailable: Invalid value: intstr.IntOrString{Type:1, IntVal:0, StrVal:\"1\"}: a valid percent string must be a numeric string followed by an ending '%' (e.g. '1%',  or '93%', regex used for validation is '[0-9]+%'), spec.strategy.rollingUpdate.maxSurge: Invalid value: intstr.IntOrString{Type:1, IntVal:0, StrVal:\"1\"}: a valid percent string must be a numeric string followed by an ending '%' (e.g. '1%',  or '93%', regex used for validation is '[0-9]+%')]",
	"reason": "Invalid",
	"details": {
		"name": "ingress-gateway-test",
		"group": "apps",
		"kind": "Deployment",
		"causes": [
			{
				"reason": "FieldValueInvalid",
				"message": "Invalid value: intstr.IntOrString{Type:1, IntVal:0, StrVal:\"1\"}: a valid percent string must be a numeric string followed by an ending '%' (e.g. '1%',  or '93%', regex used for validation is '[0-9]+%')",
				"field": "spec.strategy.rollingUpdate.maxUnavailable"
			},
			{
				"reason": "FieldValueInvalid",
				"message": "Invalid value: intstr.IntOrString{Type:1, IntVal:0, StrVal:\"1\"}: a valid percent string must be a numeric string followed by an ending '%' (e.g. '1%',  or '93%', regex used for validation is '[0-9]+%')",
				"field": "spec.strategy.rollingUpdate.maxSurge"
			}
		]
	},
	"code": 422
}

I have the same error with 5.0.0, so which version i can use to solve this problem, Thanks;

@chengdonglin
Copy link

this reason is because the k8s use the gson, but you app use the other json package, which can not convert the intOrString type, so you should define the json util to hanlde the intOrString type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

8 participants