Using const() defines constants together (part:1)

Signed-off-by: xichengliudui <1693291525@qq.com>

update pull request
Signed-off-by: xichengliudui <1693291525@qq.com>

update pull request
Signed-off-by: xichengliudui <1693291525@qq.com>
pull/5606/head
xichengliudui 6 years ago
parent 8494d133bf
commit 5edb79df4c

@ -16,16 +16,18 @@ limitations under the License.
package kube package kube
// ResourcePolicyAnno is the annotation name for a resource policy const (
const ResourcePolicyAnno = "helm.sh/resource-policy" // ResourcePolicyAnno is the annotation name for a resource policy
ResourcePolicyAnno = "helm.sh/resource-policy"
// deletePolicy is the resource policy type for delete // deletePolicy is the resource policy type for delete
// //
// This resource policy type allows explicitly opting in to the default // This resource policy type allows explicitly opting in to the default
// resource deletion behavior, for example when overriding a chart's // resource deletion behavior, for example when overriding a chart's
// default annotations. Any other value allows resources to skip being // default annotations. Any other value allows resources to skip being
// deleted during an uninstallRelease action. // deleted during an uninstallRelease action.
const deletePolicy = "delete" deletePolicy = "delete"
)
// ResourcePolicyIsKeep accepts a map of Kubernetes resource annotations and // ResourcePolicyIsKeep accepts a map of Kubernetes resource annotations and
// returns true if the resource should be kept, otherwise false if it is safe // returns true if the resource should be kept, otherwise false if it is safe

@ -25,7 +25,11 @@ import (
"k8s.io/helm/pkg/lint/support" "k8s.io/helm/pkg/lint/support"
) )
const templateTestBasedir = "./testdata/albatross" const (
strict = false
namespace = "testNamespace"
templateTestBasedir = "./testdata/albatross"
)
func TestValidateAllowedExtension(t *testing.T) { func TestValidateAllowedExtension(t *testing.T) {
var failTest = []string{"/foo", "/test.toml"} var failTest = []string{"/foo", "/test.toml"}
@ -46,9 +50,6 @@ func TestValidateAllowedExtension(t *testing.T) {
var values = []byte("nameOverride: ''\nhttpPort: 80") var values = []byte("nameOverride: ''\nhttpPort: 80")
const namespace = "testNamespace"
const strict = false
func TestTemplateParsing(t *testing.T) { func TestTemplateParsing(t *testing.T) {
linter := support.Linter{ChartDir: templateTestBasedir} linter := support.Linter{ChartDir: templateTestBasedir}
Templates(&linter, values, namespace, strict) Templates(&linter, values, namespace, strict)

@ -37,11 +37,13 @@ import (
"k8s.io/helm/pkg/storage/driver" "k8s.io/helm/pkg/storage/driver"
) )
// DefaultTillerNamespace is the default namespace for Tiller. const (
const DefaultTillerNamespace = "kube-system" // DefaultTillerNamespace is the default namespace for Tiller.
DefaultTillerNamespace = "kube-system"
// GoTplEngine is the name of the Go template engine, as registered in the EngineYard. // GoTplEngine is the name of the Go template engine, as registered in the EngineYard.
const GoTplEngine = "gotpl" GoTplEngine = "gotpl"
)
// DefaultEngine points to the engine that the EngineYard should treat as the // DefaultEngine points to the engine that the EngineYard should treat as the
// default. A chart that does not specify an engine may be run through the // default. A chart that does not specify an engine may be run through the

@ -40,18 +40,20 @@ import (
"k8s.io/helm/pkg/version" "k8s.io/helm/pkg/version"
) )
// releaseNameMaxLen is the maximum length of a release name. const (
// // releaseNameMaxLen is the maximum length of a release name.
// As of Kubernetes 1.4, the max limit on a name is 63 chars. We reserve 10 for //
// charts to add data. Effectively, that gives us 53 chars. // As of Kubernetes 1.4, the max limit on a name is 63 chars. We reserve 10 for
// See https://github.com/kubernetes/helm/issues/1528 // charts to add data. Effectively, that gives us 53 chars.
const releaseNameMaxLen = 53 // See https://github.com/kubernetes/helm/issues/1528
releaseNameMaxLen = 53
// NOTESFILE_SUFFIX that we want to treat special. It goes through the templating engine
// but it's not a yaml file (resource) hence can't have hooks, etc. And the user actually // NOTESFILE_SUFFIX that we want to treat special. It goes through the templating engine
// wants to see this file after rendering in the status command. However, it must be a suffix // but it's not a yaml file (resource) hence can't have hooks, etc. And the user actually
// since there can be filepath in front of it. // wants to see this file after rendering in the status command. However, it must be a suffix
const notesFileSuffix = "NOTES.txt" // since there can be filepath in front of it.
notesFileSuffix = "NOTES.txt"
)
var ( var (
// errMissingChart indicates that a chart was not provided. // errMissingChart indicates that a chart was not provided.

Loading…
Cancel
Save