update linting

This commit is contained in:
Sergey Dudoladov
2019-10-02 13:36:54 +02:00
parent f0e29060b1
commit 7217046ef5
14 changed files with 60 additions and 42 deletions
+3 -2
View File
@@ -25,11 +25,12 @@ package cmd
import (
"encoding/json"
"fmt"
"log"
"github.com/spf13/cobra"
PostgresqlLister "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"log"
)
// addDbCmd represents the addDb command
@@ -69,7 +70,7 @@ func addDb(dbName string, dbOwner string, clusterName string) {
var dbOwnerExists bool
dbUsers := postgresql.Spec.Users
for key, _ := range dbUsers {
for key := range dbUsers {
if key == dbOwner {
dbOwnerExists = true
}
+6 -2
View File
@@ -24,12 +24,13 @@ package cmd
import (
"fmt"
"io/ioutil"
"log"
"github.com/spf13/cobra"
v1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1"
PostgresqlLister "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1"
"io/ioutil"
"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme"
"log"
)
// createCmd kubectl pg create.
@@ -50,6 +51,9 @@ kubectl pg create -f cluster-manifest.yaml
func create(fileName string) {
config := getConfig()
postgresConfig, err := PostgresqlLister.NewForConfig(config)
if err != nil {
log.Fatal(err)
}
ymlFile, err := ioutil.ReadFile(fileName)
if err != nil {
log.Fatal(err)
+5 -4
View File
@@ -25,20 +25,21 @@ package cmd
import (
"encoding/json"
"fmt"
"log"
"strconv"
"github.com/spf13/cobra"
PostgresqlLister "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"log"
"strconv"
)
// extVolumeCmd represents the extVolume command
var extVolumeCmd = &cobra.Command{
Use: "ext-volume",
Short: "Increases the volume size of a given Postgres cluster",
Long: `Extends the volume of the postgres cluster. But volume cannot be shrinked.`,
Long: `Extends the volume of the postgres cluster. But volume cannot be shrunk.`,
Run: func(cmd *cobra.Command, args []string) {
clusterName, _ := cmd.Flags().GetString("cluster")
if len(args) > 0 {
@@ -98,7 +99,7 @@ func extVolume(increasedVolumeSize string, clusterName string) {
} else if newSize.Value() == oldSize.Value() {
fmt.Println("volume already has the desired size.")
} else {
fmt.Printf("volume %s size cannot be shrinked.\n", postgresql.Spec.Volume.Size)
fmt.Printf("volume %s size cannot be shrunk.\n", postgresql.Spec.Volume.Size)
}
}
+6 -2
View File
@@ -25,6 +25,9 @@ package cmd
import (
"encoding/json"
"fmt"
"log"
"strconv"
"github.com/spf13/cobra"
PostgresqlLister "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1"
v1 "k8s.io/api/apps/v1"
@@ -32,8 +35,6 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"log"
"strconv"
)
// scaleCmd represents the scale command
@@ -44,6 +45,9 @@ var scaleCmd = &cobra.Command{
Scaling to 0 leads to down time.`,
Run: func(cmd *cobra.Command, args []string) {
clusterName, err := cmd.Flags().GetString("cluster")
if err != nil {
log.Fatal(err)
}
namespace, err := cmd.Flags().GetString("namespace")
if err != nil {
log.Fatal(err)
+6 -2
View File
@@ -24,13 +24,14 @@ package cmd
import (
"fmt"
"io/ioutil"
"log"
"github.com/spf13/cobra"
v1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1"
PostgresqlLister "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1"
"io/ioutil"
"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"log"
)
// updateCmd represents kubectl pg update
@@ -55,6 +56,9 @@ kubectl pg update -f cluster-manifest.yaml
func updatePgResources(fileName string) {
config := getConfig()
postgresConfig, err := PostgresqlLister.NewForConfig(config)
if err != nil {
log.Fatal(err)
}
ymlFile, err := ioutil.ReadFile(fileName)
if err != nil {
log.Fatal(err)