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

feat(helm): add support for helm capabilities #48

Merged
merged 1 commit into from
Aug 13, 2023
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
18 changes: 11 additions & 7 deletions internal/myks/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package myks
import (
"errors"
"fmt"
"github.com/rs/zerolog/log"
yaml "gopkg.in/yaml.v3"
"io"
"os"
"path/filepath"

"github.com/rs/zerolog/log"
yaml "gopkg.in/yaml.v3"
)

const (
Expand Down Expand Up @@ -35,13 +36,16 @@ type Application struct {
}

type HelmConfig struct {
Namespace string `yaml:"namespace"`
KubeVersion string `yaml:"kubeVersion"`
IncludeCRDs bool `yaml:"includeCRDs"`
Namespace string `yaml:"namespace"`
KubeVersion string `yaml:"kubeVersion"`
IncludeCRDs bool `yaml:"includeCRDs"`
Capabilities []string `yaml:"capabilities"`
}

var ErrNoVendirConfig = errors.New("no vendir config found")
var ApplicationLogFormat = "\033[1m[%s > %s > %s]\033[0m %s"
var (
ErrNoVendirConfig = errors.New("no vendir config found")
ApplicationLogFormat = "\033[1m[%s > %s > %s]\033[0m %s"
)

func NewApplication(e *Environment, name string, prototypeName string) (*Application, error) {
if prototypeName == "" {
Expand Down
4 changes: 4 additions & 0 deletions internal/myks/assets/data-schema.ytt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ helm:
#! Used by myks.
#! If defined, passed as a value of `--namespace` for `helm template`.
namespace: ""
#! Used by myks.
#! If defined, passed as `--api-version` for `helm-template`.
capabilities:
- "" #! e.g. "monitoring.coreos.com/v1"
#! Myks configuration and runtime data.
myks:
applicationDataFileName: ""
Expand Down
3 changes: 3 additions & 0 deletions internal/myks/render_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ func (h *Helm) Render(_ string) (string, error) {
commonHelmArgs = append(commonHelmArgs, "--include-crds")
}

for _, capa := range helmConfig.Capabilities {
commonHelmArgs = append(commonHelmArgs, "--api-versions", capa)
}
var outputs []string

for _, chartDir := range chartDirs {
Expand Down