Skip to content

Commit

Permalink
Update helm.go
Browse files Browse the repository at this point in the history
  • Loading branch information
dbw7 committed May 15, 2024
1 parent 5f6e022 commit f1a12d6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
## Bug Fixes

* [#429](https://github.com/suse-edge/edge-image-builder/issues/429) - Automatically set execute bit on scripts
* [#442](https://github.com/suse-edge/edge-image-builder/issues/442) - Only get images from specific Kubernetes objects

---

Expand Down
15 changes: 14 additions & 1 deletion pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"os/exec"
"path/filepath"
"slices"
"strings"

"github.com/suse-edge/edge-image-builder/pkg/fileio"
Expand Down Expand Up @@ -270,6 +271,15 @@ func templateCommand(chart, repository, version, valuesFilePath, kubeVersion, ta

func parseChartContents(chartContents string) ([]map[string]any, error) {
var resources []map[string]any
var k8sKinds = []string{
"Pod",
"Deployment",
"StatefulSet",
"DaemonSet",
"ReplicaSet",
"Job",
"CronJob",
}

for _, resource := range strings.Split(chartContents, "---\n") {
if resource == "" {
Expand All @@ -292,7 +302,10 @@ func parseChartContents(chartContents string) ([]map[string]any, error) {
return nil, fmt.Errorf("decoding resource from source '%s': %w", source, err)
}

resources = append(resources, r)
kind, _ := r["kind"].(string)
if slices.Contains(k8sKinds, kind) {
resources = append(resources, r)
}
}

return resources, nil
Expand Down

0 comments on commit f1a12d6

Please sign in to comment.