Skip to content
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

disable telemetry with init #412

Merged
merged 5 commits into from
Jul 17, 2024
Merged

disable telemetry with init #412

merged 5 commits into from
Jul 17, 2024

Conversation

thebigbone
Copy link
Contributor

closes #364

πŸ“‘ Description

added a telemetry flag which will disable the telemetry

βœ… Checks

  • I have updated the documentation as required
  • I have performed a self-review of my code

@thebigbone thebigbone requested a review from a team as a code owner July 13, 2024 11:43
Copy link
Collaborator

@petar-cvit petar-cvit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @thebigbone, left a couple of comments

Comment on lines 93 to 98
if telemetry {
if obj.GetKind() == "Deployment" {
labels, _, _ := unstructured.NestedMap(obj.Object, "metadata", "labels")
if labels != nil {
appLabel, _, _ := unstructured.NestedString(labels, "app")
if appLabel == "cyclops-ctrl" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check for cyclops controller deployment by checking the name? Also, you can check for all of those in the same if statement

Suggested change
if telemetry {
if obj.GetKind() == "Deployment" {
labels, _, _ := unstructured.NestedMap(obj.Object, "metadata", "labels")
if labels != nil {
appLabel, _, _ := unstructured.NestedString(labels, "app")
if appLabel == "cyclops-ctrl" {
if telemetry && obj.GetKind() == "Deployment" && obj.GetName() == "cyclops-ctrl" {

log.Fatal(err)
}
}
err = doServerSideApply(context.TODO(), config, obj)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you first deploying the controller without telemetry and then updating it? I would prefer if just alter the object and then call the doServerSideApply with it

@@ -161,5 +201,6 @@ var applyCmd = &cobra.Command{

func init() {
applyCmd.Flags().StringP("version", "v", "main", "specify cyclops version")
applyCmd.Flags().BoolP("telemetry", "t", false, "disable telemetry")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename the flag to disable-telemetry and update the usage string to something like disable emitting telemetry metrics from cyclops controller

cyctl/cmd/apply.go Outdated Show resolved Hide resolved
Co-authored-by: Petar Cvitanović <72022639+petar-cvit@users.noreply.github.com>
@thebigbone
Copy link
Contributor Author

done

@@ -67,7 +67,7 @@ func doServerSideApply(ctx context.Context, cfg *rest.Config, obj *unstructured.
return err
}

func applyYaml(yamlFile []byte, config *rest.Config) error {
func applyYaml(yamlFile []byte, config *rest.Config, telemetry bool) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also rename this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

@petar-cvit petar-cvit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @thebigbone 🧑

@petar-cvit petar-cvit merged commit 21facd6 into cyclops-ui:main Jul 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cyctl telemetry flag
2 participants