mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-06 12:45:16 +02:00
update linting
This commit is contained in:
@@ -21,48 +21,48 @@ const (
|
||||
|
||||
// PostgresCRDResourceColumns definition of AdditionalPrinterColumns for postgresql CRD
|
||||
var PostgresCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefinition{
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Team",
|
||||
Type: "string",
|
||||
Description: "Team responsible for Postgres cluster",
|
||||
JSONPath: ".spec.teamId",
|
||||
},
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Version",
|
||||
Type: "string",
|
||||
Description: "PostgreSQL version",
|
||||
JSONPath: ".spec.postgresql.version",
|
||||
},
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Pods",
|
||||
Type: "integer",
|
||||
Description: "Number of Pods per Postgres cluster",
|
||||
JSONPath: ".spec.numberOfInstances",
|
||||
},
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Volume",
|
||||
Type: "string",
|
||||
Description: "Size of the bound volume",
|
||||
JSONPath: ".spec.volume.size",
|
||||
},
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "CPU-Request",
|
||||
Type: "string",
|
||||
Description: "Requested CPU for Postgres containers",
|
||||
JSONPath: ".spec.resources.requests.cpu",
|
||||
},
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Memory-Request",
|
||||
Type: "string",
|
||||
Description: "Requested memory for Postgres containers",
|
||||
JSONPath: ".spec.resources.requests.memory",
|
||||
},
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Age",
|
||||
Type: "date",
|
||||
JSONPath: ".metadata.creationTimestamp",
|
||||
},
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Status",
|
||||
Type: "string",
|
||||
Description: "Current sync status of postgresql resource",
|
||||
@@ -72,31 +72,31 @@ var PostgresCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefinition{
|
||||
|
||||
// OperatorConfigCRDResourceColumns definition of AdditionalPrinterColumns for OperatorConfiguration CRD
|
||||
var OperatorConfigCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefinition{
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Image",
|
||||
Type: "string",
|
||||
Description: "Spilo image to be used for Pods",
|
||||
JSONPath: ".configuration.docker_image",
|
||||
},
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Cluster-Label",
|
||||
Type: "string",
|
||||
Description: "Label for K8s resources created by operator",
|
||||
JSONPath: ".configuration.kubernetes.cluster_name_label",
|
||||
},
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Service-Account",
|
||||
Type: "string",
|
||||
Description: "Name of service account to be used",
|
||||
JSONPath: ".configuration.kubernetes.pod_service_account_name",
|
||||
},
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Min-Instances",
|
||||
Type: "integer",
|
||||
Description: "Minimum number of instances per Postgres cluster",
|
||||
JSONPath: ".configuration.min_instances",
|
||||
},
|
||||
apiextv1beta1.CustomResourceColumnDefinition{
|
||||
{
|
||||
Name: "Age",
|
||||
Type: "date",
|
||||
JSONPath: ".metadata.creationTimestamp",
|
||||
|
||||
@@ -81,7 +81,7 @@ func (ps *PostgresStatus) UnmarshalJSON(data []byte) error {
|
||||
if err != nil {
|
||||
metaErr := json.Unmarshal(data, &status)
|
||||
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
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ type KubernetesMetaConfiguration struct {
|
||||
PodServiceAccountDefinition string `json:"pod_service_account_definition,omitempty"`
|
||||
PodServiceAccountRoleBindingDefinition string `json:"pod_service_account_role_binding_definition,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"`
|
||||
WatchedNamespace string `json:"watched_namespace,omitempty"`
|
||||
PDBNameFormat config.StringTemplate `json:"pdb_name_format,omitempty"`
|
||||
|
||||
@@ -842,7 +842,7 @@ func (c *Cluster) initHumanUsers() error {
|
||||
for _, postgresSuperuserTeam := range c.OpConfig.PostgresSuperuserTeams {
|
||||
err := c.initTeamMembers(postgresSuperuserTeam, true)
|
||||
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 {
|
||||
clusterIsOwnedBySuperuserTeam = true
|
||||
@@ -856,7 +856,7 @@ func (c *Cluster) initHumanUsers() error {
|
||||
|
||||
err := c.initTeamMembers(c.Spec.TeamID, false)
|
||||
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
|
||||
|
||||
@@ -174,6 +174,7 @@ PatroniInitDBParams:
|
||||
for _, k := range initdbOptionNames {
|
||||
v := patroni.InitDB[k]
|
||||
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) {
|
||||
case map[string]string:
|
||||
{
|
||||
@@ -1308,11 +1309,11 @@ func (c *Cluster) generateCloneEnvironment(description *acidv1.CloneDescription)
|
||||
c.logger.Info(msg, description.S3WalPath)
|
||||
|
||||
envs := []v1.EnvVar{
|
||||
v1.EnvVar{
|
||||
{
|
||||
Name: "CLONE_WAL_S3_BUCKET",
|
||||
Value: c.OpConfig.WALES3Bucket,
|
||||
},
|
||||
v1.EnvVar{
|
||||
{
|
||||
Name: "CLONE_WAL_BUCKET_SCOPE_SUFFIX",
|
||||
Value: getBucketScopeSuffix(description.UID),
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
rbacv1beta1 "k8s.io/api/rbac/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@@ -176,7 +176,7 @@ func (c *Controller) initPodServiceAccount() {
|
||||
|
||||
switch {
|
||||
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":
|
||||
panic(fmt.Errorf("pod service account definition in the operator config map defines another type of resource: %v", groupVersionKind.Kind))
|
||||
default:
|
||||
@@ -224,7 +224,7 @@ func (c *Controller) initRoleBinding() {
|
||||
|
||||
switch {
|
||||
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":
|
||||
panic(fmt.Errorf("role binding definition in the operator config map defines another type of resource: %v", groupVersionKind.Kind))
|
||||
default:
|
||||
|
||||
@@ -133,6 +133,7 @@ var requestsURLtc = []struct {
|
||||
}{
|
||||
{
|
||||
"coffee://localhost/",
|
||||
//lint:ignore ST1005 formatting matches the value returned by Teams API
|
||||
fmt.Errorf(`Get coffee://localhost/teams/acid: unsupported protocol scheme "coffee"`),
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user