Merge pull request #1678 from monopole/fixCliInternalDeps

Fix internal kustomize CLI deps
This commit is contained in:
Jeff Regan
2019-10-22 15:37:37 -07:00
committed by Jeffrey Regan
42 changed files with 103 additions and 102 deletions

View File

@@ -1,4 +1,4 @@
module sigs.k8s.io/kustomize/kustomize/v3
module sigs.k8s.io/kustomize/kustomize
go 1.13

View File

@@ -202,6 +202,7 @@ k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
k8s.io/kube-openapi v0.0.0-20190918143330-0270cf2f1c1d h1:Xpe6sK+RY4ZgCTyZ3y273UmFmURhjtoJiwOMbQsXitY=
k8s.io/kube-openapi v0.0.0-20190918143330-0270cf2f1c1d/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
sigs.k8s.io/kustomize/api v0.1.1 h1:W2dWXex2MhF4/EZNokZllvet2RejCHqdAFklufN7VTg=
sigs.k8s.io/kustomize/api v0.1.1/go.mod h1:FyfJD1q1QMjC/TvK78b6cCtZB+mbpnGIo9YOvbucJes=
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=

View File

@@ -16,11 +16,11 @@ import (
"sigs.k8s.io/kustomize/api/pgmconfig"
"sigs.k8s.io/kustomize/api/resmap"
"sigs.k8s.io/kustomize/api/resource"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/build"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/config"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/create"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/version"
"sigs.k8s.io/kustomize/kustomize/internal/commands/build"
"sigs.k8s.io/kustomize/kustomize/internal/commands/config"
"sigs.k8s.io/kustomize/kustomize/internal/commands/create"
"sigs.k8s.io/kustomize/kustomize/internal/commands/edit"
"sigs.k8s.io/kustomize/kustomize/internal/commands/version"
)
// NewDefaultCommand returns the default (aka root) command for kustomize command.

View File

@@ -13,8 +13,8 @@ import (
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/ifc"
"sigs.k8s.io/kustomize/api/pgmconfig"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/util"
)
type createFlags struct {

View File

@@ -10,7 +10,7 @@ import (
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
var factory = kunstruct.NewKunstructuredFactoryImpl()

View File

@@ -9,8 +9,8 @@ import (
"strings"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
type addBaseOptions struct {

View File

@@ -7,9 +7,9 @@ import (
"strings"
"testing"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
const (

View File

@@ -7,11 +7,11 @@ import (
"fmt"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/pgmconfig"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/util"
)
// kindOfAdd is the kind of metadata being added: label or annotation

View File

@@ -6,11 +6,11 @@ package add
import (
"testing"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/testutils/valtest"
valtest_test "sigs.k8s.io/kustomize/api/testutils/valtest"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
func makeKustomization(t *testing.T) *types.Kustomization {
@@ -73,7 +73,7 @@ func TestAddAnnotationInvalidFormat(t *testing.T) {
if err == nil {
t.Errorf("expected an error")
}
if err.Error() != validators.SAD {
if err.Error() != valtest_test.SAD {
t.Errorf("incorrect error: %v", err.Error())
}
}
@@ -254,7 +254,7 @@ func TestAddLabelInvalidFormat(t *testing.T) {
if err == nil {
t.Errorf("expected an error")
}
if err.Error() != validators.SAD {
if err.Error() != valtest_test.SAD {
t.Errorf("incorrect error: %v", err.Error())
}
}

View File

@@ -8,10 +8,10 @@ import (
"log"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/patch"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/internal/commands/edit/patch"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/util"
)
type addPatchOptions struct {

View File

@@ -7,8 +7,8 @@ import (
"strings"
"testing"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
"sigs.k8s.io/kustomize/api/filesys"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
const (

View File

@@ -8,9 +8,9 @@ import (
"log"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/util"
)
type addResourceOptions struct {

View File

@@ -7,8 +7,8 @@ import (
"strings"
"testing"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
"sigs.k8s.io/kustomize/api/filesys"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
const (

View File

@@ -5,10 +5,10 @@ package add
import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/ifc"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
// newCmdAddConfigMap returns a new command.

View File

@@ -9,7 +9,7 @@ import (
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/kv"
"sigs.k8s.io/kustomize/api/loader"
"sigs.k8s.io/kustomize/api/testutils/valtest"
valtest_test "sigs.k8s.io/kustomize/api/testutils/valtest"
"sigs.k8s.io/kustomize/api/types"
)

View File

@@ -7,8 +7,8 @@ import (
"fmt"
"strings"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/internal/commands/util"
)
// flagsAndArgs encapsulates the options for add secret/configmap commands.

View File

@@ -5,10 +5,10 @@ package add
import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/ifc"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
// newCmdAddSecret returns a new command.

View File

@@ -7,10 +7,10 @@ import (
"testing"
"sigs.k8s.io/kustomize/api/kv"
valtest_test "sigs.k8s.io/kustomize/api/testutils/valtest"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/loader"
"sigs.k8s.io/kustomize/api/testutils/valtest"
"sigs.k8s.io/kustomize/api/types"
)

View File

@@ -9,10 +9,10 @@ import (
"sigs.k8s.io/kustomize/api/ifc"
"sigs.k8s.io/kustomize/api/kv"
"sigs.k8s.io/kustomize/api/loader"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/add"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/fix"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/remove"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/set"
"sigs.k8s.io/kustomize/kustomize/internal/commands/edit/add"
"sigs.k8s.io/kustomize/kustomize/internal/commands/edit/fix"
"sigs.k8s.io/kustomize/kustomize/internal/commands/edit/remove"
"sigs.k8s.io/kustomize/kustomize/internal/commands/edit/set"
)
// NewCmdEdit returns an instance of 'edit' subcommand.

View File

@@ -6,7 +6,7 @@ package fix
import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
// NewCmdFix returns an instance of 'fix' subcommand.

View File

@@ -8,7 +8,7 @@ import (
"testing"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
func TestFix(t *testing.T) {

View File

@@ -8,10 +8,10 @@ import (
"strings"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/pgmconfig"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
// kindOfAdd is the kind of metadata being added: label or annotation

View File

@@ -8,11 +8,11 @@ import (
"strings"
"testing"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/testutils/valtest"
valtest_test "sigs.k8s.io/kustomize/api/testutils/valtest"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
func makeKustomizationFS() filesys.FileSystem {
@@ -147,7 +147,7 @@ func TestRemoveAnnotationInvalidFormat(t *testing.T) {
if err == nil {
t.Errorf("expected an error")
}
if err.Error() != validators.SAD {
if err.Error() != valtest_test.SAD {
t.Errorf("incorrect error: %v", err.Error())
}
}
@@ -295,7 +295,7 @@ func TestRemoveLabelInvalidFormat(t *testing.T) {
if err == nil {
t.Errorf("expected an error")
}
if err.Error() != validators.SAD {
if err.Error() != valtest_test.SAD {
t.Errorf("incorrect error: %v", err.Error())
}
}

View File

@@ -8,11 +8,11 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/patch"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/pgmconfig"
"sigs.k8s.io/kustomize/kustomize/internal/commands/edit/patch"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/util"
)
type removePatchOptions struct {

View File

@@ -8,9 +8,9 @@ import (
"strings"
"testing"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/patch"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/internal/commands/edit/patch"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
const (

View File

@@ -8,9 +8,9 @@ import (
"path/filepath"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/pgmconfig"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
type removeResourceOptions struct {

View File

@@ -9,8 +9,8 @@ import (
"strings"
"testing"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
"sigs.k8s.io/kustomize/api/filesys"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
func TestRemoveResources(t *testing.T) {

View File

@@ -8,7 +8,7 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
type setNamePrefixOptions struct {

View File

@@ -8,7 +8,7 @@ import (
"testing"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
const (

View File

@@ -8,7 +8,7 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
type setNameSuffixOptions struct {

View File

@@ -8,7 +8,7 @@ import (
"testing"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
const (

View File

@@ -13,7 +13,7 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
type setImageOptions struct {

View File

@@ -9,7 +9,7 @@ import (
"testing"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
func TestSetImage(t *testing.T) {

View File

@@ -11,7 +11,7 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/ifc"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
type setNamespaceOptions struct {

View File

@@ -9,8 +9,8 @@ import (
"testing"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/testutils/valtest"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
valtest_test "sigs.k8s.io/kustomize/api/testutils/valtest"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
const (

View File

@@ -12,7 +12,7 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
"sigs.k8s.io/kustomize/kustomize/internal/commands/kustfile"
)
type setReplicasOptions struct {

View File

@@ -9,7 +9,7 @@ import (
"testing"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
func TestSetReplicas(t *testing.T) {

View File

@@ -11,7 +11,7 @@ import (
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/pgmconfig"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/internal/commands/testutils"
)
func TestFieldOrder(t *testing.T) {

View File

@@ -7,7 +7,7 @@ package main
import (
"os"
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands"
"sigs.k8s.io/kustomize/kustomize/internal/commands"
)
func main() {

View File

@@ -132,6 +132,18 @@ module=kustomize # The kustomize executable
module=api # The API
```
### review tags to help determine new tag
Local:
```
git tag -l | grep $module
```
Remote:
```
git ls-remote --tags upstream | grep $module
```
### determine the version
Go's [semver]-compatible version tags take the form `v{major}.{minor}.{patch}`:
@@ -172,10 +184,17 @@ Create it:
git checkout -b $branch
```
### define the release tag
### remove API replacements from go.mod
```
tag="${module}/v${major}.${minor}.${patch}"
echo "tag=$tag"
```
Only do this if releasing one of the executables.
### pin the executable to a particular API version
Only do this if releasing one of the
executables (kustomize or pluginator).
In this repository, an executable in development
on the master branch typically depends on the API
@@ -193,22 +212,12 @@ requires.
```
# Update the following as needed, obviously.
if [ "$module" != "api" ]; then
# go mod edit -dropreplace=sigs.k8s.io/kustomize/api $module/go.mod
# go mod edit -require=sigs.k8s.io/kustomize/api@v?.0.1 $module/go.mod
# git commit -a -m "Drop API module replacement"
fi
```
### optionally build a release locally
Install [`cloud-build-local`], then run
# git checkout -b pinTheRelease
# go mod edit -dropreplace=sigs.k8s.io/kustomize/api $module/go.mod
# go mod edit -require=sigs.k8s.io/kustomize/api@v0.1.1 $module/go.mod
# git commit -a -m "Drop API module replacement"
```
./releasing/localbuild.sh $module
```
This should create release artifacts in a local directory.
### push the release branch
@@ -216,26 +225,6 @@ This should create release artifacts in a local directory.
git push -f upstream $branch
```
### optionally review tags
Local:
```
git tag -l
```
Remote:
```
git ls-remote --tags upstream
```
### define the release tag
```
tag="${module}/v${major}.${minor}.${patch}"
echo "tag=$tag"
```
### if replacing a release...
Must delete the tag before re-pushing it.
@@ -268,6 +257,16 @@ version.
git tag -a $tag -m "Release $tag on branch $branch"
```
### optionally build a release locally
Install [`cloud-build-local`], then run
```
./releasing/localbuild.sh $module
```
This should create release artifacts in a local directory.
### trigger the cloud build by pushing the tag
Push the tag:

View File

@@ -27,6 +27,8 @@ if [ "$module" != "$tModule" ]; then
exit 1
fi
cd $module
configFile=$(mktemp)
cat <<EOF >$configFile
project_name: $module
@@ -48,8 +50,7 @@ release:
owner: kubernetes-sigs
name: kustomize
builds:
- main: ./$module/main.go
ldflags: >
- ldflags: >
-s
-X sigs.k8s.io/kustomize/api/provenance.version={{.Version}}
-X sigs.k8s.io/kustomize/api/provenance.gitCommit={{.Commit}}

View File

@@ -79,5 +79,5 @@ cloud-build-local \
echo " "
echo "Result of local build:"
echo "##########################################"
tree ./dist
tree ./$module/dist
echo "##########################################"