istio / istio/api

Make AuthorizationPolicy spec usable with controller-gen

Open
#3,363 1 comment 0 reactions 0 assignees View on GitHub
kind/enhancement
Dominant language
Go
Stars
519
Forks
612
Avg merge
18h 35m
Merged PRs (30d)
23

Description

**Describe the feature request**

The AuthorizationPolicy spec (security/v1beta1/authorization_policy.pb.go) go type can't be used with controller-tools
If I try to create a CRD with kubebuilder / controller-tools that embeds an AuthorizationPolicy spec as part of my CRD object, I have to create my own copy of the existing type, which adds more work to translate it to an actual AuthorizationPolicy later on.

The reason this fails is that the type has an ActionDetail property which lacks any `json` tag.
This is because this property is not part of the CRD itself I believe. However, controller-tools at best allows to ignore private properties from a type but not public properties. So it fails to create the CRD object.

One option would be to make ActionDetail private (actionDetail - there is already a GetActionDetail method defined) but this is an interface change that would likely introduce breakages in existing code if they access that property directly

**Describe alternatives you've considered**

Alternative is to create a "copy" of the type and create methods to get an istio AuthorizationPolicy object out of the clone type

**Affected product area (please put an X in all that apply)**

[ ] Configuration Infrastructure
[ ] Docs
[ ] Installation
[ ] Networking
[ ] Performance and Scalability
[ ] Policies and Telemetry
[ ] Security
[ ] Test and Release
[ ] User Experience

**Additional context**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.