Skip to content

Commit

Permalink
fix: avoid trying to delete default namespace (#265)
Browse files Browse the repository at this point in the history
Deleting the `default` namespace is impossible because Kubernetes API
will block it. Still, it's generated an error in the Kardinal manager,
so we avoid sending the request to the API.
  • Loading branch information
leoporoli authored Oct 3, 2024
1 parent 64bdab1 commit 907ad38
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,4 @@ kardinal flow telepresence-intercept {{flow-id}} {{service-name}} {{local-port}}
- Ask questions and get help in our community [forum](https://discuss.kardinal.dev).
- Read our [blog](https://blog.kardinal.dev/) for tips from developers and creators.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const (
// TODO move these values to a shared library between Kardinal Manager, Kontrol and Kardinal CLI
kardinalLabelKey = "kardinal.dev"
enabledKardinal = "enabled"

defaultNamespace = "default"
)

var (
Expand Down Expand Up @@ -428,6 +430,11 @@ func (manager *ClusterManager) removeKardinalNamespaces(ctx context.Context) err
}

for _, namespace := range kardinalNamespaces.Items {

if namespace.GetName() == defaultNamespace {
continue
}

if err := manager.removeNamespace(ctx, &namespace); err != nil {
return stacktrace.Propagate(err, "an error occurred while removing Kardinal namespace '%s'", namespace.GetName())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import (
"testing"
)

const (
defaultNamespace = "default"
)

func TestClusterManager_GetVirtualServices(t *testing.T) {
ctx := context.Background()
clusterManager, err := getClusterManagerForTesting(t)
Expand Down

0 comments on commit 907ad38

Please sign in to comment.