-
Notifications
You must be signed in to change notification settings - Fork 0
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
capi-add-tags-to-resources #170
Conversation
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.
Minor comments and questions, rest LGTM
@@ -127,6 +127,7 @@ func (s *Service) EnsureDistribution(config DistributionConfig) (*Distribution, | |||
|
|||
// Add internal and customer tags. | |||
{ | |||
customerTags := config.CustomerTags |
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.
customerTags := config.CustomerTags | |
customerTags := config.CustomerTags.DeepCopy() |
so we don't mutate the input parameter which may lead to surprises
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.
DeepCopy function does not exists for map[], so doing the ugly copy via for
// Fetch custom tags from AWSCluster CR | ||
awsCluster := &capa.AWSCluster{} | ||
err = s.Client.Get(ctx, types.NamespacedName{Namespace: s.Scope.ClusterNamespace(), Name: s.Scope.ClusterName()}, awsCluster) | ||
if err != nil { | ||
return 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.
Should we specifically handle apierrors.IsNotFound(err)
, as before?
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.
Probably a good idea, yeah
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 do not think its a good idea to continue if the AWSCluster CR is missing, because in that case either something terrible happened or it's some kind of super early in the creation processes and it would mean we ignore the tags that are supposed to be there.
this code feels like it was copied from somewhere where it make sense
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 removed it on purpose
…sa-operator into capi-add-tags-to-resources
towards giantswarm/roadmap#2929