1+ // Copyright (c) 2024 Parseable, Inc
2+ //
3+ // This program is free software: you can redistribute it and/or modify
4+ // it under the terms of the GNU Affero General Public License as published by
5+ // the Free Software Foundation, either version 3 of the License, or
6+ // (at your option) any later version.
7+ //
8+ // This program is distributed in the hope that it will be useful
9+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ // GNU Affero General Public License for more details.
12+ //
13+ // You should have received a copy of the GNU Affero General Public License
14+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
116package helm
217
318import (
@@ -40,15 +55,14 @@ func ListReleases(namespace string) ([]*release.Release, error) {
4055 }
4156
4257 client := action .NewList (actionConfig )
43- //client.Deployed = true
58+ // client.Deployed = true
4459
4560 return client .Run ()
4661}
4762
4863// Apply applies a Helm chart using the provided Helm struct configuration.
4964// It returns an error if any operation fails, otherwise, it returns nil.
5065func Apply (h Helm , verbose bool ) error {
51-
5266 // Create a logger that does nothing by default
5367 silentLogger := func (_ string , _ ... interface {}) {}
5468
@@ -82,7 +96,7 @@ func Apply(h Helm, verbose bool) error {
8296 // Add repository
8397 repoAdd (h )
8498
85- //RepoUpdate()
99+ // RepoUpdate()
86100
87101 // Locate chart path
88102 cp , err := client .ChartPathOptions .LocateChart (fmt .Sprintf ("%s/%s" , h .RepoName , h .ChartName ), settings )
@@ -104,7 +118,7 @@ func Apply(h Helm, verbose bool) error {
104118 client .Wait = true
105119 client .Timeout = 300 * time .Second
106120 client .WaitForJobs = true
107- //client.IncludeCRDs = true
121+ // client.IncludeCRDs = true
108122
109123 // Merge values
110124 values := values.Options {
@@ -132,7 +146,7 @@ func repoAdd(h Helm) error {
132146 // Get the repository file path
133147 repoFile := settings .RepositoryConfig
134148
135- //Ensure the file directory exists as it is required for file locking
149+ // Ensure the file directory exists as it is required for file locking
136150 err := os .MkdirAll (filepath .Dir (repoFile ), os .ModePerm )
137151 if err != nil && ! os .IsExist (err ) {
138152 return err
@@ -200,7 +214,7 @@ func repoAdd(h Helm) error {
200214 f .Update (& c )
201215
202216 // Write the updated repository file
203- if err := f .WriteFile (repoFile , 0644 ); err != nil {
217+ if err := f .WriteFile (repoFile , 0o644 ); err != nil {
204218 return err
205219 }
206220 return nil
@@ -294,7 +308,6 @@ func DeleteRelease(chartName, namespace string) error {
294308}
295309
296310func Upgrade (h Helm ) error {
297-
298311 settings := cli .New ()
299312
300313 // Initialize action configuration
@@ -311,7 +324,7 @@ func Upgrade(h Helm) error {
311324 // Add repository
312325 repoAdd (h )
313326
314- //RepoUpdate()
327+ // RepoUpdate()
315328
316329 // Locate chart path
317330 cp , err := client .ChartPathOptions .LocateChart (fmt .Sprintf ("%s/%s" , h .RepoName , h .ChartName ), settings )
@@ -332,7 +345,7 @@ func Upgrade(h Helm) error {
332345 client .Wait = true
333346 client .Timeout = 300 * time .Second
334347 client .WaitForJobs = true
335- //client.IncludeCRDs = true
348+ // client.IncludeCRDs = true
336349
337350 // Merge values
338351 values := values.Options {
@@ -352,7 +365,6 @@ func Upgrade(h Helm) error {
352365}
353366
354367func Uninstall (h Helm , verbose bool ) (* release.UninstallReleaseResponse , error ) {
355-
356368 // Create a logger that does nothing by default
357369 silentLogger := func (_ string , _ ... interface {}) {}
358370
0 commit comments