From 668578f4d74f65eba872602f878ebbf533e5aee4 Mon Sep 17 00:00:00 2001 From: Kaio Oliveira Date: Thu, 19 Feb 2026 11:34:34 -0300 Subject: [PATCH] feat: [AAP-46540] Remove redis from operator This completely removes the deployment of redis from the operator. Adding upgrade cleanup tasks, and documentation updates will be done by different changes (AAP-59028 and AAP-59027). --- config/crd/bases/eda.ansible.com_edas.yaml | 166 ------------------ ...server-operator.clusterserviceversion.yaml | 46 ----- config/samples/eda_v1alpha1_eda.yaml | 6 - roles/backup/tasks/secrets.yml | 1 - roles/eda/tasks/idle_deployment.yml | 31 ---- roles/eda/tasks/main.yml | 4 - .../eda-activation-worker.deployment.yaml.j2 | 32 ---- .../eda/templates/eda-api.deployment.yaml.j2 | 64 ------- .../eda-default-worker.deployment.yaml.j2 | 32 ---- .../eda-event-stream.deployment.yaml.j2 | 32 ---- roles/redis/defaults/main.yml | 26 --- roles/redis/meta/main.yml | 64 ------- roles/redis/tasks/check_default_config.yml | 16 -- roles/redis/tasks/check_external_config.yml | 19 -- roles/redis/tasks/create_default_config.yml | 15 -- roles/redis/tasks/create_managed_redis.yml | 30 ---- roles/redis/tasks/main.yml | 21 --- .../redis/templates/redis.deployment.yaml.j2 | 87 --------- roles/redis/templates/redis.secret.yaml.j2 | 19 -- roles/redis/templates/redis.service.yaml.j2 | 24 --- roles/redis/vars/main.yml | 2 - roles/restore/tasks/secrets.yml | 19 -- 22 files changed, 756 deletions(-) delete mode 100644 roles/redis/defaults/main.yml delete mode 100644 roles/redis/meta/main.yml delete mode 100644 roles/redis/tasks/check_default_config.yml delete mode 100644 roles/redis/tasks/check_external_config.yml delete mode 100644 roles/redis/tasks/create_default_config.yml delete mode 100644 roles/redis/tasks/create_managed_redis.yml delete mode 100644 roles/redis/tasks/main.yml delete mode 100644 roles/redis/templates/redis.deployment.yaml.j2 delete mode 100644 roles/redis/templates/redis.secret.yaml.j2 delete mode 100644 roles/redis/templates/redis.service.yaml.j2 delete mode 100644 roles/redis/vars/main.yml diff --git a/config/crd/bases/eda.ansible.com_edas.yaml b/config/crd/bases/eda.ansible.com_edas.yaml index 25649276..6c86ab9e 100644 --- a/config/crd/bases/eda.ansible.com_edas.yaml +++ b/config/crd/bases/eda.ansible.com_edas.yaml @@ -41,8 +41,6 @@ spec: message: "Both image and image_version must be set when required" - rule: "has(self.image_web) && has(self.image_web_version) || !has(self.image_web) && !has(self.image_web_version)" message: "Both image_web and image_web_version must be set when required" - - rule: "has(self.redis_image) && has(self.redis_image_version) || !has(self.redis_image) && !has(self.redis_image_version)" - message: "Both redis_image and redis_image_version must be set when required" - rule: "has(self.postgres_image) && has(self.postgres_image_version) || !has(self.postgres_image) && !has(self.postgres_image_version)" message: "Both postgres_image and postgres_image_version must be set when required" properties: @@ -96,12 +94,6 @@ spec: image_web_version: description: UI container image tag or version to use type: string - redis_image: - description: Registry path to Redis container image to use - type: string - redis_image_version: - description: Redis container image tag or version to use - type: string api: description: Defines desired state of eda-api resources properties: @@ -2106,164 +2098,6 @@ spec: type: object type: array type: object - redis: - description: 'Defines desired state of cache resources' - properties: - redis_secret: - description: Secret where the redis configuration can be found. Set this to us your own external Redis cache. If not specified, this secret will be generated and EDA will not create a managed Redis pod. - type: string - replicas: - description: 'Defines Redis Deployment replicas' - format: int32 - type: integer - default: 1 - minimum: 0 - maximum: 1 - node_selector: - additionalProperties: - type: string - description: NodeSelector for the EDA pods. - type: object - resource_requirements: - description: Resource requirements for the Redis container - properties: - claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." - items: - description: ResourceClaim references one entry in PodSpec.ResourceClaims. - properties: - name: - description: Name must match the name of one entry in - pod.spec.resourceClaims of the Pod where this field - is used. It makes that resource available inside a - container. - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' - type: object - type: object - strategy: - description: The deployment strategy to use to replace existing - pods with new ones. - properties: - rollingUpdate: - description: 'Rolling update config params. Present only if - DeploymentStrategyType = RollingUpdate. --- TODO: Update - this to follow our convention for oneOf, whatever we decide - it to be.' - properties: - maxSurge: - anyOf: - - type: integer - - type: string - description: 'The maximum number of pods that can be scheduled - above the desired number of pods. Value can be an absolute - number (ex: 5) or a percentage of desired pods (ex: - 10%). This can not be 0 if MaxUnavailable is 0. Absolute - number is calculated from percentage by rounding up. - Defaults to 25%. Example: when this is set to 30%, the - new ReplicaSet can be scaled up immediately when the - rolling update starts, such that the total number of - old and new pods do not exceed 130% of desired pods. - Once old pods have been killed, new ReplicaSet can be - scaled up further, ensuring that total number of pods - running at any time during the update is at most 130% - of desired pods.' - x-kubernetes-int-or-string: true - maxUnavailable: - anyOf: - - type: integer - - type: string - description: 'The maximum number of pods that can be unavailable - during the update. Value can be an absolute number (ex: - 5) or a percentage of desired pods (ex: 10%). Absolute - number is calculated from percentage by rounding down. - This can not be 0 if MaxSurge is 0. Defaults to 25%. - Example: when this is set to 30%, the old ReplicaSet - can be scaled down to 70% of desired pods immediately - when the rolling update starts. Once new pods are ready, - old ReplicaSet can be scaled down further, followed - by scaling up the new ReplicaSet, ensuring that the - total number of pods available at all times during the - update is at least 70% of desired pods.' - x-kubernetes-int-or-string: true - type: object - type: - description: Type of deployment. Can be "Recreate" or "RollingUpdate". - Default is RollingUpdate. - type: string - type: object - tolerations: - description: Node tolerations for the EDA pods. - items: - description: The pod this Toleration is attached to tolerates - any taint that matches the triple using - the matching operator . - properties: - effect: - description: Effect indicates the taint effect to match. - Empty means match all taint effects. When specified, allowed - values are NoSchedule, PreferNoSchedule and NoExecute. - type: string - key: - description: Key is the taint key that the toleration applies - to. Empty means match all taint keys. If the key is empty, - operator must be Exists; this combination means to match - all values and all keys. - type: string - operator: - description: Operator represents a key's relationship to - the value. Valid operators are Exists and Equal. Defaults - to Equal. Exists is equivalent to wildcard for value, - so that a pod can tolerate all taints of a particular - category. - type: string - tolerationSeconds: - description: TolerationSeconds represents the period of - time the toleration (which must be of effect NoExecute, - otherwise this field is ignored) tolerates the taint. - By default, it is not set, which means tolerate the taint - forever (do not evict). Zero and negative values will - be treated as 0 (evict immediately) by the system. - format: int64 - type: integer - value: - description: Value is the taint value the toleration matches - to. If the operator is Exists, the value should be empty, - otherwise just a regular string. - type: string - type: object - type: array - type: object database: description: The EDA PostgreSQL database StatefulSet properties: diff --git a/config/manifests/bases/eda-server-operator.clusterserviceversion.yaml b/config/manifests/bases/eda-server-operator.clusterserviceversion.yaml index 8b33ee7b..349b15f9 100644 --- a/config/manifests/bases/eda-server-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/eda-server-operator.clusterserviceversion.yaml @@ -378,16 +378,6 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:hidden - - displayName: Redis Image - path: redis_image - x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:advanced - - urn:alm:descriptor:com.tectonic.ui:hidden - - displayName: Redis Image Version - path: redis_image_version - x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:advanced - - urn:alm:descriptor:com.tectonic.ui:hidden - description: Defines desired state of eda-api deployment resources displayName: API deployment configuration path: api @@ -596,42 +586,6 @@ spec: path: activation_worker.topology_spread_constraints x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - - description: Defines desired state of redis deployment resources - displayName: Redis deployment configuration - path: redis - x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: External redis configuration secret - path: redis.redis_secret - x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:advanced - - urn:alm:descriptor:io.kubernetes:Secret - - description: The number of redis replicas. - displayName: Replicas - path: redis.replicas - x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:podCount - - displayName: Node Selector - path: redis.node_selector - x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:advanced - - description: Deployment strategy to use to replace existing pods with new - ones. - displayName: Strategy - path: redis.strategy - x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:updateStrategy - - urn:alm:descriptor:com.tectonic.ui:advanced - - displayName: Redis deployment resource requirements - path: redis.resource_requirements - x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:advanced - - urn:alm:descriptor:com.tectonic.ui:resourceRequirements - - description: Node tolerations for the Redis pods. - displayName: Tolerations - path: redis.tolerations - x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:advanced - displayName: Service Type path: service_type x-descriptors: diff --git a/config/samples/eda_v1alpha1_eda.yaml b/config/samples/eda_v1alpha1_eda.yaml index 689ab69b..a116f657 100644 --- a/config/samples/eda_v1alpha1_eda.yaml +++ b/config/samples/eda_v1alpha1_eda.yaml @@ -37,12 +37,6 @@ spec: requests: cpu: 100m memory: 256Mi - redis: - replicas: 1 - resource_requirements: - requests: - cpu: 150m - memory: 256Mi database: resource_requirements: requests: diff --git a/roles/backup/tasks/secrets.yml b/roles/backup/tasks/secrets.yml index 63324750..d372f7c5 100644 --- a/roles/backup/tasks/secrets.yml +++ b/roles/backup/tasks/secrets.yml @@ -15,7 +15,6 @@ - ldap_cacert_secret - bundle_cacert_secret - ee_pull_credentials_secret - - redis_secret # image_pull_secret is deprecated in favor of image_pull_secrets - name: Dump image_pull_secret into file diff --git a/roles/eda/tasks/idle_deployment.yml b/roles/eda/tasks/idle_deployment.yml index c8b4bcb0..0ac181b0 100644 --- a/roles/eda/tasks/idle_deployment.yml +++ b/roles/eda/tasks/idle_deployment.yml @@ -29,37 +29,6 @@ replicas: 0 when: not ui_disabled -- name: Check for an external Redis cache - ansible.builtin.import_role: - name: redis - tasks_from: check_external_config - when: redis_type | length == 0 or redis_type == 'unmanaged' - -- name: Check for the default Redis configuration - ansible.builtin.import_role: - name: redis - tasks_from: check_default_config - when: redis_type | length == 0 or redis_type == 'managed' - -- name: Create a default Redis configuration - ansible.builtin.import_role: - name: redis - tasks_from: create_default_config - when: redis_type | length == 0 - -- name: Scale down Redis Deployment - kubernetes.core.k8s: - state: present - definition: - apiVersion: apps/v1 - kind: Deployment - metadata: - name: "{{ ansible_operator_meta.name }}-redis" - namespace: "{{ ansible_operator_meta.namespace }}" - spec: - replicas: 0 - when: redis_type == "managed" - - name: Combine postgres default and custom vars for each component ansible.builtin.import_role: name: postgres diff --git a/roles/eda/tasks/main.yml b/roles/eda/tasks/main.yml index 4e69e359..35ab8e93 100644 --- a/roles/eda/tasks/main.yml +++ b/roles/eda/tasks/main.yml @@ -12,10 +12,6 @@ include_tasks: idle_deployment.yml when: idle_deployment | bool -- name: Setup Redis - include_role: - name: redis - - name: Check for old postgres configuration kubernetes.core.k8s_info: kind: Secret diff --git a/roles/eda/templates/eda-activation-worker.deployment.yaml.j2 b/roles/eda/templates/eda-activation-worker.deployment.yaml.j2 index 15ea7258..6be200a6 100644 --- a/roles/eda/templates/eda-activation-worker.deployment.yaml.j2 +++ b/roles/eda/templates/eda-activation-worker.deployment.yaml.j2 @@ -182,38 +182,6 @@ spec: secretKeyRef: name: '{{ db_fields_encryption_secret_name }}' key: secret_key - - name: EDA_MQ_HOST - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: host - - name: EDA_MQ_PORT - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: port - - name: EDA_MQ_USER - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: username - - name: EDA_MQ_USER_PASSWORD - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: password - - name: EDA_MQ_TLS - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: redis_tls - optional: true - - name: EDA_MQ_REDIS_HA_CLUSTER_HOSTS - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: cluster_endpoint - optional: true {% if combined_activation_worker.resource_requirements is defined %} resources: {{ combined_activation_worker.resource_requirements }} {% endif %} diff --git a/roles/eda/templates/eda-api.deployment.yaml.j2 b/roles/eda/templates/eda-api.deployment.yaml.j2 index d648c591..58657a52 100644 --- a/roles/eda/templates/eda-api.deployment.yaml.j2 +++ b/roles/eda/templates/eda-api.deployment.yaml.j2 @@ -240,38 +240,6 @@ spec: secretKeyRef: name: '{{ __database_secret }}' key: host - - name: EDA_MQ_HOST - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: host - - name: EDA_MQ_PORT - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: port - - name: EDA_MQ_USER - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: username - - name: EDA_MQ_USER_PASSWORD - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: password - - name: EDA_MQ_TLS - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: redis_tls - optional: true - - name: EDA_MQ_REDIS_HA_CLUSTER_HOSTS - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: cluster_endpoint - optional: true ports: - containerPort: {{ api_django_port }} readinessProbe: @@ -337,38 +305,6 @@ spec: secretKeyRef: name: '{{ db_fields_encryption_secret_name }}' key: secret_key - - name: EDA_MQ_HOST - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: host - - name: EDA_MQ_PORT - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: port - - name: EDA_MQ_USER - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: username - - name: EDA_MQ_USER_PASSWORD - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: password - - name: EDA_MQ_TLS - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: redis_tls - optional: true - - name: EDA_MQ_REDIS_HA_CLUSTER_HOSTS - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: cluster_endpoint - optional: true {% if combined_api.resource_requirements is defined %} resources: {{ combined_api.resource_requirements }} {% endif %} diff --git a/roles/eda/templates/eda-default-worker.deployment.yaml.j2 b/roles/eda/templates/eda-default-worker.deployment.yaml.j2 index e7f23cb2..5c7fc681 100644 --- a/roles/eda/templates/eda-default-worker.deployment.yaml.j2 +++ b/roles/eda/templates/eda-default-worker.deployment.yaml.j2 @@ -182,38 +182,6 @@ spec: secretKeyRef: name: '{{ db_fields_encryption_secret_name }}' key: secret_key - - name: EDA_MQ_HOST - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: host - - name: EDA_MQ_PORT - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: port - - name: EDA_MQ_USER - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: username - - name: EDA_MQ_USER_PASSWORD - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: password - - name: EDA_MQ_TLS - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: redis_tls - optional: true - - name: EDA_MQ_REDIS_HA_CLUSTER_HOSTS - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: cluster_endpoint - optional: true {% if combined_default_worker.resource_requirements is defined %} resources: {{ combined_default_worker.resource_requirements }} {% endif %} diff --git a/roles/eda/templates/eda-event-stream.deployment.yaml.j2 b/roles/eda/templates/eda-event-stream.deployment.yaml.j2 index a697e0f9..85ed9232 100644 --- a/roles/eda/templates/eda-event-stream.deployment.yaml.j2 +++ b/roles/eda/templates/eda-event-stream.deployment.yaml.j2 @@ -182,38 +182,6 @@ spec: secretKeyRef: name: '{{ db_fields_encryption_secret_name }}' key: secret_key - - name: EDA_MQ_HOST - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: host - - name: EDA_MQ_PORT - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: port - - name: EDA_MQ_USER - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: username - - name: EDA_MQ_USER_PASSWORD - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: password - - name: EDA_MQ_TLS - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: redis_tls - optional: true - - name: EDA_MQ_REDIS_HA_CLUSTER_HOSTS - valueFrom: - secretKeyRef: - name: '{{ redis_config_secret }}' - key: cluster_endpoint - optional: true ports: - containerPort: {{ event_stream_django_port }} readinessProbe: diff --git a/roles/redis/defaults/main.yml b/roles/redis/defaults/main.yml deleted file mode 100644 index 80d6b7c1..00000000 --- a/roles/redis/defaults/main.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -# defaults file for EDA - -deployment_type: eda - -image_pull_policy: IfNotPresent -image_pull_secrets: [] - -_redis_image: quay.io/sclorg/redis-6-c9s -_redis_image_version: c9s - -redis_type: '' -redis_config_secret: '' - -redis: {} -_redis: - replicas: 1 - resource_requirements: - requests: - cpu: 50m - memory: 100Mi - node_selector: {} - tolerations: [] - -# Labels defined on the resource, which should be propagated to child resources -additional_labels: [] diff --git a/roles/redis/meta/main.yml b/roles/redis/meta/main.yml deleted file mode 100644 index b4e58850..00000000 --- a/roles/redis/meta/main.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -galaxy_info: - author: Ansible - description: Redis role for EDA operator - company: Red Hat, Inc. - - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Some suggested licenses: - # - BSD (default) - # - MIT - # - GPLv2 - # - GPLv3 - # - Apache - # - CC-BY - license: license (GPLv2, CC-BY, etc) - - min_ansible_version: 2.9 - - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # Optionally specify the branch Galaxy will use when accessing the GitHub - # repo for this role. During role install, if no tags are available, - # Galaxy will use this branch. During import Galaxy will access files on - # this branch. If Travis integration is configured, only notifications for this - # branch will be accepted. Otherwise, in all cases, the repo's default branch - # (usually master) will be used. - #github_branch: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 - - galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. - -dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. -collections: -- operator_sdk.util -- kubernetes.core diff --git a/roles/redis/tasks/check_default_config.yml b/roles/redis/tasks/check_default_config.yml deleted file mode 100644 index 64d37a38..00000000 --- a/roles/redis/tasks/check_default_config.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: Check for the default Redis configuration secret - kubernetes.core.k8s_info: - kind: Secret - namespace: '{{ ansible_operator_meta.namespace }}' - name: '{{ ansible_operator_meta.name }}-redis-configuration' - register: _redis_configuration - no_log: "{{ no_log }}" - -# The default configuration should generally be a 'managed' configuration but the cost -# of dynamically setting the variable here isn't high and will help avoid odd issues. -- name: Set Redis configuration for the default Redis configuration - ansible.builtin.set_fact: - redis_type: "{{ _redis_configuration['resources'][0]['data']['type'] | default('') | b64decode }}" - redis_config_secret: "{{ _redis_configuration['resources'][0]['metadata']['name'] }}" - when: _redis_configuration['resources'][0] is defined diff --git a/roles/redis/tasks/check_external_config.yml b/roles/redis/tasks/check_external_config.yml deleted file mode 100644 index 020ddeb5..00000000 --- a/roles/redis/tasks/check_external_config.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: Check for an external Redis configuration - kubernetes.core.k8s_info: - kind: Secret - namespace: '{{ ansible_operator_meta.namespace }}' - name: '{{ redis.redis_secret }}' - register: _redis_configuration - when: - - redis is defined - - redis | length - - redis.redis_secret is defined - - redis.redis_secret | length - no_log: "{{ no_log }}" - -- name: Set Redis configuration values for an external Redis configuration - ansible.builtin.set_fact: - redis_type: 'unmanaged' - redis_config_secret: "{{ _redis_configuration['resources'][0]['metadata']['name'] }}" - when: _redis_configuration['resources'][0] is defined diff --git a/roles/redis/tasks/create_default_config.yml b/roles/redis/tasks/create_default_config.yml deleted file mode 100644 index 0c6f5e70..00000000 --- a/roles/redis/tasks/create_default_config.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Create default Redis configuration secret - kubernetes.core.k8s: - state: present - apply: true - wait: true - definition: "{{ lookup('template', 'redis.secret.yaml.j2') | from_yaml }}" - register: result - no_log: "{{ no_log }}" - -- name: Set Redis configuration values for the default Redis configuration - ansible.builtin.set_fact: - redis_type: "managed" - redis_config_secret: "{{ ansible_operator_meta.name }}-redis-configuration" - when: result is succeeded diff --git a/roles/redis/tasks/create_managed_redis.yml b/roles/redis/tasks/create_managed_redis.yml deleted file mode 100644 index 303115f3..00000000 --- a/roles/redis/tasks/create_managed_redis.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- name: Set default redis image - ansible.builtin.set_fact: - _default_redis_image: "{{ _redis_image }}:{{ _redis_image_version }}" - -- name: Set user provided redis image - ansible.builtin.set_fact: - _custom_redis_image: "{{ redis_image }}:{{ redis_image_version }}" - when: - - redis_image | default([]) | length - - redis_image_version is defined or redis_image_version != '' - -- name: Set Redis image URL - ansible.builtin.set_fact: - _redis_image: "{{ _custom_redis_image | default(lookup('env', 'RELATED_IMAGE_EDA_REDIS')) | default(_default_redis_image, true) }}" - -- name: Combine the default settings with custom values from the resource - ansible.builtin.set_fact: - combined_redis: "{{ _redis | combine(redis, recursive=True) }}" - -- name: Redis Deployment & Service - kubernetes.core.k8s: - state: present - apply: true - wait: false - definition: "{{ lookup('template', 'templates/' + item + '.yaml.j2') | from_yaml }}" - loop: - - 'redis.service' - - 'redis.deployment' - no_log: "{{ no_log }}" diff --git a/roles/redis/tasks/main.yml b/roles/redis/tasks/main.yml deleted file mode 100644 index 431012ee..00000000 --- a/roles/redis/tasks/main.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: Check for an external Redis cache - ansible.builtin.include_tasks: check_external_config.yml - when: redis_type | length == 0 or redis_type == 'unmanaged' - -- name: Check for the default Redis configuration - ansible.builtin.include_tasks: check_default_config.yml - when: redis_type | length == 0 or redis_type == 'managed' - -# This task should only be activated when we don't have an external Redis -# configuration AND we have never configured a managed Redis deployment. -- name: Create a default Redis configuration - ansible.builtin.include_tasks: create_default_config.yml - when: redis_type | length == 0 - -# This tasks combines builds the values for creating a managed Redis -# system. It is important to keep these tasks together to keep -# the reconciliation loop tight if we are using an external Redis cache. -- name: Create a managed Redis deployment - ansible.builtin.include_tasks: create_managed_redis.yml - when: redis_type == 'managed' diff --git a/roles/redis/templates/redis.deployment.yaml.j2 b/roles/redis/templates/redis.deployment.yaml.j2 deleted file mode 100644 index 74b95cf0..00000000 --- a/roles/redis/templates/redis.deployment.yaml.j2 +++ /dev/null @@ -1,87 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: "{{ ansible_operator_meta.name }}-redis" - namespace: "{{ ansible_operator_meta.namespace }}" - labels: - app.kubernetes.io/name: 'redis' - app.kubernetes.io/instance: 'redis-{{ ansible_operator_meta.name }}' - app.kubernetes.io/component: cache - app.kubernetes.io/part-of: '{{ deployment_type }}' - app.kubernetes.io/managed-by: '{{ deployment_type }}-operator' -spec: - replicas: {{ combined_redis.replicas }} - selector: - matchLabels: - app.kubernetes.io/name: 'redis' - app.kubernetes.io/instance: 'redis-{{ ansible_operator_meta.name }}' - app.kubernetes.io/component: cache - app.kubernetes.io/part-of: '{{ deployment_type }}' - app.kubernetes.io/managed-by: '{{ deployment_type }}-operator' - template: - metadata: - labels: - app.kubernetes.io/name: 'redis' - app.kubernetes.io/instance: 'redis-{{ ansible_operator_meta.name }}' - app.kubernetes.io/component: cache - app.kubernetes.io/part-of: '{{ deployment_type }}' - app.kubernetes.io/managed-by: '{{ deployment_type }}-operator' - spec: -{% if image_pull_secrets | length > 0 %} - imagePullSecrets: -{% for secret in image_pull_secrets %} - - name: {{ secret }} -{% endfor %} -{% endif %} -{% if combined_redis.node_selector %} - nodeSelector: - {{ combined_redis.node_selector | to_nice_yaml | indent(width=8) }} -{% endif %} -{% if combined_redis.tolerations %} - tolerations: - {{ combined_redis.tolerations | to_nice_yaml | indent(width=8) }} -{% endif %} - containers: - - name: redis - image: "{{ _redis_image }}" - imagePullPolicy: "IfNotPresent" - volumeMounts: - - readOnly: false - mountPath: /var/lib/redis/data - name: '{{ ansible_operator_meta.name }}-redis-data' - ports: - - protocol: TCP - containerPort: 6379 - livenessProbe: - enabled: true - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 5 - failureThreshold: 5 - successThreshold: 1 - exec: - command: - - /bin/sh - - -i - - -c - - redis-cli -h 127.0.0.1 -p 6379 - readinessProbe: - enabled: true - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 5 - failureThreshold: 5 - successThreshold: 1 - exec: - command: - - /bin/sh - - -i - - -c - - redis-cli -h 127.0.0.1 -p 6379 -{% if combined_redis.resource_requirements is defined %} - resources: {{ combined_redis.resource_requirements }} -{% endif %} - volumes: - - name: {{ ansible_operator_meta.name }}-redis-data - emptyDir: {} diff --git a/roles/redis/templates/redis.secret.yaml.j2 b/roles/redis/templates/redis.secret.yaml.j2 deleted file mode 100644 index e3be6109..00000000 --- a/roles/redis/templates/redis.secret.yaml.j2 +++ /dev/null @@ -1,19 +0,0 @@ -# Redis EDA Secret. ---- -apiVersion: v1 -kind: Secret -metadata: - labels: - app.kubernetes.io/name: 'redis' - app.kubernetes.io/instance: 'redis-{{ ansible_operator_meta.name }}' - app.kubernetes.io/component: cache - app.kubernetes.io/part-of: '{{ deployment_type }}' - app.kubernetes.io/managed-by: '{{ deployment_type }}-operator' - name: '{{ ansible_operator_meta.name }}-redis-configuration' - namespace: '{{ ansible_operator_meta.namespace }}' -stringData: - password: '' - username: '' - port: '6379' - host: {{ ansible_operator_meta.name }}-redis-svc - type: 'managed' diff --git a/roles/redis/templates/redis.service.yaml.j2 b/roles/redis/templates/redis.service.yaml.j2 deleted file mode 100644 index b9ee08f8..00000000 --- a/roles/redis/templates/redis.service.yaml.j2 +++ /dev/null @@ -1,24 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: "{{ ansible_operator_meta.name }}-redis-svc" - namespace: "{{ ansible_operator_meta.namespace }}" - labels: - app.kubernetes.io/name: 'redis' - app.kubernetes.io/instance: 'redis-{{ ansible_operator_meta.name }}' - app.kubernetes.io/component: cache - app.kubernetes.io/part-of: '{{ deployment_type }}' - app.kubernetes.io/managed-by: '{{ deployment_type }}-operator' -spec: - selector: - app.kubernetes.io/name: 'redis' - app.kubernetes.io/instance: 'redis-{{ ansible_operator_meta.name }}' - app.kubernetes.io/component: cache - app.kubernetes.io/part-of: '{{ deployment_type }}' - app.kubernetes.io/managed-by: '{{ deployment_type }}-operator' - ports: - - protocol: TCP - targetPort: 6379 - name: redis-6379 - port: 6379 diff --git a/roles/redis/vars/main.yml b/roles/redis/vars/main.yml deleted file mode 100644 index 47256432..00000000 --- a/roles/redis/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for EDA diff --git a/roles/restore/tasks/secrets.yml b/roles/restore/tasks/secrets.yml index 4d8a7f85..7bd0d5bf 100644 --- a/roles/restore/tasks/secrets.yml +++ b/roles/restore/tasks/secrets.yml @@ -77,25 +77,6 @@ no_log: "{{ no_log }}" when: secrets['databaseConfigurationSecret']['data']['type'] | b64decode == 'managed' -- name: If redis deployment is managed, update redis secret and spec - block: - - name: Set new redis configuration values - ansible.builtin.set_fact: - _redis_secret_name: "{{ deployment_name }}-redis-configuration" - _redis_host: "{{ deployment_name }}-redis-svc" - - - name: Update spec with new redis secret name - ansible.builtin.set_fact: - spec: "{{ spec | combine({'redis': spec['redis'] | combine({'redis_secret': _redis_secret_name}, recursive=True)}, recursive=True) }}" - - - name: Update redis secret with new name and host - ansible.builtin.set_fact: - secrets: "{{ secrets | combine({'redis_secret': secrets['redis_secret'] | combine({'name': _redis_secret_name, 'data': secrets['redis_secret']['data'] | combine({'host': _redis_host | b64encode})})}) }}" - no_log: "{{ no_log }}" - when: - - secrets['redis_secret'] is defined - - secrets['redis_secret']['data']['type'] | b64decode == 'managed' - - name: Apply secret k8s: state: present