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

Support to Add, Remove and List ACLs (Fixes #6) #26

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
7b9bad1
Initial commit of ACL support
jograca Jan 19, 2022
501d1ee
Updating imports for Acl
jograca Jan 19, 2022
5136fca
Additional updates for template replacements for ACL controller
jograca Jan 20, 2022
ddcaeae
Updating Group Version Info for ACL
jograca Jan 20, 2022
3ac1cb4
Adding example CRD for ACL
jograca Jan 20, 2022
a3ac43e
Adding Code to create CRDs
jograca Jan 20, 2022
b65ef5f
Updating after running gofmt against project
jograca Jan 21, 2022
e0f897e
Changing abbreviaton ACL references to be more verbose with AccessCon…
jograca Jan 21, 2022
f28cb83
Initial commit of stubbed out ACL client
jograca Jan 21, 2022
00228e0
Initial controller commit for Team collaboration
jograca Jan 24, 2022
d728f59
Adding code with Create function to troubleshoot further with SMEs
jograca Jan 24, 2022
9797c3d
Fix kafka kadm client initialization
turkenh Jan 25, 2022
7b98bf3
Tweak ACL create request
turkenh Jan 25, 2022
1a30372
Update Readme with dev kafka config to test ACL
turkenh Jan 25, 2022
31c2acc
Update Readme with another kafka cli with ACL support
turkenh Jan 25, 2022
cb9f959
Merge pull request #2 from turkenh/minor-fixes
marshmallory Jan 25, 2022
d498d61
Updating the script to use the new CLI
marshmallory Jan 25, 2022
014872d
Updated dev config toml file to add missing quote
marshmallory Jan 25, 2022
b72a363
Adding EOD code for morning XP session
jograca Jan 25, 2022
205f778
Adding working code for Create method, work in progress
jograca Jan 26, 2022
0d6e0de
Adding in working client for ACL Create
jograca Jan 26, 2022
614ef08
Adding additional case stataments to support ACL Resource Types
jograca Jan 27, 2022
68b1a43
Adding working logic
jograca Jan 27, 2022
204ca36
Adding working IsUpToDate function
jograca Jan 28, 2022
2b5593b
fix devtools setup
marshmallory Jan 28, 2022
fa5a609
fix devtools setup
marshmallory Jan 28, 2022
c537913
fix devtools setup
marshmallory Jan 28, 2022
3dc6b6d
fix devtools setup
marshmallory Jan 28, 2022
d6ec69d
fix devtools setup
marshmallory Jan 28, 2022
5c1e17a
fix devtools setup
marshmallory Jan 28, 2022
aa20941
fix devtools setup and resolve the crossplane namespace
marshmallory Jan 28, 2022
79f233c
fix devtools setup
marshmallory Jan 28, 2022
eb02ec1
acl change to get nonexistent describe acls
marshmallory Jan 28, 2022
ab28bed
Adding in working Create, List and Delete
jograca Jan 28, 2022
567f525
Formatting updates to pass linters
jograca Feb 3, 2022
44428b7
Update README.md
jograca Feb 4, 2022
e18b180
Simplifying variable names in struct for ACL types
jograca Feb 4, 2022
15535c8
Matching variable names to types struct after simplifying them
jograca Feb 4, 2022
42c7c2e
Refactoring to simplify conditional statement
jograca Feb 4, 2022
d12c08b
Updating client to match new simplified variable names from topic struct
jograca Feb 4, 2022
a95d229
Adding additional error handling
jograca Feb 4, 2022
651af3e
Removing Kafka version from Dev Utility setup script
jograca Feb 4, 2022
30c87ed
Updating sample ACL claim to match updated CRD values
jograca Feb 4, 2022
2f15c37
Updating CRDs
jograca Feb 4, 2022
3381f00
Formatting update
jograca Feb 4, 2022
ea76106
Adding additional error handling
jograca Feb 4, 2022
1507792
External name functionality addition, currently not working.
marshmallory Feb 15, 2022
30f0c60
Updating logic to support troubleshooting setting external name to no…
jograca Feb 15, 2022
93b27c5
Removing print statements used for troubleshooting
jograca Feb 15, 2022
85b5209
Removing additional unused print statement and running Go formatting
jograca Feb 15, 2022
57bd8c7
Updates to pass linting rules
jograca Feb 15, 2022
dc659cb
Setting up Late Initialize to change parameters back in the event of …
jograca Feb 16, 2022
b2e7dbe
Removing late initialize reconciliation and providing user with an up…
jograca Feb 21, 2022
66972b5
Fixing spelling typo
jograca Feb 22, 2022
d0a2b91
Update internal/controller/acl/acl.go
jograca Feb 25, 2022
e43e36c
Update internal/controller/acl/acl.go
jograca Feb 25, 2022
9817084
Update internal/controller/acl/acl.go
jograca Feb 25, 2022
845b7ad
Removing unused ID line per PR feedback
jograca Feb 25, 2022
6792222
Updating List to allow for additional resource types per PR feedback
jograca Feb 25, 2022
36345fc
Update internal/clients/kafka/acl/acl.go
jograca Feb 25, 2022
09ab097
Incorporating PR feedback to add ResourceName, updating CRDs to match…
jograca Feb 25, 2022
9bedda7
Refactor to add Resource prefix to all types
jograca Feb 25, 2022
ee4a3b6
Adding support for additional Resource Types
jograca Feb 25, 2022
2fdf0d8
Added diff functionality
marshmallory Feb 28, 2022
c30e2e6
Updating Go Formatting for linter
jograca Mar 2, 2022
08e27e0
Removing ineffectual err to pass linting
jograca Mar 2, 2022
daadff0
Adding Descriptions to Topic and ACL Types and generating new CRDs
jograca Mar 2, 2022
0651c9f
Univerally replacing Principle with Principal
jograca Mar 2, 2022
610f6a8
Adding error handling to ensure slice is not empty
jograca Mar 2, 2022
7f24eb6
Addressing additional linting
jograca Mar 2, 2022
699d62f
Adding additional error handling
jograca Mar 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions internal/clients/kafka/acl/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,6 @@ func Generate(name string, params *v1alpha1.AccessControlListParameters) *Access
return acl
}

// LateInitializeSpec fills empty ACL spec fields with the data retrieved from Kafka.
func LateInitializeSpec(in *v1alpha1.AccessControlListParameters, observed *AccessControlList) bool {
lateInitialized := false

in.Principle = observed.Principle
in.Operation = observed.Operation
in.ResourceType = observed.ResourceType
in.PermissionType = observed.PermissionType
in.ResourcePatternTypeFilter = observed.ResourcePatternTypeFilter

lateInitialized = true

return lateInitialized
}

// IsUpToDate returns true if the supplied Kubernetes resource differs from the
// supplied Kafka ACLs.
func IsUpToDate(in *v1alpha1.AccessControlListParameters, observed *AccessControlList) bool {
Expand Down
10 changes: 4 additions & 6 deletions internal/controller/acl/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const (
errGetCreds = "cannot get credentials"
errListACL = "cannot List ACLs"
errNewClient = "cannot create new Service"
errUpdateNotSupported = "upadtes are not supported"
jograca marked this conversation as resolved.
Show resolved Hide resolved
)

// Setup adds a controller that reconciles AccessControlList managed resources.
Expand Down Expand Up @@ -142,14 +143,11 @@ func (c *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex

extname, err := acl.ConvertFromJSON(meta.GetExternalName(cr))
Copy link
Collaborator

Choose a reason for hiding this comment

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

error needs to be handled.

compare := acl.CompareAcls(*extname, *acl.Generate(cr.Name, &cr.Spec.ForProvider))

lateInitialized := acl.LateInitializeSpec(&cr.Spec.ForProvider, extname)


if !compare {
return managed.ExternalObservation{
ResourceExists: true,
ResourceUpToDate: true, // acl.IsUpToDate(&cr.Spec.ForProvider, extname),
ResourceLateInitialized: lateInitialized,
ResourceUpToDate: false,
}, errors.Wrap(err, "Updating not allowed")
jograca marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down Expand Up @@ -194,7 +192,7 @@ func (c *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext

func (c *external) Update(ctx context.Context, mg resource.Managed) (managed.ExternalUpdate, error) {

return managed.ExternalUpdate{}, errors.New("Updates are not supported")
return managed.ExternalUpdate{}, errors.New(errUpdateNotSupported)
}

func (c *external) Delete(ctx context.Context, mg resource.Managed) error {
Expand Down