diff --git a/README.md b/README.md index 7510e98..d9d3ebb 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Tested with operator-sdk version: "v1.8.0". ```makefile HELMIFY = $(shell pwd)/bin/helmify helmify: - $(call go-get-tool,$(HELMIFY),github.com/arttor/helmify/cmd/helmify@v0.3.0) + $(call go-get-tool,$(HELMIFY),github.com/arttor/helmify/cmd/helmify@v0.3.2) helm: manifests kustomize helmify $(KUSTOMIZE) build config/default | $(HELMIFY) @@ -63,7 +63,7 @@ Unpack the helmify binary and add it to your PATH and you are good to go! Helmify takes a chart name for an argument. Usage: -```helmify [flags] CHART_NAME``` - `CHART_NAME` is optional. Default is 'chart'. +```helmify [flags] CHART_NAME``` - `CHART_NAME` is optional. Default is 'chart'. Can be a directory, e.g. 'deploy/charts/mychart'. | flag | description | sample | | --- | --- | --- | diff --git a/cmd/helmify/flags.go b/cmd/helmify/flags.go index b401998..b9a44f5 100644 --- a/cmd/helmify/flags.go +++ b/cmd/helmify/flags.go @@ -4,6 +4,7 @@ import ( "flag" "fmt" "os" + "path/filepath" "github.com/arttor/helmify/pkg/config" ) @@ -20,7 +21,7 @@ Example 3: 'awk 'FNR==1 && NR!=1 {print "---"}{print}' /my_directory/*.yaml | h - will create 'mychart' directory with Helm chart from all yaml files in my_directory directory. Usage: - helmify [flags] CHART_NAME - CHART_NAME is optional. Default is 'chart'. + helmify [flags] CHART_NAME - CHART_NAME is optional. Default is 'chart'. Can be a directory, e.g. 'deploy/charts/mychart'. Flags: ` @@ -44,6 +45,11 @@ func ReadFlags() config.Config { printVersion() os.Exit(0) } - result.ChartName = flag.Arg(0) + name := flag.Arg(0) + if name != "" { + result.ChartName = filepath.Base(name) + result.ChartDir = filepath.Dir(name) + } + return result } diff --git a/examples/app/templates/deployment.yaml b/examples/app/templates/deployment.yaml index 3c0c7f7..725a160 100644 --- a/examples/app/templates/deployment.yaml +++ b/examples/app/templates/deployment.yaml @@ -35,8 +35,8 @@ spec: secretKeyRef: key: VAR2 name: {{ include "app.fullname" . }}-secret-vars - image: {{ .Values.image.app.repository }}:{{ .Values.image.app.tag | default .Chart.AppVersion - }} + image: {{ .Values.app.app.image.repository }}:{{ .Values.app.app.image.tag | default + .Chart.AppVersion }} livenessProbe: httpGet: path: /healthz @@ -67,7 +67,7 @@ spec: - args: - --secure-listen-address=0.0.0.0:8443 - --v=10 - image: {{ .Values.image.proxySidecar.repository }}:{{ .Values.image.proxySidecar.tag + image: {{ .Values.app.proxySidecar.image.repository }}:{{ .Values.app.proxySidecar.image.tag | default .Chart.AppVersion }} name: proxy-sidecar ports: diff --git a/examples/app/values.yaml b/examples/app/values.yaml index a2bd4f0..d9532c7 100644 --- a/examples/app/values.yaml +++ b/examples/app/values.yaml @@ -1,5 +1,8 @@ app: app: + image: + repository: controller + tag: latest resources: limits: cpu: 100m @@ -7,6 +10,10 @@ app: requests: cpu: 100m memory: 20Mi + proxySidecar: + image: + repository: gcr.io/kubebuilder/kube-rbac-proxy + tag: v0.8.0 replicas: 3 appService: ports: @@ -30,13 +37,6 @@ configProps: myProp1: "1" myProp2: val 1 myProp3: "true" -image: - app: - repository: controller - tag: latest - proxySidecar: - repository: gcr.io/kubebuilder/kube-rbac-proxy - tag: v0.8.0 secretCa: caCrt: "" secretVars: diff --git a/examples/operator/templates/deployment.yaml b/examples/operator/templates/deployment.yaml index 40ffc18..40067e2 100644 --- a/examples/operator/templates/deployment.yaml +++ b/examples/operator/templates/deployment.yaml @@ -30,7 +30,7 @@ spec: - --upstream=http://127.0.0.1:8080/ - --logtostderr=true - --v=10 - image: {{ .Values.image.kubeRbacProxy.repository }}:{{ .Values.image.kubeRbacProxy.tag + image: {{ .Values.controllerManager.kubeRbacProxy.image.repository }}:{{ .Values.controllerManager.kubeRbacProxy.image.tag | default .Chart.AppVersion }} name: kube-rbac-proxy ports: @@ -49,8 +49,8 @@ spec: secretKeyRef: key: VAR1 name: {{ include "operator.fullname" . }}-secret-vars - image: {{ .Values.image.manager.repository }}:{{ .Values.image.manager.tag | default - .Chart.AppVersion }} + image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag + | default .Chart.AppVersion }} livenessProbe: httpGet: path: /healthz diff --git a/examples/operator/templates/secret-ca.yaml b/examples/operator/templates/secret-ca.yaml index db6d689..4dea868 100644 --- a/examples/operator/templates/secret-ca.yaml +++ b/examples/operator/templates/secret-ca.yaml @@ -5,5 +5,5 @@ metadata: labels: {{- include "operator.labels" . | nindent 4 }} data: - ca.crt: '{{ required "secret secretCa.caCrt is required" .Values.secretCa.caCrt - | b64enc }}' \ No newline at end of file + ca.crt: {{ required "secretCa.caCrt is required" .Values.secretCa.caCrt | b64enc + | quote }} \ No newline at end of file diff --git a/examples/operator/templates/secret-vars.yaml b/examples/operator/templates/secret-vars.yaml index f1f34e8..4f77653 100644 --- a/examples/operator/templates/secret-vars.yaml +++ b/examples/operator/templates/secret-vars.yaml @@ -5,7 +5,7 @@ metadata: labels: {{- include "operator.labels" . | nindent 4 }} data: - VAR1: '{{ required "secret secretVars.var1 is required" .Values.secretVars.var1 - | b64enc }}' - VAR2: '{{ required "secret secretVars.var2 is required" .Values.secretVars.var2 - | b64enc }}' \ No newline at end of file + VAR1: {{ required "secretVars.var1 is required" .Values.secretVars.var1 | b64enc + | quote }} + VAR2: {{ required "secretVars.var2 is required" .Values.secretVars.var2 | b64enc + | quote }} \ No newline at end of file diff --git a/examples/operator/values.yaml b/examples/operator/values.yaml index 4c47eb7..e27508b 100644 --- a/examples/operator/values.yaml +++ b/examples/operator/values.yaml @@ -1,5 +1,12 @@ controllerManager: + kubeRbacProxy: + image: + repository: gcr.io/kubebuilder/kube-rbac-proxy + tag: v0.8.0 manager: + image: + repository: controller + tag: latest resources: limits: cpu: 100m @@ -8,13 +15,6 @@ controllerManager: cpu: 100m memory: 20Mi replicas: 1 -image: - kubeRbacProxy: - repository: gcr.io/kubebuilder/kube-rbac-proxy - tag: v0.8.0 - manager: - repository: controller - tag: latest managerConfig: controllerManagerConfigYaml: health: diff --git a/pkg/app/app.go b/pkg/app/app.go index 956b9fa..3768176 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -2,12 +2,13 @@ package app import ( "context" - "github.com/arttor/helmify/pkg/processor" "io" "os" "os/signal" "syscall" + "github.com/arttor/helmify/pkg/processor" + "github.com/arttor/helmify/pkg/config" "github.com/arttor/helmify/pkg/decoder" "github.com/arttor/helmify/pkg/helm" diff --git a/pkg/app/context.go b/pkg/app/context.go index 69dfd11..8308840 100644 --- a/pkg/app/context.go +++ b/pkg/app/context.go @@ -67,7 +67,7 @@ func (c *appContext) CreateHelm(stop <-chan struct{}) error { default: } } - return c.output.Create(c.appMeta.ChartName(), templates) + return c.output.Create(c.config.ChartDir, c.config.ChartName, templates) } func (c *appContext) process(obj *unstructured.Unstructured) (helmify.Template, error) { diff --git a/pkg/config/config.go b/pkg/config/config.go index bfd1b0c..ae29bb4 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -11,8 +11,10 @@ const defaultChartName = "chart" // Config for Helmify application. type Config struct { - // ChartName overrides DefaultChartName. + // ChartName name of the Helm chart and its base directory where Chart.yaml is located. ChartName string + // ChartDir - optional path to chart dir. Full chart path will be: ChartDir/ChartName/Chart.yaml. + ChartDir string // Verbose set true to see WARN and INFO logs. Verbose bool // VeryVerbose set true to see WARN, INFO, and DEBUG logs. diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 56b6f87..74bcc32 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -1,8 +1,9 @@ package config import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestConfig_Validate(t *testing.T) { diff --git a/pkg/helm/chart.go b/pkg/helm/chart.go index 301aa8e..a9f68a7 100644 --- a/pkg/helm/chart.go +++ b/pkg/helm/chart.go @@ -1,13 +1,14 @@ package helm import ( - "github.com/arttor/helmify/pkg/helmify" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" "io/ioutil" "os" "path/filepath" + "github.com/arttor/helmify/pkg/helmify" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "sigs.k8s.io/yaml" ) @@ -26,8 +27,8 @@ type output struct{} // └── templates/ # The template files // └── _helpers.tp # Helm default template partials // Overwrites existing values.yaml and templates in templates dir on every run. -func (o output) Create(chartName string, templates []helmify.Template) error { - err := initChartDir(chartName) +func (o output) Create(chartDir, chartName string, templates []helmify.Template) error { + err := initChartDir(chartDir, chartName) if err != nil { return err } @@ -43,21 +44,22 @@ func (o output) Create(chartName string, templates []helmify.Template) error { return err } } + cDir := filepath.Join(chartDir, chartName) for filename, tpls := range files { - err = overwriteTemplateFile(filename, chartName, tpls) + err = overwriteTemplateFile(filename, cDir, tpls) if err != nil { return err } } - err = overwriteValuesFile(chartName, values) + err = overwriteValuesFile(cDir, values) if err != nil { return err } return nil } -func overwriteTemplateFile(filename, chartName string, templates []helmify.Template) error { - file := filepath.Join(chartName, "templates", filename) +func overwriteTemplateFile(filename, chartDir string, templates []helmify.Template) error { + file := filepath.Join(chartDir, "templates", filename) f, err := os.OpenFile(file, os.O_APPEND|os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { return errors.Wrap(err, "unable to open "+file) @@ -80,12 +82,12 @@ func overwriteTemplateFile(filename, chartName string, templates []helmify.Templ return nil } -func overwriteValuesFile(chartName string, values helmify.Values) error { +func overwriteValuesFile(chartDir string, values helmify.Values) error { res, err := yaml.Marshal(values) if err != nil { return errors.Wrap(err, "unable to write marshal values.yaml") } - file := filepath.Join(chartName, "values.yaml") + file := filepath.Join(chartDir, "values.yaml") err = ioutil.WriteFile(file, res, 0600) if err != nil { return errors.Wrap(err, "unable to write values.yaml") diff --git a/pkg/helm/init.go b/pkg/helm/init.go index a529baf..b9a0629 100644 --- a/pkg/helm/init.go +++ b/pkg/helm/init.go @@ -124,13 +124,14 @@ var chartName = regexp.MustCompile("^[a-zA-Z0-9._-]+$") const maxChartNameLength = 250 // initChartDir - creates Helm chart structure in chartName directory if not presented. -func initChartDir(chartName string) error { +func initChartDir(chartDir, chartName string) error { if err := validateChartName(chartName); err != nil { return err } - _, err := os.Stat(filepath.Join(chartName, "Chart.yaml")) + cDir := filepath.Join(chartDir, chartName) + _, err := os.Stat(filepath.Join(cDir, "Chart.yaml")) if os.IsNotExist(err) { - return createCommonFiles(chartName) + return createCommonFiles(chartDir, chartName) } logrus.Info("Skip creating Chart skeleton: Chart.yaml already exists.") return err @@ -146,8 +147,9 @@ func validateChartName(name string) error { return nil } -func createCommonFiles(chartName string) error { - err := os.MkdirAll(filepath.Join(chartName, "templates"), 0750) +func createCommonFiles(chartDir, chartName string) error { + cDir := filepath.Join(chartDir, chartName) + err := os.MkdirAll(filepath.Join(cDir, "templates"), 0750) if err != nil { return errors.Wrap(err, "unable create chart dir") } @@ -161,9 +163,9 @@ func createCommonFiles(chartName string) error { logrus.WithField("file", file).Info("created") } } - createFile(chartYAML(chartName), chartName, "Chart.yaml") - createFile([]byte(helmIgnore), chartName, ".helmignore") - createFile(helpersYAML(chartName), chartName, "templates", "_helpers.tpl") + createFile(chartYAML(chartName), cDir, "Chart.yaml") + createFile([]byte(helmIgnore), cDir, ".helmignore") + createFile(helpersYAML(chartName), cDir, "templates", "_helpers.tpl") return err } diff --git a/pkg/helmify/model.go b/pkg/helmify/model.go index 075b42a..b2b504c 100644 --- a/pkg/helmify/model.go +++ b/pkg/helmify/model.go @@ -2,6 +2,7 @@ package helmify import ( "io" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) @@ -25,7 +26,7 @@ type Template interface { // Output - converts Template into helm chart on disk. type Output interface { - Create(chartName string, templates []Template) error + Create(chartName, chartDir string, templates []Template) error } // AppMetadata handle common information about K8s objects in the chart. diff --git a/pkg/helmify/values.go b/pkg/helmify/values.go index 8dda45d..bd423c7 100644 --- a/pkg/helmify/values.go +++ b/pkg/helmify/values.go @@ -2,11 +2,12 @@ package helmify import ( "fmt" + "strings" + "github.com/iancoleman/strcase" "github.com/imdario/mergo" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "strings" ) // Values - represents helm template values.yaml. diff --git a/pkg/helmify/values_test.go b/pkg/helmify/values_test.go index ccce9bf..6d1c010 100644 --- a/pkg/helmify/values_test.go +++ b/pkg/helmify/values_test.go @@ -1,8 +1,9 @@ package helmify import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestValues_Add(t *testing.T) { diff --git a/pkg/metadata/metadata.go b/pkg/metadata/metadata.go index 6bd8653..fabd222 100644 --- a/pkg/metadata/metadata.go +++ b/pkg/metadata/metadata.go @@ -2,11 +2,12 @@ package metadata import ( "fmt" + "strings" + "github.com/arttor/helmify/pkg/helmify" "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" - "strings" ) const nameTeml = `{{ include "%s.fullname" . }}-%s` diff --git a/pkg/metadata/metadata_test.go b/pkg/metadata/metadata_test.go index 141152f..014d534 100644 --- a/pkg/metadata/metadata_test.go +++ b/pkg/metadata/metadata_test.go @@ -2,10 +2,11 @@ package metadata import ( "fmt" + "testing" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "testing" ) const res = `apiVersion: v1 diff --git a/pkg/processor/configmap/configmap.go b/pkg/processor/configmap/configmap.go index 674e864..e95bae7 100644 --- a/pkg/processor/configmap/configmap.go +++ b/pkg/processor/configmap/configmap.go @@ -2,11 +2,12 @@ package configmap import ( "fmt" - "github.com/arttor/helmify/pkg/processor" "io" "strings" "text/template" + "github.com/arttor/helmify/pkg/processor" + "github.com/arttor/helmify/pkg/helmify" yamlformat "github.com/arttor/helmify/pkg/yaml" "github.com/pkg/errors" diff --git a/pkg/processor/configmap/configmap_test.go b/pkg/processor/configmap/configmap_test.go index a9a267b..4b29dd6 100644 --- a/pkg/processor/configmap/configmap_test.go +++ b/pkg/processor/configmap/configmap_test.go @@ -1,9 +1,10 @@ package configmap import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/processor/crd/crd_test.go b/pkg/processor/crd/crd_test.go index c506364..24b4f62 100644 --- a/pkg/processor/crd/crd_test.go +++ b/pkg/processor/crd/crd_test.go @@ -1,9 +1,10 @@ package crd import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/processor/default.go b/pkg/processor/default.go index 9e0305a..b9ad42d 100644 --- a/pkg/processor/default.go +++ b/pkg/processor/default.go @@ -1,10 +1,11 @@ package processor import ( + "io" + "github.com/arttor/helmify/pkg/helmify" yamlformat "github.com/arttor/helmify/pkg/yaml" "github.com/sirupsen/logrus" - "io" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" ) diff --git a/pkg/processor/default_test.go b/pkg/processor/default_test.go index 705fc9b..e4e8f65 100644 --- a/pkg/processor/default_test.go +++ b/pkg/processor/default_test.go @@ -1,10 +1,11 @@ package processor import ( + "testing" + "github.com/arttor/helmify/internal" "github.com/arttor/helmify/pkg/metadata" "github.com/stretchr/testify/assert" - "testing" ) const pvcYaml = `apiVersion: v1 diff --git a/pkg/processor/deployment/deployment.go b/pkg/processor/deployment/deployment.go index 054e7d1..06aa841 100644 --- a/pkg/processor/deployment/deployment.go +++ b/pkg/processor/deployment/deployment.go @@ -2,11 +2,12 @@ package deployment import ( "fmt" - "github.com/arttor/helmify/pkg/processor" "io" "strings" "text/template" + "github.com/arttor/helmify/pkg/processor" + "github.com/arttor/helmify/pkg/helmify" yamlformat "github.com/arttor/helmify/pkg/yaml" "github.com/iancoleman/strcase" @@ -191,13 +192,13 @@ func processPodContainer(name string, appMeta helmify.AppMetadata, c corev1.Cont } repo, tag := c.Image[:index], c.Image[index+1:] containerName := strcase.ToLowerCamel(c.Name) - c.Image = fmt.Sprintf("{{ .Values.image.%[1]s.repository }}:{{ .Values.image.%[1]s.tag | default .Chart.AppVersion }}", containerName) + c.Image = fmt.Sprintf("{{ .Values.%[1]s.%[2]s.image.repository }}:{{ .Values.%[1]s.%[2]s.image.tag | default .Chart.AppVersion }}", name, containerName) - err := unstructured.SetNestedField(*values, repo, "image", containerName, "repository") + err := unstructured.SetNestedField(*values, repo, name, containerName, "image", "repository") if err != nil { return c, errors.Wrap(err, "unable to set deployment value field") } - err = unstructured.SetNestedField(*values, tag, "image", containerName, "tag") + err = unstructured.SetNestedField(*values, tag, name, containerName, "image", "tag") if err != nil { return c, errors.Wrap(err, "unable to set deployment value field") } diff --git a/pkg/processor/deployment/deployment_test.go b/pkg/processor/deployment/deployment_test.go index 567b481..965c085 100644 --- a/pkg/processor/deployment/deployment_test.go +++ b/pkg/processor/deployment/deployment_test.go @@ -1,9 +1,10 @@ package deployment import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/processor/meta.go b/pkg/processor/meta.go index ab4ba34..2f7c966 100644 --- a/pkg/processor/meta.go +++ b/pkg/processor/meta.go @@ -2,9 +2,10 @@ package processor import ( "fmt" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "strings" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "github.com/arttor/helmify/pkg/helmify" yamlformat "github.com/arttor/helmify/pkg/yaml" ) diff --git a/pkg/processor/meta_test.go b/pkg/processor/meta_test.go index de7982b..544cb52 100644 --- a/pkg/processor/meta_test.go +++ b/pkg/processor/meta_test.go @@ -1,10 +1,11 @@ package processor import ( + "testing" + "github.com/arttor/helmify/internal" "github.com/arttor/helmify/pkg/metadata" "github.com/stretchr/testify/assert" - "testing" ) func TestProcessObjMeta(t *testing.T) { diff --git a/pkg/processor/rbac/clusterrolebinding.go b/pkg/processor/rbac/clusterrolebinding.go index 89c48a2..81f8f90 100644 --- a/pkg/processor/rbac/clusterrolebinding.go +++ b/pkg/processor/rbac/clusterrolebinding.go @@ -1,11 +1,12 @@ package rbac import ( - "github.com/arttor/helmify/pkg/processor" "io" "strings" "text/template" + "github.com/arttor/helmify/pkg/processor" + "github.com/arttor/helmify/pkg/helmify" yamlformat "github.com/arttor/helmify/pkg/yaml" "github.com/pkg/errors" diff --git a/pkg/processor/rbac/clusterrolebinding_test.go b/pkg/processor/rbac/clusterrolebinding_test.go index 6b502be..2287b12 100644 --- a/pkg/processor/rbac/clusterrolebinding_test.go +++ b/pkg/processor/rbac/clusterrolebinding_test.go @@ -1,9 +1,10 @@ package rbac import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/processor/rbac/role.go b/pkg/processor/rbac/role.go index 81ee0c4..bd4455e 100644 --- a/pkg/processor/rbac/role.go +++ b/pkg/processor/rbac/role.go @@ -1,11 +1,12 @@ package rbac import ( - "github.com/arttor/helmify/pkg/processor" "io" "strings" "text/template" + "github.com/arttor/helmify/pkg/processor" + "github.com/arttor/helmify/pkg/helmify" yamlformat "github.com/arttor/helmify/pkg/yaml" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" diff --git a/pkg/processor/rbac/role_test.go b/pkg/processor/rbac/role_test.go index 1380bb6..7a3399a 100644 --- a/pkg/processor/rbac/role_test.go +++ b/pkg/processor/rbac/role_test.go @@ -1,9 +1,10 @@ package rbac import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/processor/rbac/rolebinding.go b/pkg/processor/rbac/rolebinding.go index 8da0676..dc7eb47 100644 --- a/pkg/processor/rbac/rolebinding.go +++ b/pkg/processor/rbac/rolebinding.go @@ -1,11 +1,12 @@ package rbac import ( - "github.com/arttor/helmify/pkg/processor" "io" "strings" "text/template" + "github.com/arttor/helmify/pkg/processor" + "github.com/arttor/helmify/pkg/helmify" yamlformat "github.com/arttor/helmify/pkg/yaml" "github.com/pkg/errors" diff --git a/pkg/processor/rbac/rolebinding_test.go b/pkg/processor/rbac/rolebinding_test.go index d8c1270..e068e15 100644 --- a/pkg/processor/rbac/rolebinding_test.go +++ b/pkg/processor/rbac/rolebinding_test.go @@ -1,9 +1,10 @@ package rbac import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/processor/rbac/serviceaccount.go b/pkg/processor/rbac/serviceaccount.go index 79b9870..c7d395f 100644 --- a/pkg/processor/rbac/serviceaccount.go +++ b/pkg/processor/rbac/serviceaccount.go @@ -1,9 +1,10 @@ package rbac import ( + "io" + "github.com/arttor/helmify/pkg/helmify" "github.com/arttor/helmify/pkg/processor" - "io" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" ) diff --git a/pkg/processor/rbac/serviceaccount_test.go b/pkg/processor/rbac/serviceaccount_test.go index da84924..e2939c4 100644 --- a/pkg/processor/rbac/serviceaccount_test.go +++ b/pkg/processor/rbac/serviceaccount_test.go @@ -1,9 +1,10 @@ package rbac import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/processor/secret/secret.go b/pkg/processor/secret/secret.go index f17ac64..6bd3af2 100644 --- a/pkg/processor/secret/secret.go +++ b/pkg/processor/secret/secret.go @@ -1,11 +1,12 @@ package secret import ( - "github.com/arttor/helmify/pkg/processor" "io" "strings" "text/template" + "github.com/arttor/helmify/pkg/processor" + "github.com/arttor/helmify/pkg/helmify" yamlformat "github.com/arttor/helmify/pkg/yaml" "github.com/iancoleman/strcase" diff --git a/pkg/processor/secret/secret_test.go b/pkg/processor/secret/secret_test.go index 80c56bd..664de5d 100644 --- a/pkg/processor/secret/secret_test.go +++ b/pkg/processor/secret/secret_test.go @@ -1,9 +1,10 @@ package secret import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/processor/service/service.go b/pkg/processor/service/service.go index 74b4056..72557f1 100644 --- a/pkg/processor/service/service.go +++ b/pkg/processor/service/service.go @@ -3,10 +3,11 @@ package service import ( "bytes" "fmt" - "github.com/arttor/helmify/pkg/processor" "io" "strings" + "github.com/arttor/helmify/pkg/processor" + "github.com/arttor/helmify/pkg/helmify" yamlformat "github.com/arttor/helmify/pkg/yaml" "github.com/iancoleman/strcase" diff --git a/pkg/processor/service/service_test.go b/pkg/processor/service/service_test.go index 7c8489e..fd310f4 100644 --- a/pkg/processor/service/service_test.go +++ b/pkg/processor/service/service_test.go @@ -1,9 +1,10 @@ package service import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/processor/webhook/cert_test.go b/pkg/processor/webhook/cert_test.go index e28a8b9..3767192 100644 --- a/pkg/processor/webhook/cert_test.go +++ b/pkg/processor/webhook/cert_test.go @@ -1,9 +1,10 @@ package webhook import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/processor/webhook/issuer.go b/pkg/processor/webhook/issuer.go index 464b32e..ad3ff21 100644 --- a/pkg/processor/webhook/issuer.go +++ b/pkg/processor/webhook/issuer.go @@ -3,9 +3,10 @@ package webhook import ( "bytes" "fmt" + "io" + "github.com/arttor/helmify/pkg/helmify" yamlformat "github.com/arttor/helmify/pkg/yaml" - "io" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "sigs.k8s.io/yaml" diff --git a/pkg/processor/webhook/issuer_test.go b/pkg/processor/webhook/issuer_test.go index fd3c8ec..71bb7ff 100644 --- a/pkg/processor/webhook/issuer_test.go +++ b/pkg/processor/webhook/issuer_test.go @@ -1,9 +1,10 @@ package webhook import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/processor/webhook/webhook_test.go b/pkg/processor/webhook/webhook_test.go index c91ee62..857cd04 100644 --- a/pkg/processor/webhook/webhook_test.go +++ b/pkg/processor/webhook/webhook_test.go @@ -1,9 +1,10 @@ package webhook import ( - "github.com/arttor/helmify/pkg/metadata" "testing" + "github.com/arttor/helmify/pkg/metadata" + "github.com/arttor/helmify/internal" "github.com/stretchr/testify/assert" ) diff --git a/pkg/yaml/yaml.go b/pkg/yaml/yaml.go index 45a392e..e8012e1 100644 --- a/pkg/yaml/yaml.go +++ b/pkg/yaml/yaml.go @@ -2,6 +2,7 @@ package yaml import ( "bytes" + "sigs.k8s.io/yaml" )