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

lib/resourcebuilder/apps: Explicit mode instead of 'Generation > 1' #401

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions lib/resourcebuilder/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type deploymentBuilder struct {
proxyGetter configv1.ProxiesGetter
raw []byte
modifier MetaV1ObjectModifierFunc
mode Mode
}

func newDeploymentBuilder(config *rest.Config, m lib.Manifest) Interface {
Expand All @@ -37,6 +38,7 @@ func newDeploymentBuilder(config *rest.Config, m lib.Manifest) Interface {
}

func (b *deploymentBuilder) WithMode(m Mode) Interface {
b.mode = m
return b
}

Expand Down Expand Up @@ -70,11 +72,11 @@ func (b *deploymentBuilder) Do(ctx context.Context) error {
}
}

actual, updated, err := resourceapply.ApplyDeployment(b.client, deployment)
_, updated, err := resourceapply.ApplyDeployment(b.client, deployment)
if err != nil {
return err
}
if updated && actual.Generation > 1 {
if updated && b.mode != InitializingMode {
return waitForDeploymentCompletion(ctx, b.client, deployment)
}
return nil
Expand Down Expand Up @@ -174,6 +176,7 @@ type daemonsetBuilder struct {
proxyGetter configv1.ProxiesGetter
raw []byte
modifier MetaV1ObjectModifierFunc
mode Mode
}

func newDaemonsetBuilder(config *rest.Config, m lib.Manifest) Interface {
Expand All @@ -185,6 +188,7 @@ func newDaemonsetBuilder(config *rest.Config, m lib.Manifest) Interface {
}

func (b *daemonsetBuilder) WithMode(m Mode) Interface {
b.mode = m
return b
}

Expand Down Expand Up @@ -218,11 +222,11 @@ func (b *daemonsetBuilder) Do(ctx context.Context) error {
}
}

actual, updated, err := resourceapply.ApplyDaemonSet(b.client, daemonset)
_, updated, err := resourceapply.ApplyDaemonSet(b.client, daemonset)
if err != nil {
return err
}
if updated && actual.Generation > 1 {
if updated && b.mode != InitializingMode {
return waitForDaemonsetRollout(ctx, b.client, daemonset)
}
return nil
Expand Down