-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use new SDK with proper errors for service bus with pod identity (…
…#4030) Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>
- Loading branch information
Showing
31 changed files
with
1,144 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package azure | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/Azure/azure-sdk-for-go/sdk/azcore" | ||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity" | ||
) | ||
|
||
func NewChainedCredential(identityID string) (*azidentity.ChainedTokenCredential, error) { | ||
var creds []azcore.TokenCredential | ||
|
||
// Used for local debug based on az-cli user | ||
// As production images don't have shell, we can't register this provider always | ||
if _, err := os.Stat("/bin/sh"); err == nil { | ||
cliCred, err := azidentity.NewAzureCLICredential(&azidentity.AzureCLICredentialOptions{}) | ||
if err == nil { | ||
creds = append(creds, cliCred) | ||
} | ||
} | ||
|
||
// Used for aad-pod-identity | ||
msiCred, err := ManagedIdentityWrapperCredential(identityID) | ||
if err == nil { | ||
creds = append(creds, msiCred) | ||
} | ||
|
||
wiCred, err := NewADWorkloadIdentityCredential(identityID) | ||
if err == nil { | ||
creds = append(creds, wiCred) | ||
} | ||
|
||
// Create the chained credential based on the previous 3 | ||
return azidentity.NewChainedTokenCredential(creds, nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.