@@ -140,13 +140,20 @@ func statefulset(
140140 configmap , & sts .Spec .Template .Spec , volumeMounts , "" , []string {}, false )
141141 }
142142
143- // Determine if a rollout because Secrets and ConfigMaps have changed
143+ // Determine if a rollout is needed because Secrets and ConfigMaps have changed.
144+ // If the OAuth Secrets are changed, or if the OAUTH2_CONFIG changes in the
145+ // PGAdmin ConfigMap, then we need to restart the pgAdmin process and re-run
146+ // the init container.
147+ // We therefore store hashes of these configurations in annotations on the
148+ // pgAdmin statefulset, which force a Pod restart when they change.
144149 checkOauthSecretsChange (oauthSecrets , sts )
145150 checkConfigMapChange (configmap , sts )
146151
147152 return sts
148153}
149154
155+ // Checks if the Oauth Secrets have changed by calculating and comparing a hash
156+ // of the data. We update the hash when changed to trigger a rollout.
150157func checkOauthSecretsChange (oauthSecrets []corev1.Secret , sts * appsv1.StatefulSet ) {
151158 var secretHash , currentHash string
152159 var sb strings.Builder
@@ -171,6 +178,8 @@ func checkOauthSecretsChange(oauthSecrets []corev1.Secret, sts *appsv1.StatefulS
171178 }
172179}
173180
181+ // Checks if the OAUTH2_CONFIG ConfigMap has changed by calculating and comparing a hash
182+ // of the data. We update the hash when changed to trigger a rollout.
174183func checkConfigMapChange (configmap * corev1.ConfigMap , sts * appsv1.StatefulSet ) {
175184 var secretHash , currentHash string
176185 hash := sha256 .New ()
0 commit comments