Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Aerogear 7683 provision deprovision keycloak #9

Merged
merged 3 commits into from Aug 7, 2018
Merged

Aerogear 7683 provision deprovision keycloak #9

merged 3 commits into from Aug 7, 2018

Conversation

philbrookes
Copy link
Contributor

@JameelB @dimitraz rebased and tested your work after merging @mikenairn PR into master.

I've also rebased the changes Dimitra made to the keycloak-apb on top of the work @witmicko and I did over the last week: aerogearcatalog/keycloak-apb#107

Using these together seems to be working really well!

kcCopy.Status.Phase = v1alpha1.PhaseDeprovisioned

case v1alpha1.PhaseDeprovisioned:
kcCopy.Finalizers = []string{}
Copy link
Contributor

Choose a reason for hiding this comment

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

This will remove all finalizers, you should only be removing the one we add in this operator. The finalizeKeycloak function doe this, but if you want to have it done here and update as normal, you should call sc.RemoveFinalizer(kc, v1alpha1.KeycloakFinalizer) and get rid of the finalizeKeycloak function.

@philbrookes
Copy link
Contributor Author

To see this working:

  • Have the keycloak-operator running

  • Have the keycloak-apb with the shared plan available in your catalog

  • Create a SharedService CRD with > 0 min_instances.

  • OR create a SharedService CRD with > 0 required_instances and < max_instances.

This should:

  • create a min_instances number of keycloak CRDs
  • deploy Keycloak once for each keycloak CRD

Things worth testing:

  • deleting the sharedservice CRD deletes the keycloak CRDs which also deletes the keycloak instances.
  • setting min_instances > required_instances provision min_instances number of keycloaks.
  • setting required_instances > min_instances provision required_instances number of keycloaks.
  • setting require_instances > max_instances only provisions max_instances number of keycloaks.

N.B. Each test case needs to be a newly created SharedService CRD.

@@ -47,18 +205,116 @@ func (h *Handler) Handle(ctx context.Context, event sdk.Event) error {
logrus.Info("not doing anything as this resource is already being worked on")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we get rid of this?

if err := h.reconcileRealm(ctx, r, authenticatedClient); err != nil {
return errors.Wrap(err, "failed to reconcile realm "+r.Name)
}
}

if event.Deleted {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there anything that will go here in the future? Otherwise, can we delete this?

@dimitraz
Copy link
Collaborator

dimitraz commented Aug 7, 2018

@philbrookes will there be a phase in the future which allows the user to modify the number of slices for a single keycloak?

}

// Only update the Keycloak custom resource if there was a change
if !reflect.DeepEqual(kc, kcCopy) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@philbrookes
Copy link
Contributor Author

made suggested changes, merging

@philbrookes philbrookes merged commit 840fb63 into aerogear-attic:master Aug 7, 2018
@dimitraz
Copy link
Collaborator

dimitraz commented Aug 7, 2018

This is late, but I tested all of the use cases and they are all working as expected

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants