When applying the keycloak operator CRD manifests using the ansible k8s module the realms CRD fails to apply with the following error message:
"msg": "Failed to patch object: __init__() got multiple values for argument 'self'", "reason": "", "status": ""}
After some debugging I found the source of the issue to be these dictionaries in the CRD:
clientScopeMappings:
additionalProperties:
items:
description: https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_scopemappingrepresentation
properties:
client:
description: Client
type: string
clientScope:
description: Client Scope
type: string
roles:
description: Roles
items:
type: string
type: array
self:
description: Self
type: string
type: object
type: array
description: Client Scope Mappings
type: object
scopeMappings:
description: Scope Mappings
items:
description: https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_scopemappingrepresentation
properties:
client:
description: Client
type: string
clientScope:
description: Client Scope
type: string
roles:
description: Roles
items:
type: string
type: array
self:
description: Self
type: string
type: object
type: array
More specifically these bits:
self:
description: Self
type: string
With the above commented out the manifest applies with no issue. Is this something the keycloak operator devs should look at? Is it a community.k8s bug? How can I go about making this work?
Here’s the task for reference:
- name: deploy keycloak operator crds
community.kubernetes.k8s:
state: "{{ keycloak_operator_state | default('present') }}"
definition: "{{ lookup('template', '{{ item }}') }}"
with_fileglob:
- "templates/keycloak-operator/crds/*.yml"
run_once: yes