Skip to content

feat: Updating the RolloutStrategy field is not allowed.#212

Merged
hessjcg merged 2 commits intomainfrom
gh-36-rolloutstrategy
Feb 24, 2023
Merged

feat: Updating the RolloutStrategy field is not allowed.#212
hessjcg merged 2 commits intomainfrom
gh-36-rolloutstrategy

Conversation

@hessjcg
Copy link
Copy Markdown
Collaborator

@hessjcg hessjcg commented Feb 21, 2023

RolloutStrategy controls when and how changes to the AuthProxyWorkload are rolled out to
running workloads. Changing this value after creation would cause an inconsistent rollout state.

Related to #36

@hessjcg hessjcg requested a review from a team as a code owner February 21, 2023 18:28
@hessjcg hessjcg requested a review from enocom February 21, 2023 18:28
Copy link
Copy Markdown
Member

@enocom enocom left a comment

Choose a reason for hiding this comment

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

PR looks good functionally, but the tests are a bit hard to read.

},
},
AuthProxyContainer: &cloudsqlapi.AuthProxyContainerSpec{
RolloutStrategy: "Workload",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This line is the key line right? The strategy is workload before, and not changed after?

Could we make that change more clear and hide the rest of these details?

Cf. https://arslan.io/2022/12/04/functional-table-driven-tests-in-go/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we pull workload rollout strategy updates into a separate test?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I moved RolloutStrategy update table tests into their own test function.

return allErrs
}

func validateRolloutStrategyChange(c *AuthProxyContainerSpec, oc *AuthProxyContainerSpec) []*field.Error {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's add a doc string here explaining why this is important and what validate is doing.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

@hessjcg hessjcg force-pushed the gh-36-rolloutstrategy branch from 85e9f6e to 72c429c Compare February 23, 2023 20:07
@hessjcg hessjcg requested a review from enocom February 23, 2023 20:07
RolloutStrategy: "None",
},
oldSpec: &cloudsqlapi.AuthProxyContainerSpec{
RolloutStrategy: "Workload",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is really nice.

@hessjcg hessjcg merged commit f31b637 into main Feb 24, 2023
@hessjcg hessjcg deleted the gh-36-rolloutstrategy branch February 24, 2023 01:53
This was referenced Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants