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

Confusing error when object with generateName already exists #10237

Closed
liggitt opened this issue Aug 5, 2016 · 4 comments
Closed

Confusing error when object with generateName already exists #10237

liggitt opened this issue Aug 5, 2016 · 4 comments
Assignees
Labels
area/usability component/kubernetes component/restapi lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/P2

Comments

@liggitt
Copy link
Contributor

liggitt commented Aug 5, 2016

Spawned from #10008 (comment)

https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/api/rest/create.go#L106 is converting an AlreadyExists error into a server timeout error if it has a generateName

// CheckGeneratedNameError checks whether an error that occurred creating a resource is due
// to generation being unable to pick a valid name.
func CheckGeneratedNameError(strategy RESTCreateStrategy, err error, obj runtime.Object) error {
    if !errors.IsAlreadyExists(err) {
        return err
    }

    objectMeta, kind, kerr := objectMetaAndKind(strategy, obj)
    if kerr != nil {
        return kerr
    }

    if len(objectMeta.GenerateName) == 0 {
        return err
    }

    return errors.NewServerTimeoutForKind(kind.GroupKind(), "POST", 0)
}

That means that this returns really confusing errors:

data='{"kind":"Secret","apiVersion":"v1","metadata":{"name":"foo","generateName":"foo"}}'
$ oc create -f - <<< "$data"
secret "foo" created
$ oc create -f - <<< "$data"
Error from server: error when creating "STDIN": The POST operation against Secret could not be completed at this time, please try again.
@liggitt
Copy link
Contributor Author

liggitt commented Aug 5, 2016

@derekwaynecarr
Copy link
Member

created upstream issue to follow: kubernetes/kubernetes#32220

@openshift-bot
Copy link
Contributor

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.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 7, 2018
@0xmichalis
Copy link
Contributor

Closing in favor of the upstream issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/usability component/kubernetes component/restapi lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/P2
Projects
None yet
Development

No branches or pull requests

6 participants