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

Install fails on ClusterRoleBinding #1945

Closed
japhar81 opened this issue Jan 24, 2023 · 7 comments
Closed

Install fails on ClusterRoleBinding #1945

japhar81 opened this issue Jan 24, 2023 · 7 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@japhar81
Copy link

On OKD 4.11 I installed the hive operator from OperatorHub -- tried both the alpha channel and the mce-2.0 channel. Once installed, I created a base HiveConfig;

apiVersion: hive.openshift.io/v1
kind: HiveConfig
metadata:
  name: hive
spec:
  logLevel: debug
  targetNamespace: hive

This fails, and pods in my hive namespace are never created. The status on HiveConfig throws this error;

    message: |-
      unable to apply asset: config/controllers/hive_controllers_role_binding.yaml: error when applying patch:
      {"metadata":{"$setElementOrder/ownerReferences":[{"uid":"fd49def4-3900-41e6-9a6a-4305e4c2cb5b"}],"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"rbac.authorization.k8s.io/v1\",\"kind\":\"ClusterRoleBinding\",\"metadata\":{\"annotations\":{},\"name\":\"hive-controllers\",\"ownerReferences\":[{\"apiVersion\":\"hive.openshift.io/v1\",\"blockOwnerDeletion\":true,\"kind\":\"HiveConfig\",\"name\":\"hive\",\"uid\":\"fd49def4-3900-41e6-9a6a-4305e4c2cb5b\"}]},\"roleRef\":{\"apiGroup\":\"rbac.authorization.k8s.io\",\"kind\":\"ClusterRole\",\"name\":\"hive-controllers\"},\"subjects\":[{\"kind\":\"ServiceAccount\",\"name\":\"hive-controllers\",\"namespace\":\"hive\"}]}\n"},"ownerReferences":[{"apiVersion":"hive.openshift.io/v1","blockOwnerDeletion":true,"kind":"HiveConfig","name":"hive","uid":"fd49def4-3900-41e6-9a6a-4305e4c2cb5b"},{"$patch":"delete","uid":"8bb8e669-5c32-42db-9569-6ad0ff5a3b95"}]}}
      to:
      Resource: "rbac.authorization.k8s.io/v1, Resource=clusterrolebindings", GroupVersionKind: "rbac.authorization.k8s.io/v1, Kind=ClusterRoleBinding"
      Name: "hive-controllers", Namespace: ""
      for: "object": error when patching "object": ClusterRoleBinding.rbac.authorization.k8s.io "hive-controllers" is invalid: [metadata.ownerReferences.apiVersion: Invalid value: "": version must not be empty, metadata.ownerReferences.kind: Invalid value: "": kind must not be empty, metadata.ownerReferences.name: Invalid value: "": name must not be empty]
@2uasimojo
Copy link
Member

Hi @japhar81. We don't work with OKD much (um, ever), but I'll go off and try to create an environment where I can reproduce this. Stay tuned!

@2uasimojo
Copy link
Member

Update: I was able to deploy manually on OKD; so this is going to be something to do with the OLM packaging.

@2uasimojo
Copy link
Member

Installed from alpha (currently quay.io/openshift-hive/hive:v1.2.3996-500a742) via OperatorHub and created the HiveConfig with contents as in your OP. Everything worked smoothly. I'm on OKD 4.11.0-0.okd-2023-01-14-152430.

Based on the error message, it looks like our apply function is only setting the uid of the owner. Here is the code that sets up that OwnerReference. As you can see, we set up all the fields that the error message is complaining about before we send the object off to be applied. The apply code creates the object if it does not exist. If it does exist, we create a patch to apply the changes.

In this case, based on the fact that the CRB has a last-applied-configuration, it appears as though that CRB existed previously -- probably from a previous iteration of the hive-operator's reconcile loop. I'm not sure why it's trying to $setElementOrder. Can you please dump me the full manifest of that CRB, as well as the hiveconfig in its current state?

oc get clusterrolebinding hive-controllers -o yaml
oc get hiveconfig hive -o yaml

@openshift-bot
Copy link

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 openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 1, 2023
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

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

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot 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 May 31, 2023
@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this as completed Jul 1, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 1, 2023

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

3 participants