-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: add scaletargetref exists check in webhook and revise some variable name #6350
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Shane <[email protected]>
Signed-off-by: Shane <[email protected]>
Signed-off-by: Shane <[email protected]>
Signed-off-by: Shane <[email protected]>
Signed-off-by: Shane <[email protected]>
Signed-off-by: Shane <[email protected]>
7d2395d
to
c76c19f
Compare
…rgetRef not found Signed-off-by: Shane <[email protected]>
Signed-off-by: Shane <[email protected]>
37ac177
to
0fb7542
Compare
Could you please open an issue for this improvement and relate this pr to the issue? This will make it clear and easy to tracing. |
done. Thank you. |
Friendly ping @zroubalik @wozniakjan @SpiritZhou @psi @wonko @fivesheep @JorTurFer hope you to review and discuss, much thanks. |
if err := kc.Get(ctx, client.ObjectKey{Namespace: so.Namespace, Name: so.Spec.ScaleTargetRef.Name}, unstruct); err != nil { | ||
// resource doesn't exist | ||
scaledobjectlog.Error(err, message.ScaleTargetNotFoundMsg, "resource", gvkString, "name", so.Spec.ScaleTargetRef.Name) | ||
return err | ||
} | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this can potentially happen before the targetRef is available through the cached client it should check the item using getFromCacheOrDirect
to rely on user configuration to try using the direct client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this can potentially happen before the targetRef is available through the cached client it should check the item using
getFromCacheOrDirect
to rely on user configuration to try using the direct client
Thank you for your comment. I have follow your idea and change the code already. Hope for your reply soon. MuchThanks.
Signed-off-by: Shane <[email protected]>
3ca6939
to
22b489d
Compare
Signed-off-by: Shane <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the improvement :)
/run-e2e |
PTAL @kedacore/keda-contributors |
@ctccxxd , please open another PR to docs adding the new check to the admission webhooks -> https://github.com/kedacore/keda-docs/blob/main/content/docs/2.17/concepts/admission-webhooks.md |
check scaletargetref exists in webhook and revise some variable name, originally,
1, There is not scaletargetref exists check code in webhook module.
2, Change the inappropriate variable name Gckr to Gvkr.
3, If still want to remain the function to create scaleobj first without real scaletargetRef obj. Think whether this function will be a way can be configged, to confirm the real scaletargetRef obj already exists when we create/update scaleobj. In this way, it can avoid the user misconfigurations about scaletargetRef in yaml file.
Checklist
Fixes #
Relates to #
#6354