Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nikimanoledaki committed Feb 16, 2022
1 parent c1633cd commit e54bb98
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/helm/releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import (
sourcev1beta1 "github.com/fluxcd/source-controller/api/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
apimachinery "k8s.io/apimachinery/pkg/util/yaml"
k8syaml "k8s.io/apimachinery/pkg/util/yaml"
kyaml "sigs.k8s.io/yaml"
)

const DefaultBufferSize = 2048

// MakeHelmRelease returns a HelmRelease object given a name, version, cluster, namespace, and HelmRepository's name and namespace.
func MakeHelmRelease(name, version, cluster, namespace string, helmRepository types.NamespacedName) *helmv2beta1.HelmRelease {
return &helmv2beta1.HelmRelease{
Expand Down Expand Up @@ -44,7 +46,8 @@ func MakeHelmRelease(name, version, cluster, namespace string, helmRepository ty
}
}

// AppendHelmReleaseToString appends a HelmRelease to a string.
// AppendHelmReleaseToString appends "---" and a HelmRelease to string that may or may not be empty.
// This creates the content of a manifest that contains HelmReleases separated by "---".
func AppendHelmReleaseToString(content string, newRelease *helmv2beta1.HelmRelease) (string, error) {
var sb strings.Builder
if content != "" {
Expand All @@ -65,7 +68,7 @@ func AppendHelmReleaseToString(content string, newRelease *helmv2beta1.HelmRelea
func SplitHelmReleaseYAML(resources []byte) ([]*helmv2beta1.HelmRelease, error) {
var helmReleaseList []*helmv2beta1.HelmRelease

decoder := apimachinery.NewYAMLOrJSONDecoder(bytes.NewReader(resources), 100000000)
decoder := k8syaml.NewYAMLOrJSONDecoder(bytes.NewReader(resources), DefaultBufferSize)

for {
var value helmv2beta1.HelmRelease
Expand Down

0 comments on commit e54bb98

Please sign in to comment.