Skip to content

Commit b553787

Browse files
Copilotmatthchr
andauthored
Add secret export support to TopicAuthorizationRule (#5039)
* Initial plan * Add secret export support to TopicAuthorizationRule - Added $azureGeneratedSecrets config in azure-arm.yaml - Ran code generator to create Secrets field in TopicAuthorizationRuleOperatorSpec - Implemented KubernetesSecretExporter interface in topic_authorization_rule_extensions.go - Added unit test for secret specification logic Co-authored-by: matthchr <[email protected]> * Fix kustomize format and complete implementation - Fixed kustomize configuration format compatibility - Verified controller builds successfully - All custom tests passing Co-authored-by: matthchr <[email protected]> * Add secret export test for TopicAuthorizationRule Updated ServiceBus_Topic_AuthorizationRule_v1api20240101_CRUD test to: - Add OperatorSpec with Secrets configuration for all four secret types - Patch the resource to trigger secret export - Assert that secrets are correctly written with all expected keys Co-authored-by: matthchr <[email protected]> * Add comment to secret test --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: matthchr <[email protected]> Co-authored-by: Matthew Christopher <[email protected]>
1 parent 5c9c8e6 commit b553787

28 files changed

+1220
-316
lines changed

v2/api/apimanagement/customizations/subscription_extensions_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ func Test_SecretsSpecified_AllSecretsSpecifiedAllSecretsReturned(t *testing.T) {
3232
}
3333
secretNames := secretsSpecified(obj)
3434
expectedTags := reflecthelpers.GetJSONTags(reflect.TypeOf(apimanagement.SubscriptionOperatorSecrets{}))
35+
// We expect every property in the secrets struct to be considered a secret except for the $propertyBag one
36+
// (that property exists because this is the storage version)
3537
expectedTags.Remove("$propertyBag")
3638

3739
g.Expect(expectedTags).To(Equal(secretNames))

v2/api/appconfiguration/customizations/configuration_store_extensions_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ func Test_SecretsSpecified_AllSecretsSpecifiedAllSecretsReturned(t *testing.T) {
3232
}
3333
secretNames := secretsSpecified(obj)
3434
expectedTags := reflecthelpers.GetJSONTags(reflect.TypeOf(appconfiguration.ConfigurationStoreOperatorSecrets{}))
35+
// We expect every property in the secrets struct to be considered a secret except for the $propertyBag one
36+
// (that property exists because this is the storage version)
3537
expectedTags.Remove("$propertyBag")
3638

3739
g.Expect(expectedTags).To(Equal(secretNames))

v2/api/containerservice/customizations/managed_cluster_extensions_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ func Test_SecretsSpecified_AllSecretsSpecifiedAllSecretsReturned(t *testing.T) {
3232
}
3333
secretNames := secretsSpecified(obj)
3434
expectedTags := reflecthelpers.GetJSONTags(reflect.TypeOf(containerservice.ManagedClusterOperatorSecrets{}))
35+
// We expect every property in the secrets struct to be considered a secret except for the $propertyBag one
36+
// (that property exists because this is the storage version)
3537
expectedTags.Remove("$propertyBag")
3638

3739
g.Expect(expectedTags).To(Equal(secretNames))

v2/api/devices/customizations/iot_hub_extensions_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ func Test_SecretsSpecified_AllSecretsSpecifiedAllSecretsReturned(t *testing.T) {
3232
}
3333
secretNames := secretsSpecified(obj)
3434
expectedTags := reflecthelpers.GetJSONTags(reflect.TypeOf(devices.IotHubOperatorSecrets{}))
35+
// We expect every property in the secrets struct to be considered a secret except for the $propertyBag one
36+
// (that property exists because this is the storage version)
3537
expectedTags.Remove("$propertyBag")
3638

3739
g.Expect(expectedTags).To(Equal(secretNames))

v2/api/documentdb/customizations/database_account_extensions_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ func Test_SecretsSpecified_AllSecretsSpecifiedAllSecretsReturned(t *testing.T) {
3232
}
3333
secretNames, _ := secretsSpecified(acct)
3434
expectedTags := reflecthelpers.GetJSONTags(reflect.TypeOf(documentdb.DatabaseAccountOperatorSecrets{}))
35+
// We expect every property in the secrets struct to be considered a secret except for the $propertyBag one
36+
// (that property exists because this is the storage version)
3537
expectedTags.Remove("$propertyBag")
3638
expectedTags.Remove("documentEndpoint")
3739

v2/api/eventgrid/customizations/topic_extension_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ func Test_SecretsSpecified_AllSecretsSpecifiedAllSecretsReturned(t *testing.T) {
3232
}
3333
secretNames := secretsSpecified(obj)
3434
expectedTags := reflecthelpers.GetJSONTags(reflect.TypeOf(eventgrid.TopicOperatorSecrets{}))
35+
// We expect every property in the secrets struct to be considered a secret except for the $propertyBag one
36+
// (that property exists because this is the storage version)
3537
expectedTags.Remove("$propertyBag")
3638

3739
g.Expect(expectedTags).To(Equal(secretNames))

v2/api/eventhub/customizations/namespace_extension_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ func Test_NamespaceSecretsSpecified_AllSecretsSpecifiedAllSecretsReturned(t *tes
3434
// If this doesn't compile, check that the version of eventhub imported is the hub version
3535
secretNames := namespaceSecretsSpecified(obj)
3636
expectedTags := reflecthelpers.GetJSONTags(reflect.TypeOf(eventhub.NamespaceOperatorSecrets{}))
37+
// We expect every property in the secrets struct to be considered a secret except for the $propertyBag one
38+
// (that property exists because this is the storage version)
3739
expectedTags.Remove("$propertyBag")
3840

3941
g.Expect(expectedTags).To(Equal(secretNames))

v2/api/eventhub/customizations/namespaces_authorization_rule_extension_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ func Test_NamespaceAuthorizationRuleSecretsSpecified_AllSecretsSpecifiedAllSecre
3434
// If this doesn't compile, check that the version of eventhub imported is the hub version
3535
secretNames := namespacesAuthorizationRuleSecretsSpecified(obj)
3636
expectedTags := reflecthelpers.GetJSONTags(reflect.TypeOf(eventhub.NamespacesAuthorizationRuleOperatorSecrets{}))
37+
// We expect every property in the secrets struct to be considered a secret except for the $propertyBag one
38+
// (that property exists because this is the storage version)
3739
expectedTags.Remove("$propertyBag")
3840

3941
g.Expect(expectedTags).To(Equal(secretNames))

v2/api/eventhub/customizations/namespaces_eventhubs_authorization_rule_extension_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ func Test_NamespaceEventHubsAuthorizationRuleSecretsSpecified_AllSecretsSpecifie
3434
// If this doesn't compile, check that the version of eventhub imported is the hub version
3535
secretNames := namespacesEventHubAuthorizationRuleSecretsSpecified(obj)
3636
expectedTags := reflecthelpers.GetJSONTags(reflect.TypeOf(eventhub.NamespacesEventhubsAuthorizationRuleOperatorSecrets{}))
37+
// We expect every property in the secrets struct to be considered a secret except for the $propertyBag one
38+
// (that property exists because this is the storage version)
3739
expectedTags.Remove("$propertyBag")
3840

3941
g.Expect(expectedTags).To(Equal(secretNames))

v2/api/machinelearningservices/customizations/workspace_extension_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ func Test_SecretsSpecified_AllSecretsSpecifiedAllSecretsReturned(t *testing.T) {
3232
}
3333
secretNames := secretsSpecified(obj)
3434
expectedTags := reflecthelpers.GetJSONTags(reflect.TypeOf(machinelearning.WorkspaceOperatorSecrets{}))
35+
// We expect every property in the secrets struct to be considered a secret except for the $propertyBag one
36+
// (that property exists because this is the storage version)
3537
expectedTags.Remove("$propertyBag")
3638

3739
g.Expect(expectedTags).To(Equal(secretNames))

0 commit comments

Comments
 (0)