-
Notifications
You must be signed in to change notification settings - Fork 124
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
Check for cluster name in annotations #134
Conversation
controller/cluster_check.go
Outdated
@@ -30,6 +30,13 @@ func ObjectInCluster(cluster string, obj interface{}) bool { | |||
} | |||
} | |||
} | |||
if clusterName == "" { | |||
if c := getValue(obj, "Annotations").MapIndex(reflect.ValueOf("field.cattle.io/projectId")); c.IsValid() { |
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.
If the object does not have Annotations
field this may panic. Just happens that all objects have it, but I'd rather check
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.
thank you @ibuildthecloud, updated
controller/cluster_check.go
Outdated
if clusterName == "" { | ||
if a := getValue(obj, "Annotations"); a.IsValid() { | ||
if c := a.MapIndex(reflect.ValueOf("field.cattle.io/projectId")); c.IsValid() { | ||
logrus.Info(c) |
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.
Please remove
controller/cluster_check.go
Outdated
if parts := strings.SplitN(c.String(), ":", 2); len(parts) == 2 { | ||
clusterName = parts[0] | ||
} | ||
logrus.Info(clusterName) |
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.
and there
@ibuildthecloud done |
No description provided.