Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning notes if helm charts Istio version is already EOL #1294

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions pkg/build/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,30 @@ func sanitizeChart(manifest model.Manifest, s string) error {
return err
}
}

if fname == "NOTES.txt" {
read, err := os.ReadFile(p)
if err != nil {
return err
}
contents := string(read)

//nolint
EOLTemplate := `
{{- $EndOfLife := toDate "2006-01" "%s" | unixEpoch -}}
{{- $Now := now | unixEpoch -}}

{{- if ge $Now $EndOfLife}}

WARNING: may be installing an EOL version: see https://istio.io/latest/docs/releases/supported-releases/ for supported releases
{{ end }}
`
contents = contents + fmt.Sprintf(EOLTemplate, manifest.EOLDate)
err = os.WriteFile(p, []byte(contents), 0)
if err != nil {
return err
}
}
return nil
}); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions pkg/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func InputManifestToManifest(in model.InputManifest) (model.Manifest, error) {
return model.Manifest{
Dependencies: in.Dependencies,
Version: in.Version,
EOLDate: in.EOLDate,
Docker: in.Docker,
DockerOutput: do,
Directory: wd,
Expand Down
6 changes: 6 additions & 0 deletions pkg/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ type InputManifest struct {
Dependencies IstioDependencies `json:"dependencies"`
// Version specifies what version of Istio this release is
Version string `json:"version"`
// EOLDate specifies what is the date when this Istio version become EOL
// Should be in format "yyyy-mm"
EOLDate string `json:"eolDate"`
// Docker specifies the docker hub to use in the helm charts.
Docker string `json:"docker"`
// DockerOutput specifies where docker images are written.
Expand Down Expand Up @@ -160,6 +163,9 @@ type Manifest struct {
Dependencies IstioDependencies `json:"dependencies"`
// Version specifies what version of Istio this release is
Version string `json:"version"`
// EOLDate specifies what is the date when this Istio version become EOL
// Should be in format "yyyy-mm"
EOLDate string `json:"eolDate"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we already have to update istioctl binary directly it seems like we could just update the helm notes directly as well? We can have a test to check they are in sync if needed

Will defer to @ericvn

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean to update the helm notes directly on istio/istio repository?

// Docker specifies the docker hub to use in the helm charts.
Docker string `json:"docker"`
// DockerOutput specifies where docker images are written.
Expand Down