Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwenma committed Sep 18, 2020
1 parent 6ebae64 commit 15e1a78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions pkg/skaffold/deploy/kpt.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ import (
"regexp"
"strings"

"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
k8syaml "sigs.k8s.io/yaml"

"github.com/GoogleContainerTools/skaffold/pkg/skaffold/build"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/config"
deploy "github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy/kubectl"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/event"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/util"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
k8syaml "sigs.k8s.io/yaml"
)

const (
Expand Down Expand Up @@ -190,8 +191,8 @@ func (k *KptDeployer) renderManifests(ctx context.Context, _ io.Writer, builds [
return nil, nil
}

// Remove the kpt function from the manipulated resources.
manifests, err = k.ExcludeKptFn(manifests)
// exclude the kpt function from the manipulated resources.
manifests, err = k.excludeKptFn(manifests)
if err != nil {
return nil, fmt.Errorf("exclude kpt fn from manipulated resources: %w", err)
}
Expand Down Expand Up @@ -280,9 +281,9 @@ func (k *KptDeployer) kptFnRun(ctx context.Context) (deploy.ManifestList, error)
return manifests, nil
}

// ExcludeKptFn adds an annotation "config.kubernetes.io/local-config: 'true'" to kpt function.
// excludeKptFn adds an annotation "config.kubernetes.io/local-config: 'true'" to kpt function.
// This will exclude kpt functions from deployed to the cluster in kpt live apply.
func (k *KptDeployer) ExcludeKptFn(manifest deploy.ManifestList) (deploy.ManifestList, error) {
func (k *KptDeployer) excludeKptFn(manifest deploy.ManifestList) (deploy.ManifestList, error) {
var newManifest deploy.ManifestList
for _, yByte := range manifest {
// Convert yaml byte config to unstructured.Unstructured
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/deploy/kpt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ spec:
for _, test := range tests {
testutil.Run(t, test.description, func(t *testutil.T) {
k := NewKptDeployer(&kptConfig{}, nil)
actualManifest, err := k.ExcludeKptFn(test.manifests)
actualManifest, err := k.excludeKptFn(test.manifests)
t.CheckErrorAndDeepEqual(false, err, test.expected.String(), actualManifest.String())
})
}
Expand Down

0 comments on commit 15e1a78

Please sign in to comment.