Skip to content

Commit

Permalink
Fix namespace create update
Browse files Browse the repository at this point in the history
  • Loading branch information
phillebaba committed Jun 3, 2024
1 parent 0b9b098 commit a22a7ad
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/pkg/packager/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"time"

corev1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/defenseunicorns/pkg/helpers"
Expand Down Expand Up @@ -454,7 +455,17 @@ func (p *Packager) setupState(ctx context.Context) (err error) {
// Try to create the zarf namespace
spinner.Updatef("Creating the Zarf namespace")
zarfNamespace := cluster.NewZarfManagedNamespace(cluster.ZarfNamespaceName)
_, err := p.cluster.Clientset.CoreV1().Namespaces().Create(ctx, zarfNamespace, metav1.CreateOptions{})
err := func() error {
_, err := p.cluster.Clientset.CoreV1().Namespaces().Create(ctx, zarfNamespace, metav1.CreateOptions{})
if err != nil && !kerrors.IsAlreadyExists(err) {
return err
}
_, err = p.cluster.Clientset.CoreV1().Namespaces().Update(ctx, zarfNamespace, metav1.UpdateOptions{})
if err != nil {
return err
}
return nil
}()
if err != nil {
spinner.Fatalf(err, "Unable to create the zarf namespace")
}
Expand Down

0 comments on commit a22a7ad

Please sign in to comment.