Skip to content

Commit

Permalink
Update IMPLEMENTATION.adoc
Browse files Browse the repository at this point in the history
  • Loading branch information
jmazzitelli authored Jun 15, 2023
1 parent 5fbf6fb commit 28aa1a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions IMPLEMENTATION.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kial
** link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-deploy/filter_plugins/only_accessible_namespaces.py[only_accessible_namespaces] - given a list of all known namespaces and a list of accessible namespace regular expressions, this filters out all non-accessible namespaces (i.e. returns a list of only the namespaces that match an accessible namespace regex). Example usage link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-deploy/tasks/main.yml#L556[here].
** link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-deploy/filter_plugins/stripnone.py[stripnone] - Recursively processes a given dict value and removes all keys that have a None value. This is needed when setting up the startup variable values. Example usage link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-deploy/vars/main.yml#L36[here].
* link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-deploy/meta[meta] - The KO only uses this to declare what collections it wants to use. Today, the KO only needs to link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-deploy/meta/main.yml[declare the kubernetes.core collection].
* link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-deploy/tasks[tasks] - The tasks that are executed when a Kiali CR has been created or modified. The KO does not care if this is a new Kiali that needs to be installed or an existing Kiali that needs to be updated. The KO will invoke the same tasks and process the same templates. Any existing resources will simply be updated to match that of the templates (this is what it means when it is said the operator "reconciles" the existing resources with the desired state of the templates).
* link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-deploy/tasks[tasks] - The tasks that are executed when a Kiali CR has been created or modified. The KO does not care if this is a new Kiali that needs to be installed or an existing Kiali that needs to be updated. The KO will invoke the same tasks and process the same templates. Any existing resources will simply be updated to match that of the templates (this is what it means when it is said the operator "reconciles" the existing resources with the desired state of the templates). The link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-deploy/tasks/main.yml[main.yml] file is the main starting point of execution for the deploy role. This performs some initialization (getting version information of the operator itself and the cluster, initializing variables and setting defaults, etc) and then handles creation and updates of the various resources that make up a Kiali installation. There is a lot of work done here (and included tasks such as link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-deploy/tasks/remove-roles.yml[remove-roles.yml] and others) that handle reconciling the Roles and Role Bindings (as accessible namespaces come and go, the Kiali Service Account must have its Roles/RoleBindings updated appropriately).
* link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-deploy/templates[templates] - YAML files which are used to create new resources (or update existing ones). Ansible expressions can be placed in the templates; these expressions will be evaluated when they are processed by the `kubernetes.core.k8s` task (an example where they are processed is link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-deploy/tasks/process-resource.yml#L4-L7[here]). There are two sets of YAML templates - one for OpenShift clusters (link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-deploy/templates/openshift[`openshift`]) and one for non-OpenShift clusters (link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-deploy/templates/kubernetes[`kubernetes`]).
* link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-deploy/vars[vars] - defines the actual variables used by the Ansible deploy tasks. All variables are stored under the main top level dict called `kiali_vars`. Read link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-deploy/vars/main.yml#L1-L9[the comment here] to understand the trick being used to define the variables. Notice that only the top group of variables (directly under `kiali_vars`) has a section defined here (e.g. link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-deploy/vars/main.yml#L34-L39[`auth`] is a top group of variables). When adding a new top group, just copy-and-paste an existing group and rename variables in the new top group as appropriate.

Expand All @@ -49,7 +49,7 @@ The link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kial
* link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-remove/filter_plugins[filter_plugins] - filter plugins are a way to jump from Ansible into a Python context when things are easier or more efficient to do with Python code rather than directly within Ansible tasks. There is one custom filter the KO uses in the remove role:
** link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-remove/filter_plugins/stripnone.py[stripnone] - Recursively processes a given dict value and removes all keys that have a None value. This is needed when setting up the startup variable values. Example usage link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-remove/vars/main.yml#L6[here].
* link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-remove/meta[meta] - The KO only uses this to declare what collections it wants to use. Today, the KO only needs to link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-remove/meta/main.yml[declare the kubernetes.core collection].
* link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-remove/tasks[tasks] - The tasks that are executed when a Kiali CR has been removed and Kiali needs to be uninstalled. These tasks will also run if an existing Kial CR had its `spec.version` changed, in which case the old version installation will be removed via these tasks.
* link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-remove/tasks[tasks] - The tasks that are executed when a Kiali CR has been removed and Kiali needs to be uninstalled. These tasks will also run if an existing Kial CR had its `spec.version` changed, in which case the old version installation will be removed via these tasks (this is described link:#main-ansible-playbooks[above]).
* link:https://github.com/kiali/kiali-operator/tree/v1.69.0/roles/default/kiali-remove/vars[vars] - defines the actual variables used by the Ansible remove tasks. All variables are stored under the main top level dict called `kiali_vars_remove`. Read link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-deploy/vars/main.yml#L1-L9[the comment here] to understand the trick being used to define the variables. Notice that only the top group of variables (directly under `kiali_vars_remove`) has a section defined here (e.g. link:https://github.com/kiali/kiali-operator/blob/v1.69.0/roles/default/kiali-remove/vars/main.yml#L4-L9[`deployment`] is a top group of variables). When adding a new top group, just copy-and-paste an existing group and rename variables in the new top group as appropriate.

== OLM Metadata Publishing
Expand Down

0 comments on commit 28aa1a0

Please sign in to comment.