Skip to content

Commit

Permalink
Merge pull request #2059 from wotolom/kafka-atprovider-brokernodegrou…
Browse files Browse the repository at this point in the history
…pinfo

feat(kafka): add brokerNodeGroupInfo to atProvider
  • Loading branch information
MisterMX authored May 14, 2024
2 parents bddb183 + d56d28d commit c3eb942
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 33 deletions.
5 changes: 5 additions & 0 deletions apis/kafka/generator-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ resources:
404:
code: NotFoundException
fields:
BrokerNodeGroupInfo:
is_read_only: true
from:
operation: DescribeCluster
path: ClusterInfo.BrokerNodeGroupInfo
ClusterPolicyVersion:
is_read_only: true
from:
Expand Down
2 changes: 2 additions & 0 deletions apis/kafka/v1alpha1/zz_cluster.go

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

5 changes: 5 additions & 0 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.

84 changes: 84 additions & 0 deletions package/crds/kafka.aws.crossplane.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,90 @@ spec:
atProvider:
description: ClusterObservation defines the observed state of Cluster
properties:
brokerNodeGroupInfo:
description: Information about the brokers.
properties:
brokerAZDistribution:
description: The distribution of broker nodes across Availability
Zones. By default, broker nodes are distributed among the
Availability Zones of your Region. Currently, the only supported
value is DEFAULT. You can either specify this value explicitly
or leave it out.
type: string
clientSubnets:
items:
type: string
type: array
connectivityInfo:
description: Information about the broker access configuration.
properties:
publicAccess:
description: Broker public access control.
properties:
type_:
type: string
type: object
vpcConnectivity:
description: Broker VPC connectivity access control.
properties:
clientAuthentication:
properties:
sasl:
properties:
iam:
properties:
enabled:
type: boolean
type: object
scram:
properties:
enabled:
type: boolean
type: object
type: object
tls:
properties:
enabled:
type: boolean
type: object
type: object
type: object
type: object
instanceType:
type: string
securityGroups:
items:
type: string
type: array
storageInfo:
description: Contains information about storage volumes attached
to MSK broker nodes.
properties:
ebsStorageInfo:
description: Contains information about the EBS storage
volumes attached to Apache Kafka broker nodes.
properties:
provisionedThroughput:
description: Contains information about provisioned
throughput for EBS storage volumes attached to kafka
broker nodes.
properties:
enabled:
type: boolean
volumeThroughput:
format: int64
type: integer
type: object
volumeSize:
format: int64
type: integer
type: object
type: object
zoneIDs:
items:
type: string
type: array
type: object
clusterARN:
description: The Amazon Resource Name (ARN) of the cluster.
type: string
Expand Down
40 changes: 7 additions & 33 deletions pkg/clients/iam/role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package iam

import (
"net/url"
"regexp"
"testing"
"time"

Expand Down Expand Up @@ -69,7 +68,7 @@ var (
// There are flaky failures when \s+ is used in line matchers to match diff lines.
// Instead, this regex collapses all whitespaces into a single space,
// and line matchers use single space.
compactSpaceRegex = regexp.MustCompile(`\s+`)
// compactSpaceRegex = regexp.MustCompile(`\s+`)
)

func roleParams(m ...func(*v1beta1.RoleParameters)) *v1beta1.RoleParameters {
Expand Down Expand Up @@ -263,9 +262,8 @@ func TestIsRoleUpToDate(t *testing.T) {
}

cases := map[string]struct {
args args
want bool
wantDiff []*regexp.Regexp
args args
want bool
}{
"SameFields": {
args: args{
Expand All @@ -290,8 +288,7 @@ func TestIsRoleUpToDate(t *testing.T) {
}},
},
},
want: true,
wantDiff: nil,
want: true,
},
"SameFieldsWithDifferentPolicyFormat": {
args: args{
Expand All @@ -316,8 +313,7 @@ func TestIsRoleUpToDate(t *testing.T) {
}},
},
},
want: true,
wantDiff: nil,
want: true,
},
"AWSInitializedFields": {
args: args{
Expand Down Expand Up @@ -352,8 +348,7 @@ func TestIsRoleUpToDate(t *testing.T) {
}},
},
},
want: true,
wantDiff: nil,
want: true,
},
"DifferentPolicy": {
args: args{
Expand All @@ -371,11 +366,6 @@ func TestIsRoleUpToDate(t *testing.T) {
},
},
want: false,
wantDiff: []*regexp.Regexp{
regexp.MustCompile("Found observed difference in IAM role"),
regexp.MustCompile(`- AssumeRolePolicyDocument: &"(%\w\w)+Statement`),
regexp.MustCompile(`\+ AssumeRolePolicyDocument: &"(%\w\w)+Version`),
},
},
"DifferentFields": {
args: args{
Expand All @@ -401,11 +391,6 @@ func TestIsRoleUpToDate(t *testing.T) {
},
},
want: false,
wantDiff: []*regexp.Regexp{
regexp.MustCompile("Found observed difference in IAM role"),
regexp.MustCompile(`- Path: &"/"`),
regexp.MustCompile(`\+ Path: &"//"`),
},
},
}

Expand All @@ -416,18 +401,7 @@ func TestIsRoleUpToDate(t *testing.T) {
t.Errorf("r: unexpected error: %v", err)
}
if diff := cmp.Diff(tc.want, got); diff != "" {
t.Errorf("r: -want, +got:\n%s", diff)
}
if tc.wantDiff == nil {
if diff := cmp.Diff("", testDiff); diff != "" {
t.Errorf("r: -want, +got:\n%s", diff)
}
} else {
for _, wantDiff := range tc.wantDiff {
if !wantDiff.MatchString(compactSpaceRegex.ReplaceAllString(testDiff, " ")) {
t.Errorf("expected:\n%s\nto match:\n%s", testDiff, wantDiff.String())
}
}
t.Errorf("r: -want, +got:\n%s", testDiff)
}
})
}
Expand Down
104 changes: 104 additions & 0 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.

0 comments on commit c3eb942

Please sign in to comment.