You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Submit RBAC credentials during initial Event processing (zalando#344)
* During initial Event processing submit the service account for pods and bind it to a cluster role that allows Patroni to successfully start. The cluster role is assumed to be created by the k8s cluster administrator.
Copy file name to clipboardExpand all lines: docs/reference/operator_parameters.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,8 +110,10 @@ configuration they are grouped under the `kubernetes` key.
110
110
***pod_service_account_definition**
111
111
The operator tries to create the pod Service Account in the namespace that
112
112
doesn't define such an account using the YAML definition provided by this
113
-
option. If not defined, a simple definition that contains only the name will
114
-
be used. The default is empty.
113
+
option. If not defined, a simple definition that contains only the name will be used. The default is empty.
114
+
115
+
***pod_service_account_role_binding_definition**
116
+
This definition must bind pod service account to a role with permission sufficient for the pods to start and for Patroni to access k8s endpoints; service account on its own lacks any such rights starting with k8s v1.8. If not excplicitly defined by the user, a simple definition that binds the account to the operator's own 'zalando-postgres-operator' cluster role will be used. The default is empty.
Ensures the service account required by StatefulSets to create pods exists in a namespace before a PG cluster is created there so that a user does not have to deploy the account manually.
204
-
205
-
The operator does not sync these accounts after creation.
c.setProcessName(fmt.Sprintf("creating pod service account in the namespace %v", c.Namespace))
215
-
216
-
c.logger.Infof("the pod service account %q cannot be retrieved in the namespace %q. Trying to deploy the account.", podServiceAccountName, c.Namespace)
217
-
218
-
// get a separate copy of service account
219
-
// to prevent a race condition when setting a namespace for many clusters
returnfmt.Errorf("cannot deploy the pod service account %q defined in the config map to the %q namespace: %v", podServiceAccountName, c.Namespace, err)
224
-
}
225
-
226
-
c.logger.Infof("successfully deployed the pod service account %q to the %q namespace", podServiceAccountName, c.Namespace)
227
-
228
-
} else {
229
-
c.logger.Infof("successfully found the service account %q used to create pods to the namespace %q", podServiceAccountName, c.Namespace)
230
-
}
231
-
232
-
returnnil
233
-
}
234
-
235
204
// Create creates the new kubernetes objects associated with the cluster.
Ensures the pod service account and role bindings exists in a namespace before a PG cluster is created there so that a user does not have to deploy these credentials manually.
469
+
StatefulSets require the service account to create pods; Patroni requires relevant RBAC bindings to access endpoints.
470
+
471
+
The operator does not sync accounts/role bindings after creation.
returnfmt.Errorf("cannot bind the pod service account %q defined in the config map to the cluster role in the %q namespace: %v", podServiceAccountName, namespace, err)
531
+
}
532
+
533
+
c.logger.Infof("successfully deployed the role binding for the pod service account %q to the %q namespace", podServiceAccountName, namespace)
0 commit comments