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

fix: helm param gcr service account auth #2108

Merged
merged 3 commits into from
Jun 26, 2024

Conversation

chen-keinan
Copy link
Collaborator

Description

helm param gcr service account auth

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).

Signed-off-by: chenk <hen.keinan@gmail.com>
@github-actions github-actions bot added the bug label May 28, 2024
Signed-off-by: chenk <hen.keinan@gmail.com>
@chen-keinan
Copy link
Collaborator Author

@tidusete do you know how to build the project from this PR and test it to make sure it works for you ?

@tidusete
Copy link
Contributor

@chen-keinan I have been trying to make it work but without luck.
Im defining on the configmap:

  name: trivy-operator
  namespace: default
  data:
    scanJob.useGCRServiceAccount: testing

But I believe this condition trivyoperator.GetDefaultConfig().GetScanJobUseGCRServiceAccount() is always giving me true although I have defined on the trivy-operator configmap the following Key.
As soon as I forced this condition to false it worked:

if CheckGcpCrOrPrivateRegistry(c.Image) &&
                              trivyoperator.GetDefaultConfig().GetScanJobUseGCRServiceAccount() && false {

So basically the problem relays on the function trivyoperator.GetDefaultConfig().GetScanJobUseGCRServiceAccount()

From which helm version should I work on that point? Should I forward everything to the last helm version and put on top of that the container image that I'm building with your changes?

@chen-keinan
Copy link
Collaborator Author

@tidusete if you want to run from helm do the following.
steps:

  • building trivy-operator binary
cd ~/<your workspace>/trivy-operator/cmd/trivy-operator
GOOS=linux GOARCH=arm64/amd64 go build -o trivy-operator
  • building operator image: /trivy-operator:
mv trivy-operator ~/<your workspace>/trivy-operator/build/trivy-operator/trivy-operator

cd ~/<your workspace>/trivy-operator/build/trivy-operator

docker build -t <docker hub user>/trivy-operator:<tag> .
  • publishing operator image: /trivy-operator:
docker push <docker hub user>/trivy-operator:<tag>"

update the deployment image with the one you just build and published

@chen-keinan
Copy link
Collaborator Author

@tidusete any update ?

@tidusete
Copy link
Contributor

I will try to do it today

@tidusete
Copy link
Contributor

Hey @chen-keinan I have been following all what you said but I have no luck.

  1. building trivy-operator binary
  2. building operator image: /trivy-operator
  3. publishing operator image: /trivy-operator
  4. Modifying the configmap:
kind: ConfigMap
name: trivy-operator
data:
  scanJob.useGCRServiceAccount: 'false'
  1. Modifying the deployment of the operator and adding there my custom image...

I have the feeling that this var scanJob.useGCRServiceAccount: 'False' is not being set on the trivy operator. Is it possible? As I said before, the only way to make it work was forcing to be always false the condition:
https://github.com/aquasecurity/trivy-operator/pull/2108/files#diff-53a92550719283e3e24a05f5be379432b7015f20730b85c8803b9c0855556909R213

if CheckGcpCrOrPrivateRegistry(c.Image) &&
                              trivyoperator.GetDefaultConfig().GetScanJobUseGCRServiceAccount() && false {

@chen-keinan
Copy link
Collaborator Author

chen-keinan commented Jun 23, 2024

@tidusete thanks for the update, I have found the issue and added a fix to this PR, can you try again the above steps after updating the branch with latest commit

Signed-off-by: chenk <hen.keinan@gmail.com>
@chen-keinan
Copy link
Collaborator Author

@tidusete let me know if now it works for you and I'll merge it

@tidusete
Copy link
Contributor

Will try to do it today as well

@tidusete
Copy link
Contributor

Works like a charm!

@chen-keinan
Copy link
Collaborator Author

Works like a charm!

Thanks for the update, I'll merge it now.

@chen-keinan chen-keinan marked this pull request as ready for review June 26, 2024 13:13
@chen-keinan chen-keinan merged commit 5d266cf into aquasecurity:main Jun 26, 2024
9 checks passed
@34fathombelow
Copy link

I see a new helm chart was published, but I believe this would require a newer appVersion to use this fix. Correct?

@chen-keinan
Copy link
Collaborator Author

@34fathombelow the fix on the PR has not yet been released, only merged , will be out with trivy-operator v0.22.0 hopefully later on this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google Container Registry / Google Artifact Registry ImagePullSecret connection problem
3 participants