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" "k8s.io/kops/upup/pkg/fi/cloudup/awstasks"
) )
const BastionELBSecurityGroupPrefix = "bastion" const (
const BastionELBDefaultIdleTimeout = 5 * time.Minute BastionELBSecurityGroupPrefix = "bastion"
BastionELBDefaultIdleTimeout = 5 * time.Minute
)
// BastionModelBuilder adds model objects to support bastions // BastionModelBuilder adds model objects to support bastions
// //

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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