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

fix: account matching issue in account search #3082

Merged
merged 1 commit into from
Jan 9, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions pkg/provider/azure_storageaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ func (az *Cloud) getStorageAccounts(ctx context.Context, accountOptions *Account
isTaggedWithSkip(acct) &&
isHnsPropertyEqual(acct, accountOptions) &&
isEnableNfsV3PropertyEqual(acct, accountOptions) &&
isAllowBlobPublicAccessEqual(acct, accountOptions) &&
isRequireInfrastructureEncryptionEqual(acct, accountOptions) &&
isAllowSharedKeyAccessEqual(acct, accountOptions) &&
isPrivateEndpointAsExpected(acct, accountOptions)) {
continue
}
Expand Down Expand Up @@ -627,10 +630,16 @@ func isTagsEqual(account storage.Account, accountOptions *AccountOptions) bool {
}

func isHnsPropertyEqual(account storage.Account, accountOptions *AccountOptions) bool {
if accountOptions.IsHnsEnabled == nil {
return true
}
return pointer.BoolDeref(account.IsHnsEnabled, false) == pointer.BoolDeref(accountOptions.IsHnsEnabled, false)
}

func isEnableNfsV3PropertyEqual(account storage.Account, accountOptions *AccountOptions) bool {
if accountOptions.EnableNfsV3 == nil {
return true
}
return pointer.BoolDeref(account.EnableNfsV3, false) == pointer.BoolDeref(accountOptions.EnableNfsV3, false)
}

Expand All @@ -643,3 +652,27 @@ func isPrivateEndpointAsExpected(account storage.Account, accountOptions *Accoun
}
return false
}

func isAllowBlobPublicAccessEqual(account storage.Account, accountOptions *AccountOptions) bool {
if accountOptions.AllowBlobPublicAccess == nil {
return true
}
return pointer.BoolDeref(account.AllowBlobPublicAccess, false) == pointer.BoolDeref(accountOptions.AllowBlobPublicAccess, false)
}

func isRequireInfrastructureEncryptionEqual(account storage.Account, accountOptions *AccountOptions) bool {
if accountOptions.RequireInfrastructureEncryption == nil {
return true
}
if *accountOptions.RequireInfrastructureEncryption {
return account.Encryption != nil && pointer.BoolDeref(account.Encryption.RequireInfrastructureEncryption, false)
}
return account.Encryption == nil || !pointer.BoolDeref(account.Encryption.RequireInfrastructureEncryption, false)
}

func isAllowSharedKeyAccessEqual(account storage.Account, accountOptions *AccountOptions) bool {
if accountOptions.AllowSharedKeyAccess == nil {
return true
}
return pointer.BoolDeref(account.AllowSharedKeyAccess, false) == pointer.BoolDeref(accountOptions.AllowSharedKeyAccess, false)
}