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

RoleBindings listed before Roles in template #122

Closed
jfchevrette opened this issue Jan 29, 2019 · 3 comments
Closed

RoleBindings listed before Roles in template #122

jfchevrette opened this issue Jan 29, 2019 · 3 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@jfchevrette
Copy link
Member

https://github.com/openshift/telemeter/blob/91e1dd6d343b0ca89440bd0776b4719baa532ad4/manifests/server/list.yaml
https://github.com/openshift/telemeter/blob/91e1dd6d343b0ca89440bd0776b4719baa532ad4/manifests/prometheus/list.yaml

Because the RoleBindings are listed before the Roles, our CI fails to apply the rolebinding objects on the first run because the roles are missing.

A workaround is to run the job a second time.

Ideally the Role objects would be listed before the RoleBinding objects in the templates.

@jfchevrette
Copy link
Member Author

ksonnet seem to do this specifically because some resources cannot reconcile if listed in the wrong order

https://github.com/ksonnet/ksonnet/blob/8b703db7cf6303ceddb3317a3a24e4b61ad7fc4f/pkg/cluster/sort.go#L95-L148

It does not seem to be possible to do this with jsonnet itself. The roles are in fact already defined prior to the roleBindings in jsonnet/telemeter/prometheus/kubernetes.libsonnet but they end up in a different order in the generated manifests.

@squat
Copy link
Contributor

squat commented Feb 19, 2019

This is because all of the items are defined as fields in a JSON object and key order is never guaranteed for an object. However, if this truly is an issue (my kubectl will happily create a multi-doc yaml file with bindings before roles) we can modify this during the generation of the list. Lists are by definition ordered collections and any ordering we set during its creation will be preserved.

@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

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 Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants