Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
pull/13301/head
Nathan Baulch 3 months ago
parent 3a3e3846ca
commit ff9dd262e3
No known key found for this signature in database

@ -230,7 +230,7 @@ func checkForExpiredRepos(repofile string) {
} }
// parse repo file. // parse repo file.
// Ignore the error because it is okay for a repo file to be unparseable at this // Ignore the error because it is okay for a repo file to be unparsable at this
// stage. Later checks will trap the error and respond accordingly. // stage. Later checks will trap the error and respond accordingly.
repoFile, err := repo.LoadFile(repofile) repoFile, err := repo.LoadFile(repofile)
if err != nil { if err != nil {

@ -55,7 +55,7 @@ import (
"helm.sh/helm/v3/pkg/storage/driver" "helm.sh/helm/v3/pkg/storage/driver"
) )
// NOTESFILE_SUFFIX that we want to treat special. It goes through the templating engine // notesFileSuffix that we want to treat special. It goes through the templating engine
// but it's not a yaml file (resource) hence can't have hooks, etc. And the user actually // but it's not a yaml file (resource) hence can't have hooks, etc. And the user actually
// wants to see this file after rendering in the status command. However, it must be a suffix // wants to see this file after rendering in the status command. However, it must be a suffix
// since there can be filepath in front of it. // since there can be filepath in front of it.
@ -307,7 +307,7 @@ func (i *Install) RunWithContext(ctx context.Context, chrt *chart.Chart, vals ma
} }
if driver.ContainsSystemLabels(i.Labels) { if driver.ContainsSystemLabels(i.Labels) {
return nil, fmt.Errorf("user suplied labels contains system reserved label name. System labels: %+v", driver.GetSystemLabels()) return nil, fmt.Errorf("user supplied labels contains system reserved label name. System labels: %+v", driver.GetSystemLabels())
} }
rel := i.createRelease(chrt, vals, i.Labels) rel := i.createRelease(chrt, vals, i.Labels)
@ -389,7 +389,7 @@ func (i *Install) RunWithContext(ctx context.Context, chrt *chart.Chart, vals ma
} }
} }
// If Replace is true, we need to supercede the last release. // If Replace is true, we need to supersede the last release.
if i.Replace { if i.Replace {
if err := i.replaceRelease(rel); err != nil { if err := i.replaceRelease(rel); err != nil {
return nil, err return nil, err
@ -631,7 +631,7 @@ func createOrOpenFile(filename string, append bool) (*os.File, error) {
return os.Create(filename) return os.Create(filename)
} }
// check if the directory exists to create file. creates if don't exists // check if the directory exists to create file. creates if don't exist
func ensureDirectoryForFile(file string) error { func ensureDirectoryForFile(file string) error {
baseDir := path.Dir(file) baseDir := path.Dir(file)
_, err := os.Stat(baseDir) _, err := os.Stat(baseDir)

@ -469,8 +469,8 @@ func TestInstallRelease_Atomic(t *testing.T) {
failer.WaitError = fmt.Errorf("I timed out") failer.WaitError = fmt.Errorf("I timed out")
instAction.cfg.KubeClient = failer instAction.cfg.KubeClient = failer
instAction.Atomic = true instAction.Atomic = true
// disabling hooks to avoid an early fail when the // disabling hooks to avoid an early fail when
// the WaitForDelete is called on the pre-delete hook execution // WaitForDelete is called on the pre-delete hook execution
instAction.DisableHooks = true instAction.DisableHooks = true
vals := map[string]interface{}{} vals := map[string]interface{}{}
@ -479,7 +479,7 @@ func TestInstallRelease_Atomic(t *testing.T) {
is.Contains(err.Error(), "I timed out") is.Contains(err.Error(), "I timed out")
is.Contains(err.Error(), "atomic") is.Contains(err.Error(), "atomic")
// Now make sure it isn't in storage any more // Now make sure it isn't in storage anymore
_, err = instAction.cfg.Releases.Get(res.Name, res.Version) _, err = instAction.cfg.Releases.Get(res.Name, res.Version)
is.Error(err) is.Error(err)
is.Equal(err, driver.ErrReleaseNotFound) is.Equal(err, driver.ErrReleaseNotFound)
@ -522,7 +522,7 @@ func TestInstallRelease_Atomic_Interrupted(t *testing.T) {
is.Contains(err.Error(), "atomic") is.Contains(err.Error(), "atomic")
is.Contains(err.Error(), "uninstalled") is.Contains(err.Error(), "uninstalled")
// Now make sure it isn't in storage any more // Now make sure it isn't in storage anymore
_, err = instAction.cfg.Releases.Get(res.Name, res.Version) _, err = instAction.cfg.Releases.Get(res.Name, res.Version)
is.Error(err) is.Error(err)
is.Equal(err, driver.ErrReleaseNotFound) is.Equal(err, driver.ErrReleaseNotFound)
@ -796,5 +796,5 @@ func TestInstallWithSystemLabels(t *testing.T) {
t.Fatal("expected an error") t.Fatal("expected an error")
} }
is.Equal(fmt.Errorf("user suplied labels contains system reserved label name. System labels: %+v", driver.GetSystemLabels()), err) is.Equal(fmt.Errorf("user supplied labels contains system reserved label name. System labels: %+v", driver.GetSystemLabels()), err)
} }

@ -279,7 +279,7 @@ func (u *Upgrade) prepareUpgrade(name string, chart *chart.Chart, vals map[strin
} }
if driver.ContainsSystemLabels(u.Labels) { if driver.ContainsSystemLabels(u.Labels) {
return nil, nil, fmt.Errorf("user suplied labels contains system reserved label name. System labels: %+v", driver.GetSystemLabels()) return nil, nil, fmt.Errorf("user supplied labels contains system reserved label name. System labels: %+v", driver.GetSystemLabels())
} }
// Store an upgraded release. // Store an upgraded release.

@ -533,7 +533,7 @@ func TestUpgradeRelease_SystemLabels(t *testing.T) {
t.Fatal("expected an error") t.Fatal("expected an error")
} }
is.Equal(fmt.Errorf("user suplied labels contains system reserved label name. System labels: %+v", driver.GetSystemLabels()), err) is.Equal(fmt.Errorf("user supplied labels contains system reserved label name. System labels: %+v", driver.GetSystemLabels()), err)
} }
func TestUpgradeRelease_DryRun(t *testing.T) { func TestUpgradeRelease_DryRun(t *testing.T) {

@ -64,7 +64,7 @@ func TestExpand(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
// os.Stat can return different values for directories, based on the OS // os.Stat can return different values for directories, based on the OS
// for Linux, for example, os.Stat alwaty returns the size of the directory // for Linux, for example, os.Stat always returns the size of the directory
// (value-4096) regardless of the size of the contents of the directory // (value-4096) regardless of the size of the contents of the directory
mode := expect.Mode() mode := expect.Mode()
if !mode.IsDir() { if !mode.IsDir() {
@ -112,7 +112,7 @@ func TestExpandFile(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
// os.Stat can return different values for directories, based on the OS // os.Stat can return different values for directories, based on the OS
// for Linux, for example, os.Stat alwaty returns the size of the directory // for Linux, for example, os.Stat always returns the size of the directory
// (value-4096) regardless of the size of the contents of the directory // (value-4096) regardless of the size of the contents of the directory
mode := expect.Mode() mode := expect.Mode()
if !mode.IsDir() { if !mode.IsDir() {

@ -173,7 +173,7 @@ func (m *Manager) Update() error {
// has some information about them and, when possible, the index files // has some information about them and, when possible, the index files
// locally. // locally.
// TODO(mattfarina): Repositories should be explicitly added by end users // TODO(mattfarina): Repositories should be explicitly added by end users
// rather than automattic. In Helm v4 require users to add repositories. They // rather than automatic. In Helm v4 require users to add repositories. They
// should have to add them in order to make sure they are aware of the // should have to add them in order to make sure they are aware of the
// repositories and opt-in to any locations, for security. // repositories and opt-in to any locations, for security.
repoNames, err = m.ensureMissingRepos(repoNames, req) repoNames, err = m.ensureMissingRepos(repoNames, req)

@ -169,7 +169,7 @@ func tplFun(parent *template.Template, includedNames map[string]int, strict bool
}) })
// We need a .New template, as template text which is just blanks // We need a .New template, as template text which is just blanks
// or comments after parsing out defines just addes new named // or comments after parsing out defines just adds new named
// template definitions without changing the main template. // template definitions without changing the main template.
// https://pkg.go.dev/text/template#Template.Parse // https://pkg.go.dev/text/template#Template.Parse
// Use the parent's name for lack of a better way to identify the tpl // Use the parent's name for lack of a better way to identify the tpl

@ -131,7 +131,7 @@ func getAPIResourceForGVK(gvk schema.GroupVersionKind, config *rest.Config) (met
return res, err return res, err
} }
for _, resource := range resList.APIResources { for _, resource := range resList.APIResources {
// if a resource contains a "/" it's referencing a subresource. we don't support suberesource for now. // if a resource contains a "/" it's referencing a subresource. we don't support subresource for now.
if resource.Kind == gvk.Kind && !strings.Contains(resource.Name, "/") { if resource.Kind == gvk.Kind && !strings.Contains(resource.Name, "/") {
res = resource res = resource
res.Group = gvk.Group res.Group = gvk.Group

@ -123,7 +123,7 @@ func (c *Client) getKubeClient() (*kubernetes.Clientset, error) {
func (c *Client) IsReachable() error { func (c *Client) IsReachable() error {
client, err := c.getKubeClient() client, err := c.getKubeClient()
if err == genericclioptions.ErrEmptyConfig { if err == genericclioptions.ErrEmptyConfig {
// re-replace kubernetes ErrEmptyConfig error with a friendy error // re-replace kubernetes ErrEmptyConfig error with a friendly error
// moar workarounds for Kubernetes API breaking. // moar workarounds for Kubernetes API breaking.
return errors.New("Kubernetes cluster unreachable") return errors.New("Kubernetes cluster unreachable")
} }

@ -426,7 +426,7 @@ func (c *ReadyChecker) statefulSetReady(sts *appsv1.StatefulSet) bool {
return false return false
} }
// This check only makes sense when all partitions are being upgraded otherwise during a // This check only makes sense when all partitions are being upgraded otherwise during a
// partioned rolling upgrade, this condition will never evaluate to true, leading to // partitioned rolling upgrade, this condition will never evaluate to true, leading to
// error. // error.
if partition == 0 && sts.Status.CurrentRevision != sts.Status.UpdateRevision { if partition == 0 && sts.Status.CurrentRevision != sts.Status.UpdateRevision {
c.log("StatefulSet is not ready: %s/%s. currentRevision %s does not yet match updateRevision %s", sts.Namespace, sts.Name, sts.Status.CurrentRevision, sts.Status.UpdateRevision) c.log("StatefulSet is not ready: %s/%s. currentRevision %s does not yet match updateRevision %s", sts.Namespace, sts.Name, sts.Status.CurrentRevision, sts.Status.UpdateRevision)

@ -305,7 +305,7 @@ func TestFindChartInAuthAndTLSAndPassRepoURL(t *testing.T) {
t.Errorf("%s is not the valid URL", chartURL) t.Errorf("%s is not the valid URL", chartURL)
} }
// If the insecureSkipTLsverify is false, it will return an error that contains "x509: certificate signed by unknown authority". // If the insecureSkipTLSVerify is false, it will return an error that contains "x509: certificate signed by unknown authority".
_, err = FindChartInAuthAndTLSAndPassRepoURL(srv.URL, "", "", "nginx", "0.1.0", "", "", "", false, false, getter.All(&cli.EnvSettings{})) _, err = FindChartInAuthAndTLSAndPassRepoURL(srv.URL, "", "", "nginx", "0.1.0", "", "", "", false, false, getter.All(&cli.EnvSettings{}))
// Go communicates with the platform and different platforms return different messages. Go itself tests darwin // Go communicates with the platform and different platforms return different messages. Go itself tests darwin
// differently for its message. On newer versions of Darwin the message includes the "Acme Co" portion while older // differently for its message. On newer versions of Darwin the message includes the "Acme Co" portion while older

@ -397,7 +397,7 @@ func jsonOrYamlUnmarshal(b []byte, i interface{}) error {
// the error isn't important for index loading // the error isn't important for index loading
// //
// In particular, charts may introduce validations that don't impact repository indexes // In particular, charts may introduce validations that don't impact repository indexes
// And repository indexes may be generated by older/non-complient software, which doesn't // And repository indexes may be generated by older/non-compliant software, which doesn't
// conform to all validations. // conform to all validations.
func ignoreSkippableChartValidationError(err error) error { func ignoreSkippableChartValidationError(err error) error {
verr, ok := err.(chart.ValidationError) verr, ok := err.(chart.ValidationError)

@ -72,8 +72,8 @@ const (
// Following limits based on k8s labels limits - https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set // Following limits based on k8s labels limits - https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set
const ( const (
sqlCustomLabelsTableKeyMaxLenght = 253 + 1 + 63 sqlCustomLabelsTableKeyMaxLength = 253 + 1 + 63
sqlCustomLabelsTableValueMaxLenght = 63 sqlCustomLabelsTableValueMaxLength = 63
) )
const ( const (
@ -119,7 +119,7 @@ func (s *SQL) checkAlreadyApplied(migrations []*migrate.Migration) bool {
} }
} }
// check if all migrations appliyed // check if all migrations applied
if len(migrationsIDs) != 0 { if len(migrationsIDs) != 0 {
for id := range migrationsIDs { for id := range migrationsIDs {
s.Log("checkAlreadyApplied: find unapplied migration (id: %v)", id) s.Log("checkAlreadyApplied: find unapplied migration (id: %v)", id)
@ -216,9 +216,9 @@ func (s *SQL) ensureDBSetup() error {
sqlCustomLabelsTableReleaseKeyColumn, sqlCustomLabelsTableReleaseKeyColumn,
sqlCustomLabelsTableReleaseNamespaceColumn, sqlCustomLabelsTableReleaseNamespaceColumn,
sqlCustomLabelsTableKeyColumn, sqlCustomLabelsTableKeyColumn,
sqlCustomLabelsTableKeyMaxLenght, sqlCustomLabelsTableKeyMaxLength,
sqlCustomLabelsTableValueColumn, sqlCustomLabelsTableValueColumn,
sqlCustomLabelsTableValueMaxLenght, sqlCustomLabelsTableValueMaxLength,
sqlCustomLabelsTableName, sqlCustomLabelsTableName,
sqlCustomLabelsTableReleaseKeyColumn, sqlCustomLabelsTableReleaseKeyColumn,
sqlCustomLabelsTableReleaseNamespaceColumn, sqlCustomLabelsTableReleaseNamespaceColumn,

@ -543,7 +543,7 @@ func mockGetReleaseCustomLabels(mock sqlmock.Sqlmock, key string, namespace stri
eq.WillReturnRows(returnRows).RowsWillBeClosed() eq.WillReturnRows(returnRows).RowsWillBeClosed()
} }
func TestSqlChechkAppliedMigrations(t *testing.T) { func TestSqlCheckAppliedMigrations(t *testing.T) {
cases := []struct { cases := []struct {
migrationsToApply []*migrate.Migration migrationsToApply []*migrate.Migration
appliedMigrationsIDs []string appliedMigrationsIDs []string

@ -436,7 +436,7 @@ func (t *parser) listItem(list []interface{}, i, nestedNameLevel int) ([]interfa
// check for an empty value // check for an empty value
// read and consume optional spaces until comma or EOF (empty val) or any other char (not empty val) // read and consume optional spaces until comma or EOF (empty val) or any other char (not empty val)
// comma and spaces are consumed, while any other char is not cosumed // comma and spaces are consumed, while any other char is not consumed
func (t *parser) emptyVal() (bool, error) { func (t *parser) emptyVal() (bool, error) {
for { for {
r, _, e := t.sc.ReadRune() r, _, e := t.sc.ReadRune()

@ -626,7 +626,7 @@ func TestParseJSON(t *testing.T) {
}, },
err: false, err: false,
}, },
{ // null assigment, and no value assigned (equivalent to null) { // null assignment, and no value assigned (equivalent to null)
input: "outer.inner1=,outer.inner3={\"aa\":\"1\",\"bb\":2,\"cc\":[1,2,3]},outer.inner3.cc[1]=null", input: "outer.inner1=,outer.inner3={\"aa\":\"1\",\"bb\":2,\"cc\":[1,2,3]},outer.inner3.cc[1]=null",
got: map[string]interface{}{ got: map[string]interface{}{
"outer": map[string]interface{}{ "outer": map[string]interface{}{

Loading…
Cancel
Save