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

added skip-push-permission flag #2657

Merged
merged 2 commits into from
Aug 15, 2023

Conversation

cmdjulian
Copy link
Contributor

@cmdjulian cmdjulian commented Aug 6, 2023

Description

I use k3s in my prod setup. In the namespace I'm using a default deny all network policy. Specifically for my kaniko pod, I added an allowance rule. k3s uses kube-route to enforce network-policies. kube-route uses ip rules. In my case it takes most of the time roughly 1s to apply the policies. This results in the kaniko pod failing to start, as when the push permission check is conducted, the network policy did not add the allowance rule yet.
When disabling the push permission check, the network policy has enough time to be applied.
As in the past with kaniko, there were some problems regarding the push permission check, having the possibility to disable it seems like an adequate solution.
In certain situations disabling the push permission checks yields better performance as well.

I also thought about adding a retry mechanism, but I'm not convinced this is the best approach here, as it would be more complex and ultimately delays the feedback for the user, that a certain build lacks the required push permissions. Additionally, having the possibility to disable the check all together as mentioned previously might in some situations speed up the build.

That basically is the printed error message: error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: checking push permission for "registry-svc:5001/environment/f07b24df-58dd-4a24-bdb5-3e64d9e3bfd4:latest": creating push check transport for registry-svc:5001 failed: Get "https://registry-svc:5001/v2/": dial tcp 10.43.7.253:5001: connect: connection refused; Get "http://registry-svc:5001/v2/": dial tcp 10.43.7.253:5001: connect: connection refused

Submitter Checklist

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

  • Includes unit tests
  • Adds integration tests if needed.

See the contribution guide for more details.

Reviewer Notes

  • The code flow looks good.
  • Unit tests and or integration tests added.

Release Notes

Added flag --skip-push-permission-check to disable initial push permission check

Examples of user facing changes:
- kaniko adds a new flag `--skip-push-permission-check` to override registry

@google-cla
Copy link

google-cla bot commented Aug 6, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Added skip-push-permission flag to conditionally disable push permission check on build start to accommodate for slow network policies
Copy link
Collaborator

@aaron-prindle aaron-prindle left a comment

Choose a reason for hiding this comment

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

@cmdjulian thanks for the PR here! LGTM

@aaron-prindle aaron-prindle merged commit cefe99b into GoogleContainerTools:main Aug 15, 2023
10 checks passed
@aaron-prindle aaron-prindle added this to the v1.14.0 milestone Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants