-
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
issue-522,implementation for OpenSearch Egress Rules lifecycle on APIv2 #527
issue-522,implementation for OpenSearch Egress Rules lifecycle on APIv2 #527
Conversation
93f3c74
to
bde9855
Compare
bde9855
to
64565f5
Compare
64565f5
to
8d82646
Compare
Makefile
Outdated
@@ -98,7 +98,7 @@ run: manifests generate fmt vet ## Run a controller from your host. | |||
go run ./main.go | |||
|
|||
.PHONY: docker-build | |||
docker-build: manifests generate test ## Build docker image with the manager. | |||
docker-build: manifests generate ## test ## Build docker image with the manager. |
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 uncomment the test instruction
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
opensearchegressruleslog.Info("validate create", "name", r.Name) | ||
|
||
if r.Spec.ClusterID == "" || r.Spec.OpenSearchBindingID == "" || r.Spec.Source == "" { | ||
return fmt.Errorf("spec.ClusterID, spec.OpenSearchBindingId, spec.Source must be filled") |
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 your yaml manifest fields are written in camelCase.
return fmt.Errorf("spec.ClusterID, spec.OpenSearchBindingId, spec.Source must be filled") | |
return fmt.Errorf("spec.ClusterId, spec.ppenSearchBindingId, spec.source must be filled") |
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
Name string `json:"name"` | ||
OpenSearchBindingID string `json:"openSearchBindingId"` | ||
Source string `json:"source"` | ||
Type string `json:"type"` |
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.
API doc says that Type is not required. Please add ,omitempty
tag.
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
func (er *OpenSearchEgressRules) GetJobID(jobName string) string { | ||
return client.ObjectKeyFromObject(er).String() + "/" + jobName | ||
} |
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 the unused func
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
pkg/instaclustr/config.go
Outdated
OpenSearchEgressRulesEndpoint = "/cluster-management/v2/resources/applications/opensearch/egress-rules/v2" | ||
OpenSearchEgressRuleDeleteEndpoint = "/cluster-management/v2/resources/applications/opensearch/egress-rules/v2/" |
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.
Both constants are identical. Please delete the second one.
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
var ( | ||
cfg *rest.Config | ||
k8sClient client.Client | ||
testEnv *envtest.Environment | ||
ctx context.Context | ||
cancel context.CancelFunc | ||
MockInstAPI = mock.NewInstAPI() | ||
) |
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 revert these changes of suit_test.
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.
It seems you don't. Please revert these changes.
8d82646
to
6aec1e1
Compare
6aec1e1
to
641c1cb
Compare
|
||
type OpenSearchEgressRulesSpec struct { | ||
ClusterID string `json:"clusterId"` | ||
Name string `json:"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.
As Instaclustr API doc says the field name
should be returned by the API if you add a new egress rule, but this is not part of a creation request. You should move this field from the resource spec to its 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.
I've looked at the request sample in the doc, and the name
field` is passed there. I think you should test what if you don't pass it. If any error is returned then change nothing
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`s described in spec file, and in request body, in general this field does not affect nothing, but I think we should implement code according to spec
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 the name
field from the spec, it's a read-only property.
|
||
type OpenSearchEgressRulesStatus struct { | ||
ID string `json:"id,omitempty"` | ||
Status string `json:"status,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.
This field is never used. Please delete 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.
fixed
var ( | ||
cfg *rest.Config | ||
k8sClient client.Client | ||
testEnv *envtest.Environment | ||
ctx context.Context | ||
cancel context.CancelFunc | ||
MockInstAPI = mock.NewInstAPI() | ||
) |
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 seems you don't. Please revert these changes.
641c1cb
to
fadba6d
Compare
fadba6d
to
b68c49e
Compare
b68c49e
to
d60d68f
Compare
if r.Spec.ClusterID == "" || r.Spec.OpenSearchBindingID == "" || r.Spec.Source == "" { | ||
return fmt.Errorf("clusterId, openSearchBindingId, source must be filled") | ||
} |
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 remove this code. All these fields are already marked as required in the resource spec
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
"context" | ||
"encoding/json" | ||
"errors" | ||
"fmt" | ||
|
||
"github.com/go-logr/logr" | ||
"github.com/instaclustr/operator/pkg/instaclustr" | ||
"github.com/instaclustr/operator/pkg/models" | ||
"github.com/instaclustr/operator/pkg/scheduler" | ||
|
||
k8serrors "k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/apimachinery/pkg/types" | ||
"k8s.io/client-go/tools/record" | ||
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" | ||
|
||
"k8s.io/apimachinery/pkg/runtime" | ||
ctrl "sigs.k8s.io/controller-runtime" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
"sigs.k8s.io/controller-runtime/pkg/log" | ||
|
||
clusterresourcesv1beta1 "github.com/instaclustr/operator/apis/clusterresources/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.
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.
fixed
err = json.Unmarshal(b, &rule.Status) | ||
if err != nil { | ||
l.Error(err, "failed to parse OpenSearch Egress Rule resource response from Instaclustr") | ||
r.EventRecorder.Eventf(rule, models.Warning, models.ConvertionFailed, | ||
"Failed to parse OpenSearch Egress Rule response from Instaclustr. Reason: %v", err, | ||
) | ||
|
||
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.
Let's move unmarshal logic inside the client method
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
// This hack was added because instaclustr api returns null value egress rule id, but it should be equal to pattern {clusterId}~{source}~{bindingId} | ||
// This code could be removed after instaclustr fix bugs, to make code cleaner |
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 hack was added because the Instaclustr API returns an egress rule id with a null value, but it should be equal to the pattern {clusterId}{source}{bindingId}
// This code could be removed after the Instaclustr API team fixes this bug
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
func (r *OpenSearchEgressRules) ValidateCreate() error { | ||
opensearchegressruleslog.Info("validate create", "name", r.Name) | ||
|
||
if r.Spec.ClusterID == "" || r.Spec.OpenSearchBindingID == "" || r.Spec.Source == "" { | ||
return fmt.Errorf("clusterId, openSearchBindingId, source must be filled") | ||
} |
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.
You also need to add enum validation for source
: "ALERTING"
, "NOTIFICATIONS"
And for type
: "SLACK"
, "WEBHOOK"
, "CUSTOM_WEBHOOK"
, "CHIME"
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 its unnecessary, all such validations implemented on Instaclustr API, and in case they add new types, logic wouldn't work. About "ALERTING" it
s already deprecated, I`d rather avoid such validations if it's possible
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.
Yea, but in such way it will be created in k8s but wasn't created in Instaclustr because of error.
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
// log is for logging in this package. | ||
var opensearchegressruleslog = logf.Log.WithName("opensearchegressrules-resource") | ||
|
||
var openSearchBindingIDPattern, _ = regexp.Compile(`[\w-]+`) |
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 add this regular expression to constants
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.
Its only one usage, and it
s very specific regular expression, I don`t think that it is necessary
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.
Such code should not be hardcoded like this, such constant expressions should be in constants I think
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
if r.Spec.ClusterID == "" || r.Spec.OpenSearchBindingID == "" || r.Spec.Source == "" { | ||
return fmt.Errorf("clusterId, openSearchBindingId, source must be filled") | ||
} |
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 strict to our error naming pattern, so please start it with cannot create OpenSearch Egress Rule
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.
As Danylo sad, this validation is redundant, so I just removed it.
"Let's remove this code. All these fields are already marked as required in the resource spec"
func (r *OpenSearchEgressRules) ValidateUpdate(old runtime.Object) error { | ||
opensearchegressruleslog.Info("validate update", "name", r.Name) | ||
|
||
oldRules := old.(*OpenSearchEgressRules) | ||
|
||
if r.Status.ID == "" { | ||
return r.ValidateCreate() | ||
} | ||
|
||
if r.Spec != oldRules.Spec { | ||
return models.ErrImmutableSpec | ||
} | ||
|
||
return 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.
If I am not wrong there are no API calls to update this entity.
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.
But there are no API calls to update entity, only creation when resource has wrong configuration, to avoid additional operations, like deletion and creation new one, we just can edit resorce and apply 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.
How we will update resouce and apply it if there are no such API calls? How we will update it on instaclustr side? In such way you sad k8s will be updated but instaclustr part won't be updated
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
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.
We need to decline the update of this resource. Without validation, if the customer tries to update this entity inside K8s and this action is passed successfully, it can be really confusing if the entity will not be updated on the Instaclustr API, but updated inside K8s
return models.ReconcileRequeue, err | ||
} | ||
|
||
// Handle resource deletion |
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 add TODO
for such kind of comments that will be implemented in future
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.
Its not TODO, it
s just decription to operations, changed it on "It`s handling resource deletion", to add more context
bbbc429
to
6732f3b
Compare
6732f3b
to
5ed815b
Compare
|
||
type OpenSearchEgressRulesSpec struct { | ||
ClusterID string `json:"clusterId"` | ||
Name string `json:"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.
please remove the name
field from the spec, it's a read-only property.
// This hack was added because the Instaclustr API returns an egress rule id with a null value, but it should be equal to the pattern {clusterId}~{source}~{bindingId} | ||
// This code could be removed after the Instaclustr API team fixes this bug | ||
if rule.Status.ID == "" { | ||
rule.Status.ID = fmt.Sprintf("%s~%s~%s", rule.Spec.ClusterID, rule.Spec.Source, rule.Spec.OpenSearchBindingID) | ||
} |
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.
var theType = []string{"SLACK", "WEBHOOK", "CUSTOM_WEBHOOK", "CHIME"} | ||
var source = []string{"NOTIFICATIONS"} |
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.
theType -> destinationTypes
source -> sourcePlugins
and please add "ALERTING" to the sourcePlugins
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
equalsToReg, _ := regexp.MatchString(models.OpenSearchBindingIDPattern, r.Spec.OpenSearchBindingID) | ||
|
||
if !slices.Contains(source, r.Spec.Source) || !slices.Contains(theType, r.Spec.Type) { | ||
return fmt.Errorf("the source should be equeal to one of options: %q , got: %q. the type should be equeal to one of options: %q , got: %q", source, theType, r.Spec.Source, r.Spec.Type) | ||
} | ||
|
||
if !equalsToReg { | ||
return fmt.Errorf("mismatching openSearchBindingId to pattern: %s", models.OpenSearchBindingIDPattern) | ||
} |
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 if !equalsToReg {
immediately after the equalsToReg
variable is assigned. And add an error
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
err := r.API.DeleteOpenSearchEgressRule(rule.Status.ID) | ||
if err != nil { | ||
logger.Error(err, "failed to delete OpenSearch Egress Rule on Instaclustr") |
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's better to handle the NotFound
error
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
err = json.Unmarshal(b, &rule.Status) | ||
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.
It would be clearer if you just returned the bytes and only then converted them to rule.Status
. This shows that the status is indeed changing and you are performing the patch
operation.
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.
After discussion with the team, we agreed that we should convert data in client
pkg/instaclustr/interfaces.go
Outdated
@@ -98,6 +98,8 @@ type API interface { | |||
ListAppVersions(app string) ([]*models.AppVersions, error) | |||
GetDefaultCredentialsV1(clusterID string) (string, string, error) | |||
UpdateClusterSettings(clusterID string, settings *models.ClusterSettings) error | |||
CreateOpenSearchEgressRules(rule *clusterresourcesv1beta1.OpenSearchEgressRules) error | |||
DeleteOpenSearchEgressRule(egressRuleId string) error |
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.
egressRuleId -> 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.
fixed
pkg/models/errors.go
Outdated
@@ -62,4 +62,5 @@ var ( | |||
ErrPrivateLinkOnlyWithPrivateNetworkCluster = errors.New("private link is available only for private network clusters") | |||
ErrPrivateLinkSupportedOnlyForSingleDC = errors.New("private link is only supported for a single data centre") | |||
ErrPrivateLinkSupportedOnlyForAWS = errors.New("private link is supported only for an AWS cloud provider") | |||
ErrImmutableSpec = errors.New("spec is immutable") |
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.
resource specification is immutable
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
5ed815b
to
67d506a
Compare
00a597d
to
c49d311
Compare
// This hack was added because the Instaclustr API returns an egress rule id with a null value, but it should be equal to the pattern {clusterId}~{source}~{bindingId} | ||
// This code could be removed after the Instaclustr API team fixes this bug |
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 this comment or move it in the right place
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
pkg/instaclustr/client.go
Outdated
// https://api.dev.instaclustr.com/cluster-management/v2/resources/applications/opensearch/egress-rules/v2/{egressRuleId} | ||
fmt.Println(id) | ||
url := c.serverHostname + OpenSearchEgressRulesEndpoint + "/" + id | ||
fmt.Println("GOT:", url) | ||
fmt.Println("expected: https://api.dev.instaclustr.com/cluster-management/v2/resources/applications/opensearch/egress-rules/v2/{egressRuleId}") |
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 unnecessary code 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
c49d311
to
ef887fb
Compare
if !slices.Contains(sourcePlugins, r.Spec.Source) || !slices.Contains(destinationTypes, r.Spec.Type) { | ||
return fmt.Errorf("the source should be equeal to one of options: %q , got: %q. the type should be equeal to one of options: %q , got: %q", sourcePlugins, destinationTypes, r.Spec.Source, r.Spec.Type) | ||
} |
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 my opinion, it will be better if you split it into 2 different conditions because the returning error looks unclear to me.
if !slices.Contains(sourcePlugins, r.Spec.Source) || !slices.Contains(destinationTypes, r.Spec.Type) { | |
return fmt.Errorf("the source should be equeal to one of options: %q , got: %q. the type should be equeal to one of options: %q , got: %q", sourcePlugins, destinationTypes, r.Spec.Source, r.Spec.Type) | |
} | |
if !slices.Contains(sourcePlugins, r.Spec.Source) { | |
return fmt.Errorf("the source should be equal to one of the options: %q , got: %q", sourcePlugins, r.Spec.Source) | |
} | |
if !slices.Contains(destinationTypes, r.Spec.Type) { | |
return fmt.Errorf("the type should be equal to one of the options: %q , got: %q", destinationTypes, r.Spec.Type | |
} |
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
"errors" | ||
"fmt" | ||
|
||
"github.com/go-logr/logr" |
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 want to say it but anyway someone will say So, please sort 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
patch := rule.NewPatch() | ||
|
||
err = r.Status().Patch(ctx, rule, 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.
It looks a bit weird. As I understand here you patch an ID of the resource. I suggest you create another variable for self-composed ID and provide it anywhere you want. Then patch rule.Status.ID
with the value of the created variable.
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
pkg/instaclustr/client.go
Outdated
} | ||
err = json.Unmarshal(b, &rule.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.
} | |
err = json.Unmarshal(b, &rule.Status) | |
} | |
err = json.Unmarshal(b, &rule.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.
fixed
pkg/instaclustr/client.go
Outdated
} | ||
|
||
func (c *Client) DeleteOpenSearchEgressRule(id string) error { | ||
// https://api.dev.instaclustr.com/cluster-management/v2/resources/applications/opensearch/egress-rules/v2/{egressRuleId} |
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 delete this
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
pkg/instaclustr/client.go
Outdated
} | ||
err = json.Unmarshal(b, &rule) |
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.
A bit of code cleanup. Also do it in other similar cases if they exists
} | |
err = json.Unmarshal(b, &rule) | |
} | |
err = json.Unmarshal(b, &rule) |
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
ef887fb
to
f45c633
Compare
import ( | ||
"context" | ||
"errors" | ||
"fmt" | ||
|
||
clusterresourcesv1beta1 "github.com/instaclustr/operator/apis/clusterresources/v1beta1" | ||
"github.com/instaclustr/operator/pkg/instaclustr" | ||
"github.com/instaclustr/operator/pkg/models" | ||
"github.com/instaclustr/operator/pkg/scheduler" | ||
|
||
"github.com/go-logr/logr" | ||
k8serrors "k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/types" | ||
"k8s.io/client-go/tools/record" | ||
ctrl "sigs.k8s.io/controller-runtime" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" | ||
"sigs.k8s.io/controller-runtime/pkg/log" | ||
) |
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.
instaclustr/operator imports go third.
if rule.DeletionTimestamp != nil { | ||
err = r.handleDelete(ctx, l, rule) | ||
if err != nil { | ||
return models.ReconcileRequeue, 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.
please apply the custom rate limiter and remove models.ReconcileRequeue
37f6b61
to
de72397
Compare
de72397
to
c3559f8
Compare
…