Skip to content

profile controller fails to update profile owner #33

Description

@thesuperzapper

/kind bug

Related to: kubeflow/kubeflow#6054

Problem:

Currently, if a Profile resource has its spec.owner.name updated, the profile-controller will lose control of the associated Namespace, and fail to update the owner.

Solution:

  1. The profile-controller will not "take control" of a Namespace unless it has the same metadata.annotations.owner as the spec.owner.name of the Profile:
    • SOLUTION: rather than checking for the presence of metadata.annotations.owner on the Namespace, we should check the "owner reference", by checking if the metadata.ownerReferences[] array contains the Profile resource
    • NOTE: after this change will need to provide a way to "import" existing namespaces, as it will be nearly impossible to set the correct "owner reference" manually (also requested in Way to "import" existing namespaces #45).
  2. The profile-controller does not update the metadata.annotations.owner of existing resources because it ignores metadata.* in its diff calculation:
    • RoleBinding/namespaceAdmin
      • SOLUTION: we can check the full RoleBinding definition for differences rather than only RoleRef and Subjects
      • NOTE: because kfam uses the metadata.annotations.user annotation of the RoleBinding/namespaceAdmin resource to determine the Namespace owner, without this solution, the wrong user will have "admin" access in the central-dashboard UI after a profile owner changes.
    • AuthorizationPolicy/ns-owner-access-istio
    • ResourceQuota/kf-resource-quota

Current Workaround:

The following steps are required to work around these issues and change the owner of an existing Profile:

  1. Patch the Profile's spec.owner.name to your new owner
  2. Patch the existing Namespace's metadata.annotations.owner annotation to your new owner.
  3. Manually delete the following resources from the Namespace (so they are recreated by the profile-controller):
    • RoleBinding/namespaceAdmin
    • AuthorizationPolicy/ns-owner-access-istio
    • ResourceQuota/kf-resource-quota

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions