Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added users graceful creation during OpenSearch cluster creation phase #483

Merged

Conversation

worryg0d
Copy link
Collaborator

Implemented graceful creation of users when the OpenSearch cluster is not in the running state. Now it starts a job that checks if a cluster is in the running state and then creates users and removes itself.

}

if o.Status.State != models.RunningStatus {
return fmt.Errorf("cluster is not is the running state")
Copy link
Contributor

Choose a reason for hiding this comment

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

please make it a log info message and add the word "yet" at the end

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 816 to 826
err := r.Get(ctx, types.NamespacedName{
Namespace: o.Namespace,
Name: o.Name,
}, o)
if err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove the job if a resource is not found

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

for _, ref := range o.Spec.UserRefs {
err = r.createUser(ctx, logger, o, ref)
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

please add here an error log and event

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@worryg0d worryg0d force-pushed the issue-439-users-graceful-creation-during-cluster-creation branch from 1de7821 to cb13b26 Compare July 19, 2023 09:25
@worryg0d worryg0d requested a review from ribaraka July 19, 2023 09:29
@worryg0d worryg0d force-pushed the issue-439-users-graceful-creation-during-cluster-creation branch from cb13b26 to f9d725d Compare July 19, 2023 09:45
}, o)
if err != nil {
if k8serrors.IsNotFound(err) {
logger.Info("OpenSearch cluster resource is not found. Closing user creation job...")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Closing user creation job... -> Removing/Stopping user creation job..., wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

for _, ref := range o.Spec.UserRefs {
err = r.createUser(ctx, logger, o, ref)
if err != nil {
logger.Info("Failed to create user on the cluster",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Failed to create a user on the cluster -> Failed to create a user for the cluster

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@worryg0d worryg0d force-pushed the issue-439-users-graceful-creation-during-cluster-creation branch from f9d725d to c81bc1e Compare July 20, 2023 07:05
@worryg0d worryg0d force-pushed the issue-439-users-graceful-creation-during-cluster-creation branch from c81bc1e to 244885d Compare July 20, 2023 07:06
@testisnullus testisnullus added the enhancement New feature or request label Jul 20, 2023
@taaraora taaraora merged commit 6689bb8 into main Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add user batch during the cluster creation phase
4 participants