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

fix(kafka): add clusterName because of api-changes #1624

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion apis/kafka/generator-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ ignore:
- ClusterV2
field_paths:
- CreateClusterInput.BrokerNodeGroupInfo
- CreateClusterInput.ClusterName
- CreateClusterInput.ConfigurationInfo
- CreateConfigurationInput.Name
- CreateConfigurationInput.ServerProperties
Expand Down
5 changes: 3 additions & 2 deletions apis/kafka/v1alpha1/zz_cluster.go

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

10 changes: 5 additions & 5 deletions apis/kafka/v1alpha1/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions examples/kafka/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: example
spec:
forProvider:
clusterName: example
region: us-east-1
brokerNodeGroupInfo:
clientSubnetRefs:
Expand Down
7 changes: 4 additions & 3 deletions package/crds/kafka.aws.crossplane.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ spec:
type: boolean
type: object
type: object
clusterName:
description: The name of the cluster.
type: string
configurationInfo:
description: Represents the configuration that you want MSK to
use for the cluster.
Expand Down Expand Up @@ -479,6 +482,7 @@ spec:
description: Create tags when creating the cluster.
type: object
required:
- clusterName
Copy link
Collaborator

Choose a reason for hiding this comment

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

would defaulting this parameter to the object name provide backwards compatibility? Would it make sense?

Copy link
Member Author

Choose a reason for hiding this comment

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

problem is for people using compositions - the cr.name is complete different

- kafkaVersion
- numberOfBrokerNodes
- region
Expand Down Expand Up @@ -663,9 +667,6 @@ spec:
clusterARN:
description: The Amazon Resource Name (ARN) of the cluster.
type: string
clusterName:
description: The name of the MSK cluster.
type: string
state:
description: The state of the cluster. The possible states are
ACTIVE, CREATING, DELETING, FAILED, HEALING, MAINTENANCE, REBOOTING_BROKER,
Expand Down
7 changes: 0 additions & 7 deletions pkg/controller/kafka/cluster/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func SetupCluster(mgr ctrl.Manager, o controller.Options) error {
name := managed.ControllerName(svcapitypes.ClusterGroupKind)
opts := []option{
func(e *external) {
e.preObserve = preObserve
e.postObserve = postObserve
e.preDelete = preDelete
e.postDelete = postDelete
Expand Down Expand Up @@ -84,11 +83,6 @@ func postDelete(_ context.Context, cr *svcapitypes.Cluster, obj *svcsdk.DeleteCl
return err
}

func preObserve(_ context.Context, cr *svcapitypes.Cluster, obj *svcsdk.DescribeClusterInput) error {
obj.ClusterArn = awsclients.String(meta.GetExternalName(cr))
return nil
}

func postObserve(_ context.Context, cr *svcapitypes.Cluster, obj *svcsdk.DescribeClusterOutput, obs managed.ExternalObservation, err error) (managed.ExternalObservation, error) {
if err != nil {
return managed.ExternalObservation{}, err
Expand Down Expand Up @@ -118,7 +112,6 @@ func postObserve(_ context.Context, cr *svcapitypes.Cluster, obj *svcsdk.Describ
}

func preCreate(_ context.Context, cr *svcapitypes.Cluster, obj *svcsdk.CreateClusterInput) error {
obj.ClusterName = awsclients.String(meta.GetExternalName(cr))
obj.BrokerNodeGroupInfo = &svcsdk.BrokerNodeGroupInfo{
ClientSubnets: cr.Spec.ForProvider.CustomBrokerNodeGroupInfo.ClientSubnets,
InstanceType: cr.Spec.ForProvider.CustomBrokerNodeGroupInfo.InstanceType,
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/kafka/cluster/zz_controller.go

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

91 changes: 47 additions & 44 deletions pkg/controller/kafka/cluster/zz_conversions.go

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