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

generate policies using go generate #3160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iaiw3br
Copy link

@iaiw3br iaiw3br commented Feb 21, 2025

Proposed changes

Write a clear and concise description that helps reviewers understand the purpose and impact of your changes. Use the
following format:

Problem: Policies are created manually

Solution: Automatically create policies using a template and the go generate command.
To generate files need to use make generate command

Testing: Manual testing, I ran the command and got the generated files

Please focus on paths of the files or directories which I set.
I pushed this code to know can I use this method to generate policies ?

Closes #ISSUE

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.

NONE

@iaiw3br iaiw3br requested a review from a team as a code owner February 21, 2025 21:09
Copy link
Contributor

github-actions bot commented Feb 21, 2025

🎉 Thank you for your contribution! It appears you have not yet signed the F5 Contributor License Agreement (CLA), which is required for your changes to be incorporated into an F5 Open Source Software (OSS) project. Please kindly read the F5 CLA and reply on a new comment with the following text to agree:


I have hereby read the F5 CLA and agree to its terms


Artem Ivanov seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@iaiw3br
Copy link
Author

iaiw3br commented Feb 22, 2025

I have hereby read the F5 CLA and agree to its terms

Copy link
Collaborator

@sjberman sjberman left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! Would you mind also including the issue number in the PR description so that it will be closed when the PR is merged?

}

// Template for generating policy methods
const tmpl = `// Code generated by gen_policies.go; DO NOT EDIT.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's deduplicate the common template and main function that we have in both v1alpha1 and v1alpha2 into a common file, maybe in apis/ top-level. Then we can just include the specific policy lists in each api version directory.

The package version at the top of the template could also be provided as a templated value.

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

Successfully merging this pull request may close these issues.

2 participants