-
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
External Deletion for clusters #575
Conversation
15beb9c
to
254383b
Compare
controllers/clusters/helpers.go
Outdated
"encoding/json" | ||
"fmt" | ||
"k8s.io/client-go/tools/record" | ||
"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.
Please, sort imports, alse delete isClusterActive function on row 141
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
7d2b60e
to
5597b84
Compare
0acccfb
to
33bfd70
Compare
ee6d5c8
to
ac411f4
Compare
3ff0d92
to
664dde9
Compare
"context" | ||
"github.com/instaclustr/operator/pkg/instaclustr" | ||
"github.com/instaclustr/operator/pkg/models" | ||
"os" |
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
|
||
<-doneCh | ||
|
||
By("testing by deleting the cluster by Instaclustr API 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.
By("using all possible ways other than k8s to delete a resource, the k8s operator scheduler should notice the changes and set the status of the deleted resource accordingly.")
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
return false | ||
} | ||
|
||
fmt.Println("cassandra2.Status.State", cassandra2.Status.State) |
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.
pls 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.
Removed.
controllers/clusters/helpers.go
Outdated
"github.com/hashicorp/go-version" | ||
"k8s.io/utils/strings/slices" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
"github.com/instaclustr/operator/apis/clusters/v1beta1" | ||
"github.com/instaclustr/operator/pkg/models" | ||
"k8s.io/utils/strings/slices" | ||
"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
@@ -58,7 +59,7 @@ var _ = Describe("Kafka Controller", func() { | |||
return false | |||
} | |||
|
|||
return kafka.Status.ID == openapi.CreatedID | |||
return kafka.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.
why have you changed 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.
Because I used uuid to generate IDs for entities. Reverted
"context" | ||
"errors" | ||
|
||
"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.
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.
What's wrong here?
import ( | ||
"context" | ||
"github.com/instaclustr/operator/pkg/instaclustr" | ||
"github.com/instaclustr/operator/pkg/models" | ||
"os" | ||
|
||
. "github.com/onsi/ginkgo/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.
😮💨
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.
w_w
By("creating secret with the default user credentials") | ||
secret := kafkaConnect.NewDefaultUserSecret("", "") | ||
secretNamespacedName := types.NamespacedName{ | ||
Namespace: secret.Namespace, | ||
Name: secret.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.
is that OK to create a defaultUserSecret
with empty creds?
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 use it only for getting a secret with an already configured namespaced name for the specified cluster and nothing else.
id := uuid.New().String() | ||
kafkaConnectClusterV2.Id = id | ||
s.clusters[id] = &kafkaConnectClusterV2 |
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 use the ID setting logic that I implemented in the stub server API service for the Cassandra 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.
more control, imo
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 makes sense. I just forgot to revert these changes.
Implemented handling of the external deletion of resources. In the previous implementation if there was no resource on the Instaclustr we deleted it in k8s. Now it changes a resource state to
DELETED
without deleting it in k8s.