-
Notifications
You must be signed in to change notification settings - Fork 12
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: add new field RolloutStrategy control automatic rollout #202
Conversation
@@ -862,6 +862,13 @@ spec: | |||
description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' | |||
type: object | |||
type: object | |||
rolloutStrategy: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is generated from the source code comments: authproxyworkload_types.go
@@ -880,6 +880,13 @@ spec: | |||
description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' | |||
type: object | |||
type: object | |||
rolloutStrategy: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is generated from the source code comments: authproxyworkload_types.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no e2e test here because the cluster is defaulting to "Workload" and so we can't test None?
@@ -39,7 +39,11 @@ var _ webhook.Defaulter = &AuthProxyWorkload{} | |||
// Default implements webhook.Defaulter so a webhook will be registered for the type | |||
func (r *AuthProxyWorkload) Default() { | |||
authproxyworkloadlog.Info("default", "name", r.Name) | |||
// TODO(user): fill in your defaulting logic. | |||
if r.Spec.AuthProxyContainer != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if x != nil && y == "" {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -276,6 +276,12 @@ func (r *AuthProxyWorkloadReconciler) needsAnnotationUpdate(wl workload.Workload | |||
return false | |||
} | |||
|
|||
// The user has set "None" as the rollout strategy. Ignore it. | |||
if resource.Spec.AuthProxyContainer != nil && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is pretty simple, but since we're repeating it and it's a pretty important check, should we pull it out into a re-used function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Fixed.
t.Fatal(err) | ||
} | ||
|
||
// Fetch the deployment and make sure the annotations show the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means the annotations are gone, but we haven't rolled it out, yeah?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This demonstrates the intended behavior. When RolloutStrategy== "None", then Reconcile() will not modify the Deployment's annotations.
Regarding E2E tests: In my judgement, an E2E test case doesn't add a lot of additional quality assurance above the unit test, and it introduces another source of flakey test errors. I'm inclined to skip the e2e test. For me, the unit test that shows that the Reconcile() will not modify a deployment when RolloutStrategy == "None" is enough. |
Labels: map[string]string{labelK: labelV}, | ||
}, | ||
Spec: appsv1.DeploymentSpec{Template: corev1.PodTemplateSpec{ | ||
ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some annotations here to just show that they're still there down below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Features - Add new field RolloutStrategy control automatic rollout (#202) (090b88d) - Add new terraform project for e2e test resources (#181) (0140592) - Add script to run terraform with input validation. (#182) (857444a) - Add support for Unix sockets. (#205) (8177a35), closes #47 - Add telemetry settings to configure health check port (#210) (3ede42d) - Add the e2e test job for Cloud Build (#184) (dc2990c) - Automatic changes to workloads when an AuthProxyWorload is deleted (#200) (e11caed) - Automatically trigger pod rollout for appsv1 resources when AuthProxyWorkload changes. (#197) (3b0359b) - Separate terraform for project setup and permissions (#179) (8f43657) - Validate AuthProxyWorkload spec.selector field (#209) (98c460b) - Validate AuthProxyWorkload updates to prevent changes to the workload selector. (#211) (4304283) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Release PR Generate Bot action release-please[bot] <release-please[bot]@users.noreply.github.com>
Adds a new field
RolloutStrategy
to the AuthProxyWorkload that will allow users to control howthe operator will roll out changes when an AuthProxyWorkload is updated.
RolloutStrategy
has two possible values:Workload
in which the operator will automatically follow the behavior of the Strategy set on the workload.None
in which the operator will not attempt to roll out changes