update linting
This commit is contained in:
		
							parent
							
								
									f0e29060b1
								
							
						
					
					
						commit
						7217046ef5
					
				
							
								
								
									
										14
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										14
									
								
								Makefile
								
								
								
								
							|  | @ -20,7 +20,7 @@ GITSTATUS = $(shell git status --porcelain || echo "no changes") | ||||||
| SOURCES = cmd/main.go | SOURCES = cmd/main.go | ||||||
| VERSION ?= $(shell git describe --tags --always --dirty) | VERSION ?= $(shell git describe --tags --always --dirty) | ||||||
| DIRS := cmd pkg | DIRS := cmd pkg | ||||||
| PKG := `go list ./... | grep -v /vendor/` | PKG := `go list ./... | grep --invert-match /vendor/ | grep --invert-match /kubectl-pg` | ||||||
| 
 | 
 | ||||||
| ifeq ($(DEBUG),1) | ifeq ($(DEBUG),1) | ||||||
| 	DOCKERFILE = DebugDockerfile | 	DOCKERFILE = DebugDockerfile | ||||||
|  | @ -46,7 +46,7 @@ default: local | ||||||
| clean: | clean: | ||||||
| 	rm -rf build scm-source.json | 	rm -rf build scm-source.json | ||||||
| 
 | 
 | ||||||
| local: ${SOURCES} | local: test ${SOURCES} | ||||||
| 	hack/verify-codegen.sh | 	hack/verify-codegen.sh | ||||||
| 	CGO_ENABLED=${CGO_ENABLED} go build -o build/${BINARY} $(LOCAL_BUILD_FLAGS) -ldflags "$(LDFLAGS)" $^ | 	CGO_ENABLED=${CGO_ENABLED} go build -o build/${BINARY} $(LOCAL_BUILD_FLAGS) -ldflags "$(LDFLAGS)" $^ | ||||||
| 
 | 
 | ||||||
|  | @ -60,7 +60,7 @@ docker-context: scm-source.json linux | ||||||
| 	mkdir -p docker/build/ | 	mkdir -p docker/build/ | ||||||
| 	cp build/linux/${BINARY} scm-source.json docker/build/ | 	cp build/linux/${BINARY} scm-source.json docker/build/ | ||||||
| 
 | 
 | ||||||
| docker: ${DOCKERDIR}/${DOCKERFILE} docker-context | docker: test ${DOCKERDIR}/${DOCKERFILE} docker-context | ||||||
| 	echo `(env)` | 	echo `(env)` | ||||||
| 	echo "Tag ${TAG}" | 	echo "Tag ${TAG}" | ||||||
| 	echo "Version ${VERSION}" | 	echo "Version ${VERSION}" | ||||||
|  | @ -78,22 +78,24 @@ scm-source.json: .git | ||||||
| 	echo '{\n "url": "git:$(GITURL)",\n "revision": "$(GITHEAD)",\n "author": "$(USER)",\n "status": "$(GITSTATUS)"\n}' > scm-source.json | 	echo '{\n "url": "git:$(GITURL)",\n "revision": "$(GITHEAD)",\n "author": "$(USER)",\n "status": "$(GITSTATUS)"\n}' > scm-source.json | ||||||
| 
 | 
 | ||||||
| tools: | tools: | ||||||
|  | 	@go get -u github.com/gordonklaus/ineffassign | ||||||
| 	@go get -u honnef.co/go/tools/cmd/staticcheck | 	@go get -u honnef.co/go/tools/cmd/staticcheck | ||||||
| 	@go get -u github.com/Masterminds/glide | 	@go get -u github.com/Masterminds/glide | ||||||
| 
 | 
 | ||||||
| fmt: | fmt: | ||||||
| 	@gofmt -l -w -s $(DIRS) | 	@gofmt -l -w -s $(DIRS) | ||||||
| 
 | 
 | ||||||
| vet: | vet: fmt | ||||||
| 	@go vet $(PKG) | 	@go vet $(PKG) | ||||||
|  | 	@ineffassign kubectl-pg pkg | ||||||
| 	@staticcheck $(PKG) | 	@staticcheck $(PKG) | ||||||
| 
 | 
 | ||||||
| deps: | deps: | ||||||
| 	@glide install --strip-vendor | 	@glide install --strip-vendor | ||||||
| 
 | 
 | ||||||
| test: | test: vet | ||||||
| 	hack/verify-codegen.sh | 	hack/verify-codegen.sh | ||||||
| 	@go test ./... | 	@go test $(PKG) | ||||||
| 
 | 
 | ||||||
| e2e: docker # build operator image to be tested
 | e2e: docker # build operator image to be tested
 | ||||||
| 	cd e2e; make tools test clean | 	cd e2e; make tools test clean | ||||||
|  |  | ||||||
|  | @ -33,7 +33,7 @@ $ $GOPATH/src/github.com/zalando/postgres-operator/kubectl-pg  go install | ||||||
| # This will place the kubectl-pg binary in your $GOPATH/bin | # This will place the kubectl-pg binary in your $GOPATH/bin | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ### Before using the kubectl pg plugin make sure to set KUBECONFIG env varibale | ### Before using the kubectl pg plugin make sure to set KUBECONFIG env variable | ||||||
| 
 | 
 | ||||||
| Ideally KUBECONFIG is found in $HOME/.kube/config else specify the KUBECONFIG path here. | Ideally KUBECONFIG is found in $HOME/.kube/config else specify the KUBECONFIG path here. | ||||||
| 
 | 
 | ||||||
|  | @ -117,7 +117,7 @@ Note: -p represents psql prompt | ||||||
| 
 | 
 | ||||||
| ```kubectl pg logs -c CLUSTER``` #Fetches the logs of a random pod. Not master | ```kubectl pg logs -c CLUSTER``` #Fetches the logs of a random pod. Not master | ||||||
| ```kubectl pg logs -c CLUSTER -m``` #Fetches the logs of master | ```kubectl pg logs -c CLUSTER -m``` #Fetches the logs of master | ||||||
| ```kubectl pg logs -c CLUSTER -r 2``` #Fecthes the logs of specified replica | ```kubectl pg logs -c CLUSTER -r 2``` #Fetches the logs of specified replica | ||||||
| 
 | 
 | ||||||
| ## Development | ## Development | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -25,11 +25,12 @@ package cmd | ||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"log" | ||||||
|  | 
 | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
| 	PostgresqlLister "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1" | 	PostgresqlLister "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1" | ||||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
| 	"k8s.io/apimachinery/pkg/types" | 	"k8s.io/apimachinery/pkg/types" | ||||||
| 	"log" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // addDbCmd represents the addDb command
 | // addDbCmd represents the addDb command
 | ||||||
|  | @ -69,7 +70,7 @@ func addDb(dbName string, dbOwner string, clusterName string) { | ||||||
| 
 | 
 | ||||||
| 	var dbOwnerExists bool | 	var dbOwnerExists bool | ||||||
| 	dbUsers := postgresql.Spec.Users | 	dbUsers := postgresql.Spec.Users | ||||||
| 	for key, _ := range dbUsers { | 	for key := range dbUsers { | ||||||
| 		if key == dbOwner { | 		if key == dbOwner { | ||||||
| 			dbOwnerExists = true | 			dbOwnerExists = true | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -24,12 +24,13 @@ package cmd | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"io/ioutil" | ||||||
|  | 	"log" | ||||||
|  | 
 | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
| 	v1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1" | 	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" | 	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" | 	"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme" | ||||||
| 	"log" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // createCmd kubectl pg create.
 | // createCmd kubectl pg create.
 | ||||||
|  | @ -50,6 +51,9 @@ kubectl pg create -f cluster-manifest.yaml | ||||||
| func create(fileName string) { | func create(fileName string) { | ||||||
| 	config := getConfig() | 	config := getConfig() | ||||||
| 	postgresConfig, err := PostgresqlLister.NewForConfig(config) | 	postgresConfig, err := PostgresqlLister.NewForConfig(config) | ||||||
|  | 	if err != nil { | ||||||
|  | 		log.Fatal(err) | ||||||
|  | 	} | ||||||
| 	ymlFile, err := ioutil.ReadFile(fileName) | 	ymlFile, err := ioutil.ReadFile(fileName) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		log.Fatal(err) | 		log.Fatal(err) | ||||||
|  |  | ||||||
|  | @ -25,20 +25,21 @@ package cmd | ||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"log" | ||||||
|  | 	"strconv" | ||||||
|  | 
 | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
| 	PostgresqlLister "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1" | 	PostgresqlLister "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1" | ||||||
| 	"k8s.io/apimachinery/pkg/api/resource" | 	"k8s.io/apimachinery/pkg/api/resource" | ||||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
| 	"k8s.io/apimachinery/pkg/types" | 	"k8s.io/apimachinery/pkg/types" | ||||||
| 	"log" |  | ||||||
| 	"strconv" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // extVolumeCmd represents the extVolume command
 | // extVolumeCmd represents the extVolume command
 | ||||||
| var extVolumeCmd = &cobra.Command{ | var extVolumeCmd = &cobra.Command{ | ||||||
| 	Use:   "ext-volume", | 	Use:   "ext-volume", | ||||||
| 	Short: "Increases the volume size of a given Postgres cluster", | 	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) { | 	Run: func(cmd *cobra.Command, args []string) { | ||||||
| 		clusterName, _ := cmd.Flags().GetString("cluster") | 		clusterName, _ := cmd.Flags().GetString("cluster") | ||||||
| 		if len(args) > 0 { | 		if len(args) > 0 { | ||||||
|  | @ -98,7 +99,7 @@ func extVolume(increasedVolumeSize string, clusterName string) { | ||||||
| 	} else if newSize.Value() == oldSize.Value() { | 	} else if newSize.Value() == oldSize.Value() { | ||||||
| 		fmt.Println("volume already has the desired size.") | 		fmt.Println("volume already has the desired size.") | ||||||
| 	} else { | 	} 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) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -25,6 +25,9 @@ package cmd | ||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"log" | ||||||
|  | 	"strconv" | ||||||
|  | 
 | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
| 	PostgresqlLister "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1" | 	PostgresqlLister "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1" | ||||||
| 	v1 "k8s.io/api/apps/v1" | 	v1 "k8s.io/api/apps/v1" | ||||||
|  | @ -32,8 +35,6 @@ import ( | ||||||
| 	"k8s.io/apimachinery/pkg/types" | 	"k8s.io/apimachinery/pkg/types" | ||||||
| 	"k8s.io/client-go/kubernetes" | 	"k8s.io/client-go/kubernetes" | ||||||
| 	"k8s.io/client-go/rest" | 	"k8s.io/client-go/rest" | ||||||
| 	"log" |  | ||||||
| 	"strconv" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // scaleCmd represents the scale command
 | // scaleCmd represents the scale command
 | ||||||
|  | @ -44,6 +45,9 @@ var scaleCmd = &cobra.Command{ | ||||||
| Scaling to 0 leads to down time.`, | Scaling to 0 leads to down time.`, | ||||||
| 	Run: func(cmd *cobra.Command, args []string) { | 	Run: func(cmd *cobra.Command, args []string) { | ||||||
| 		clusterName, err := cmd.Flags().GetString("cluster") | 		clusterName, err := cmd.Flags().GetString("cluster") | ||||||
|  | 		if err != nil { | ||||||
|  | 			log.Fatal(err) | ||||||
|  | 		} | ||||||
| 		namespace, err := cmd.Flags().GetString("namespace") | 		namespace, err := cmd.Flags().GetString("namespace") | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			log.Fatal(err) | 			log.Fatal(err) | ||||||
|  |  | ||||||
|  | @ -24,13 +24,14 @@ package cmd | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"io/ioutil" | ||||||
|  | 	"log" | ||||||
|  | 
 | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
| 	v1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1" | 	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" | 	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" | 	"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme" | ||||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
| 	"log" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // updateCmd represents kubectl pg update
 | // updateCmd represents kubectl pg update
 | ||||||
|  | @ -55,6 +56,9 @@ kubectl pg update -f cluster-manifest.yaml | ||||||
| func updatePgResources(fileName string) { | func updatePgResources(fileName string) { | ||||||
| 	config := getConfig() | 	config := getConfig() | ||||||
| 	postgresConfig, err := PostgresqlLister.NewForConfig(config) | 	postgresConfig, err := PostgresqlLister.NewForConfig(config) | ||||||
|  | 	if err != nil { | ||||||
|  | 		log.Fatal(err) | ||||||
|  | 	} | ||||||
| 	ymlFile, err := ioutil.ReadFile(fileName) | 	ymlFile, err := ioutil.ReadFile(fileName) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		log.Fatal(err) | 		log.Fatal(err) | ||||||
|  |  | ||||||
|  | @ -21,48 +21,48 @@ const ( | ||||||
| 
 | 
 | ||||||
| // PostgresCRDResourceColumns definition of AdditionalPrinterColumns for postgresql CRD
 | // PostgresCRDResourceColumns definition of AdditionalPrinterColumns for postgresql CRD
 | ||||||
| var PostgresCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefinition{ | var PostgresCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefinition{ | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:        "Team", | 		Name:        "Team", | ||||||
| 		Type:        "string", | 		Type:        "string", | ||||||
| 		Description: "Team responsible for Postgres cluster", | 		Description: "Team responsible for Postgres cluster", | ||||||
| 		JSONPath:    ".spec.teamId", | 		JSONPath:    ".spec.teamId", | ||||||
| 	}, | 	}, | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:        "Version", | 		Name:        "Version", | ||||||
| 		Type:        "string", | 		Type:        "string", | ||||||
| 		Description: "PostgreSQL version", | 		Description: "PostgreSQL version", | ||||||
| 		JSONPath:    ".spec.postgresql.version", | 		JSONPath:    ".spec.postgresql.version", | ||||||
| 	}, | 	}, | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:        "Pods", | 		Name:        "Pods", | ||||||
| 		Type:        "integer", | 		Type:        "integer", | ||||||
| 		Description: "Number of Pods per Postgres cluster", | 		Description: "Number of Pods per Postgres cluster", | ||||||
| 		JSONPath:    ".spec.numberOfInstances", | 		JSONPath:    ".spec.numberOfInstances", | ||||||
| 	}, | 	}, | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:        "Volume", | 		Name:        "Volume", | ||||||
| 		Type:        "string", | 		Type:        "string", | ||||||
| 		Description: "Size of the bound volume", | 		Description: "Size of the bound volume", | ||||||
| 		JSONPath:    ".spec.volume.size", | 		JSONPath:    ".spec.volume.size", | ||||||
| 	}, | 	}, | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:        "CPU-Request", | 		Name:        "CPU-Request", | ||||||
| 		Type:        "string", | 		Type:        "string", | ||||||
| 		Description: "Requested CPU for Postgres containers", | 		Description: "Requested CPU for Postgres containers", | ||||||
| 		JSONPath:    ".spec.resources.requests.cpu", | 		JSONPath:    ".spec.resources.requests.cpu", | ||||||
| 	}, | 	}, | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:        "Memory-Request", | 		Name:        "Memory-Request", | ||||||
| 		Type:        "string", | 		Type:        "string", | ||||||
| 		Description: "Requested memory for Postgres containers", | 		Description: "Requested memory for Postgres containers", | ||||||
| 		JSONPath:    ".spec.resources.requests.memory", | 		JSONPath:    ".spec.resources.requests.memory", | ||||||
| 	}, | 	}, | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:     "Age", | 		Name:     "Age", | ||||||
| 		Type:     "date", | 		Type:     "date", | ||||||
| 		JSONPath: ".metadata.creationTimestamp", | 		JSONPath: ".metadata.creationTimestamp", | ||||||
| 	}, | 	}, | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:        "Status", | 		Name:        "Status", | ||||||
| 		Type:        "string", | 		Type:        "string", | ||||||
| 		Description: "Current sync status of postgresql resource", | 		Description: "Current sync status of postgresql resource", | ||||||
|  | @ -72,31 +72,31 @@ var PostgresCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefinition{ | ||||||
| 
 | 
 | ||||||
| // OperatorConfigCRDResourceColumns definition of AdditionalPrinterColumns for OperatorConfiguration CRD
 | // OperatorConfigCRDResourceColumns definition of AdditionalPrinterColumns for OperatorConfiguration CRD
 | ||||||
| var OperatorConfigCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefinition{ | var OperatorConfigCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefinition{ | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:        "Image", | 		Name:        "Image", | ||||||
| 		Type:        "string", | 		Type:        "string", | ||||||
| 		Description: "Spilo image to be used for Pods", | 		Description: "Spilo image to be used for Pods", | ||||||
| 		JSONPath:    ".configuration.docker_image", | 		JSONPath:    ".configuration.docker_image", | ||||||
| 	}, | 	}, | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:        "Cluster-Label", | 		Name:        "Cluster-Label", | ||||||
| 		Type:        "string", | 		Type:        "string", | ||||||
| 		Description: "Label for K8s resources created by operator", | 		Description: "Label for K8s resources created by operator", | ||||||
| 		JSONPath:    ".configuration.kubernetes.cluster_name_label", | 		JSONPath:    ".configuration.kubernetes.cluster_name_label", | ||||||
| 	}, | 	}, | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:        "Service-Account", | 		Name:        "Service-Account", | ||||||
| 		Type:        "string", | 		Type:        "string", | ||||||
| 		Description: "Name of service account to be used", | 		Description: "Name of service account to be used", | ||||||
| 		JSONPath:    ".configuration.kubernetes.pod_service_account_name", | 		JSONPath:    ".configuration.kubernetes.pod_service_account_name", | ||||||
| 	}, | 	}, | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:        "Min-Instances", | 		Name:        "Min-Instances", | ||||||
| 		Type:        "integer", | 		Type:        "integer", | ||||||
| 		Description: "Minimum number of instances per Postgres cluster", | 		Description: "Minimum number of instances per Postgres cluster", | ||||||
| 		JSONPath:    ".configuration.min_instances", | 		JSONPath:    ".configuration.min_instances", | ||||||
| 	}, | 	}, | ||||||
| 	apiextv1beta1.CustomResourceColumnDefinition{ | 	{ | ||||||
| 		Name:     "Age", | 		Name:     "Age", | ||||||
| 		Type:     "date", | 		Type:     "date", | ||||||
| 		JSONPath: ".metadata.creationTimestamp", | 		JSONPath: ".metadata.creationTimestamp", | ||||||
|  |  | ||||||
|  | @ -81,7 +81,7 @@ func (ps *PostgresStatus) UnmarshalJSON(data []byte) error { | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		metaErr := json.Unmarshal(data, &status) | 		metaErr := json.Unmarshal(data, &status) | ||||||
| 		if metaErr != nil { | 		if metaErr != nil { | ||||||
| 			return fmt.Errorf("Could not parse status: %v; err %v", string(data), metaErr) | 			return fmt.Errorf("could not parse status: %v; err %v", string(data), metaErr) | ||||||
| 		} | 		} | ||||||
| 		tmp.PostgresClusterStatus = status | 		tmp.PostgresClusterStatus = status | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -45,7 +45,7 @@ type KubernetesMetaConfiguration struct { | ||||||
| 	PodServiceAccountDefinition            string                `json:"pod_service_account_definition,omitempty"` | 	PodServiceAccountDefinition            string                `json:"pod_service_account_definition,omitempty"` | ||||||
| 	PodServiceAccountRoleBindingDefinition string                `json:"pod_service_account_role_binding_definition,omitempty"` | 	PodServiceAccountRoleBindingDefinition string                `json:"pod_service_account_role_binding_definition,omitempty"` | ||||||
| 	PodTerminateGracePeriod                Duration              `json:"pod_terminate_grace_period,omitempty"` | 	PodTerminateGracePeriod                Duration              `json:"pod_terminate_grace_period,omitempty"` | ||||||
| 	SpiloPrivileged                        bool                  `json:"spilo_privileged,omitemty"` | 	SpiloPrivileged                        bool                  `json:"spilo_privileged,omitempty"` | ||||||
| 	SpiloFSGroup                           *int64                `json:"spilo_fsgroup,omitempty"` | 	SpiloFSGroup                           *int64                `json:"spilo_fsgroup,omitempty"` | ||||||
| 	WatchedNamespace                       string                `json:"watched_namespace,omitempty"` | 	WatchedNamespace                       string                `json:"watched_namespace,omitempty"` | ||||||
| 	PDBNameFormat                          config.StringTemplate `json:"pdb_name_format,omitempty"` | 	PDBNameFormat                          config.StringTemplate `json:"pdb_name_format,omitempty"` | ||||||
|  |  | ||||||
|  | @ -842,7 +842,7 @@ func (c *Cluster) initHumanUsers() error { | ||||||
| 	for _, postgresSuperuserTeam := range c.OpConfig.PostgresSuperuserTeams { | 	for _, postgresSuperuserTeam := range c.OpConfig.PostgresSuperuserTeams { | ||||||
| 		err := c.initTeamMembers(postgresSuperuserTeam, true) | 		err := c.initTeamMembers(postgresSuperuserTeam, true) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return fmt.Errorf("Cannot create a team %q of Postgres superusers: %v", postgresSuperuserTeam, err) | 			return fmt.Errorf("cannot create a team %q of Postgres superusers: %v", postgresSuperuserTeam, err) | ||||||
| 		} | 		} | ||||||
| 		if postgresSuperuserTeam == c.Spec.TeamID { | 		if postgresSuperuserTeam == c.Spec.TeamID { | ||||||
| 			clusterIsOwnedBySuperuserTeam = true | 			clusterIsOwnedBySuperuserTeam = true | ||||||
|  | @ -856,7 +856,7 @@ func (c *Cluster) initHumanUsers() error { | ||||||
| 
 | 
 | ||||||
| 	err := c.initTeamMembers(c.Spec.TeamID, false) | 	err := c.initTeamMembers(c.Spec.TeamID, false) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return fmt.Errorf("Cannot create a team %q of admins owning the PG cluster: %v", c.Spec.TeamID, err) | 		return fmt.Errorf("cannot create a team %q of admins owning the PG cluster: %v", c.Spec.TeamID, err) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return nil | 	return nil | ||||||
|  |  | ||||||
|  | @ -174,6 +174,7 @@ PatroniInitDBParams: | ||||||
| 	for _, k := range initdbOptionNames { | 	for _, k := range initdbOptionNames { | ||||||
| 		v := patroni.InitDB[k] | 		v := patroni.InitDB[k] | ||||||
| 		for i, defaultParam := range config.Bootstrap.Initdb { | 		for i, defaultParam := range config.Bootstrap.Initdb { | ||||||
|  | 			//lint:ignore S1034 looks like false positive: defaultParam.(type) cannot be used outside of type switch
 | ||||||
| 			switch defaultParam.(type) { | 			switch defaultParam.(type) { | ||||||
| 			case map[string]string: | 			case map[string]string: | ||||||
| 				{ | 				{ | ||||||
|  | @ -1308,11 +1309,11 @@ func (c *Cluster) generateCloneEnvironment(description *acidv1.CloneDescription) | ||||||
| 			c.logger.Info(msg, description.S3WalPath) | 			c.logger.Info(msg, description.S3WalPath) | ||||||
| 
 | 
 | ||||||
| 			envs := []v1.EnvVar{ | 			envs := []v1.EnvVar{ | ||||||
| 				v1.EnvVar{ | 				{ | ||||||
| 					Name:  "CLONE_WAL_S3_BUCKET", | 					Name:  "CLONE_WAL_S3_BUCKET", | ||||||
| 					Value: c.OpConfig.WALES3Bucket, | 					Value: c.OpConfig.WALES3Bucket, | ||||||
| 				}, | 				}, | ||||||
| 				v1.EnvVar{ | 				{ | ||||||
| 					Name:  "CLONE_WAL_BUCKET_SCOPE_SUFFIX", | 					Name:  "CLONE_WAL_BUCKET_SCOPE_SUFFIX", | ||||||
| 					Value: getBucketScopeSuffix(description.UID), | 					Value: getBucketScopeSuffix(description.UID), | ||||||
| 				}, | 				}, | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ import ( | ||||||
| 	"sync" | 	"sync" | ||||||
| 
 | 
 | ||||||
| 	"github.com/sirupsen/logrus" | 	"github.com/sirupsen/logrus" | ||||||
| 	"k8s.io/api/core/v1" | 	v1 "k8s.io/api/core/v1" | ||||||
| 	rbacv1beta1 "k8s.io/api/rbac/v1beta1" | 	rbacv1beta1 "k8s.io/api/rbac/v1beta1" | ||||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
| 	"k8s.io/apimachinery/pkg/types" | 	"k8s.io/apimachinery/pkg/types" | ||||||
|  | @ -176,7 +176,7 @@ func (c *Controller) initPodServiceAccount() { | ||||||
| 
 | 
 | ||||||
| 	switch { | 	switch { | ||||||
| 	case err != nil: | 	case err != nil: | ||||||
| 		panic(fmt.Errorf("Unable to parse pod service account definition from the operator config map: %v", err)) | 		panic(fmt.Errorf("unable to parse pod service account definition from the operator config map: %v", err)) | ||||||
| 	case groupVersionKind.Kind != "ServiceAccount": | 	case groupVersionKind.Kind != "ServiceAccount": | ||||||
| 		panic(fmt.Errorf("pod service account definition in the operator config map defines another type of resource: %v", groupVersionKind.Kind)) | 		panic(fmt.Errorf("pod service account definition in the operator config map defines another type of resource: %v", groupVersionKind.Kind)) | ||||||
| 	default: | 	default: | ||||||
|  | @ -224,7 +224,7 @@ func (c *Controller) initRoleBinding() { | ||||||
| 
 | 
 | ||||||
| 	switch { | 	switch { | ||||||
| 	case err != nil: | 	case err != nil: | ||||||
| 		panic(fmt.Errorf("Unable to parse the definition of the role binding for the pod service account definition from the operator config map: %v", err)) | 		panic(fmt.Errorf("unable to parse the definition of the role binding for the pod service account definition from the operator config map: %v", err)) | ||||||
| 	case groupVersionKind.Kind != "RoleBinding": | 	case groupVersionKind.Kind != "RoleBinding": | ||||||
| 		panic(fmt.Errorf("role binding definition in the operator config map defines another type of resource: %v", groupVersionKind.Kind)) | 		panic(fmt.Errorf("role binding definition in the operator config map defines another type of resource: %v", groupVersionKind.Kind)) | ||||||
| 	default: | 	default: | ||||||
|  |  | ||||||
|  | @ -133,6 +133,7 @@ var requestsURLtc = []struct { | ||||||
| }{ | }{ | ||||||
| 	{ | 	{ | ||||||
| 		"coffee://localhost/", | 		"coffee://localhost/", | ||||||
|  | 		//lint:ignore ST1005 formatting matches the value returned by Teams API
 | ||||||
| 		fmt.Errorf(`Get coffee://localhost/teams/acid: unsupported protocol scheme "coffee"`), | 		fmt.Errorf(`Get coffee://localhost/teams/acid: unsupported protocol scheme "coffee"`), | ||||||
| 	}, | 	}, | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue