Skip to content

Commit

Permalink
Merge pull request #877 from spanio/matt/kafka-configuration-ref-4.67
Browse files Browse the repository at this point in the history
Add reference for Configuration to kafka cluster
  • Loading branch information
turkenf authored Sep 22, 2023
2 parents eefeab9 + 84ce0b3 commit 1228da6
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 28 deletions.
15 changes: 11 additions & 4 deletions apis/kafka/v1beta1/zz_cluster_types.go

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

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

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

18 changes: 18 additions & 0 deletions apis/kafka/v1beta1/zz_generated.resolvers.go

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

4 changes: 4 additions & 0 deletions config/kafka/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ func Configure(p *config.Provider) {
r.References["broker_node_group_info.security_groups"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/ec2/v1beta1.SecurityGroup",
}
r.References["configuration_info.arn"] = config.Reference{
Type: "Configuration",
Extractor: common.PathARNExtractor,
}
r.UseAsync = true
})
}
56 changes: 41 additions & 15 deletions examples/kafka/cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: kafka.aws.upbound.io/v1beta1
kind: Cluster
metadata:
annotations:
uptest.upbound.io/timeout: "7200"
labels:
testing.upbound.io/example-name: example
name: example
Expand All @@ -10,13 +12,18 @@ spec:
- clientSubnetsRefs:
- name: subnet-az1
- name: subnet-az2
instanceType: kafka.m5.large
instanceType: kafka.t3.small
securityGroupsRefs:
- name: sg
storageInfo:
- ebsStorageInfo:
- volumeSize: 1000
clusterName: example
configurationInfo:
- arnSelector:
matchLabels:
testing.upbound.io/example-name: example
revision: 1
encryptionInfo:
- encryptionAtRestKmsKeyArnSelector:
matchLabels:
Expand All @@ -36,12 +43,30 @@ spec:
- enabledInBroker: true
nodeExporter:
- enabledInBroker: true
region: us-west-1
region: us-east-2
tags:
foo: bar

---

apiVersion: kafka.aws.upbound.io/v1beta1
kind: Configuration
metadata:
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
kafkaVersions:
- 2.6.0
name: example
region: us-east-2
serverProperties: |
auto.create.topics.enable = true
delete.topic.enable = true
---

apiVersion: iam.aws.upbound.io/v1beta1
kind: Role
metadata:
Expand Down Expand Up @@ -72,18 +97,19 @@ kind: DeliveryStream
metadata:
labels:
testing.upbound.io/example-name: test_stream
name: test-stream
name: example
spec:
forProvider:
destination: s3
region: us-west-1
s3Configuration:
destination: extended_s3
region: us-east-2
extendedS3Configuration:
- bucketArnSelector:
matchLabels:
testing.upbound.io/example-name: bucket
roleArnSelector:
matchLabels:
testing.upbound.io/example-name: firehose_role
name: example
tags:
LogDeliveryEnabled: placeholder

Expand All @@ -98,7 +124,7 @@ metadata:
spec:
forProvider:
description: example
region: us-west-1
region: us-east-2

---

Expand All @@ -110,7 +136,7 @@ metadata:
name: ${Rand.RFC1123Subdomain}
spec:
forProvider:
region: us-west-1
region: us-east-2

---

Expand All @@ -122,7 +148,7 @@ metadata:
name: sg
spec:
forProvider:
region: us-west-1
region: us-east-2
vpcIdSelector:
matchLabels:
testing.upbound.io/example-name: vpc
Expand All @@ -135,9 +161,9 @@ metadata:
name: subnet-az1
spec:
forProvider:
availabilityZone: us-west-1b
availabilityZone: us-east-2a
cidrBlock: 192.168.0.0/24
region: us-west-1
region: us-east-2
vpcIdSelector:
matchLabels:
testing.upbound.io/example-name: vpc
Expand All @@ -150,9 +176,9 @@ metadata:
name: subnet-az2
spec:
forProvider:
availabilityZone: us-west-1c
availabilityZone: us-east-2b
cidrBlock: 192.168.1.0/24
region: us-west-1
region: us-east-2
vpcIdSelector:
matchLabels:
testing.upbound.io/example-name: vpc
Expand All @@ -168,7 +194,7 @@ metadata:
spec:
forProvider:
cidrBlock: 192.168.0.0/22
region: us-west-1
region: us-east-2

---

Expand All @@ -178,7 +204,7 @@ metadata:
name: test
spec:
forProvider:
region: us-west-1
region: us-east-2
tags:
Application: serviceA
Environment: production
80 changes: 76 additions & 4 deletions package/crds/kafka.aws.upbound.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,82 @@ spec:
description: Amazon Resource Name (ARN) of the MSK Configuration
to use in the cluster.
type: string
arnRef:
description: Reference to a Configuration to populate arn.
properties:
name:
description: Name of the referenced object.
type: string
policy:
description: Policies for referencing.
properties:
resolution:
default: Required
description: Resolution specifies whether resolution
of this reference is required. The default is
'Required', which means the reconcile will fail
if the reference cannot be resolved. 'Optional'
means this reference will be a no-op if it cannot
be resolved.
enum:
- Required
- Optional
type: string
resolve:
description: Resolve specifies when this reference
should be resolved. The default is 'IfNotPresent',
which will attempt to resolve the reference only
when the corresponding field is not present. Use
'Always' to resolve the reference on every reconcile.
enum:
- Always
- IfNotPresent
type: string
type: object
required:
- name
type: object
arnSelector:
description: Selector for a Configuration to populate arn.
properties:
matchControllerRef:
description: MatchControllerRef ensures an object with
the same controller reference as the selecting object
is selected.
type: boolean
matchLabels:
additionalProperties:
type: string
description: MatchLabels ensures an object with matching
labels is selected.
type: object
policy:
description: Policies for selection.
properties:
resolution:
default: Required
description: Resolution specifies whether resolution
of this reference is required. The default is
'Required', which means the reconcile will fail
if the reference cannot be resolved. 'Optional'
means this reference will be a no-op if it cannot
be resolved.
enum:
- Required
- Optional
type: string
resolve:
description: Resolve specifies when this reference
should be resolved. The default is 'IfNotPresent',
which will attempt to resolve the reference only
when the corresponding field is not present. Use
'Always' to resolve the reference on every reconcile.
enum:
- Always
- IfNotPresent
type: string
type: object
type: object
revision:
description: Revision of the MSK Configuration to use in
the cluster.
Expand Down Expand Up @@ -1003,10 +1079,6 @@ spec:
to attach to Kafka brokers. See below.
items:
properties:
arn:
description: Amazon Resource Name (ARN) of the MSK Configuration
to use in the cluster.
type: string
revision:
description: Revision of the MSK Configuration to use in
the cluster.
Expand Down

0 comments on commit 1228da6

Please sign in to comment.