go fmt run
This commit is contained in:
parent
abd04e6f5a
commit
5adceceb36
12
cmd/main.go
12
cmd/main.go
|
|
@ -15,13 +15,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
KubeConfigFile string
|
KubeConfigFile string
|
||||||
podNamespace string
|
podNamespace string
|
||||||
configMapName spec.NamespacedName
|
configMapName spec.NamespacedName
|
||||||
OutOfCluster bool
|
OutOfCluster bool
|
||||||
noTeamsAPI bool
|
noTeamsAPI bool
|
||||||
noDatabaseAccess bool
|
noDatabaseAccess bool
|
||||||
version string
|
version string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package cluster
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"k8s.io/client-go/pkg/api/resource"
|
"k8s.io/client-go/pkg/api/resource"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
|
|
|
||||||
|
|
@ -40,17 +40,17 @@ func (c *Cluster) DatabaseAccessDisabled() bool {
|
||||||
}
|
}
|
||||||
func (c *Cluster) initDbConn() (err error) {
|
func (c *Cluster) initDbConn() (err error) {
|
||||||
if c.pgDb == nil {
|
if c.pgDb == nil {
|
||||||
conn, err := sql.Open("postgres", c.pgConnectionString())
|
conn, err := sql.Open("postgres", c.pgConnectionString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = conn.Ping()
|
err = conn.Ping()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
conn.Close()
|
conn.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
c.pgDb = conn
|
c.pgDb = conn
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
remotecommandconsts "k8s.io/apimachinery/pkg/util/remotecommand"
|
||||||
"k8s.io/client-go/pkg/api"
|
"k8s.io/client-go/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/remotecommand"
|
"k8s.io/kubernetes/pkg/client/unversioned/remotecommand"
|
||||||
remotecommandconsts "k8s.io/apimachinery/pkg/util/remotecommand"
|
|
||||||
|
|
||||||
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ type Config struct {
|
||||||
WALES3Bucket string `name:"wal_s3_bucket"`
|
WALES3Bucket string `name:"wal_s3_bucket"`
|
||||||
KubeIAMRole string `name:"kube_iam_role"`
|
KubeIAMRole string `name:"kube_iam_role"`
|
||||||
DebugLogging bool `name:"debug_logging" default:"false"`
|
DebugLogging bool `name:"debug_logging" default:"false"`
|
||||||
EnableDBAccess bool `name:"enable_database_access" default:"true"`
|
EnableDBAccess bool `name:"enable_database_access" default:"true"`
|
||||||
EnableTeamsAPI bool `name:"enable_teams_api" default:"true"`
|
EnableTeamsAPI bool `name:"enable_teams_api" default:"true"`
|
||||||
DNSNameFormat string `name:"dns_name_format" default:"%s.%s.%s"`
|
DNSNameFormat string `name:"dns_name_format" default:"%s.%s.%s"`
|
||||||
Workers uint32 `name:"workers" default:"4"`
|
Workers uint32 `name:"workers" default:"4"`
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ type TeamsAPI struct {
|
||||||
httpClient *http.Client
|
httpClient *http.Client
|
||||||
logger *logrus.Entry
|
logger *logrus.Entry
|
||||||
RefreshTokenAction func() (string, error)
|
RefreshTokenAction func() (string, error)
|
||||||
enabled bool
|
enabled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTeamsAPI(url string, log *logrus.Logger, enabled bool) *TeamsAPI {
|
func NewTeamsAPI(url string, log *logrus.Logger, enabled bool) *TeamsAPI {
|
||||||
|
|
@ -50,7 +50,7 @@ func NewTeamsAPI(url string, log *logrus.Logger, enabled bool) *TeamsAPI {
|
||||||
url: strings.TrimRight(url, "/"),
|
url: strings.TrimRight(url, "/"),
|
||||||
httpClient: &http.Client{},
|
httpClient: &http.Client{},
|
||||||
logger: log.WithField("pkg", "teamsapi"),
|
logger: log.WithField("pkg", "teamsapi"),
|
||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &t
|
return &t
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue