Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(csv): detect changes to a deployment and persist them #931

Merged
merged 1 commit into from
Jul 3, 2019

Conversation

ecordell
Copy link
Member

@ecordell ecordell commented Jun 27, 2019

Prior to this PR, changes made to a CSV's deployment specs would not affect the running deployments. Instead, you would need to delete and recreate the CSV, or create a new one that replaces the existing one, to test changes to a deployment.

This is obviously a UX improvement for developing CSVs, but this also has an advantage for simplifying our deployment. We are looking at switching to kustomize instead of helm, which means we need to limit the templating we do, and specifically the lack of partials in kustomize means that it's difficult to support our current deployment model. With this change we can just include the packageserver CSV (instead of CSV + Deployment + CatalogSource + ConfigMap) in our release artifacts.

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 27, 2019
@ecordell
Copy link
Member Author

/retest

@ecordell ecordell force-pushed the depupdate branch 2 times, most recently from 40bbd18 to 8430e05 Compare June 28, 2019 18:51
@ecordell
Copy link
Member Author

/retest

1 similar comment
@ecordell
Copy link
Member Author

/retest

@ecordell
Copy link
Member Author

/refresh

@ecordell
Copy link
Member Author

/retest

Copy link
Member

@njhale njhale left a comment

Choose a reason for hiding this comment

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

Looks great! I just some testing nits/questions:

test/e2e/csv_e2e_test.go Show resolved Hide resolved
test/e2e/csv_e2e_test.go Show resolved Hide resolved
test/e2e/csv_e2e_test.go Outdated Show resolved Hide resolved
test/e2e/csv_e2e_test.go Outdated Show resolved Hide resolved
@ecordell
Copy link
Member Author

/retest

1 similar comment
@ecordell
Copy link
Member Author

ecordell commented Jul 1, 2019

/retest

// check equality
calculated := i.deploymentForSpec(spec.Name, spec.Spec)
if !i.equalDeployments(&calculated.Spec, &dep.Spec) {
return StrategyError{Reason: StrategyErrDeploymentUpdated, Message: fmt.Sprintf("deployment changed, rolling update with patch: %s\n%#v\n%#v", diff.ObjectDiff(dep.Spec.Template.Spec, calculated.Spec.Template.Spec), calculated.Spec.Template.Spec, dep.Spec.Template.Spec)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question: I assume this error will cause the csv to go to a Failed state for a retry - in the next sync loop it will be set to Pending and redeployment will take place from there, correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

IIRC, we don't take a step through Failed if we know that a re-apply can fix it. It should go straight back to Pending for re-install.

@ecordell ecordell force-pushed the depupdate branch 2 times, most recently from 291f11f to b22c6bb Compare July 3, 2019 14:39
Copy link
Member

@njhale njhale left a comment

Choose a reason for hiding this comment

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

🎉
/lgtm

@@ -148,7 +148,7 @@ func newNginxDeployment(name string) appsv1.DeploymentSpec {
Containers: []corev1.Container{
{
Name: genName("nginx"),
Image: "bitnami/nginx:latest",
Image: "redis",
Copy link
Member

@njhale njhale Jul 3, 2019

Choose a reason for hiding this comment

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

🙂
Note: It would be nice not to worry about issues with external images. Maybe, in the future, we could use a standard base image configured to run a "generic test operator" script.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 3, 2019
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ecordell, njhale

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants