Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Implement upgrade path for SSP operator #186

Merged

Conversation

omeryahud
Copy link
Contributor

@omeryahud omeryahud commented Jun 11, 2020

An upgrade of the SSP operator from versions 1.0.22 to a higher version would cause duplicate CRDs due to a change to the CRDs api group:

$ oc get crds | grep "aggre\|labeller\|validator\|common"

kubevirtcommontemplatesbundles.kubevirt.io                       2020-06-03T14:07:02Z
kubevirtcommontemplatesbundles.ssp.kubevirt.io                   2020-06-04T10:26:17Z
kubevirtmetricsaggregations.kubevirt.io                          2020-06-03T14:07:02Z
kubevirtmetricsaggregations.ssp.kubevirt.io                      2020-06-04T10:26:17Z
kubevirtnodelabellerbundles.kubevirt.io                          2020-06-03T14:07:02Z
kubevirtnodelabellerbundles.ssp.kubevirt.io                      2020-06-04T10:26:17Z
kubevirttemplatevalidators.kubevirt.io                           2020-06-03T14:07:02Z
kubevirttemplatevalidators.ssp.kubevirt.io                       2020-06-04T10:26:17Z

This PR is introducing the following changes:

  • The operator now manages the CRs in the ssp.kubevirt.io group only.

  • When the operator is deployed and reconciling starts, if any resources exist from a previous installation, the operator will take ownership of them. For example, KubevirtTemplateValidator.ssp.kubevirt.io will take ownership of all resources created by KubevirtTemplateValidator.kubevirt.io, if it existed

  • The following status fields are added to the CR to indicate a successful upgrade:

    • status:
        operatorVersion: "v1.0.36"
        targetVersion: "v1.0.36"
        observedVersion: ""
      
    • operatorVersion - States the version of the deployed operator
    • targetVersion - States the desired version of deployed resources
    • observedVersion - States the version of currently deployed resources

An upgrade is complete when the Available condition is True, and when targetVersion == observedVersion.

roles/KubevirtCommonTemplatesBundle/tasks/main.yml Outdated Show resolved Hide resolved
roles/KubevirtCommonTemplatesBundle/tasks/main.yml Outdated Show resolved Hide resolved
roles/KubevirtMetricsAggregation/tasks/main.yml Outdated Show resolved Hide resolved
roles/KubevirtNodeLabeller/tasks/main.yml Show resolved Hide resolved
@omeryahud omeryahud force-pushed the take-resource-ownership-during-upgrade branch from c1716d1 to a0354b3 Compare June 16, 2020 14:28
@omeryahud omeryahud changed the title Take resource ownership during upgrade Implement upgrade path for SSP operator Jun 22, 2020
@omeryahud omeryahud force-pushed the take-resource-ownership-during-upgrade branch from 9efe7aa to 3f8b840 Compare June 23, 2020 07:16
@akrejcir
Copy link
Contributor

Can you squash related commits together, so that each commit makes sense on its own? It would be easier to review and look better in the history.

@omeryahud omeryahud force-pushed the take-resource-ownership-during-upgrade branch 3 times, most recently from 3474a55 to cc50066 Compare June 23, 2020 12:39
deployed_templates_after: "{{ lookup('k8s', api_version=ct_status.results[0].result.apiVersion, kind='template', label_selector=label)|length }}"
deployed_templates_after: "{{ lookup('k8s', api_version=ct_status.results[0].result.apiVersion, kind='template', label_selector=label) | length }}"

- name: "Set Progressing status"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need the facts here anymore as you do not use them

…on would cause duplicate CRDs due to a change to the CRDs api group:

$ oc get crds | grep "aggre\|labeller\|validator\|common"

kubevirtcommontemplatesbundles.kubevirt.io                       2020-06-03T14:07:02Z
kubevirtcommontemplatesbundles.ssp.kubevirt.io                   2020-06-04T10:26:17Z
kubevirtmetricsaggregations.kubevirt.io                          2020-06-03T14:07:02Z
kubevirtmetricsaggregations.ssp.kubevirt.io                      2020-06-04T10:26:17Z
kubevirtnodelabellerbundles.kubevirt.io                          2020-06-03T14:07:02Z
kubevirtnodelabellerbundles.ssp.kubevirt.io                      2020-06-04T10:26:17Z
kubevirttemplatevalidators.kubevirt.io                           2020-06-03T14:07:02Z
kubevirttemplatevalidators.ssp.kubevirt.io                       2020-06-04T10:26:17Z
This PR is introducing the following changes:

The operator now manages the CRs in the ssp.kubevirt.io group only.

When the operator is deployed and reconciling starts, if any resources exist from a previous installation, the operator will take ownership of them. For example, KubevirtTemplateValidator.ssp.kubevirt.io will take ownership of all resources created by KubevirtTemplateValidator.kubevirt.io, if it existed

The following status fields are added to the CR to indicate a successful upgrade:

status:
  operatorVersion: "v1.0.36"
  targetVersion: "v1.0.36"
  observedVersion: ""
operatorVersion - States the version of the deployed operator
targetVersion - States the desired version of deployed resources
observedVersion - States the version of currently deployed resources
An upgrade is complete when the Available condition is True, and when targetVersion == observedVersion.

Signed-off-by: Omer Yahud <oyahud@redhat.com>
@omeryahud omeryahud force-pushed the take-resource-ownership-during-upgrade branch from cc50066 to b2c14a7 Compare June 23, 2020 14:27
@omeryahud omeryahud merged commit 416e4fb into kubevirt:master Jun 24, 2020
omeryahud added a commit to omeryahud/MarSik-kubevirt-ssp-operator that referenced this pull request Jun 24, 2020
Signed-off-by: Omer Yahud <oyahud@redhat.com>
omeryahud added a commit to omeryahud/MarSik-kubevirt-ssp-operator that referenced this pull request Jun 24, 2020
…p-during-upgrade

Implement upgrade path for SSP operator
ksimon1 added a commit that referenced this pull request Jun 24, 2020
[Backport] Merge pull request #186 - Operator upgrade path
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants