diff --git a/README.md b/README.md index d6bf18fb..83fc864a 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,8 @@ metadata: name: awx ``` +> The metadata.name you provide, will be the name of the resulting AWX deployment. If you deploy more than one to the same namespace, be sure to use unique names. + Finally, use `kubectl` to create the awx instance in your cluster: ```bash diff --git a/ansible/templates/crd.yml.j2 b/ansible/templates/crd.yml.j2 index b7cd32bc..0cbda243 100644 --- a/ansible/templates/crd.yml.j2 +++ b/ansible/templates/crd.yml.j2 @@ -29,9 +29,11 @@ spec: tower_task_privileged: description: If a privileged security context should be enabled type: boolean + default: false tower_admin_user: description: Username to use for the admin account type: string + default: admin tower_hostname: description: The hostname of the instance type: string diff --git a/ansible/templates/operator.yml.j2 b/ansible/templates/operator.yml.j2 index 8fd88f92..f4256339 100644 --- a/ansible/templates/operator.yml.j2 +++ b/ansible/templates/operator.yml.j2 @@ -37,8 +37,8 @@ spec: httpGet: path: /healthz port: 6789 - initialDelaySeconds: 5 - periodSeconds: 3 + initialDelaySeconds: 15 + periodSeconds: 20 volumes: - name: runner emptyDir: {} diff --git a/deploy/awx-operator.yaml b/deploy/awx-operator.yaml index 67fe3368..58e2c141 100644 --- a/deploy/awx-operator.yaml +++ b/deploy/awx-operator.yaml @@ -143,8 +143,8 @@ spec: httpGet: path: /healthz port: 6789 - initialDelaySeconds: 5 - periodSeconds: 3 + initialDelaySeconds: 15 + periodSeconds: 20 volumes: - name: runner emptyDir: {} @@ -180,9 +180,11 @@ spec: tower_task_privileged: description: If a privileged security context should be enabled type: boolean + default: false tower_admin_user: description: Username to use for the admin account type: string + default: admin tower_hostname: description: The hostname of the instance type: string @@ -348,9 +350,6 @@ spec: type: string tower_web_extra_volume_mounts: type: string - tower_ee_image: - description: Registry path to the Execution Environment container to use - type: string tower_redis_image: description: Registry path to the redis container to use type: string diff --git a/deploy/crds/awx_v1beta1_crd.yaml b/deploy/crds/awx_v1beta1_crd.yaml index 18e989b8..0cbda243 100644 --- a/deploy/crds/awx_v1beta1_crd.yaml +++ b/deploy/crds/awx_v1beta1_crd.yaml @@ -29,9 +29,11 @@ spec: tower_task_privileged: description: If a privileged security context should be enabled type: boolean + default: false tower_admin_user: description: Username to use for the admin account type: string + default: admin tower_hostname: description: The hostname of the instance type: string @@ -197,9 +199,6 @@ spec: type: string tower_web_extra_volume_mounts: type: string - tower_ee_image: - description: Registry path to the Execution Environment container to use - type: string tower_redis_image: description: Registry path to the redis container to use type: string diff --git a/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml b/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml index e0906fd3..c3e66461 100644 --- a/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/awx-operator/manifests/awx-operator.clusterserviceversion.yaml @@ -100,6 +100,7 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:io.kubernetes:Secret + - displayName: Old Database configuration secret path: tower_old_postgres_configuration_secret x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced @@ -208,6 +209,18 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - displayName: Deploy the instance in development mode ? + path: development_mode + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Should Tower Task container deployed with privileged level ? + path: tower_task_privileged + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - urn:alm:descriptor:com.tectonic.ui:hidden - displayName: Deployment Type path: deployment_type x-descriptors: @@ -218,16 +231,76 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Redis Image + path: tower_redis_image + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: PostgreSQL Image + path: tower_postgres_image + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden - displayName: Tower Postgres Storage Class path: tower_postgres_storage_class x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Tower Postgres Datapath + path: tower_postgres_data_path + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden - displayName: Certificate Authorirty Trust Bundle path: ca_trust_bundle x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Tower Task Args + path: tower_task_args + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Tower Task Command + path: tower_task_command + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Tower Task Extra Env + path: tower_task_extra_env + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Tower Task Extra Volume Mounts + path: tower_task_extra_volume_mounts + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Tower Web Args + path: tower_web_args + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Tower Web Command + path: tower_web_command + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Tower Web Extra Env + path: tower_web_extra_env + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Tower Web Extra Volume Mounts + path: tower_web_extra_volume_mounts + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden + - displayName: Tower Extra Volumes + path: tower_extra_volumes + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + - urn:alm:descriptor:com.tectonic.ui:hidden statusDescriptors: - description: Route to access the instance deployed displayName: URL @@ -367,8 +440,8 @@ spec: httpGet: path: /healthz port: 6789 - initialDelaySeconds: 5 - periodSeconds: 3 + initialDelaySeconds: 15 + periodSeconds: 20 name: awx-operator resources: {} volumeMounts: diff --git a/deploy/olm-catalog/awx-operator/manifests/awx.ansible.com_awxs_crd.yaml b/deploy/olm-catalog/awx-operator/manifests/awx.ansible.com_awxs_crd.yaml index 7a7da681..840ef939 100644 --- a/deploy/olm-catalog/awx-operator/manifests/awx.ansible.com_awxs_crd.yaml +++ b/deploy/olm-catalog/awx-operator/manifests/awx.ansible.com_awxs_crd.yaml @@ -37,6 +37,7 @@ spec: tower_admin_user: description: Username to use for the admin account type: string + default: admin tower_broadcast_websocket_secret: description: Secret where the broadcast websocket secret can be found type: string @@ -180,6 +181,7 @@ spec: tower_task_privileged: description: If a privileged security context should be enabled type: boolean + default: false tower_task_resource_requirements: description: Resource requirements for the task container properties: diff --git a/roles/installer/tasks/database_configuration.yml b/roles/installer/tasks/database_configuration.yml index 622bbc7a..a79f55c4 100644 --- a/roles/installer/tasks/database_configuration.yml +++ b/roles/installer/tasks/database_configuration.yml @@ -14,14 +14,26 @@ name: '{{ meta.name }}-postgres-configuration' register: _default_pg_config_resources -- name: Check for old PostgreSQL configuration secret +- name: Check for specified old PostgreSQL configuration secret k8s_info: kind: Secret namespace: '{{ meta.namespace }}' name: '{{ tower_old_postgres_configuration_secret }}' - register: old_pg_config + register: _custom_old_pg_config_resources when: tower_old_postgres_configuration_secret | length +- name: Check for default old PostgreSQL configuration + k8s_info: + kind: Secret + namespace: '{{ meta.namespace }}' + name: '{{ meta.name }}-old-postgres-configuration' + register: _default_old_pg_config_resources + +- name: Set old PostgreSQL configuration + set_fact: + # yamllint disable-line rule:line-length + old_pg_config: '{{ _custom_old_pg_config_resources["resources"] | default([]) | length | ternary(_custom_old_pg_config_resources, _default_old_pg_config_resources) }}' # noqa 204 + - name: Set proper database name when migrating from old deployment set_fact: database_name: "{{ old_pg_config['resources'][0]['data']['database'] | b64decode }}" diff --git a/roles/installer/tasks/migrate_data.yml b/roles/installer/tasks/migrate_data.yml index ae04e8ca..59b5c744 100644 --- a/roles/installer/tasks/migrate_data.yml +++ b/roles/installer/tasks/migrate_data.yml @@ -13,7 +13,7 @@ kind: Pod namespace: '{{ meta.namespace }}' label_selectors: - - "app={{ deployment_type }}-postgres" + - "app={{ meta.name }}-{{ deployment_type }}-postgres" register: postgres_pod until: "postgres_pod['resources'][0]['status']['phase'] == 'Running'" delay: 5 diff --git a/roles/installer/templates/tower_postgres.yaml.j2 b/roles/installer/templates/tower_postgres.yaml.j2 index 5cdd17e2..c2629861 100644 --- a/roles/installer/templates/tower_postgres.yaml.j2 +++ b/roles/installer/templates/tower_postgres.yaml.j2 @@ -6,11 +6,11 @@ metadata: name: '{{ meta.name }}-postgres' namespace: '{{ meta.namespace }}' labels: - app: '{{ deployment_type }}-postgres' + app: '{{ meta.name }}-{{ deployment_type }}-postgres' spec: selector: matchLabels: - app: '{{ deployment_type }}-postgres' + app: '{{ meta.name }}-{{ deployment_type }}-postgres' serviceName: '{{ meta.name }}' replicas: 1 updateStrategy: @@ -18,7 +18,7 @@ spec: template: metadata: labels: - app: '{{ deployment_type }}-postgres' + app: '{{ meta.name }}-{{ deployment_type }}-postgres' spec: containers: - image: '{{ tower_postgres_image }}' @@ -71,10 +71,10 @@ metadata: name: '{{ meta.name }}-postgres' namespace: '{{ meta.namespace }}' labels: - app: '{{ deployment_type }}-postgres' + app: '{{ meta.name }}-{{ deployment_type }}-postgres' spec: ports: - port: 5432 clusterIP: None selector: - app: '{{ deployment_type }}-postgres' + app: '{{ meta.name }}-{{ deployment_type }}-postgres'