-
Notifications
You must be signed in to change notification settings - Fork 772
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
Conversation
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.
Thanks @thebigbone, left a couple of comments
cyctl/cmd/apply.go
Outdated
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" { |
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.
Can we check for cyclops controller deployment by checking the name? Also, you can check for all of those in the same if statement
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" { |
cyctl/cmd/apply.go
Outdated
log.Fatal(err) | ||
} | ||
} | ||
err = doServerSideApply(context.TODO(), config, obj) |
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.
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
cyctl/cmd/apply.go
Outdated
@@ -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") |
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.
Can we rename the flag to disable-telemetry
and update the usage string to something like disable emitting telemetry metrics from cyclops controller
done |
cyctl/cmd/apply.go
Outdated
@@ -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 { |
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.
Can you also rename this 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.
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.
Thanks @thebigbone π§‘
closes #364
π Description
added a telemetry flag which will disable the telemetry
β Checks