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

Increased Partition Count Minimum in EventHub to 2 #178

Merged
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
4 changes: 2 additions & 2 deletions api/v1/eventhub_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ type EventhubProperties struct {
// MessageRetentionInDays - Number of days to retain the events for this Event Hub, value should be 1 to 7 days
MessageRetentionInDays int32 `json:"messageRetentionInDays,omitempty"`
// +kubebuilder:validation:Maximum=32
// +kubebuilder:validation:Minimum=1
// PartitionCount - Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions.
// +kubebuilder:validation:Minimum=2
// PartitionCount - Number of partitions created for the Event Hub, allowed values are from 2 to 32 partitions.
PartitionCount int32 `json:"partitionCount,omitempty"`
// CaptureDescription - Details specifying EventHub capture to persistent storage
CaptureDescription CaptureDescription `json:"captureDescription,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion api/v1/eventhub_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var _ = Describe("Eventhub", func() {
ResourceGroup: "foo-resource-group",
Properties: EventhubProperties{
MessageRetentionInDays: 7,
PartitionCount: 1,
PartitionCount: 2,
CaptureDescription: captureDescription,
},
},
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/azure.microsoft.com_eventhubs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,10 @@ spec:
type: integer
partitionCount:
description: PartitionCount - Number of partitions created for the
Event Hub, allowed values are from 1 to 32 partitions.
Event Hub, allowed values are from 2 to 32 partitions.
format: int32
maximum: 32
minimum: 1
minimum: 2
type: integer
type: object
resourceGroup:
Expand Down
98 changes: 49 additions & 49 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rules:
- apiGroups:
- azure.microsoft.com
resources:
- cosmosdbs
- storages
verbs:
- create
- delete
Expand All @@ -18,14 +18,6 @@ rules:
- patch
- update
- watch
- apiGroups:
- azure.microsoft.com
resources:
- eventhubnamespaces/status
verbs:
- get
- patch
- update
- apiGroups:
- azure.microsoft.com
resources:
Expand All @@ -36,7 +28,7 @@ rules:
- apiGroups:
- azure.microsoft.com
resources:
- consumergroups
- cosmosdbs
verbs:
- create
- delete
Expand All @@ -48,15 +40,7 @@ rules:
- apiGroups:
- azure.microsoft.com
resources:
- consumergroups/status
verbs:
- get
- patch
- update
- apiGroups:
- azure.microsoft.com
resources:
- resourcegroups
- eventhubs
verbs:
- create
- delete
Expand All @@ -68,7 +52,7 @@ rules:
- apiGroups:
- azure.microsoft.com
resources:
- storages
- eventhubnamespaces
verbs:
- create
- delete
Expand All @@ -78,9 +62,9 @@ rules:
- update
- watch
- apiGroups:
- ""
- azure.microsoft.com
resources:
- secrets
- rediscaches
verbs:
- create
- delete
Expand All @@ -92,15 +76,15 @@ rules:
- apiGroups:
- azure.microsoft.com
resources:
- eventhubs/status
- rediscaches/status
verbs:
- get
- patch
- update
- apiGroups:
- azure.microsoft.com
resources:
- eventhubnamespaces
- resourcegroups
verbs:
- create
- delete
Expand All @@ -110,44 +94,56 @@ rules:
- update
- watch
- apiGroups:
- azure.microsoft.com
- ""
resources:
- keyvaults
- events
verbs:
- create
- delete
- watch
- apiGroups:
- apps
resources:
- deployments/status
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- azure.microsoft.com
resources:
- rediscaches/status
- consumergroups/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
- azure.microsoft.com
resources:
- events
- cosmosdbs/status
verbs:
- create
- watch
- get
- patch
- update
- apiGroups:
- azure.microsoft.com
resources:
- cosmosdbs/status
- eventhubs/status
verbs:
- get
- patch
- update
- apiGroups:
- azure.microsoft.com
resources:
- eventhubs
- eventhubnamespaces/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- delete
Expand All @@ -157,17 +153,21 @@ rules:
- update
- watch
- apiGroups:
- azure.microsoft.com
- apps
resources:
- keyvaults/status
- deployments
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- azure.microsoft.com
resources:
- rediscaches
- consumergroups
verbs:
- create
- delete
Expand All @@ -179,35 +179,35 @@ rules:
- apiGroups:
- azure.microsoft.com
resources:
- resourcegroups/status
- keyvaults
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- azure.microsoft.com
resources:
- storages/status
- keyvaults/status
verbs:
- get
- patch
- update
- apiGroups:
- apps
- azure.microsoft.com
resources:
- deployments
- resourcegroups/status
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
- azure.microsoft.com
resources:
- deployments/status
- storages/status
verbs:
- get
- patch
Expand Down
2 changes: 1 addition & 1 deletion config/samples/azure_v1_eventhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
namespace: "eventhubnamespace-sample-6"
properties:
messageRetentionInDays: 7
partitionCount: 1
partitionCount: 2
authorizationRule:
name : "RootManageSharedAccessKey"
rights:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/azure_v1_eventhub_capture.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
namespace: "eventhubnamespace-sample-6"
properties:
messageRetentionInDays: 7
partitionCount: 1
partitionCount: 2
captureDescription:
# Note that the storage account and blob container below must already exist
destination:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/azure_v1_resourcegroup.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: azure.microsoft.com/v1
kind: ResourceGroup
metadata:
name: resourcegroup-sample-1908
name: resourcegroup-sample-1907
spec:
location: "westus"
8 changes: 4 additions & 4 deletions controllers/eventhub_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var _ = Describe("EventHub Controller", func() {
ResourceGroup: "t-rg-dev-eh-" + helpers.RandomString(10),
Properties: azurev1.EventhubProperties{
MessageRetentionInDays: 7,
PartitionCount: 1,
PartitionCount: 2,
},
},
}
Expand Down Expand Up @@ -111,7 +111,7 @@ var _ = Describe("EventHub Controller", func() {
ResourceGroup: rgName,
Properties: azurev1.EventhubProperties{
MessageRetentionInDays: 7,
PartitionCount: 1,
PartitionCount: 2,
},
AuthorizationRule: azurev1.EventhubAuthorizationRule{
Name: "RootManageSharedAccessKey",
Expand Down Expand Up @@ -198,7 +198,7 @@ var _ = Describe("EventHub Controller", func() {
ResourceGroup: rgName,
Properties: azurev1.EventhubProperties{
MessageRetentionInDays: 7,
PartitionCount: 1,
PartitionCount: 2,
},
AuthorizationRule: azurev1.EventhubAuthorizationRule{
Name: "RootManageSharedAccessKey",
Expand Down Expand Up @@ -290,7 +290,7 @@ var _ = Describe("EventHub Controller", func() {
ResourceGroup: rgName,
Properties: azurev1.EventhubProperties{
MessageRetentionInDays: 7,
PartitionCount: 1,
PartitionCount: 2,
CaptureDescription: azurev1.CaptureDescription{
Destination: azurev1.Destination{
ArchiveNameFormat: "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}",
Expand Down
2 changes: 1 addition & 1 deletion pkg/resourcemanager/eventhubs/consumergroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var _ = Describe("ConsumerGroup", func() {
namespaceLocation = resourcegroupLocation
eventhubName = "t-eh-dev-ehs-" + helpers.RandomString(10)
messageRetentionInDays = int32(7)
partitionCount = int32(1)
partitionCount = int32(2)

_, _ = CreateNamespaceAndWait(context.Background(), rgName, eventhubNamespaceName, namespaceLocation)
_, _ = CreateHub(context.Background(), rgName, eventhubNamespaceName, eventhubName, messageRetentionInDays, partitionCount, nil)
Expand Down
4 changes: 2 additions & 2 deletions pkg/resourcemanager/eventhubs/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ func CreateHub(ctx context.Context, resourceGroupName string, namespaceName stri
return eventhub.Model{}, fmt.Errorf("MessageRetentionInDays is invalid")
}

// PartitionCount - Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions.
if PartitionCount < 1 || PartitionCount > 32 {
// PartitionCount - Number of partitions created for the Event Hub, allowed values are from 2 to 32 partitions.
if PartitionCount < 2 || PartitionCount > 32 {
return eventhub.Model{}, fmt.Errorf("PartitionCount is invalid")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/resourcemanager/eventhubs/hub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var _ = Describe("Eventhub", func() {

eventhubName := "t-eh-" + helpers.RandomString(10)
messageRetentionInDays := int32(7)
partitionCount := int32(1)
partitionCount := int32(2)

var err error

Expand Down