Skip to content

Commit 07c4f52

Browse files
authored
use pointer type for nodeAffinity (#1263)
* use pointer type for nodeAffinity
1 parent a63ad49 commit 07c4f52

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

pkg/apis/acid.zalan.do/v1/postgresql_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type PostgresSpec struct {
6161
Databases map[string]string `json:"databases,omitempty"`
6262
PreparedDatabases map[string]PreparedDatabase `json:"preparedDatabases,omitempty"`
6363
SchedulerName *string `json:"schedulerName,omitempty"`
64-
NodeAffinity v1.NodeAffinity `json:"nodeAffinity,omitempty"`
64+
NodeAffinity *v1.NodeAffinity `json:"nodeAffinity,omitempty"`
6565
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
6666
Sidecars []Sidecar `json:"sidecars,omitempty"`
6767
InitContainers []v1.Container `json:"initContainers,omitempty"`

pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cluster/cluster.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ func New(cfg Config, kubeClient k8sutil.KubernetesClient, pgSpec acidv1.Postgres
113113

114114
return fmt.Sprintf("%s-%s", e.PodName, e.ResourceVersion), nil
115115
})
116-
password_encryption, ok := pgSpec.Spec.PostgresqlParam.Parameters["password_encryption"]
116+
passwordEncryption, ok := pgSpec.Spec.PostgresqlParam.Parameters["password_encryption"]
117117
if !ok {
118-
password_encryption = "md5"
118+
passwordEncryption = "md5"
119119
}
120120

121121
cluster := &Cluster{
@@ -128,7 +128,7 @@ func New(cfg Config, kubeClient k8sutil.KubernetesClient, pgSpec acidv1.Postgres
128128
Secrets: make(map[types.UID]*v1.Secret),
129129
Services: make(map[PostgresRole]*v1.Service),
130130
Endpoints: make(map[PostgresRole]*v1.Endpoints)},
131-
userSyncStrategy: users.DefaultUserSyncStrategy{PasswordEncryption: password_encryption},
131+
userSyncStrategy: users.DefaultUserSyncStrategy{PasswordEncryption: passwordEncryption},
132132
deleteOptions: metav1.DeleteOptions{PropagationPolicy: &deletePropagationPolicy},
133133
podEventsQueue: podEventsQueue,
134134
KubeClient: kubeClient,

pkg/cluster/connection_pooler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/zalando/postgres-operator/pkg/util/k8sutil"
2323
)
2424

25-
// K8S objects that are belong to connection pooler
25+
// ConnectionPoolerObjects K8s objects that are belong to connection pooler
2626
type ConnectionPoolerObjects struct {
2727
Deployment *appsv1.Deployment
2828
Service *v1.Service

pkg/cluster/k8sres.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef
12231223
effectiveRunAsUser,
12241224
effectiveRunAsGroup,
12251225
effectiveFSGroup,
1226-
nodeAffinity(c.OpConfig.NodeReadinessLabel, &spec.NodeAffinity),
1226+
nodeAffinity(c.OpConfig.NodeReadinessLabel, spec.NodeAffinity),
12271227
spec.SchedulerName,
12281228
int64(c.OpConfig.PodTerminateGracePeriod.Seconds()),
12291229
c.OpConfig.PodServiceAccountName,

pkg/cluster/k8sres_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ func TestNodeAffinity(t *testing.T) {
882882
Volume: acidv1.Volume{
883883
Size: "1G",
884884
},
885-
NodeAffinity: *nodeAffinity,
885+
NodeAffinity: nodeAffinity,
886886
}
887887
}
888888

0 commit comments

Comments
 (0)