-
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
Implementing refs to clusterresources in postgres cluster #576
Conversation
ac29154
to
9d62caf
Compare
7cb587f
to
6294ada
Compare
7289f36
to
58ccceb
Compare
immutablePeeringFields{ | ||
DataCentreID: aws.DataCentreID, | ||
}, | ||
immutablePeeringFields{}, |
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 DataCentreID
is mutable or unused for now, it is not necessary to leave the immutablePeeringFields
struct unfilled, just remove it
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.
agree, fixed
ClusterID string `json:"clusterId"` | ||
ClusterID string `json:"clusterId,omitempty"` |
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 customer doesn't have to fill in the clusterID
, let's remove it
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.
Other clusters are still using this field
ClusterID string `json:"clusterId"` | ||
ClusterID string `json:"clusterId,omitempty"` |
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 customer doesn't have to fill in the clusterID
, let's remove it. Fix in all similar cases, please
UserRefs []*UserReference `json:"userRefs,omitempty"` | ||
ClusterBackups []*UserReference `json:"clusterBackups,omitempty"` | ||
ClusterNetworkFirewallRules []*UserReference `json:"clusterNetworkFirewallRules,omitempty"` | ||
AWSVPCPeerings []*UserReference `json:"awsVPCPeerings,omitempty"` | ||
AWSSecurityGroupFirewallRules []*UserReference `json:"awsSecurityGroupFirewallRules,omitempty"` | ||
ExclusionWindows []*UserReference `json:"exclusionWindows,omitempty"` | ||
GCPVPCPeerings []*UserReference `json:"gcpVPCPeerings,omitempty"` | ||
AzureVNetPeerings []*UserReference `json:"azureVNetPeerings,omitempty"` | ||
//ClusterResourceRefs *ClusterResourceRefs `json:"clusterResourceRefs,omitempty"` |
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.
Use the ClusterResourceRefs
struct here and rename the UserReference
struct to something like NamespacedName
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.
agree, fixed
@@ -195,7 +212,6 @@ func (pgs *PgSpec) ToInstAPI() *models.PGCluster { | |||
PostgreSQLVersion: pgs.Version, | |||
DataCentres: pgs.DCsToInstAPI(), | |||
SynchronousModeStrict: pgs.SynchronousModeStrict, | |||
Description: pgs.Description, |
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.
Why did you remove the Description
field from here?
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.
Same question
@@ -183,6 +267,7 @@ spec: | |||
privateNetworkCluster: | |||
type: boolean | |||
resizeSettings: | |||
description: ClusterResourceRefs *ClusterResourceRefs `json:"clusterResourceRefs,omitempty"` |
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.
Looks pretty strange to me
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.
it was triggered by unnecessary comment
if firewallRule.Annotations[models.ClusterIDAnnotation] == "" { | ||
return models.ExitReconcile, 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.
Let's use something similar to clusterEvents
as we did for cluster's users instead of entirely relying on annotations
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.
agree, refactored
"context" | ||
"encoding/json" | ||
"errors" | ||
"github.com/instaclustr/operator/controllers/clusterresources" |
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.
Sort imports please
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.
done
reconcileResult := r.HandleDeleteFirewallRule(ctx, firewallRule, &l) | ||
return reconcileResult, 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.
return
reconcileResult := r.HandleDeleteFirewallRule(ctx, firewallRule, &l) | |
return reconcileResult, nil | |
return r.HandleDeleteFirewallRule(ctx, firewallRule, &l), 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.
done
l.Info("PostgreSQL clusterresource was updated", | ||
"Resource name:", ref.Name, | ||
"Resource Kind:", kind, | ||
"Event:", models.DeletingEvent, |
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 those colons symbols here
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.
done
32779b0
to
dcb12a6
Compare
func (cb *ClusterBackup) DetachFromCluster() { | ||
|
||
} | ||
|
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.
Delete if unused, please
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.
It was created to implement the custom interface Object
which allows to work generic object status
"github.com/instaclustr/operator/pkg/models" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"sigs.k8s.io/controller-runtime/pkg/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.
imports
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.
fixed
@@ -62,7 +62,7 @@ type CassandraSpec struct { | |||
PasswordAndUserAuth bool `json:"passwordAndUserAuth,omitempty"` | |||
Spark []*Spark `json:"spark,omitempty"` | |||
BundledUseOnly bool `json:"bundledUseOnly,omitempty"` | |||
UserRefs []*UserReference `json:"userRefs,omitempty"` | |||
UserRefs []*NamespacedNameRef `json:"userRefs,omitempty"` |
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.
NamespacedNameRef -> NamespacedName
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.
renamed
@@ -195,7 +212,6 @@ func (pgs *PgSpec) ToInstAPI() *models.PGCluster { | |||
PostgreSQLVersion: pgs.Version, | |||
DataCentres: pgs.DCsToInstAPI(), | |||
SynchronousModeStrict: pgs.SynchronousModeStrict, | |||
Description: pgs.Description, |
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.
Same question
if firewallRule.Annotations[models.ResourceStateAnnotation] == models.GenericEvent { | ||
l.Info("AWS security group firewall rule event isn't handled", | ||
"cluster ID", firewallRule.Spec.ClusterID, | ||
"cluster ID", firewallRule.Status.ClusterID, | ||
"type", firewallRule.Spec.Type, | ||
"request", req, | ||
"event", firewallRule.Annotations[models.ResourceStateAnnotation]) |
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.
Do we really need to handle the Generic Event
if we rely on resource status?
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.
agree fixed
firewallRule.Status.ClusterEvent = models.DeletedEvent | ||
err = r.Status().Patch(ctx, firewallRule, patch) | ||
if err != nil { | ||
l.Error(err, "Cannot patch AWS security group firewall rule status ", "ID", firewallRule.Status.ID) |
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.
Remove the space please
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.
done
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.
done
"type", firewallRule.Spec.Type, | ||
) | ||
|
||
patch := firewallRule.NewPatch() | ||
|
||
firewallRuleStatus, err := r.API.CreateFirewallRule(instaclustr.AWSSecurityGroupFirewallRuleEndpoint, &firewallRule.Spec) | ||
firewallRuleStatus, err := r.API.CreateAWSSecurityGroupFirewallRule(instaclustr.AWSSecurityGroupFirewallRuleEndpoint, &firewallRule.Spec, firewallRule.Status.ClusterID) |
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.
Form the endpoint inside API method please
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.
fixed
firewallRule.Status.ClusterEvent = models.DeletedEvent | ||
err = r.Status().Patch(ctx, firewallRule, patch) | ||
if err != nil { | ||
l.Error(err, "Cannot patch cluster network firewall rule status ", "ID", firewallRule.Status.ID) |
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.
Remove space, fix in all similar cases
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.
done
resource = &clusterresourcesv1beta1.AzureVNetPeering{} | ||
isCDC = true | ||
default: | ||
l.Info("Provided reference to resource that is not support deletion", "kind", kind, "resource", 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.
deletion -> creation?
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.
fixed
case "ClusterBackup": | ||
resource = &clusterresourcesv1beta1.ClusterBackup{} | ||
case "ClusterNetworkFirewallRule": | ||
resource = &clusterresourcesv1beta1.ClusterNetworkFirewallRule{} | ||
case "AWSVPCPeering": | ||
resource = &clusterresourcesv1beta1.AWSVPCPeering{} | ||
isCDC = true | ||
case "AWSSecurityGroupFirewallRule": | ||
resource = &clusterresourcesv1beta1.AWSSecurityGroupFirewallRule{} | ||
case "ExclusionWindow": | ||
resource = &clusterresourcesv1beta1.ExclusionWindow{} | ||
case "GCPVPCPeering": | ||
resource = &clusterresourcesv1beta1.GCPVPCPeering{} | ||
isCDC = true | ||
case "AzureVNetPeering": | ||
resource = &clusterresourcesv1beta1.AzureVNetPeering{} | ||
isCDC = 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.
Let's move to models?
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.
agree, done
4d628fb
to
b971a58
Compare
err := r.Get(ctx, req, resource) | ||
if err != nil { | ||
if k8serrors.IsNotFound(err) { | ||
l.Error(err, "Cannot create a cluster resource. The resource is not found", "request", req) |
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.
l.Error(err, "Cannot create a cluster resource. The resource is not found", "request", req) | |
l.Error(err, "Provided resource is not found", "request", req) |
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.
fixed
l.Error(err, "Cannot create a cluster resource. The resource is not found", "request", req) | ||
return err | ||
} | ||
l.Error(err, "Cannot get cluster resource", "Resource", 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.
l.Error(err, "Cannot get cluster resource", "Resource", resource) | |
l.Error(err, "Cannot get cluster resource", "request", req) |
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.
done
} | ||
|
||
l.Info("PostgreSQL clusterresource was patched", | ||
"Resource name", ref.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 think you should log and namespace too
"Resource name", ref.Name, | |
"reference", ref, |
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.
refactored
resource.DetachFromCluster() | ||
|
||
err = r.Status().Patch(ctx, resource, patch) | ||
|
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.
delete this gap please
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.
done
b971a58
to
513188d
Compare
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at |
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.
Why did you remove this message here?
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.
fixed
@@ -37,6 +37,7 @@ type ClusterBackupStatus struct { | |||
Progress string `json:"progress,omitempty"` | |||
Start int `json:"start,omitempty"` | |||
End int `json:"end,omitempty"` | |||
ClusterID string `json:"clusterID,omitempty"` |
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.
In json it should be clusterId
. Please change here and in all such cases
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.
done
type ClusterResourceRefs struct { | ||
ClusterBackups []*NamespacedName `json:"clusterBackups,omitempty"` | ||
ClusterNetworkFirewallRules []*NamespacedName `json:"clusterNetworkFirewallRules,omitempty"` | ||
AWSVPCPeerings []*NamespacedName `json:"awsVPCPeerings,omitempty"` | ||
AWSSecurityGroupFirewallRules []*NamespacedName `json:"awsSecurityGroupFirewallRules,omitempty"` | ||
ExclusionWindows []*NamespacedName `json:"exclusionWindows,omitempty"` | ||
GCPVPCPeerings []*NamespacedName `json:"gcpVPCPeerings,omitempty"` | ||
AzureVNetPeerings []*NamespacedName `json:"azureVNetPeerings,omitempty"` | ||
} |
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 all resources should be in the same namespace as a cluster. So in general the entity name would be sufficient. But this solution is also ok
type ClusterResourceRefs struct { | ||
ClusterBackups []*NamespacedName `json:"clusterBackups,omitempty"` | ||
ClusterNetworkFirewallRules []*NamespacedName `json:"clusterNetworkFirewallRules,omitempty"` | ||
AWSVPCPeerings []*NamespacedName `json:"awsVPCPeerings,omitempty"` | ||
AWSSecurityGroupFirewallRules []*NamespacedName `json:"awsSecurityGroupFirewallRules,omitempty"` | ||
ExclusionWindows []*NamespacedName `json:"exclusionWindows,omitempty"` | ||
GCPVPCPeerings []*NamespacedName `json:"gcpVPCPeerings,omitempty"` | ||
AzureVNetPeerings []*NamespacedName `json:"azureVNetPeerings,omitempty"` | ||
} |
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.
Also, I think a better solution would be to store resource references as map[string][]name
or map[string][]namespacedName
where string will be the resource name. Because when there are a lot of resources, I think such a solution will not be beautiful and a high-quality architectural solution.
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.
ResorceRefs must be an object for maintenance improvement
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 just think this is not an improvement but a deterioration because there are a lot of duplicate unnecessary code not only in this place, also adding new resources will be an issue. This approach can be discussed with @taaraora and other team members @testisnullus @OleksiienkoMykyta @worryg0d @RostislavPorohnya @ribaraka
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 we can simplify the code and make the resourceRefs architecture cleaner than it is using the suggested approach by Matvii, I think it will be a way better solution for now
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 just think this is not an improvement but a deterioration because there are a lot of duplicate unnecessary code not only in this place, also adding new resources will be an issue. This approach can be discussed with @taaraora and other team members @testisnullus @OleksiienkoMykyta @worryg0d @RostislavPorohnya @ribaraka
I have already discussed it with @taaraora and we decided to store refs as an 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.
Ok
@@ -1,7 +1,7 @@ | |||
apiVersion: clusterresources.instaclustr.com/v1beta1 | |||
kind: ClusterBackup | |||
metadata: | |||
name: clusterbackup-sample | |||
name: clusterbackup-sample-two |
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 default clusterbackup-sample
is better
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.
agree fixed
switch aws.Annotations[models.ResourceStateAnnotation] { | ||
case models.UpdatingEvent: | ||
return r.handleUpdatePeering(ctx, aws, l), 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.
why didn't you make the same logic with ResourceState for update event?
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.
agree, refactored
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.
agree, refactored
switch ew.Status.ResourceState { | ||
case models.CreatingEvent: | ||
return r.handleCreateWindow(ctx, ew, l), nil | ||
case models.DeletingEvent: | ||
return r.handleDeleteWindow(ctx, ew, l), nil | ||
default: | ||
l.Info("event isn't handled", |
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.
Lets use switch instead of if for all such cases so that the code will be persistent
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.
agree, done
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.
done
ew.Status.ResourceState = models.DeletedEvent | ||
err = r.Status().Patch(ctx, ew, patch) | ||
if err != nil { | ||
l.Error(err, "cannot patch Exclusion Window resource status", |
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.
cannot patch Exclusion Window
-> Cannot patch Exclusion Window
.
Start such error messages from UpperCase.
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.
fixed
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.
fixed
r.HandleResourceEvent(newObj, models.ClusterbackupRef, oldObjSpec.ClusterResources.ClusterBackups, newObj.Spec.ClusterResources.ClusterBackups) | ||
r.HandleResourceEvent(newObj, models.ClusterNetworkFirewallRuleref, oldObjSpec.ClusterResources.ClusterNetworkFirewallRules, newObj.Spec.ClusterResources.ClusterNetworkFirewallRules) | ||
r.HandleResourceEvent(newObj, models.AWSVPCPeeringRef, oldObjSpec.ClusterResources.AWSVPCPeerings, newObj.Spec.ClusterResources.AWSVPCPeerings) | ||
r.HandleResourceEvent(newObj, models.AWSSecurityGroupFirewallRuleRef, oldObjSpec.ClusterResources.AWSSecurityGroupFirewallRules, newObj.Spec.ClusterResources.AWSSecurityGroupFirewallRules) | ||
r.HandleResourceEvent(newObj, models.ExclusionWindowRef, oldObjSpec.ClusterResources.ExclusionWindows, newObj.Spec.ClusterResources.ExclusionWindows) | ||
r.HandleResourceEvent(newObj, models.GCPVPCPeeringRef, oldObjSpec.ClusterResources.GCPVPCPeerings, newObj.Spec.ClusterResources.GCPVPCPeerings) | ||
r.HandleResourceEvent(newObj, models.AzureVNetPeeringRef, oldObjSpec.ClusterResources.AzureVNetPeerings, newObj.Spec.ClusterResources.AzureVNetPeerings) |
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.
In the case of using the map that I described above, there would be no need to write such code
var exist bool | ||
for _, oldRef := range oldRefs { | ||
if *ref == *oldRef { | ||
exist = true | ||
break | ||
} | ||
} | ||
|
||
if exist { | ||
continue | ||
} |
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 move it to separate func, because there are duplication below
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.
there is no duplication, we check arrays on specific event(creation/deletion) and iterating by different ways
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.
oldRefs and newRefs have the same type and you did the same in these 2 peaces of code. Please move code that I commented on lines +518 to +528 to the seperate function
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.
agree, fixed
513188d
to
815ef9e
Compare
815ef9e
to
d999585
Compare
var exist bool | ||
for _, oldRef := range oldRefs { | ||
if *ref == *oldRef { | ||
exist = true | ||
break | ||
} | ||
} | ||
|
||
if exist { | ||
continue | ||
} |
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.
oldRefs and newRefs have the same type and you did the same in these 2 peaces of code. Please move code that I commented on lines +518 to +528 to the seperate function
452ca79
to
3e91cac
Compare
3e91cac
to
40309f0
Compare
@@ -36,7 +38,9 @@ type ExclusionWindowSpec struct { | |||
|
|||
// ExclusionWindowStatus defines the observed state of ExclusionWindow | |||
type ExclusionWindowStatus struct { | |||
ID string `json:"id"` | |||
ID string `json:"id,omitempty"` | |||
ClusterID string `json:"clusterID,omitempty"` |
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 rename clusterID
-> clusterId
here and in all such cases
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.
done
azure.Status.ResourceState = models.DeletedEvent | ||
err = r.Status().Patch(ctx, azure, patch) | ||
if err != nil { | ||
l.Error(err, "cannot patch Azure VNet Peering resource status", |
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.
Start such error messages from capitalized letter
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.
fixed
l := log.FromContext(ctx) | ||
|
||
for _, ref := range newRefs { | ||
exist := isClusterResourceRefExist(ref, oldRefs) |
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.
isClusterResourceRefExist
-> isClusterResourceRefExists
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.
fixed
40309f0
to
3a74ba1
Compare
@@ -106,6 +106,14 @@ const ( | |||
CassandraAppType = "APACHE_CASSANDRA" | |||
SparkAppType = "SPARK" | |||
|
|||
ClusterbackupRef = "ClusterBackup" |
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.
ClusterBackupRef
clusterBackups: | ||
# - namespace: default | ||
# name: clusterbackup-sample | ||
clusterNetworkFirewallRules: |
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.
remove 'cluster' prefixes from here
No description provided.