Skip to content

Commit

Permalink
Support []string and map[string]string secret properties (Azure#3744)
Browse files Browse the repository at this point in the history
This resolves Azure#3435.

[]string is transformed into []genruntime.SecretReference.

map[string]string is transformed into a new type
genruntime.SecretCollectionReference. Unlike genruntime.SecretReference,
SecretCollectionReference refers to an entire secret rather than only
some parts of it. This is required to keep the keys of the map secret
too. It also presents a slightly cleaner user interface than
map[string]genruntime.SecretReference would have.
  • Loading branch information
matthchr authored Jan 31, 2024
1 parent ae0d185 commit 27e6a82
Show file tree
Hide file tree
Showing 33 changed files with 852 additions and 71 deletions.

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

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

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

4 changes: 2 additions & 2 deletions v2/api/containerinstance/v1api20211001/structure.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ github.com/Azure/azure-service-operator/v2/api/containerinstance/v1api20211001
│ │ │ │ └── "ContainerInstanceLogs"
│ │ │ ├── Metadata: map[string]string
│ │ │ ├── WorkspaceId: *string
│ │ │ ├── WorkspaceKey: genruntime.SecretReference
│ │ │ ├── WorkspaceKey: *genruntime.SecretReference
│ │ │ └── WorkspaceResourceReference: *genruntime.ResourceReference
│ │ ├── DnsConfig: *Object (3 properties)
│ │ │ ├── NameServers: string[]
Expand Down Expand Up @@ -687,7 +687,7 @@ github.com/Azure/azure-service-operator/v2/api/containerinstance/v1api20211001
│ │ │ └── "ContainerInstanceLogs"
│ │ ├── Metadata: map[string]string
│ │ ├── WorkspaceId: *string
│ │ ├── WorkspaceKey: string
│ │ ├── WorkspaceKey: *string
│ │ └── WorkspaceResourceId: *string
│ ├── DnsConfig: *Object (3 properties)
│ │ ├── NameServers: string[]
Expand Down
11 changes: 10 additions & 1 deletion v2/api/containerinstance/v1api20211001/zz_generated.deepcopy.go

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

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

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

26 changes: 17 additions & 9 deletions v2/api/dbformariadb/v1api20180601/server_types_gen.go

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

4 changes: 2 additions & 2 deletions v2/api/dbformariadb/v1api20180601/structure.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ github.com/Azure/azure-service-operator/v2/api/dbformariadb/v1api20180601
│ │ ├── Properties: *Object (4 properties)
│ │ │ ├── Default: *Object (8 properties)
│ │ │ │ ├── AdministratorLogin: *string
│ │ │ │ ├── AdministratorLoginPassword: genruntime.SecretReference
│ │ │ │ ├── AdministratorLoginPassword: *genruntime.SecretReference
│ │ │ │ ├── CreateMode: *Enum (1 value)
│ │ │ │ │ └── "Default"
│ │ │ │ ├── MinimalTlsVersion: *Enum (4 values)
Expand Down Expand Up @@ -309,7 +309,7 @@ github.com/Azure/azure-service-operator/v2/api/dbformariadb/v1api20180601
│ ├── Properties: *Object (4 properties)
│ │ ├── Default: *Object (8 properties)
│ │ │ ├── AdministratorLogin: *string
│ │ │ ├── AdministratorLoginPassword: string
│ │ │ ├── AdministratorLoginPassword: *string
│ │ │ ├── CreateMode: Enum (1 value)
│ │ │ │ └── "Default"
│ │ │ ├── MinimalTlsVersion: *Enum (4 values)
Expand Down
11 changes: 10 additions & 1 deletion v2/api/dbformariadb/v1api20180601/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion v2/api/devices/v1api20210702/iot_hub_spec_arm_types_gen.go

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

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

26 changes: 17 additions & 9 deletions v2/api/devices/v1api20210702/iot_hub_types_gen.go

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

4 changes: 2 additions & 2 deletions v2/api/devices/v1api20210702/structure.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ github.com/Azure/azure-service-operator/v2/api/devices/v1api20210702
│ │ │ ├── AuthenticationType: *Enum (2 values)
│ │ │ │ ├── "identityBased"
│ │ │ │ └── "keyBased"
│ │ │ ├── ConnectionString: genruntime.SecretReference
│ │ │ ├── ConnectionString: *genruntime.SecretReference
│ │ │ ├── ContainerName: *string
│ │ │ ├── Identity: *Object (1 property)
│ │ │ │ └── UserAssignedIdentity: *string
Expand Down Expand Up @@ -803,7 +803,7 @@ github.com/Azure/azure-service-operator/v2/api/devices/v1api20210702
│ ├── AuthenticationType: *Enum (2 values)
│ │ ├── "identityBased"
│ │ └── "keyBased"
│ ├── ConnectionString: string
│ ├── ConnectionString: *string
│ ├── ContainerName: *string
│ ├── Identity: *Object (1 property)
│ │ └── UserAssignedIdentity: *string
Expand Down
11 changes: 10 additions & 1 deletion v2/api/devices/v1api20210702/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion v2/internal/controllers/crd_mariadb_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func Test_MariaDB_Server_CRUD(t *testing.T) {
Properties: &mariadb.ServerPropertiesForCreate{
Default: &mariadb.ServerPropertiesForDefaultCreate{
AdministratorLogin: to.Ptr(adminUser),
AdministratorLoginPassword: adminPasswordRef,
AdministratorLoginPassword: &adminPasswordRef,
CreateMode: &createMode,
PublicNetworkAccess: &networkAccess,
StorageProfile: &mariadb.StorageProfile{
Expand Down
5 changes: 5 additions & 0 deletions v2/internal/reflecthelpers/reflect_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ func FindSecretReferences(obj interface{}) (set.Set[genruntime.SecretReference],
return Find[genruntime.SecretReference](obj)
}

// FindSecretMaps finds all the genruntime.SecretMapReference's on the provided object
func FindSecretMaps(obj interface{}) (set.Set[genruntime.SecretMapReference], error) {
return Find[genruntime.SecretMapReference](obj)
}

// FindConfigMapReferences finds all the genruntime.ConfigMapReference's on the provided object
func FindConfigMapReferences(obj interface{}) (set.Set[genruntime.ConfigMapReference], error) {
return Find[genruntime.ConfigMapReference](obj)
Expand Down
Loading

0 comments on commit 27e6a82

Please sign in to comment.