Make generation of the apply annotation optional

This commit is contained in:
Janet Kuo
2015-11-04 13:47:08 -08:00
parent 13e68d2a87
commit a6a64820d7
24 changed files with 158 additions and 41 deletions

View File

@@ -28,7 +28,6 @@ import (
"strings"
"time"
"github.com/evanphx/json-patch"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/unversioned"
@@ -39,11 +38,16 @@ import (
"k8s.io/kubernetes/pkg/runtime"
utilerrors "k8s.io/kubernetes/pkg/util/errors"
"github.com/evanphx/json-patch"
"github.com/golang/glog"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
const (
ApplyAnnotationsFlag = "save-config"
)
type debugError interface {
DebugError() (msg string, args []interface{})
}
@@ -283,6 +287,10 @@ func AddValidateFlags(cmd *cobra.Command) {
cmd.Flags().String("schema-cache-dir", fmt.Sprintf("~/%s/%s", clientcmd.RecommendedHomeDir, clientcmd.RecommendedSchemaName), fmt.Sprintf("If non-empty, load/store cached API schemas in this directory, default is '$HOME/%s/%s'", clientcmd.RecommendedHomeDir, clientcmd.RecommendedSchemaName))
}
func AddApplyAnnotationFlags(cmd *cobra.Command) {
cmd.Flags().Bool(ApplyAnnotationsFlag, false, "If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future.")
}
func ReadConfigDataFromReader(reader io.Reader, source string) ([]byte, error) {
data, err := ioutil.ReadAll(reader)
if err != nil {