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

[CLI] Support passing of Service Account to tkn-results #575

Merged
merged 1 commit into from
Sep 3, 2023

Conversation

khrm
Copy link
Contributor

@khrm khrm commented Aug 24, 2023

The User can pass the flag --sa for serviceaccount name and --sa-ns for serviceaccount namespace. Latter is optional. If not given, then the namespace from the current context is assumed.

Fixes #576

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

The User can pass the flag --sa for serviceaccount name and --sa-ns for serviceaccount namespace. Latter is optional. If not given, then the namespace from the current context is assumed.

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Aug 24, 2023
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 24, 2023
@khrm
Copy link
Contributor Author

khrm commented Aug 24, 2023

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 24, 2023
@khrm khrm added this to the v0.8.0 milestone Aug 24, 2023
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 24, 2023
@khrm khrm changed the title Support passing of Service Account to tkn-results [CLI] Support passing of Service Account to tkn-results Aug 24, 2023
@khrm
Copy link
Contributor Author

khrm commented Aug 25, 2023

@enarha @avinal @sayan-biswas @adambkaplan Can you review this asap? Part of milestone v0.8.0

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.

/test pull-tekton-results-integration-tests

Copy link
Member

@avinal avinal left a comment

Choose a reason for hiding this comment

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

Even if I provide argument, it is not working for me. I hope I am doing it right.

My results.yaml
address: localhost:8080
token:
ssl:
  roots_file_path: /tmp/results.crt
  server_name_override: tekton-results-api-service.tekton-pipelines.svc.cluster.local
service_account:
  namespace:
  name:
$ ./tkn-results list default --sa=tekton-results-debug --sa-ns=tekton-pipelines
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x15e0232]

goroutine 1 [running]:
github.com/tektoncd/results/tools/tkn-results/internal/client.NewDefaultFactory()
        /home/avinal/Documents/redhat/github.com/tektoncd/results/tools/tkn-results/internal/client/client.go:38 +0xd2
github.com/tektoncd/results/tools/tkn-results/internal/client.DefaultClient({0x1c34770, 0xc000048120}, {0x0, 0x0})
        /home/avinal/Documents/redhat/github.com/tektoncd/results/tools/tkn-results/internal/client/client.go:91 +0x2d
github.com/tektoncd/results/tools/tkn-results/cmd.Root.func1(0xc000004c00?, {0xc000025e00?, 0x3?, 0x3?})
        /home/avinal/Documents/redhat/github.com/tektoncd/results/tools/tkn-results/cmd/root.go:54 +0x165
github.com/spf13/cobra.(*Command).execute(0xc000004c00, {0xc000025da0, 0x3, 0x3})
        /home/avinal/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:891 +0x739
github.com/spf13/cobra.(*Command).ExecuteC(0xc000004900)
        /home/avinal/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /home/avinal/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968
github.com/spf13/cobra.(*Command).ExecuteContext(0x0?, {0x1c34770?, 0xc000048120?})
        /home/avinal/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:961 +0x4a
main.main()
        /home/avinal/Documents/redhat/github.com/tektoncd/results/tools/tkn-results/main.go:9 +0x2c

tools/tkn-results/internal/client/client.go Outdated Show resolved Hide resolved
@khrm khrm force-pushed the f/sa branch 2 times, most recently from 9414457 to e8374ed Compare August 28, 2023 06:10
@khrm
Copy link
Contributor Author

khrm commented Aug 28, 2023

All flags seem to be broken in the main.

@khrm khrm force-pushed the f/sa branch 2 times, most recently from 5348e2d to 390c6a1 Compare August 30, 2023 06:52
@khrm
Copy link
Contributor Author

khrm commented Aug 30, 2023

@avinal Can you test this pr now?

Copy link
Member

@avinal avinal left a comment

Choose a reason for hiding this comment

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

Tested, working as expected. I do think that the error messages can be improved. Currently we get this error if nothing is passed or added in the config.

ListRecords: rpc error: code = Unauthenticated desc = permission denied
Error: rpc error: code = Unauthenticated desc = permission denied

We can instead return a more helpful message quoting the possible reasons. Fo now this PR is good.

@khrm
Copy link
Contributor Author

khrm commented Aug 30, 2023

@enarha @sayan-biswas Let's merge this pr also. @avinal Tested this.

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: avinal, 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 tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 30, 2023
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 31, 2023
User can pass flag --sa for serviceaccount name and --sa-ns for
serviceaccount namespace. Latter is optional. If not given, then
namespace from current context is assumed.
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 31, 2023
@enarha
Copy link
Contributor

enarha commented Sep 3, 2023

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 3, 2023
@tekton-robot tekton-robot merged commit 1464654 into tektoncd:main Sep 3, 2023
5 checks passed
@khrm khrm deleted the f/sa branch September 4, 2023 07:37
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CLI] Support the serviceaccount flag
5 participants