diff --git a/.ci/eda_v1alpha1_eda.default.ci.yaml b/.ci/eda_v1alpha1_eda.default.ci.yaml index 4fc614ed..27ca5521 100644 --- a/.ci/eda_v1alpha1_eda.default.ci.yaml +++ b/.ci/eda_v1alpha1_eda.default.ci.yaml @@ -6,4 +6,4 @@ metadata: "ansible.sdk.operatorframework.io/verbosity": "5" spec: no_log: false - automation_server_url: https://foo.bar + automation_server_url: http://foo.bar diff --git a/.ci/eda_v1alpha1_eda.ingress.ci.yaml b/.ci/eda_v1alpha1_eda.ingress.ci.yaml index 6f1846fb..168ccd2d 100644 --- a/.ci/eda_v1alpha1_eda.ingress.ci.yaml +++ b/.ci/eda_v1alpha1_eda.ingress.ci.yaml @@ -6,5 +6,5 @@ metadata: "ansible.sdk.operatorframework.io/verbosity": "5" spec: no_log: false - automation_server_url: https://foo.bar + automation_server_url: http://foo.bar ingress_type: ingress diff --git a/.ci/eda_v1alpha1_edabackup.ci.yaml b/.ci/eda_v1alpha1_edabackup.ci.yaml new file mode 100644 index 00000000..ce7eda09 --- /dev/null +++ b/.ci/eda_v1alpha1_edabackup.ci.yaml @@ -0,0 +1,9 @@ +apiVersion: eda.ansible.com/v1alpha1 +kind: EDABackup +metadata: + name: eda-demo-backup + annotations: + "ansible.sdk.operatorframework.io/verbosity": "5" +spec: + no_log: false + deployment_name: eda-demo diff --git a/.ci/eda_v1alpha1_edarestore.ci.yaml b/.ci/eda_v1alpha1_edarestore.ci.yaml new file mode 100644 index 00000000..45fe8f3b --- /dev/null +++ b/.ci/eda_v1alpha1_edarestore.ci.yaml @@ -0,0 +1,10 @@ +apiVersion: eda.ansible.com/v1alpha1 +kind: EDARestore +metadata: + name: eda-demo-restore + annotations: + "ansible.sdk.operatorframework.io/verbosity": "5" +spec: + no_log: false + deployment_name: eda-demo + backup_name: eda-demo-backup diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cd715c3..7da85930 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ env: jobs: eda: runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 20 strategy: fail-fast: false matrix: @@ -43,12 +43,10 @@ jobs: env: VERSION: main - - name: Set imagePullPolicy to ifNotPresent + - name: Deploy the EDA operator run: | sed -i 's/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g' config/manager/manager.yaml - - - name: Deploy the EDA operator - run: make deploy + make deploy env: NAMESPACE: eda VERSION: main @@ -61,13 +59,10 @@ jobs: if: ${{ matrix.SCENARIO == 'externaldb' }} - name: Create the EDA demo CR - run: kubectl apply -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml - - - name: Print EDA demo CR - run: kubectl -n eda get eda eda-demo -o yaml - - - name: Check and wait the EDA demo to be ready - run: kubectl wait --for condition=Successful eda/eda-demo --timeout=-1s + run: | + kubectl apply -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml + kubectl -n eda get eda eda-demo -o yaml + kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml - name: Test EDA API via k8s service run: | @@ -82,11 +77,27 @@ jobs: curl -s http://${IP}:80/api/eda/v1/status/ if: ${{ matrix.SCENARIO == 'ingress' }} + - name: Backup EDA demo + run: | + kubectl apply -f .ci/eda_v1alpha1_edabackup.ci.yaml + kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_edabackup.ci.yaml + + - name: Delete the EDA demo CR + run: | + kubectl delete --cascade=foreground -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml + kubectl wait --for=delete --timeout=-1s -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml + + - name: Restore EDA demo + run: | + kubectl apply -f .ci/eda_v1alpha1_edarestore.ci.yaml + kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_edarestore.ci.yaml + kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml + - name: Get logs if: always() run: | echo ::group::OPERATOR_LOGS - kubectl logs -l control-plane=controller-manager --tail=1000 || true + kubectl logs -l control-plane=controller-manager --tail=10000 || true echo ::endgroup:: echo ::group::POSTGRES_LOGS kubectl logs -l app.kubernetes.io/component=database --tail=1000 || true @@ -103,7 +114,7 @@ jobs: echo ::group::EDA_DEFAULT_WORKER_LOGS kubectl logs -l app.kubernetes.io/component=eda-default-worker --tail=1000 || true echo ::endgroup:: - echo ::group::EDA_ACTIVATION_WORKERLOGS + echo ::group::EDA_ACTIVATION_WORKER_LOGS kubectl logs -l app.kubernetes.io/component=eda-activation-worker --tail=1000 || true echo ::endgroup:: echo ::group::EDA_SCHEDULER_LOGS diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6df18934..0053113d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -7,7 +7,7 @@ env: jobs: eda: runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 20 strategy: fail-fast: false matrix: @@ -41,12 +41,10 @@ jobs: env: VERSION: main - - name: Set imagePullPolicy to ifNotPresent + - name: Deploy the EDA operator run: | sed -i 's/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g' config/manager/manager.yaml - - - name: Deploy the EDA operator - run: make deploy + make deploy env: NAMESPACE: eda VERSION: main @@ -59,13 +57,10 @@ jobs: if: ${{ matrix.SCENARIO == 'externaldb' }} - name: Create the EDA demo CR - run: kubectl apply -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml - - - name: Print EDA demo CR - run: kubectl -n eda get eda eda-demo -o yaml - - - name: Check and wait the EDA demo to be ready - run: kubectl wait --for condition=Successful eda/eda-demo --timeout=-1s + run: | + kubectl apply -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml + kubectl -n eda get eda eda-demo -o yaml + kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml - name: Test EDA API via k8s service run: | @@ -80,11 +75,27 @@ jobs: curl -s http://${IP}:80/api/eda/v1/status/ if: ${{ matrix.SCENARIO == 'ingress' }} + - name: Backup EDA demo + run: | + kubectl apply -f .ci/eda_v1alpha1_edabackup.ci.yaml + kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_edabackup.ci.yaml + + - name: Delete the EDA demo CR + run: | + kubectl delete --cascade=foreground -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml + kubectl wait --for=delete --timeout=-1s -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml + + - name: Restore EDA demo + run: | + kubectl apply -f .ci/eda_v1alpha1_edarestore.ci.yaml + kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_edarestore.ci.yaml + kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml + - name: Get logs if: always() run: | echo ::group::OPERATOR_LOGS - kubectl logs -l control-plane=controller-manager --tail=1000 || true + kubectl logs -l control-plane=controller-manager --tail=10000 || true echo ::endgroup:: echo ::group::POSTGRES_LOGS kubectl logs -l app.kubernetes.io/component=database --tail=1000 || true @@ -101,7 +112,7 @@ jobs: echo ::group::EDA_DEFAULT_WORKER_LOGS kubectl logs -l app.kubernetes.io/component=eda-default-worker --tail=1000 || true echo ::endgroup:: - echo ::group::EDA_ACTIVATION_WORKERLOGS + echo ::group::EDA_ACTIVATION_WORKER_LOGS kubectl logs -l app.kubernetes.io/component=eda-activation-worker --tail=1000 || true echo ::endgroup:: echo ::group::EDA_SCHEDULER_LOGS diff --git a/roles/restore/tasks/postgres.yml b/roles/restore/tasks/postgres.yml index 024b106e..de51b812 100644 --- a/roles/restore/tasks/postgres.yml +++ b/roles/restore/tasks/postgres.yml @@ -66,9 +66,8 @@ - name: Set full resolvable host name for postgres pod set_fact: - resolvable_db_host: "{{ eda_postgres_host }}.{{ ansible_operator_meta.namespace }}.svc.{{ cluster_name }}" + resolvable_db_host: "{{ (eda_postgres_type == 'managed') | ternary(eda_postgres_host + '.' + ansible_operator_meta.namespace + '.svc.' + cluster_name, eda_postgres_host) }}" no_log: "{{ no_log }}" - when: eda_postgres_type == 'managed' - name: Set pg_restore command set_fact: