Implement operator support for pool ownership#1393
Conversation
a9de629 to
fb1729b
Compare
pkg/system/phase2_creating.go
Outdated
|
|
||
| //check if provider mode is enabled and signal the core | ||
| if util.GetAnnotationValue(r.NooBaa.Annotations, "MulticloudObjectGatewayProviderMode") == "true" { | ||
| util.GetEnvVariable(&r.CoreApp.Spec.Template.Spec.Containers[0].Env, "RESTRICT_RESOURCE_DELETION").Value = "true" |
There was a problem hiding this comment.
to modify the RESTRICT_RESOURCE_DELETION config you need to add the CONFIG_JS_ prefix in the env.
| util.GetEnvVariable(&r.CoreApp.Spec.Template.Spec.Containers[0].Env, "RESTRICT_RESOURCE_DELETION").Value = "true" | |
| util.GetEnvVariable(&r.CoreApp.Spec.Template.Spec.Containers[0].Env, "CONFIG_JS_RESTRICT_RESOURCE_DELETION").Value = "true" |
pkg/util/util.go
Outdated
| } | ||
|
|
||
| func GetAnnotationValue(annotations map[string]string, name string) string { | ||
| val, err := annotations[name] |
fb1729b to
1bc4a89
Compare
pkg/util/util.go
Outdated
| val, err := annotations[name] | ||
| if err { | ||
| return "" | ||
| } | ||
| return val |
There was a problem hiding this comment.
This code does the opposite of what you intended. Golang map returns ok as the second return value, so it is true if the value exist.
Also, if it does not exist, it should return a zero value, which in a string is "", so there is no need to really check for ok.
| val, err := annotations[name] | |
| if err { | |
| return "" | |
| } | |
| return val | |
| return annotations[name] |
1bc4a89 to
99ff6c9
Compare
pkg/util/util.go
Outdated
| return nil | ||
| } | ||
|
|
||
| func GetAnnotationValue(annotations map[string]string, name string) string { |
There was a problem hiding this comment.
It is worth returning a boolean exists as a second return value, the same as the map return value.
There was a problem hiding this comment.
for what purpose?
There was a problem hiding this comment.
650f620 to
5563877
Compare
dannyzaken
left a comment
There was a problem hiding this comment.
one small comment (it will probably fail the tests anyway) . otherwise approved
| return nil | ||
| } | ||
|
|
||
| func GetAnnotationValue(annotations map[string]string, name string) (string, bool) { |
There was a problem hiding this comment.
Please add a comment for this function.
|
@bernerhat The unit tests failed due to diff with the expected generated files. |
37f8d60 to
0f3f7db
Compare
set an env var for the core when cluster is in provider mode and the annotation is set on the cr Signed-off-by: Amit Berner <aberner@redhat.com>
0f3f7db to
0b5591b
Compare
|
@dannyzaken done |
Explain the changes
Issues: Fixed #xxx / Gap #xxx
Testing Instructions: