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

Add configmap for tracing config #6897

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

kmjayadeep
Copy link
Contributor

@kmjayadeep kmjayadeep commented Jul 4, 2023

Changes

This PR moves the configuration of tracing from environment variables into a configmap named config-tracing. The available configuration options are provided as an example in the configmap itself.

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Tracing endpoint configuration is now moved from environment variable to the configmap `config-tracing`. Tracing can be now configured dynamically without needing to restart the controller. Refer the example configuration provided as part of the ConfigMap for the configuration options and format.

@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Jul 4, 2023
@tekton-robot
Copy link
Collaborator

Hi @kmjayadeep. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 4, 2023
@kmjayadeep kmjayadeep changed the title add configmap for tracing config Add configmap for tracing config Jul 4, 2023
@kmjayadeep
Copy link
Contributor Author

/kind misc

@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label Jul 4, 2023
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

/ok-to-test

config/config-tracing.yaml Outdated Show resolved Hide resolved
@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 5, 2023
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

@afrittoli afrittoli self-assigned this Jul 6, 2023
pkg/tracing/tracing.go Outdated Show resolved Hide resolved
@kmjayadeep kmjayadeep force-pushed the tracing-configmap branch 2 times, most recently from 6ff5163 to e42358e Compare July 6, 2023 16:52
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/store.go 92.6% 93.3% 0.7
pkg/apis/config/tracing.go Do not exist 61.1%
pkg/reconciler/taskrun/controller.go 95.2% 95.5% 0.2
pkg/tracing/tracing.go Do not exist 69.0%
test/controller.go 30.1% 30.7% 0.6

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 25, 2023
@afrittoli afrittoli added this to the Pipelines v0.51 milestone Jul 25, 2023
Copy link
Member

@lbernick lbernick left a comment

Choose a reason for hiding this comment

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

thanks @kmjayadeep! would you mind adding some more context to your commit message/PR description on the reason for this change? Also, this likely needs a release note.

#
# API endpoint to send the traces to
# (optional): The default value is given below
endpoint: "http://jaeger-collector.jaeger.svc.cluster.local:14268/api/traces"
Copy link
Member

Choose a reason for hiding this comment

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

would it make sense to either:

  • assume that if someone has configured an endpoint, that they want tracing enabled, i.e. remove the "enabled" setting
  • make this configuration real configuration instead of an example configuration, and set this to be the actual default endpoint and set enabled to "false" by default
    ?

Copy link
Contributor Author

@kmjayadeep kmjayadeep Sep 8, 2023

Choose a reason for hiding this comment

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

assume that if someone has configured an endpoint, that they want tracing enabled, i.e. remove the "enabled" setting

We will add more config options later. So it makes sense to make the enable flag explicit rather than based on the endpoint, which will be confusing to the users.

make this configuration real configuration instead of an example configuration, and set this to be the actual default endpoint and set enabled to "false" by default

We follow this pattern of giving only an example for other configmaps like config-events and config-observability. It is better to keep it consistent with those.

@@ -54,7 +59,9 @@ func NewController(opts *pipeline.Options, clock clock.PassiveClock, tracerProvi
pipelineRunInformer := pipelineruninformer.Get(ctx)
resolutionInformer := resolutioninformer.Get(ctx)
verificationpolicyInformer := verificationpolicyinformer.Get(ctx)
configStore := config.NewStore(logger.Named("config-store"), pipelinerunmetrics.MetricsOnStore(logger))
tracerProvider := tracing.New(TracerProviderName)
//nolint:contextcheck // OnStore methods does not support context as a parameter
Copy link
Member

Choose a reason for hiding this comment

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

rather than disabling the linter, would it make sense for OnStore to accept a ctx?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. It only makes sense if the OnStore method is directly consuming the context object.

But in this case, the OnStore method returns a callback function that is called every time the configmap changes. Ideally the callback method should be accepting the context object which is passed by the caller. But this logic is implemented inside knative library and we cannot change it.

That's why i had to create a context object inside the callback method. The linter is reporting a false positive error in this case. Of course we can pass the context and use it inside the callback, but it doesn't much sense to do it that way.


* `OTEL_EXPORTER_JAEGER_ENDPOINT` is the HTTP endpoint for sending spans directly to a collector.
* `OTEL_EXPORTER_JAEGER_USER` is the username to be sent as authentication to the collector endpoint.
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious why some of the configuration is moving to a configmap but not all of it. Is it because the password can be read from a secret when used in an envvar but not when used in a configmap? maybe the configmap could accept the name of a secret where the password is stored?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that's the idea. Configmap will have a secret name where creds are stored. It requires a separate logic for reconciling the secret. I wanted to keep the scope of the PR small for easy review process. I already have a WIP follow-up PR for this change in my fork here if you are interested to take a look.

// tp.Tracer should return a nooptracer initially
// recording is always false for spans created by nooptracer
if span.IsRecording() {
t.Fatalf("Span is recording before configuration")
Copy link
Member

Choose a reason for hiding this comment

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

super nits: context.background makes more sense than context.TODO IMO, since there's nothing todo, and I think t.Errorf makes more sense than Fatalf, since it's asserting test outputs rather than failing some setup steps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Other tests are likely to fail if one of these fails, so it doesn't make much difference in reality.
But you are right that it is a better practice to use t.Errorf instead. I will make these nit changes along with any other feedbacks as part of the PR. Otherwise I will just add it to my next PR if that's okay.

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesnt merit a release note. labels Sep 8, 2023
@kmjayadeep
Copy link
Contributor Author

thanks @kmjayadeep! would you mind adding some more context to your commit message/PR description on the reason for this change? Also, this likely needs a release note.

I have updated the description and release notes. I think it is clear enough. Feel free to update it directly as required.

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

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

Thank you @kmjayadeep!
/lgtm

@lbernick are you happy with the replies with your comments? If so can we merge this now?

@lbernick
Copy link
Member

lbernick commented Sep 8, 2023

No problem with merging
/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lbernick

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 8, 2023
@tekton-robot tekton-robot merged commit 6cf7c5e into tektoncd:main Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants