chore: Cleanup deprecated and TODO comments
Signed-off-by: George Jenkins <gvjenkins@gmail.com>
This commit is contained in:
17 files changed
+69
-39
No files matched your search
@@ -141,7 +141,7 @@ func (ch *Chart) AppVersion() string {
|
||||
|
||||
// CRDs returns a list of File objects in the 'crds/' directory of a Helm chart.
|
||||
//
|
||||
// Deprecated: use CRDObjects()
|
||||
// Deprecated: Use CRDObjects instead.
|
||||
func (ch *Chart) CRDs() []*common.File {
|
||||
files := []*common.File{}
|
||||
// Find all resources in the crds/ directory
|
||||
|
||||
@@ -101,11 +101,15 @@ type ChartVersion struct {
|
||||
// Search performs a search against the monocular search API
|
||||
//
|
||||
// Deprecated: Use SearchWithContext instead.
|
||||
//
|
||||
//go:fix inline
|
||||
func (c *Client) Search(term string) ([]SearchResult, error) {
|
||||
return c.SearchWithContext(context.Background(), term)
|
||||
}
|
||||
|
||||
// SearchWithContext performs a search against the monocular search API
|
||||
//
|
||||
// TODO Helm v5: Rename this to Search (remove the current deprecated Search method) and 'go:fix inline' SearchWithContext method to call Search.
|
||||
func (c *Client) SearchWithContext(ctx context.Context, term string) ([]SearchResult, error) {
|
||||
// Create the URL to the search endpoint
|
||||
// Note, this is currently an internal API for the Hub. This should be
|
||||
|
||||
@@ -48,7 +48,7 @@ var Extractors = map[string]Extractor{
|
||||
|
||||
// Convert a media type to an extractor extension.
|
||||
//
|
||||
// This should be refactored in Helm 4, combined with the extension-based mechanism.
|
||||
// TODO Helm v5: refactor this, combined with the extension-based mechanism.
|
||||
func mediaTypeToExtension(mt string) (string, bool) {
|
||||
switch strings.ToLower(mt) {
|
||||
case "application/gzip", "application/x-gzip", "application/x-tgz", "application/x-gtar":
|
||||
|
||||
@@ -47,7 +47,7 @@ type RuntimeConfigSubprocess struct {
|
||||
PlatformHooks PlatformHooks `yaml:"platformHooks"`
|
||||
// ProtocolCommands allows the plugin to specify protocol specific commands
|
||||
//
|
||||
// Obsolete/deprecated: This is a compatibility hangover from the old plugin downloader mechanism, which was extended
|
||||
// Deprecated: This is an obsolete compatibility hangover from the old plugin downloader mechanism, which was extended
|
||||
// to support multiple protocols in a given plugin. The command supplied in PlatformCommand should implement protocol
|
||||
// specific logic by inspecting the download URL
|
||||
ProtocolCommands []SubprocessProtocolCommand `yaml:"protocolCommands,omitempty"`
|
||||
|
||||
@@ -508,8 +508,8 @@ func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart,
|
||||
newDir = filepath.Join(outputDir, releaseName)
|
||||
}
|
||||
// NOTE: We do not have to worry about the post-renderer because
|
||||
// output dir is only used by `helm template`. In the next major
|
||||
// release, we should move this logic to template only as it is not
|
||||
// output dir is only used by `helm template`.
|
||||
// TODO Helm v5: move this logic to template only as it is not
|
||||
// used by install or upgrade
|
||||
err = writeToFile(newDir, m.Name, m.Content, fileWritten[m.Name])
|
||||
if err != nil {
|
||||
|
||||
@@ -77,12 +77,14 @@ func (d *Dependency) dependencyStatus(chartpath string, dep *chart.Dependency, p
|
||||
filename := fmt.Sprintf("%s-%s.tgz", dep.Name, "*")
|
||||
|
||||
// If a chart is unpacked, this will check the unpacked chart's `charts/` directory for tarballs.
|
||||
// Technically, this is COMPLETELY unnecessary, and should be removed in Helm 4. It is here
|
||||
// to preserved backward compatibility. In Helm 2/3, there is a "difference" between
|
||||
//
|
||||
// Technically, this is COMPLETELY unnecessary. It is here to preserve backward
|
||||
// compatibility. In Helm 2/3, there is a "difference" between
|
||||
// the tgz version (which outputs "ok" if it unpacks) and the loaded version (which outputs
|
||||
// "unpacked"). Early in Helm 2's history, this would have made a difference. But it no
|
||||
// longer does. However, since this code shipped with Helm 3, the output must remain stable
|
||||
// until Helm 4.
|
||||
// longer does. However, since this code shipped with Helm 3, the output must remain stable.
|
||||
//
|
||||
// TODO Helm v5: remove this.
|
||||
switch archives, err := filepath.Glob(filepath.Join(chartpath, "charts", filename)); {
|
||||
case err != nil:
|
||||
return "bad pattern"
|
||||
@@ -156,7 +158,9 @@ func (d *Dependency) dependencyStatus(chartpath string, dep *chart.Dependency, p
|
||||
// stat an archive and return a message if the stat is successful
|
||||
//
|
||||
// This is a refactor of the code originally in dependencyStatus. It is here to
|
||||
// support legacy behavior, and should be removed in Helm 4.
|
||||
// support legacy behavior.
|
||||
//
|
||||
// TODO Helm v5: remove this.
|
||||
func statArchiveForStatus(archive string, dep *chart.Dependency) string {
|
||||
if _, err := os.Stat(archive); err == nil {
|
||||
c, err := loader.Load(archive)
|
||||
|
||||
@@ -87,7 +87,9 @@ func (kv *KubeVersion) String() string {
|
||||
|
||||
// GitVersion returns the full Kubernetes version string.
|
||||
//
|
||||
// Deprecated: use KubeVersion.Version.
|
||||
// Deprecated: Use KubeVersion.Version.
|
||||
//
|
||||
//go:fix inline
|
||||
func (kv *KubeVersion) GitVersion() string { return kv.Version }
|
||||
|
||||
// ParseKubeVersion parses kubernetes version from string
|
||||
|
||||
@@ -144,7 +144,7 @@ func (ch *Chart) AppVersion() string {
|
||||
|
||||
// CRDs returns a list of File objects in the 'crds/' directory of a Helm chart.
|
||||
//
|
||||
// Deprecated: use CRDObjects()
|
||||
// Deprecated: Use CRDObjects instead.
|
||||
func (ch *Chart) CRDs() []*common.File {
|
||||
files := []*common.File{}
|
||||
// Find all resources in the crds/ directory
|
||||
|
||||
@@ -113,8 +113,8 @@ func LoadFiles(files []*archive.BufferedFile) (*chart.Chart, error) {
|
||||
c.Schema = f.Data
|
||||
c.SchemaModTime = f.ModTime
|
||||
|
||||
// Deprecated: requirements.yaml is deprecated use Chart.yaml.
|
||||
// We will handle it for you because we are nice people
|
||||
// requirements.yaml is deprecated; dependencies are declared in Chart.yaml since
|
||||
// apiVersion v2. Handled here for backwards compatibility.
|
||||
case f.Name == "requirements.yaml":
|
||||
if c.Metadata == nil {
|
||||
c.Metadata = new(chart.Metadata)
|
||||
@@ -128,7 +128,8 @@ func LoadFiles(files []*archive.BufferedFile) (*chart.Chart, error) {
|
||||
if c.Metadata.APIVersion == chart.APIVersionV1 {
|
||||
c.Files = append(c.Files, &common.File{Name: f.Name, ModTime: f.ModTime, Data: f.Data})
|
||||
}
|
||||
// Deprecated: requirements.lock is deprecated use Chart.lock.
|
||||
// requirements.lock is deprecated; use Chart.lock. Handled here for backwards
|
||||
// compatibility.
|
||||
case f.Name == "requirements.lock":
|
||||
c.Lock = new(chart.Lock)
|
||||
if err := yaml.Unmarshal(f.Data, &c.Lock); err != nil {
|
||||
|
||||
@@ -643,7 +643,7 @@ spec:
|
||||
|
||||
// Stderr is an io.Writer to which error messages can be written
|
||||
//
|
||||
// In Helm 4, this will be replaced. It is needed in Helm 3 to preserve API backward
|
||||
// TODO Helm v5: replace this. It is needed in Helm 3 to preserve API backward
|
||||
// compatibility.
|
||||
var Stderr io.Writer = os.Stderr
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error {
|
||||
}
|
||||
|
||||
// Save Chart.lock
|
||||
// TODO: remove the APIVersion check when APIVersionV1 is not used anymore
|
||||
// TODO Helm v5: remove the APIVersion check when APIVersionV1 is not used anymore
|
||||
if c.Metadata.APIVersion == chart.APIVersionV2 {
|
||||
if c.Lock != nil {
|
||||
ldata, err := yaml.Marshal(c.Lock)
|
||||
|
||||
@@ -100,8 +100,11 @@ func ValidateReleaseName(name string) error {
|
||||
// The Kubernetes documentation is here, though it is not entirely correct:
|
||||
// https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
|
||||
//
|
||||
// Deprecated: remove in Helm 4. Name validation now uses rules defined in
|
||||
// pkg/lint/rules.validateMetadataNameFunc()
|
||||
// Deprecated: ValidateMetadataName is no longer used by Helm. Metadata name
|
||||
// validation is now performed by the lint rule validateMetadataNameFunc (see
|
||||
// pkg/chart/v2/lint/rules).
|
||||
//
|
||||
// TODO Helm v5: remove this function.
|
||||
func ValidateMetadataName(name string) error {
|
||||
if name == "" || len(name) > maxMetadataNameLen || !validName.MatchString(name) {
|
||||
return errInvalidKubernetesName
|
||||
|
||||
+1
-1
@@ -214,7 +214,7 @@ func addInstallFlags(cmd *cobra.Command, f *pflag.FlagSet, client *action.Instal
|
||||
|
||||
// For `helm template`, these notes flags are legacy, unused, and should not show in help, but
|
||||
// must remain accepted for backwards compatibility in Helm 4. Deprecate and hide them for now
|
||||
// TODO remove these from template command in Helm 5
|
||||
// TODO Helm v5: remove these from template command
|
||||
if cmd.Name() == "template" {
|
||||
if err := cmd.Flags().MarkDeprecated("hide-notes", "this flag has no effect for 'helm template' and will be removed in Helm 5"); err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
@@ -177,10 +177,11 @@ func (m *Manager) Update() error {
|
||||
// For the repositories Helm is not configured to know about, ensure Helm
|
||||
// has some information about them and, when possible, the index files
|
||||
// locally.
|
||||
// TODO(mattfarina): Repositories should be explicitly added by end users
|
||||
// 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
|
||||
// repositories and opt-in to any locations, for security.
|
||||
//
|
||||
// TODO Helm v5: require users to add repositories explicitly rather than
|
||||
// adding them automatically. They should have to add them in order to make
|
||||
// sure they are aware of the repositories and opt-in to any locations, for
|
||||
// security.
|
||||
repoNames, err = m.ensureMissingRepos(repoNames, req)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+17
-3
@@ -79,6 +79,8 @@ func New(config *rest.Config) Engine {
|
||||
// bar chart during render time.
|
||||
//
|
||||
// Deprecated: Use RenderWithContext instead.
|
||||
//
|
||||
//go:fix inline
|
||||
func (e Engine) Render(chrt ci.Charter, values common.Values) (map[string]string, error) {
|
||||
return e.RenderWithContext(context.Background(), chrt, values)
|
||||
}
|
||||
@@ -102,6 +104,8 @@ func (e Engine) Render(chrt ci.Charter, values common.Values) (map[string]string
|
||||
// that section of the values will be passed into the "foo" chart. And if that
|
||||
// section contains a value named "bar", that value will be passed on to the
|
||||
// bar chart during render time.
|
||||
//
|
||||
// TODO Helm v5: Rename this to Render (remove the current deprecated Render method) and 'go:fix inline' RenderWithContext method to call Render.
|
||||
func (e Engine) RenderWithContext(ctx context.Context, chrt ci.Charter, values common.Values) (map[string]string, error) {
|
||||
tmap := allTemplates(chrt, values)
|
||||
return e.render(ctx, tmap)
|
||||
@@ -109,28 +113,38 @@ func (e Engine) RenderWithContext(ctx context.Context, chrt ci.Charter, values c
|
||||
|
||||
// Render takes a chart, optional values, and value overrides, and attempts to
|
||||
// render the Go templates using the default options.
|
||||
//
|
||||
// Deprecated: Instantiate an Engine and call RenderWithContext instead.
|
||||
//
|
||||
// TODO Helm v5: Replace with a NewEngine function.
|
||||
//
|
||||
//go:fix inline
|
||||
func Render(chrt ci.Charter, values common.Values) (map[string]string, error) {
|
||||
return new(Engine).Render(chrt, values)
|
||||
return new(Engine).RenderWithContext(context.Background(), chrt, values)
|
||||
}
|
||||
|
||||
// RenderWithClient takes a chart, optional values, and value overrides, and attempts to
|
||||
// render the Go templates using the default options. This engine is client aware and so can have template
|
||||
// functions that interact with the client.
|
||||
//
|
||||
// TODO Helm v5: Replace with a NewEngine function that accepts a rest.Config option
|
||||
func RenderWithClient(chrt ci.Charter, values common.Values, config *rest.Config) (map[string]string, error) {
|
||||
var clientProvider ClientProvider = clientProviderFromConfig{config}
|
||||
return Engine{
|
||||
clientProvider: &clientProvider,
|
||||
}.Render(chrt, values)
|
||||
}.RenderWithContext(context.Background(), chrt, values)
|
||||
}
|
||||
|
||||
// RenderWithClientProvider takes a chart, optional values, and value overrides, and attempts to
|
||||
// render the Go templates using the default options. This engine is client aware and so can have template
|
||||
// functions that interact with the client.
|
||||
// This function differs from RenderWithClient in that it lets you customize the way a dynamic client is constructed.
|
||||
//
|
||||
// TODO Helm v5: Replace with a NewEngine function that accepts a ClientProvider option
|
||||
func RenderWithClientProvider(chrt ci.Charter, values common.Values, clientProvider ClientProvider) (map[string]string, error) {
|
||||
return Engine{
|
||||
clientProvider: &clientProvider,
|
||||
}.Render(chrt, values)
|
||||
}.RenderWithContext(context.Background(), chrt, values)
|
||||
}
|
||||
|
||||
// renderable is an object that can be rendered.
|
||||
|
||||
@@ -73,7 +73,7 @@ type Interface interface {
|
||||
// by "\n---\n")
|
||||
//
|
||||
// Validates against OpenAPI schema if validate is true.
|
||||
// TODO Helm 4: Integrate into Build with an argument
|
||||
// TODO Helm v5: Integrate into Build with an argument
|
||||
BuildTable(reader io.Reader, validate bool) (ResourceList, error)
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ type Waiter interface {
|
||||
// InterfaceWaitOptions defines an interface that extends Interface with
|
||||
// methods that accept wait options.
|
||||
//
|
||||
// TODO Helm 5: Remove InterfaceWaitOptions and integrate its method(s) into the Interface.
|
||||
// TODO Helm v5: Remove InterfaceWaitOptions and integrate its method(s) into the Interface.
|
||||
type InterfaceWaitOptions interface {
|
||||
// GetWaiter gets the Kube.Waiter with options.
|
||||
GetWaiterWithOptions(ws WaitStrategy, opts ...WaitOption) (Waiter, error)
|
||||
|
||||
+11
-10
@@ -151,7 +151,7 @@ func (i IndexFile) MustAdd(md *chart.Metadata, filename, baseURL, digest string)
|
||||
|
||||
// Add adds a file to the index and logs an error.
|
||||
//
|
||||
// Deprecated: Use index.MustAdd instead.
|
||||
// Deprecated: Use IndexFile.MustAdd instead. Add logs errors; MustAdd returns them.
|
||||
func (i IndexFile) Add(md *chart.Metadata, filename, baseURL, digest string) {
|
||||
if err := i.MustAdd(md, filename, baseURL, digest); err != nil {
|
||||
slog.Error("skipping loading invalid entry for chart", "name", md.Name, "version", md.Version, "file", filename, "error", err)
|
||||
@@ -290,21 +290,22 @@ type ChartVersion struct {
|
||||
Removed bool `json:"removed,omitempty"`
|
||||
Digest string `json:"digest,omitempty"`
|
||||
|
||||
// ChecksumDeprecated is deprecated in Helm 3, and therefore ignored. Helm 3 replaced
|
||||
// this with Digest. However, with a strict YAML parser enabled, a field must be
|
||||
// present on the struct for backwards compatibility.
|
||||
// Deprecated: ChecksumDeprecated is ignored (Helm 3 replaced it with Digest). It is
|
||||
// retained only so a strict YAML parser accepts the "checksum" field for backwards
|
||||
// compatibility; do not use it.
|
||||
ChecksumDeprecated string `json:"checksum,omitempty"`
|
||||
|
||||
// EngineDeprecated is deprecated in Helm 3, and therefore ignored. However, with a strict
|
||||
// YAML parser enabled, this field must be present.
|
||||
// Deprecated: EngineDeprecated is ignored (removed in Helm 3). It is retained only so a
|
||||
// strict YAML parser accepts the "engine" field for backwards compatibility; do not use it.
|
||||
EngineDeprecated string `json:"engine,omitempty"`
|
||||
|
||||
// TillerVersionDeprecated is deprecated in Helm 3, and therefore ignored. However, with a strict
|
||||
// YAML parser enabled, this field must be present.
|
||||
// Deprecated: TillerVersionDeprecated is ignored (removed in Helm 3). It is retained only
|
||||
// so a strict YAML parser accepts the "tillerVersion" field for backwards compatibility;
|
||||
// do not use it.
|
||||
TillerVersionDeprecated string `json:"tillerVersion,omitempty"`
|
||||
|
||||
// URLDeprecated is deprecated in Helm 3, superseded by URLs. It is ignored. However,
|
||||
// with a strict YAML parser enabled, this must be present on the struct.
|
||||
// Deprecated: URLDeprecated is ignored (superseded by URLs). It is retained only so a
|
||||
// strict YAML parser accepts the "url" field for backwards compatibility; do not use it.
|
||||
URLDeprecated string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user