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

stack controller: watch for delete events #756

Merged
merged 4 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGELOG
=========

## Unreleased

- Stack Controller: watch for delete events. [#756](https://github.com/pulumi/pulumi-kubernetes-operator/pull/756)

## 2.0.0-beta.2 (2024-11-11)

- Improved support for using custom program sources. [#741](https://github.com/pulumi/pulumi-kubernetes-operator/pull/741)
Expand Down
2 changes: 2 additions & 0 deletions operator/internal/controller/auto/update_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"fmt"
"io"
"regexp"
"sort"
"time"

"github.com/go-logr/logr"
Expand Down Expand Up @@ -497,6 +498,7 @@ func outputsToSecret(owner *autov1alpha1.Update, outputs map[string]*agentpb.Out
secrets = append(secrets, k)
}
}
sort.Strings(secrets)

annotation, err := json.Marshal(secrets)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions operator/internal/controller/pulumi/stack_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (stackReadyPredicate) Create(e event.CreateEvent) bool {
}

func (stackReadyPredicate) Delete(_ event.DeleteEvent) bool {
return false
return true
}

func (stackReadyPredicate) Update(e event.UpdateEvent) bool {
Expand All @@ -393,7 +393,7 @@ func (stackReadyPredicate) Generic(_ event.GenericEvent) bool {
}

func isWorkspaceReady(ws *autov1alpha1.Workspace) bool {
if ws == nil || ws.Generation != ws.Status.ObservedGeneration {
if ws == nil || !ws.DeletionTimestamp.IsZero() || ws.Generation != ws.Status.ObservedGeneration {
return false
}
return meta.IsStatusConditionTrue(ws.Status.Conditions, autov1alpha1.WorkspaceReady)
Expand All @@ -408,7 +408,7 @@ func (workspaceReadyPredicate) Create(e event.CreateEvent) bool {
}

func (workspaceReadyPredicate) Delete(_ event.DeleteEvent) bool {
return false
return true
}

func (workspaceReadyPredicate) Update(e event.UpdateEvent) bool {
Expand Down Expand Up @@ -438,7 +438,7 @@ func (updateCompletePredicate) Create(e event.CreateEvent) bool {
}

func (updateCompletePredicate) Delete(e event.DeleteEvent) bool {
return false
return true
}

func (updateCompletePredicate) Update(e event.UpdateEvent) bool {
Expand Down