Merge pull request #6791 from xichengliudui/update-go-const-part3

Using const() defines constants together (part:3)
This commit is contained in:
Kubernetes Prow Robot 2019-04-17 23:26:10 -07:00 committed by GitHub
commit d517e0c58e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 24 deletions

View File

@ -26,8 +26,10 @@ import (
"k8s.io/kops/upup/pkg/fi/cloudup/awstasks"
)
const BastionELBSecurityGroupPrefix = "bastion"
const BastionELBDefaultIdleTimeout = 5 * time.Minute
const (
BastionELBSecurityGroupPrefix = "bastion"
BastionELBDefaultIdleTimeout = 5 * time.Minute
)
// BastionModelBuilder adds model objects to support bastions
//

View File

@ -27,8 +27,10 @@ import (
"github.com/golang/glog"
)
const GUARD_BEGIN = "# Begin host entries managed by kops - do not edit"
const GUARD_END = "# End host entries managed by kops"
const (
GUARD_BEGIN = "# Begin host entries managed by kops - do not edit"
GUARD_END = "# End host entries managed by kops"
)
func UpdateHostsFileWithRecords(p string, addrToHosts map[string][]string) error {
stat, err := os.Stat(p)

View File

@ -33,8 +33,10 @@ import (
"k8s.io/kops/upup/pkg/fi/cloudup/vsphere"
)
const VolumeMetaDataFile = "/vol-metadata/metadata.json"
const VolStatusValue = "attached"
const (
VolumeMetaDataFile = "/vol-metadata/metadata.json"
VolStatusValue = "attached"
)
// VSphereVolumes represents vSphere volume and implements Volumes interface.
type VSphereVolumes struct{}

View File

@ -36,10 +36,12 @@ import (
"k8s.io/kops/upup/pkg/fi"
)
const TagClusterName = "KubernetesCluster"
const TagNameRolePrefix = "k8s.io/role/"
const TagNameEtcdClusterPrefix = "k8s.io/etcd/"
const TagRoleMaster = "master"
const (
TagClusterName = "KubernetesCluster"
TagNameRolePrefix = "k8s.io/role/"
TagNameEtcdClusterPrefix = "k8s.io/etcd/"
TagRoleMaster = "master"
)
// This is for statistic purpose.
var KubernetesKopsIdentity = fmt.Sprintf("Kubernetes.Kops/%s", prj.Version)

View File

@ -23,11 +23,13 @@ import (
"strings"
)
// The tag name we use to differentiate multiple logically independent clusters running in the same region
const GceLabelNameKubernetesCluster = "k8s-io-cluster-name"
const (
// The tag name we use to differentiate multiple logically independent clusters running in the same region
GceLabelNameKubernetesCluster = "k8s-io-cluster-name"
const GceLabelNameRolePrefix = "k8s-io-role-"
const GceLabelNameEtcdClusterPrefix = "k8s-io-etcd-"
GceLabelNameRolePrefix = "k8s-io-role-"
GceLabelNameEtcdClusterPrefix = "k8s-io-etcd-"
)
// EncodeGCELabel encodes a string into an RFC1035 compatible value, suitable for use as GCE label key or value
// We use a URI inspired escaping, but with - instead of %.

View File

@ -57,10 +57,12 @@ import (
"k8s.io/kops/util/pkg/vfs"
)
const TagNameEtcdClusterPrefix = "k8s.io/etcd/"
const TagNameRolePrefix = "k8s.io/role/"
const TagClusterName = "KubernetesCluster"
const TagRoleMaster = "master"
const (
TagNameEtcdClusterPrefix = "k8s.io/etcd/"
TagNameRolePrefix = "k8s.io/role/"
TagClusterName = "KubernetesCluster"
TagRoleMaster = "master"
)
// ErrNotFound is used to inform that the object is not found
var ErrNotFound = "Resource not found"

View File

@ -29,10 +29,12 @@ import (
"k8s.io/kops/util/pkg/hashing"
)
const defaultKopsBaseUrl = "https://kubeupv2.s3.amazonaws.com/kops/%s/"
const (
defaultKopsBaseUrl = "https://kubeupv2.s3.amazonaws.com/kops/%s/"
// defaultKopsMirrorBase will be detected and automatically set to pull from the defaultKopsMirrors
const defaultKopsMirrorBase = "https://kubeupv2.s3.amazonaws.com/kops/%s/"
// defaultKopsMirrorBase will be detected and automatically set to pull from the defaultKopsMirrors
defaultKopsMirrorBase = "https://kubeupv2.s3.amazonaws.com/kops/%s/"
)
// mirror holds the configuration for a mirror
type mirror struct {

View File

@ -37,9 +37,11 @@ func NewVFSScan(base Path) *VFSScan {
type ChangeType string
const ChangeType_Added ChangeType = "ADDED"
const ChangeType_Removed ChangeType = "REMOVED"
const ChangeType_Modified ChangeType = "MODIFIED"
const (
ChangeType_Added ChangeType = "ADDED"
ChangeType_Removed ChangeType = "REMOVED"
ChangeType_Modified ChangeType = "MODIFIED"
)
type Change struct {
ChangeType ChangeType