Skip to content

Commit

Permalink
issue-545, remove self composing id for the opensearch egress rules
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksiienkoMykyta committed Nov 8, 2023
1 parent 1a20736 commit 4d8473b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ func (r *OpenSearchEgressRulesReconciler) handleCreate(ctx context.Context, l lo
}

func (r *OpenSearchEgressRulesReconciler) handleDelete(ctx context.Context, logger logr.Logger, rule *clusterresourcesv1beta1.OpenSearchEgressRules) error {
if rule.Status.ID == "" {
rule.Status.ID = fmt.Sprintf("%s~%s~%s", rule.Spec.ClusterID, rule.Spec.Source, rule.Spec.OpenSearchBindingID)
}

_, err := r.API.GetOpenSearchEgressRule(rule.Status.ID)
if !errors.Is(err, instaclustr.NotFound) && err != nil {
logger.Error(err, "failed to get OpenSearch Egress Rule resource from Instaclustr")
Expand Down
4 changes: 2 additions & 2 deletions pkg/instaclustr/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2356,8 +2356,8 @@ func (c *Client) CreateOpenSearchEgressRules(rule *clusterresourcesv1beta1.OpenS
return nil
}

func (c *Client) GetOpenSearchEgressRule(id string) (*clusterresourcesv1beta1.OpenSearchEgressRules, error) {
rule := clusterresourcesv1beta1.OpenSearchEgressRules{}
func (c *Client) GetOpenSearchEgressRule(id string) (*clusterresourcesv1beta1.OpenSearchEgressRulesStatus, error) {
rule := clusterresourcesv1beta1.OpenSearchEgressRulesStatus{}
url := c.serverHostname + OpenSearchEgressRulesEndpoint + "/" + id

resp, err := c.DoRequest(url, http.MethodGet, nil)
Expand Down
2 changes: 1 addition & 1 deletion pkg/instaclustr/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type API interface {
UpdateClusterSettings(clusterID string, settings *models.ClusterSettings) error
GetAWSEndpointServicePrincipal(id string) (*models.AWSEndpointServicePrincipal, error)
CreateOpenSearchEgressRules(rule *clusterresourcesv1beta1.OpenSearchEgressRules) error
GetOpenSearchEgressRule(id string) (*clusterresourcesv1beta1.OpenSearchEgressRules, error)
GetOpenSearchEgressRule(id string) (*clusterresourcesv1beta1.OpenSearchEgressRulesStatus, error)
DeleteOpenSearchEgressRule(id string) error
CreateAWSEndpointServicePrincipal(spec any) ([]byte, error)
DeleteAWSEndpointServicePrincipal(principalID string) error
Expand Down
2 changes: 1 addition & 1 deletion pkg/instaclustr/mock/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func (c *mockClient) CreateOpenSearchEgressRules(rule *clusterresourcesv1beta1.O
panic("CreateOpenSearchEgressRules: is not implemented")
}

func (c *mockClient) GetOpenSearchEgressRule(id string) (*clusterresourcesv1beta1.OpenSearchEgressRules, error) {
func (c *mockClient) GetOpenSearchEgressRule(id string) (*clusterresourcesv1beta1.OpenSearchEgressRulesStatus, error) {
panic("GetOpenSearchEgressRule: is not implemented")
}

Expand Down

0 comments on commit 4d8473b

Please sign in to comment.