Skip to content

Commit

Permalink
ssa in zarf
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Abro <[email protected]>
  • Loading branch information
AustinAbro321 committed Oct 18, 2024
1 parent 71eb153 commit 7c38c13
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/internal/packager/helm/post-render.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package helm
import (
"bytes"
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -53,7 +54,18 @@ func (h *Helm) newRenderer(ctx context.Context) (*renderer, error) {
if kerrors.IsNotFound(err) {
rend.namespaces[h.chart.Namespace] = cluster.NewZarfManagedNamespace(h.chart.Namespace)
} else if h.cfg.DeployOpts.AdoptExistingResources {
namespace.Labels[cluster.ZarfManagedByLabel] = "zarf"
// Need to make sure this path is tested
b, err := json.Marshal(namespace)
if err != nil {
return nil, err
}
nsAc := &v1ac.NamespaceApplyConfiguration{}
err = json.Unmarshal(b, nsAc)
if err != nil {
return nil, err
}
nsAc.WithLabels(cluster.AdoptZarfManagedLabels(nsAc.Labels))
rend.namespaces[h.chart.Namespace] = nsAc
}

return rend, nil
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/cluster/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/avast/retry-go/v4"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1ac "k8s.io/client-go/applyconfigurations/core/v1"

"github.com/zarf-dev/zarf/src/pkg/message"
v1ac "k8s.io/client-go/applyconfigurations/core/v1"
)

// DeleteZarfNamespace deletes the Zarf namespace from the connected cluster.
Expand Down

0 comments on commit 7c38c13

Please sign in to comment.