Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using const() defines constants together (part:3) #6791

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkg/model/bastion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
6 changes: 4 additions & 2 deletions protokube/pkg/gossip/dns/hosts/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions protokube/pkg/protokube/vsphere_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
10 changes: 6 additions & 4 deletions upup/pkg/fi/cloudup/aliup/ali_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions upup/pkg/fi/cloudup/gce/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 %.
Expand Down
10 changes: 6 additions & 4 deletions upup/pkg/fi/cloudup/openstack/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 5 additions & 3 deletions upup/pkg/fi/cloudup/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 5 additions & 3 deletions util/pkg/vfs/vfssync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down