-
Task
-
Resolution: Done
-
Critical
-
None
-
None
-
None
-
5
-
False
-
-
False
-
Yes
-
RHOAM Sprint 31, RHOAM Sprint 32
WHAT
For now, a tracking Jira more than anything, depends on the outcome of this conversation https://chat.google.com/room/AAAAt6g-c1I/mC1dGCutQ-s
In order to have keycloak operator compatible with the osd 4.12 keycloak team have decided for their operator to check if unsupported apis are used, and if they are, to remove the unsupported fields and let customer know via logs that a manual fix is required using the supported apis.
Since this approach will not work with RHOAM as RHOAM has keycloak operator listed as it's dependency, we need to remove the dependency between RHOAM and keycloak.
The way to do this is to use the Go's dynamic resources - https://itnext.io/generically-working-with-kubernetes-resources-in-go-53bce678f887
So that for example, instead of calling keycloak.keycloak (CR) in our code, we would be calling a function to retrieve keycloak CRs dynamically.
HOW
Please read the attached document and introduce the removal of dependency between RHOAM and keycloak.
Remove keycloak operator dependency from RHOAMs go.mod
Suggested approach is to have another file that would contain the logic and be generic enough to support other api groups/versions and so on, like in this example:
items, err := GetResourcesDynamically(dynamic, ctx, group, version, resource, namespace) if err != nil { return nil, err } func GetResourcesDynamically(dynamic dynamic.Interface, ctx context.Context, group string, version string, resource string, namespace string) ( []unstructured.Unstructured, error) { resourceId := schema.GroupVersionResource{ Group: group, Version: version, Resource: resource, } list, err := dynamic.Resource(resourceId).Namespace(namespace). List(ctx, metav1.ListOptions{}) if err != nil { return nil, err } return list.Items, nil }
TESTS
unit tests need to be added to the newly created functions
existing e2e tests should be good enough but a new e2e test that checks the functionality of dynamic resources retrieval is prefferable.
DONE
Keycloak operator dependency is removed from RHOAM