microcks / microcks-ansible-operator

Kubernetes Operator for easy setup and management of Microcks installs
https://microcks.io
Apache License 2.0
26 stars 6 forks source link

Make the detection of OpenShift / Kubernetes more robust #15

Closed lbroudoux closed 1 month ago

lbroudoux commented 4 years ago

We found on some OpenShift clusters that the API Groups Information is not always available making the Operator crash on the following command because of HTTP response 502:

api_groups: "{{ lookup('k8s', cluster_info='api_groups') }}"

A more stable (but maybe more crappy ?) solution could be to look at the available annotations on namespace to try detecting some OpenShift specific ones like this:

- name: Retrieve and set watch namespace
  set_fact:
    watch_namespace: "{{ lookup('env','WATCH_NAMESPACE') }}"

- name: Get watched namespace infos
  set_fact:
    watched_namespace: "{{ lookup('k8s', kind='Namespace', resource_name=watch_namespace) }}"

- name: Determine is this is an OpenShift or Kubernetes namespace
  set_fact:
    is_openshift : "{{ watched_namespace.metadata.annotations['openshift.io/display-name'] is defined }}"
    is_kubernetes : "{{ watched_namespace.metadata.annotations['openshift.io/display-name'] is not defined }}"

Maybe we should consider this as a fallback in case of official API returning an error?

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. Microcks is a Cloud Native Computing Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart: