-
Notifications
You must be signed in to change notification settings - Fork 8
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
Watching for Kyma Custom Resource #7
Conversation
Skipping CI for Draft Pull Request. |
/test all |
/test all |
/test all |
/test all |
|
||
cm.Log.Infof("reconciliation triggered for resource named: %s", req.Name) | ||
kymaName := req.Name | ||
kubeconfigSecretName := "kubeconfig-" + req.Name |
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.
I don't think it isa good idea to build the secret name. The more bulletproof solution would be to find the secret based on a label.
api/v1beta1/compassmanager_types.go
Outdated
@@ -0,0 +1,48 @@ | |||
package v1beta1 |
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.
Compass Manager doesn't need to define its own CRD.
@@ -0,0 +1,50 @@ | |||
--- |
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.
Not needed, as Compass Manager doesn't need have its own CRD.
api/v1beta1/groupversion_info.go
Outdated
@@ -0,0 +1,20 @@ | |||
// Package v1beta1 contains API Schema definitions for the operator v1beta1 API group |
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.
Not needed, as Compass Manager doesn't need have its own CRD.
@@ -0,0 +1,16 @@ | |||
# The following patch enables a conversion webhook for the CRD |
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.
Is it needed? I think not, as Compass Manager doesn't need have its own CRD.
@@ -0,0 +1,31 @@ | |||
# permissions for end users to edit compassmanagers. |
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.
I think it is not needed
UpdateFunc: func(e event.UpdateEvent) bool { | ||
return cm.checkUpdateCompassLabel(e.ObjectNew, e.ObjectOld) | ||
}, | ||
GenericFunc: func(e event.GenericEvent) bool { |
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.
I'm not sure we need to provide GenericFunc
.
LabelSelector: labelSelector, | ||
}) | ||
if err != nil { | ||
cm.Log.Infof("%v", err) |
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.
Logging errors with Info level is misleading.
instance := &kyma.Kyma{} | ||
err := cm.Client.Get(context.Background(), objKey, instance) | ||
if err != nil { | ||
if errors.IsNotFound(err) { |
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.
I don't think we need to distinguish error type here.
func (cm *CompassManagerReconciler) SetupWithManager(mgr ctrl.Manager) error { | ||
fieldSelectorPredicate := predicate.Funcs{ | ||
CreateFunc: func(e event.CreateEvent) bool { | ||
return cm.checkCompassLabel(e.Object) |
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.
checkCompassLabel
is not descriptive enough.
|
||
err = cm.Client.Update(context.Background(), instance) | ||
if err != nil { | ||
log.Infof("%v, %s", err, " failed to update Kyma Custom Resource") |
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.
Logging errors with Info level is misleading.
@akgalwas Thank you for your review and suggestions! 😄 |
/check-cla |
h.shouldCreateKyma(testSuiteKyma.Name, testSuiteKyma) | ||
|
||
// then | ||
h.shouldCheckCompassLabel(testSuiteKyma.Name, testSuiteKyma.Namespace, true) |
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.
This assertion is not correct. We should wait for some time, and periodically ensure the predicate (label not set) is met. This is not how this code works. As it uses Eventually
the predicate is true the first time it is checked before timeout is passed. I would suggest Consistently
directive instead on Eventually
.
@mvshao: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Description
Changes proposed in this pull request:
compass-manager
Related issue(s)
kyma-project/kyma#9