From db72d82f14cc4a2178504efc899df8158f6e9a4d Mon Sep 17 00:00:00 2001 From: Vineeth Reddy Date: Mon, 4 Mar 2019 17:43:55 +0530 Subject: [PATCH] gofmt and golint fixes (#506) * fix gofmt and golint issues --- .../v1/operator_configuration_type.go | 10 ++--- pkg/apis/acid.zalan.do/v1/register.go | 2 +- pkg/cluster/k8sres_test.go | 8 ++-- pkg/controller/operator_config.go | 4 +- pkg/util/config/config.go | 38 +++++++++---------- pkg/util/util.go | 2 +- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go b/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go index 3c406d2e3..dde9b624b 100644 --- a/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go +++ b/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go @@ -58,11 +58,11 @@ type KubernetesMetaConfiguration struct { // TODO: use a proper toleration structure? PodToleration map[string]string `json:"toleration,omitempty"` // TODO: use namespacedname - PodEnvironmentConfigMap string `json:"pod_environment_configmap,omitempty"` - PodPriorityClassName string `json:"pod_priority_class_name,omitempty"` - MasterPodMoveTimeout time.Duration `json:"master_pod_move_timeout,omitempty"` - EnablePodAntiAffinity bool `json:"enable_pod_antiaffinity" default:"false"` - PodAntiAffinityTopologyKey string `name:"pod_antiaffinity_topology_key" default:"kubernetes.io/hostname"` + PodEnvironmentConfigMap string `json:"pod_environment_configmap,omitempty"` + PodPriorityClassName string `json:"pod_priority_class_name,omitempty"` + MasterPodMoveTimeout time.Duration `json:"master_pod_move_timeout,omitempty"` + EnablePodAntiAffinity bool `json:"enable_pod_antiaffinity" default:"false"` + PodAntiAffinityTopologyKey string `name:"pod_antiaffinity_topology_key" default:"kubernetes.io/hostname"` } // PostgresPodResourcesDefaults defines the spec of default resources diff --git a/pkg/apis/acid.zalan.do/v1/register.go b/pkg/apis/acid.zalan.do/v1/register.go index ed0add91d..1c30e35fb 100644 --- a/pkg/apis/acid.zalan.do/v1/register.go +++ b/pkg/apis/acid.zalan.do/v1/register.go @@ -16,7 +16,7 @@ const ( var ( // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. - // An instance of runtime.SchemeBuilder, global for this package + // SchemeBuilder : An instance of runtime.SchemeBuilder, global for this package SchemeBuilder runtime.SchemeBuilder localSchemeBuilder = &SchemeBuilder //AddToScheme is localSchemeBuilder.AddToScheme diff --git a/pkg/cluster/k8sres_test.go b/pkg/cluster/k8sres_test.go index 73af5a3d3..6b96f8ec1 100644 --- a/pkg/cluster/k8sres_test.go +++ b/pkg/cluster/k8sres_test.go @@ -91,7 +91,7 @@ func TestShmVolume(t *testing.T) { podSpec: &v1.PodSpec{ Volumes: []v1.Volume{}, Containers: []v1.Container{ - v1.Container{ + { VolumeMounts: []v1.VolumeMount{}, }, }, @@ -101,11 +101,11 @@ func TestShmVolume(t *testing.T) { { subTest: "non empty PodSpec", podSpec: &v1.PodSpec{ - Volumes: []v1.Volume{v1.Volume{}}, + Volumes: []v1.Volume{{}}, Containers: []v1.Container{ - v1.Container{ + { VolumeMounts: []v1.VolumeMount{ - v1.VolumeMount{}, + {}, }, }, }, diff --git a/pkg/controller/operator_config.go b/pkg/controller/operator_config.go index 85535fa32..bca0f5b34 100644 --- a/pkg/controller/operator_config.go +++ b/pkg/controller/operator_config.go @@ -54,8 +54,8 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur result.PodPriorityClassName = fromCRD.Kubernetes.PodPriorityClassName result.MasterPodMoveTimeout = fromCRD.Kubernetes.MasterPodMoveTimeout - result.EnablePodAntiAffinity = fromCRD.Kubernetes.EnablePodAntiAffinity; - result.PodAntiAffinityTopologyKey = fromCRD.Kubernetes.PodAntiAffinityTopologyKey; + result.EnablePodAntiAffinity = fromCRD.Kubernetes.EnablePodAntiAffinity + result.PodAntiAffinityTopologyKey = fromCRD.Kubernetes.PodAntiAffinityTopologyKey result.DefaultCPURequest = fromCRD.PostgresPodResources.DefaultCPURequest result.DefaultMemoryRequest = fromCRD.PostgresPodResources.DefaultMemoryRequest diff --git a/pkg/util/config/config.go b/pkg/util/config/config.go index a60c8e673..3ea8874c5 100644 --- a/pkg/util/config/config.go +++ b/pkg/util/config/config.go @@ -79,25 +79,25 @@ type Config struct { // default name `operator` enables backward compatibility with the older ServiceAccountName field PodServiceAccountName string `name:"pod_service_account_name" default:"operator"` // value of this string must be valid JSON or YAML; see initPodServiceAccount - PodServiceAccountDefinition string `name:"pod_service_account_definition" default:""` - PodServiceAccountRoleBindingDefinition string `name:"pod_service_account_role_binding_definition" default:""` - MasterPodMoveTimeout time.Duration `name:"master_pod_move_timeout" default:"20m"` - DbHostedZone string `name:"db_hosted_zone" default:"db.example.com"` - AWSRegion string `name:"aws_region" default:"eu-central-1"` - WALES3Bucket string `name:"wal_s3_bucket"` - LogS3Bucket string `name:"log_s3_bucket"` - KubeIAMRole string `name:"kube_iam_role"` - DebugLogging bool `name:"debug_logging" default:"true"` - EnableDBAccess bool `name:"enable_database_access" default:"true"` - EnableTeamsAPI bool `name:"enable_teams_api" default:"true"` - EnableTeamSuperuser bool `name:"enable_team_superuser" default:"false"` - TeamAdminRole string `name:"team_admin_role" default:"admin"` - EnableAdminRoleForUsers bool `name:"enable_admin_role_for_users" default:"true"` - EnableMasterLoadBalancer bool `name:"enable_master_load_balancer" default:"true"` - EnableReplicaLoadBalancer bool `name:"enable_replica_load_balancer" default:"false"` - CustomServiceAnnotations map[string]string `name:"custom_service_annotations"` - EnablePodAntiAffinity bool `name:"enable_pod_antiaffinity" default:"false"` - PodAntiAffinityTopologyKey string `name:"pod_antiaffinity_topology_key" default:"kubernetes.io/hostname"` + PodServiceAccountDefinition string `name:"pod_service_account_definition" default:""` + PodServiceAccountRoleBindingDefinition string `name:"pod_service_account_role_binding_definition" default:""` + MasterPodMoveTimeout time.Duration `name:"master_pod_move_timeout" default:"20m"` + DbHostedZone string `name:"db_hosted_zone" default:"db.example.com"` + AWSRegion string `name:"aws_region" default:"eu-central-1"` + WALES3Bucket string `name:"wal_s3_bucket"` + LogS3Bucket string `name:"log_s3_bucket"` + KubeIAMRole string `name:"kube_iam_role"` + DebugLogging bool `name:"debug_logging" default:"true"` + EnableDBAccess bool `name:"enable_database_access" default:"true"` + EnableTeamsAPI bool `name:"enable_teams_api" default:"true"` + EnableTeamSuperuser bool `name:"enable_team_superuser" default:"false"` + TeamAdminRole string `name:"team_admin_role" default:"admin"` + EnableAdminRoleForUsers bool `name:"enable_admin_role_for_users" default:"true"` + EnableMasterLoadBalancer bool `name:"enable_master_load_balancer" default:"true"` + EnableReplicaLoadBalancer bool `name:"enable_replica_load_balancer" default:"false"` + CustomServiceAnnotations map[string]string `name:"custom_service_annotations"` + EnablePodAntiAffinity bool `name:"enable_pod_antiaffinity" default:"false"` + PodAntiAffinityTopologyKey string `name:"pod_antiaffinity_topology_key" default:"kubernetes.io/hostname"` // deprecated and kept for backward compatibility EnableLoadBalancer *bool `name:"enable_load_balancer"` MasterDNSNameFormat StringTemplate `name:"master_dns_name_format" default:"{cluster}.{team}.{hostedzone}"` diff --git a/pkg/util/util.go b/pkg/util/util.go index 60d8159a9..20e1951f6 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -130,7 +130,7 @@ func Coalesce(val, defaultVal string) string { return val } -// RequestIsSmallerThanLimit +// RequestIsSmallerThanLimit : ... func RequestIsSmallerThanLimit(requestStr, limitStr string) (bool, error) { request, err := resource.ParseQuantity(requestStr)