Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: make the statefulset reconciliation wait for secret creation#31646

Merged
vmuzikar merged 1 commit intokeycloak:mainfrom
shawkins:iss30004-cont
Jul 29, 2024
Merged

fix: make the statefulset reconciliation wait for secret creation#31646
vmuzikar merged 1 commit intokeycloak:mainfrom
shawkins:iss30004-cont

Conversation

@shawkins
Copy link
Contributor

closes: #30004

@ahus1 @vmuzikar the issue here is that adding the KeycloakAdminSecretDependentResource EnabledCondition is causing the KeycloakAdminSecretDependentResource to be run more routinely after the KeycloakDeploymentDependentResource. When that happens it's creating another revision of the StatefulSet because the initial one is marked as having a missing secret. I'm not sure why yet, but that StatefulSet revision is not rolled out to the Pods in the test case with a non-existent image. So the Pods are staying at the initial revision, which causes the logic that scrapes the Pod status for the Keycloak status error message to not work.

In general it would be good to avoid creating these short lived versions of the StatefulSet, so I added a depends on dependency between the two dependents.

Another solution / refinement, that is more involved, would be to only use the missing annotations for optional Secrets / ConfigMaps - or to simply let the optional case be handled by the general poll interval.

@ahus1
Copy link
Member

ahus1 commented Jul 26, 2024

As the tests are failing on this PR, we discussed this online and @vmuzikar created a PR to revert the original PR, see #31650. This PR would then need to re-add the changes this other PR is about to revert.

@ahus1 ahus1 marked this pull request as draft July 26, 2024 07:24
@shawkins shawkins force-pushed the iss30004-cont branch 3 times, most recently from 1454ddc to 1981e47 Compare July 26, 2024 12:58
@shawkins
Copy link
Contributor Author

As the tests are failing on this PR, we discussed this online and @vmuzikar created a PR to revert the original PR, see #31650. This PR would then need to re-add the changes this other PR is about to revert.

Ok, this has been updated to switch from using depends on to manual invocation of the statefulset dependent. cc @vmuzikar

vmuzikar
vmuzikar previously approved these changes Jul 26, 2024
Copy link
Contributor

@vmuzikar vmuzikar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shawkins LGTM, thank you!

switching to manual invocation of statefulset reconciliation

closes: keycloak#30004

Signed-off-by: Steve Hawkins <[email protected]>

* Update docs/guides/operator/advanced-configuration.adoc

Co-authored-by: Václav Muzikář <[email protected]>
Signed-off-by: Steven Hawkins <[email protected]>

* enhance: add bootstrap admin handling to the operator

closes: keycloak#30004

Signed-off-by: Steve Hawkins <[email protected]>

---------

Signed-off-by: Steve Hawkins <[email protected]>
Signed-off-by: Steven Hawkins <[email protected]>
Co-authored-by: Václav Muzikář <[email protected]>
@shawkins
Copy link
Contributor Author

@shawkins LGTM, thank you!

Had to switch to manual creation of the statefulset dependent as well. Using Application or Depedent scope doesn't work with this version of the operator sdk because the re-initialization of the depedent is inconplete and it ends up with a reference to the old Kubernetes client. I believe this was addressed in later versions of the operator sdk.

@shawkins
Copy link
Contributor Author

@ahus1 @vmuzikar should be ready now. Also logged #31680 to further prevent situations that could quickly change the StatefulSet.

@ahus1
Copy link
Member

ahus1 commented Jul 29, 2024

@shawkins thank you for this PR. I have to admit I understand those code changes. With @vmuzikar's review in, this is IMHO now good to be merged. Ping me if you want to to merge this.

@shawkins
Copy link
Contributor Author

@ahus1 yes, we should be able to merge this

@vmuzikar vmuzikar merged commit 6a91436 into keycloak:main Jul 29, 2024
@vmuzikar
Copy link
Contributor

@shawkins @ahus1 Merged. Let's see how the tests behave with other PRs now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bootstrapping an admin user or service account using the Operator

3 participants