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 Support for Blob Type (s3 and GCS) #879

Merged
merged 6 commits into from
Nov 13, 2024
Merged

Conversation

khrm
Copy link
Contributor

@khrm khrm commented Nov 10, 2024

Added support for reading forwarded logs to s3 and GCS.
If vector forwards logs to s3 and GCS, these logs can be read using
Go CDK's blob library.
Also, if result logging mechanism is changed from v1alpha2 to v1alpha3
which doesn't support watcher, we can read old logs if they exist.

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you review them:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Tested your changes locally (if this is a code change)
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add 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)
  • Release notes contain the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Added support for reading forwarded logs to s3 and GCS.
If vector forwards logs to s3 and GCS, these logs can be read using
Go CDK's blob library.
Also, if result logging mechanism is changed from v1alpha2 to v1alpha3
which doesn't support watcher, we can read old logs if they exist.

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Nov 10, 2024
@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 10, 2024
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
cmd/api/main.go 8.3% 8.4% 0.2
pkg/api/server/v1alpha2/log/s3.go 38.2% 0.0% -38.2
pkg/api/server/v1alpha2/plugin_logs/plugin_logs.go Do not exist 26.4%
pkg/api/server/v1alpha2/plugin_logs/server.go Do not exist 80.0%
pkg/apis/v1alpha3/types.go 100.0% 0.0% -100.0
pkg/apis/v1alpha3/types.go Do not exist 42.9%
pkg/apis/v1alpha3/types.go Do not exist 0.0%

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
cmd/api/main.go 8.3% 8.4% 0.2
pkg/api/server/v1alpha2/log/s3.go 38.2% 0.0% -38.2
pkg/api/server/v1alpha2/plugin_logs/plugin_logs.go Do not exist 26.4%
pkg/api/server/v1alpha2/plugin_logs/server.go Do not exist 80.0%
pkg/apis/v1alpha3/types.go 100.0% 0.0% -100.0
pkg/apis/v1alpha3/types.go Do not exist 42.9%
pkg/apis/v1alpha3/types.go Do not exist 0.0%

@khrm khrm force-pushed the blobLogs branch 2 times, most recently from 3f5b1b8 to c91eaaa Compare November 11, 2024 08:31
@khrm khrm added this to the v0.13.0 milestone Nov 11, 2024
Copy link
Contributor Author

@khrm khrm left a comment

Choose a reason for hiding this comment

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

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/log/s3.go 38.2% 0.0% -38.2
pkg/api/server/v1alpha2/plugin_logs/plugin_logs.go Do not exist 26.4%
pkg/api/server/v1alpha2/plugin_logs/server.go Do not exist 80.0%
pkg/api/server/v1alpha2/server.go 75.9% 69.2% -6.7
pkg/apis/v1alpha3/types.go 100.0% 14.3% -85.7
pkg/apis/v1alpha3/types.go Do not exist 33.3%
pkg/apis/v1alpha3/types.go Do not exist 100.0%
pkg/apis/v1alpha3/types.go Do not exist 0.0%

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/log/s3.go 38.2% 0.0% -38.2
pkg/api/server/v1alpha2/plugin/plugin_logs.go Do not exist 26.4%
pkg/api/server/v1alpha2/plugin/server.go Do not exist 80.0%
pkg/api/server/v1alpha2/server.go 75.9% 69.2% -6.7
pkg/apis/v1alpha3/types.go 66.7% 0.0% -66.7
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 66.7%
pkg/apis/v1alpha3/types.go Do not exist 0.0%

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/log/s3.go 38.2% 0.0% -38.2
pkg/api/server/v1alpha2/plugin/plugin_logs.go Do not exist 26.4%
pkg/api/server/v1alpha2/plugin/server.go Do not exist 80.0%
pkg/api/server/v1alpha2/server.go 75.9% 69.2% -6.7
pkg/apis/v1alpha3/types.go 66.7% 0.0% -66.7
pkg/apis/v1alpha3/types.go Do not exist 20.0%
pkg/apis/v1alpha3/types.go Do not exist 50.0%
pkg/apis/v1alpha3/types.go Do not exist 0.0%

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/log/s3.go 38.2% 0.0% -38.2
pkg/api/server/v1alpha2/plugin/plugin_logs.go Do not exist 26.4%
pkg/api/server/v1alpha2/plugin/server.go Do not exist 80.0%
pkg/api/server/v1alpha2/server.go 75.9% 69.2% -6.7
pkg/apis/v1alpha3/types.go 66.7% 0.0% -66.7
pkg/apis/v1alpha3/types.go Do not exist 20.0%
pkg/apis/v1alpha3/types.go Do not exist 50.0%
pkg/apis/v1alpha3/types.go Do not exist 0.0%

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/log/gcs.go 42.9% 33.9% -8.9
pkg/api/server/v1alpha2/log/s3.go 38.2% 37.7% -0.6
pkg/api/server/v1alpha2/plugin/plugin_logs.go Do not exist 26.4%
pkg/api/server/v1alpha2/plugin/server.go Do not exist 80.0%
pkg/api/server/v1alpha2/server.go 75.9% 69.2% -6.7
pkg/apis/v1alpha3/types.go 66.7% 0.0% -66.7
pkg/apis/v1alpha3/types.go Do not exist 50.0%
pkg/apis/v1alpha3/types.go Do not exist 20.0%
pkg/apis/v1alpha3/types.go Do not exist 50.0%

@khrm
Copy link
Contributor Author

khrm commented Nov 12, 2024

/test pull-tekton-results-unit-tests

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/log/s3.go 38.2% 37.7% -0.6
pkg/api/server/v1alpha2/plugin/plugin_logs.go Do not exist 26.4%
pkg/api/server/v1alpha2/plugin/server.go Do not exist 80.0%
pkg/api/server/v1alpha2/server.go 75.9% 69.2% -6.7
pkg/apis/v1alpha3/types.go 66.7% 0.0% -66.7
pkg/apis/v1alpha3/types.go Do not exist 50.0%
pkg/apis/v1alpha3/types.go Do not exist 20.0%
pkg/apis/v1alpha3/types.go Do not exist 50.0%

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 12, 2024
pkg/api/server/v1alpha2/log/gcs_test.go Show resolved Hide resolved
pkg/api/server/v1alpha2/plugin/plugin_logs.go Outdated Show resolved Hide resolved
if legacy {
logRec, err = getLogRecord(s.db, parent, rec.ResultID, rec.Name)
if err != nil {
s.logger.Debugf("error getting legacy log record: %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we continue here?

  1. If err != nil, then logRec will be nil
  2. If legacy is configured which means log type to v1alpha2, why do we continue as v1alpha3?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Yes, fixed that.
  2. Yes, Log Type kind itself can be v1alpha2 or v1alpha3.
    In plugin API, there's no LogType record itself.

err := json.Unmarshal(logRec.Data, log)
if err != nil {
err = fmt.Errorf("could not decode Log record: %w", err)
s.logger.Error(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

below you call the .Error() (s.logger.Error(err.Error())) method on the error while logging. I do not mind either, just keep consistent.
Also in the other instances below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to use s.logger.Error(err) to everywhere.

}

s.logger.Debugf("LOGS_TYPE: %s", strings.ToLower(s.config.LOGS_TYPE))
// If the logs type is not Loki, we don't need to set up the LogPluginServer
Copy link
Contributor

Choose a reason for hiding this comment

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

setLogPlugin() with also return true if the log type BlobLogType, so either the comment is outdated or the logic below.

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. Comment is outdated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated this.

@khrm
Copy link
Contributor Author

khrm commented Nov 13, 2024

/retest

@khrm khrm force-pushed the blobLogs branch 2 times, most recently from 7c735d5 to 7d4c40c Compare November 13, 2024 09:46
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/log/s3.go 38.2% 37.7% -0.6
pkg/api/server/v1alpha2/plugin/plugin_logs.go Do not exist 25.6%
pkg/api/server/v1alpha2/plugin/server.go Do not exist 80.0%
pkg/api/server/v1alpha2/server.go 75.9% 69.2% -6.7
pkg/apis/v1alpha3/types.go 66.7% 0.0% -66.7
pkg/apis/v1alpha3/types.go Do not exist 50.0%
pkg/apis/v1alpha3/types.go Do not exist 20.0%
pkg/apis/v1alpha3/types.go Do not exist 50.0%

khrm added 3 commits November 13, 2024 15:29
Added support for reading forwarded logs to s3 and GCS.
If vector forwards logs to s3 and GCS, these logs can be read using
Go CDK's blob library.
Also, if result logging mechanism is changeg from v1alpha2 to v1alpha3
which doesn't support watcher, we can read old logs if they exist.
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/log/s3.go 38.2% 37.7% -0.6
pkg/api/server/v1alpha2/plugin/plugin_logs.go Do not exist 25.6%
pkg/api/server/v1alpha2/plugin/server.go Do not exist 80.0%
pkg/api/server/v1alpha2/server.go 75.9% 69.2% -6.7
pkg/apis/v1alpha3/types.go 66.7% 0.0% -66.7
pkg/apis/v1alpha3/types.go Do not exist 16.7%
pkg/apis/v1alpha3/types.go Do not exist 0.0%
pkg/apis/v1alpha3/types.go Do not exist 66.7%

Added documentation for blob plugin logging and added details about CDK.
docs/logging-support.md Outdated Show resolved Hide resolved
docs/logging-support.md Outdated Show resolved Hide resolved
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/log/s3.go 38.2% 37.7% -0.6
pkg/api/server/v1alpha2/plugin/plugin_logs.go Do not exist 25.6%
pkg/api/server/v1alpha2/plugin/server.go Do not exist 80.0%
pkg/api/server/v1alpha2/server.go 75.9% 69.2% -6.7
pkg/apis/v1alpha3/types.go 66.7% 0.0% -66.7
pkg/apis/v1alpha3/types.go Do not exist 20.0%
pkg/apis/v1alpha3/types.go Do not exist 33.3%
pkg/apis/v1alpha3/types.go Do not exist 60.0%

Fix typo in documentation (ena)
@enarha
Copy link
Contributor

enarha commented Nov 13, 2024

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 13, 2024
@enarha
Copy link
Contributor

enarha commented Nov 13, 2024

/approve

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enarha, vdemeester

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
Copy link

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

File Old Coverage New Coverage Delta
pkg/api/server/v1alpha2/log/s3.go 38.2% 37.7% -0.6
pkg/api/server/v1alpha2/plugin/plugin_logs.go Do not exist 25.6%
pkg/api/server/v1alpha2/plugin/server.go Do not exist 80.0%
pkg/api/server/v1alpha2/server.go 75.9% 69.2% -6.7
pkg/apis/v1alpha3/types.go 66.7% 0.0% -66.7
pkg/apis/v1alpha3/types.go Do not exist 50.0%
pkg/apis/v1alpha3/types.go Do not exist 20.0%
pkg/apis/v1alpha3/types.go Do not exist 50.0%

@tekton-robot tekton-robot merged commit eb58c78 into tektoncd:main Nov 13, 2024
6 checks passed
@khrm khrm deleted the blobLogs branch November 13, 2024 11:35
@khrm
Copy link
Contributor Author

khrm commented Nov 13, 2024

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 13, 2024
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/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants