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 64 commits
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
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ parameters [here](https://github.com/bitnami/charts/tree/master/bitnami/kafka/#i
```
helm repo add bitnami https://charts.bitnami.com/bitnami
kubectl create ns kafka-cluster
helm upgrade --install kafka-dev -n kafka-cluster bitnami/kafka --set auth.clientProtocol=sasl --set deleteTopicEnable=true --wait
helm upgrade --install kafka-dev -n kafka-cluster bitnami/kafka \
--version 15.0.1 \
--set auth.clientProtocol=sasl \
--set deleteTopicEnable=true \
--set authorizerClassName="kafka.security.authorizer.AclAuthorizer" \
--wait
```

Username is "user", obtain password using the following
Expand Down Expand Up @@ -84,34 +89,29 @@ parameters [here](https://github.com/bitnami/charts/tree/master/bitnami/kafka/#i
sudo kubefwd svc -n kafka-cluster
```

5. (optional) Install [kafka cli](https://github.com/birdayz/kaf).
5. (optional) Install the [kafka cli](https://github.com/twmb/kcl).


6. (optional) Configure the kafka cli to talk against local Kafka installation:

1. Create a config file for the client with the following content at `~/.kaf/config`:
1. Create a config file for the client with the following content at `~/.kcl/config.toml`:

```
current-cluster: local
clusteroverride: ""
clusters:
- name: local
version: ""
brokers:
- kafka-dev-0.kafka-dev-headless:9092
SASL:
mechanism: PLAIN
username: user
password: <password-you-obtained-in-step-2>
TLS: null
security-protocol: ""
schema-registry-url: ""
seed_brokers = ["kafka-dev-0.kafka-dev-headless:9092"]
timeout_ms = 10000

[sasl]
method = "plain"
user = "user"
pass = "<password-you-obtained-in-step-2>"
```

1. Verify that cli could talk to the Kafka cluster:

```
kaf nodes
export KCL_CONFIG_DIR=~/.kcl

kcl metadata --all
```

### Building and Running the provider locally
Expand Down
18 changes: 18 additions & 0 deletions apis/acl/acl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Copyright 2020 The Crossplane Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Package acl contains group Sample API versions
package acl
97 changes: 97 additions & 0 deletions apis/acl/v1alpha1/acl_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
Copyright 2020 The Crossplane Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
"reflect"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
)

// AccessControlListParameters are the configurable fields of a AccessControlList.
type AccessControlListParameters struct {
// +kubebuilder
ResourceName string `json:"resourceName"`
// +kubebuilder:validation:Enum=Unknown;Any;Topic;Group;Cluster;TransactionalID
ResourceType string `json:"resourceType"`
ResourcePrinciple string `json:"resourcePrinciple"`
ResourceHost string `json:"resourceHost"`
// +kubebuilder:validation:Enum=Unknown;Any;All;Read;Write;Create;Delete;Alter;Describe;ClusterAction;DescribeConfigs;AlterConfigs;IdempotentWrite
ResourceOperation string `json:"resourceOperation"`
// +kubebuilder:validation:Enum=Unknown;Any;Allow;Deny
ResourcePermissionType string `json:"resourcePermissionType"`
// +kubebuilder:validation:Enum=Prefixed;Any;Match;Literal
ResourcePatternTypeFilter string `json:"resourcePatternTypeFilter"`
}

// AccessControlListObservation are the observable fields of an AccessControlList
type AccessControlListObservation struct {
ID string `json:"id,omitempty"`
}

// An AccessControlListSpec defines the desired state of an AccessControlList
type AccessControlListSpec struct {
xpv1.ResourceSpec `json:",inline"`
ForProvider AccessControlListParameters `json:"forProvider"`
}

// A AccessControlListStatus represents the observed state of a AccessControlList.
type AccessControlListStatus struct {
xpv1.ResourceStatus `json:",inline"`
AtProvider AccessControlListObservation `json:"atProvider,omitempty"`
}

// +kubebuilder:object:root=true

// A AccessControlList is an example API type.
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,kafka}
type AccessControlList struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec AccessControlListSpec `json:"spec"`
Status AccessControlListStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// AccessControlListList contains a list of AccessControlList
type AccessControlListList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []AccessControlList `json:"items"`
}

// AccessControlList type metadata.
var (
AccessControlListKind = reflect.TypeOf(AccessControlList{}).Name()
AccessControlListGroupKind = schema.GroupKind{Group: Group, Kind: AccessControlListKind}.String()
AccessControlListKindAPIVersion = AccessControlListKind + "." + SchemeGroupVersion.String()
AccessControlListGroupVersionKind = SchemeGroupVersion.WithKind(AccessControlListKind)
)

func init() {
SchemeBuilder.Register(&AccessControlList{}, &AccessControlListList{})
}
17 changes: 17 additions & 0 deletions apis/acl/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
Copyright 2020 The Crossplane Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
40 changes: 40 additions & 0 deletions apis/acl/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copyright 2020 The Crossplane Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1alpha1 contains the v1alpha1 group Sample resources of the Template provider.
// +kubebuilder:object:generate=true
// +groupName=acl.kafka.crossplane.io
// +versionName=v1alpha1
package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

// Package type metadata.
const (
Group = "acl.kafka.crossplane.io"
Version = "v1alpha1"
)

var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
)
149 changes: 149 additions & 0 deletions apis/acl/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading