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

remove kustomizeVersion and kubectlVersion #173

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19 AS builder
FROM golang:1.21 AS builder

ADD . /go/src/github.com/replicatedhq/kots-lint
WORKDIR /go/src/github.com/replicatedhq/kots-lint
Expand Down
272 changes: 158 additions & 114 deletions go.mod

Large diffs are not rendered by default.

911 changes: 428 additions & 483 deletions go.sum

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@
"icon": {
"type": "string"
},
"kubectlVersion": {
"type": "string"
},
"kustomizeVersion": {
"type": "string"
},
"minKotsVersion": {
"type": "string"
},
Expand Down
2 changes: 1 addition & 1 deletion okteto.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19
FROM golang:1.21

EXPOSE 8082
EXPOSE 2345
Expand Down
12 changes: 6 additions & 6 deletions pkg/kots/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import (
"github.com/pkg/errors"
kjs "github.com/replicatedhq/kots-lint/kubernetes_json_schema"
"github.com/replicatedhq/kots-lint/pkg/util"
"github.com/replicatedhq/kots/pkg/kotsutil"
kotsoperatortypes "github.com/replicatedhq/kots/pkg/operator/types"
kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1"
kotsv1beta2 "github.com/replicatedhq/kotskinds/apis/kots/v1beta2"
kotsscheme "github.com/replicatedhq/kotskinds/client/kotsclientset/scheme"
"github.com/replicatedhq/kotskinds/pkg/helmchart"
kurllint "github.com/replicatedhq/kurlkinds/pkg/lint"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
Expand Down Expand Up @@ -890,7 +890,7 @@ func lintExpressionsHaveErrors(lintExpressions []LintExpression) bool {

// archiveForHelmChartExists iterates through all files, looking for a helm chart archive
// that matches the chart name and version specified in the kotsHelmChart parameter
func archiveForHelmChartExists(specFiles SpecFiles, kotsHelmChart kotsutil.HelmChartInterface) (bool, error) {
func archiveForHelmChartExists(specFiles SpecFiles, kotsHelmChart helmchart.HelmChartInterface) (bool, error) {
for _, specFile := range specFiles {
if !specFile.isTarGz() {
continue
Expand Down Expand Up @@ -923,7 +923,7 @@ func archiveForHelmChartExists(specFiles SpecFiles, kotsHelmChart kotsutil.HelmC

// helmChartForArchiveExists iterates through all existing helm charts, looking for a helm chart manifest
// that matches the chart name and version specified in the Chart.yaml file in the archive
func helmChartForArchiveExists(allKotsHelmCharts []kotsutil.HelmChartInterface, archive SpecFile) (bool, error) {
func helmChartForArchiveExists(allKotsHelmCharts []helmchart.HelmChartInterface, archive SpecFile) (bool, error) {
files, err := SpecFilesFromTarGz(archive)
if err != nil {
return false, errors.Wrap(err, "failed to read chart archive")
Expand Down Expand Up @@ -951,8 +951,8 @@ func helmChartForArchiveExists(allKotsHelmCharts []kotsutil.HelmChartInterface,
return false, nil
}

func findAllKotsHelmCharts(specFiles SpecFiles) []kotsutil.HelmChartInterface {
kotsHelmCharts := []kotsutil.HelmChartInterface{}
func findAllKotsHelmCharts(specFiles SpecFiles) []helmchart.HelmChartInterface {
kotsHelmCharts := []helmchart.HelmChartInterface{}
for _, specFile := range specFiles {
kotsHelmChart := tryParsingAsHelmChartGVK([]byte(specFile.Content))
if kotsHelmChart != nil {
Expand All @@ -963,7 +963,7 @@ func findAllKotsHelmCharts(specFiles SpecFiles) []kotsutil.HelmChartInterface {
return kotsHelmCharts
}

func tryParsingAsHelmChartGVK(content []byte) kotsutil.HelmChartInterface {
func tryParsingAsHelmChartGVK(content []byte) helmchart.HelmChartInterface {
decode := scheme.Codecs.UniversalDeserializer().Decode
obj, gvk, err := decode(content, nil, nil)
if err != nil {
Expand Down
39 changes: 2 additions & 37 deletions pkg/kots/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ metadata:
name: app-slug
spec:
title: App Name
kustomizeVersion: "3.5.4"
icon: https://github.com/cncf/artwork/blob/master/projects/kubernetes/icon/color/kubernetes-icon-color.png
statusInformers:
- deployment/example-nginx
Expand Down Expand Up @@ -1423,8 +1422,6 @@ spec:
icon: https://support.io/img/logo.png
releaseNotes: These are our release notes
allowRollback: false
kubectlVersion: latest
kustomizeVersion: latest
targetKotsVersion: "1.60.0"
minKotsVersion: "1.40.0"
requireMinimalRBACPrivileges: false
Expand Down Expand Up @@ -4072,7 +4069,6 @@ metadata:
name: app-slug
spec:
title: App Name
kustomizeVersion: "3.5.4"
icon: https://github.com/cncf/artwork/blob/master/projects/kubernetes/icon/color/kubernetes-icon-color.png
statusInformers:
- deployment/example-nginx
Expand Down Expand Up @@ -4129,7 +4125,6 @@ metadata:
name: app-slug
spec:
title: App Name
kustomizeVersion: "latest"
icon: https://github.com/cncf/artwork/blob/master/projects/kubernetes/icon/color/kubernetes-icon-color.png
statusInformers:
- deployment-example-nginx
Expand All @@ -4150,7 +4145,7 @@ spec:
Positions: []LintExpressionItemPosition{
{
Start: LintExpressionItemLinePosition{
Line: 10,
Line: 9,
},
},
},
Expand All @@ -4163,7 +4158,7 @@ spec:
Positions: []LintExpressionItemPosition{
{
Start: LintExpressionItemLinePosition{
Line: 11,
Line: 10,
},
},
},
Expand Down Expand Up @@ -4439,36 +4434,6 @@ spec:
},
expect: []LintExpression{},
},
{
name: "unsupported kustomize version",
specFiles: SpecFiles{
{
Name: "kots-app.yaml",
Path: "kots-app.yaml",
Content: `apiVersion: kots.io/v1beta1
kind: Application
metadata:
name: app-slug
spec:
kustomizeVersion: "2.0.0"`,
},
},
expect: []LintExpression{
{
Rule: "kustomize-version",
Type: "warn",
Path: "kots-app.yaml",
Message: "Unsupported kustomize version, 3.5.4 will be used instead",
Positions: []LintExpressionItemPosition{
{
Start: LintExpressionItemLinePosition{
Line: 6,
},
},
},
},
},
},
{
name: "ignore nonexistent-status-informer-object rule",
specFiles: SpecFiles{
Expand Down
22 changes: 0 additions & 22 deletions pkg/kots/rego/kots-spec-opa-rendered.rego
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@

package kots.spec.rendered

kustomize_versions = {
"",
"latest",
"3.5.4",
}

# Files set with the contents of each file as json
files[output] {
file := input[_]
Expand Down Expand Up @@ -55,22 +49,6 @@ lint[output] {
}
}

# Check if kustomize version is supported
lint[output] {
file := files[_]
file.content.kind == "Application"
file.content.apiVersion == "kots.io/v1beta1"
not kustomize_versions[file.content.spec.kustomizeVersion]
output := {
"rule": "kustomize-version",
"type": "warn",
"message": "Unsupported kustomize version, 3.5.4 will be used instead",
"path": file.path,
"field": "spec.kustomizeVersion",
"docIndex": file.docIndex
}
}

# Check if any "status informer" points to a non-existent object
informer_object_exists(informer) {
is_string(informer)
Expand Down
2 changes: 1 addition & 1 deletion skaffold.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19 AS builder
FROM golang:1.21 AS builder

ADD . /go/src/github.com/replicatedhq/kots-lint
WORKDIR /go/src/github.com/replicatedhq/kots-lint
Expand Down
Loading