-
Notifications
You must be signed in to change notification settings - Fork 35
Add support for Azure Key Vault and updated deps #204
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f213a22
getting ready, rename old vault support, update readme, makefile, etc.
markxnelson 4e832ed
initial impl
markxnelson 90e4ca6
first build
markxnelson 22a6fc4
working on auth
markxnelson dbbd9a1
working
markxnelson 6f8bbb2
udpate readme with auth details
markxnelson 6a3defc
update log message re auth
markxnelson 7c15bcc
update tpl:
markxnelson b4dc047
get username and password from az key vault
markxnelson 4c66512
update godror
markxnelson b7e4301
update toml
markxnelson 38ed114
update prometheus
markxnelson 917aeb4
update oci sdk
markxnelson f73f1a4
update docs to prepare for release
markxnelson 1bfd5bf
update docs to prepare for release
markxnelson e67b5fa
update TPL
markxnelson fb47b18
Merge branch 'main' into 200
markxnelson a793f22
review commetns
markxnelson ff09e29
readme updates
markxnelson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,13 +12,86 @@ Copyright (c) 2016, 2025, Oracle and/or its affiliates. | |
|
||
----------------------------------- Licenses ----------------------------------- | ||
- Apache-2.0 | ||
- BSD-2-Clause | ||
- BSD-3-Clause | ||
- BSD-3-Clause--modified-by-Google | ||
- MIT | ||
- UPL-1.0 | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/Azure/azure-sdk-for-go/sdk/azcore | ||
|
||
== License Type | ||
SPDX:MIT | ||
|
||
== Copyright | ||
Copyright (c) Microsoft Corporation. | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Copyright 2017 Microsoft Corporation. All rights reserved. | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/Azure/azure-sdk-for-go/sdk/azidentity | ||
|
||
== License Type | ||
SPDX:MIT | ||
|
||
== Copyright | ||
Copyright (c) Microsoft Corporation. | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/Azure/azure-sdk-for-go/sdk/internal | ||
|
||
== License Type | ||
SPDX:MIT | ||
|
||
== Copyright | ||
Copyright (c) Microsoft Corporation. | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Copyright 2017 Microsoft Corporation. All rights reserved. | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets | ||
|
||
== License Type | ||
SPDX:MIT | ||
|
||
== Copyright | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal | ||
|
||
== License Type | ||
SPDX:MIT | ||
|
||
== Copyright | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/AzureAD/microsoft-authentication-library-for-go | ||
|
||
== License Type | ||
SPDX:MIT | ||
|
||
== Copyright | ||
Copyright (c) Microsoft Corporation. | ||
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License (the "License"). | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/BurntSushi/toml | ||
|
||
|
@@ -505,6 +578,29 @@ Copyright 2019 Tim Heckman. All rights reserved. Use of this source code is | |
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/golang-jwt/jwt/v5 | ||
|
||
== License Type | ||
SPDX:MIT | ||
|
||
== Copyright | ||
Copyright (c) 2012 Dave Grijalva | ||
Copyright (c) 2021 golang-jwt maintainers | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/google/uuid | ||
|
||
== License Type | ||
SPDX:BSD-3-Clause--modified-by-Google | ||
|
||
== Copyright | ||
Copyright 2023 Google Inc. All rights reserved. | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/jpillora/backoff | ||
|
||
|
@@ -643,6 +739,18 @@ Copyright 2016 The filepathx Authors | |
Copyright 2016-2017 The New York Times Company | ||
Copyright 2021 The Go Authors. All rights reserved. | ||
Copyright 2023 Google LLC | ||
Copyright 2023+ Klaus Post. All rights reserved. | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/kylelemons/godebug | ||
|
||
== License Type | ||
SPDX:Apache-2.0 | ||
|
||
== Copyright | ||
Copyright 2013 Google Inc. All rights reserved. | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
|
@@ -784,7 +892,18 @@ SPDX:Apache-2.0 | |
Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. | ||
|
||
== Notices | ||
Copyright (c) 2016, 2020, Oracle and/or its affiliates. | ||
Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/pkg/browser | ||
|
||
== License Type | ||
SPDX:BSD-2-Clause | ||
|
||
== Copyright | ||
Copyright (c) 2014, Dave Cheney <[email protected]> | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
|
@@ -851,7 +970,7 @@ SPDX:Apache-2.0 | |
|
||
== Copyright | ||
Copyright 2020 The Prometheus-operator Authors | ||
Copyright 2024 The Prometheus Authors | ||
Copyright 2025 The Prometheus Authors | ||
|
||
== Notices | ||
Common libraries shared by Prometheus Go components. | ||
|
@@ -920,6 +1039,17 @@ Copyright 2010 The Go Authors. All rights reserved. | |
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
github.com/youmark/pkcs8 | ||
|
||
== License Type | ||
SPDX:MIT | ||
|
||
== Copyright | ||
Copyright (c) 2014 youmark | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
||
== Dependency | ||
golang.org/x/crypto | ||
|
||
|
@@ -1023,7 +1153,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
|
||
== Copyright | ||
Copyright 2009 The Go Authors. | ||
Copyright 2024 The Go Authors. All rights reserved. | ||
Copyright 2025 The Go Authors. All rights reserved. | ||
|
||
== Patents | ||
Additional IP Rights Grant (Patents) | ||
|
@@ -1197,7 +1327,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
|
||
== Copyright | ||
Copyright 2009 The Go Authors. | ||
Copyright 2024 The Go Authors. All rights reserved. | ||
Copyright 2025 The Go Authors. All rights reserved. | ||
|
||
== Patents | ||
Additional IP Rights Grant (Patents) | ||
|
@@ -1300,7 +1430,7 @@ SPDX:BSD-3-Clause--modified-by-Google | |
|
||
== Copyright | ||
Copyright 2024 Google Inc. All rights reserved. | ||
Copyright 2024 The Go Authors. All rights reserved. | ||
Copyright 2025 The Go Authors. All rights reserved. | ||
|
||
== Patents | ||
Additional IP Rights Grant (Patents) | ||
|
@@ -1357,8 +1487,30 @@ limitations under the License. | |
|
||
----------------------------------- Licenses ----------------------------------- | ||
|
||
--------------------------------- (separator) ---------------------------------- | ||
== SPDX:Apache-2.0 | ||
== SPDX:BSD-2-Clause | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
|
||
|
||
--------------------------------- (separator) ---------------------------------- | ||
|
@@ -1414,5 +1566,5 @@ SOFTWARE. | |
|
||
|
||
=== ATTRIBUTION-HELPER-GENERATED: | ||
=== Attribution helper version: {Major:0 Minor:11 GitVersion:0.10.0-114-g3747dab9 GitCommit:3747dab92eb29c0dbe6409ffbb824b9ae3a04b87 GitTreeState:clean BuildDate:2024-05-31T13:48:06Z GoVersion:go1.21.4 Compiler:gc Platform:linux/amd64} | ||
=== License file based on go.mod with md5 sum: 771c94b3ddce81ff2e234b02d85209e4 | ||
=== Attribution helper version: {Major:0 Minor:11 GitVersion:0.10.0-116-g2a434e4d GitCommit:2a434e4d7eea22d4dfd2d1cf04909239d05562b1 GitTreeState:clean BuildDate:2025-04-17T14:57:55Z GoVersion:go1.23.7 Compiler:gc Platform:linux/amd64} | ||
=== License file based on go.mod with md5 sum: e3aaf1f636118d333ec243eb9788fa19 |
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,50 @@ | ||
// Copyright (c) 2023, 2025, Oracle and/or its affiliates. | ||
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
|
||
package azvault | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os" | ||
"strings" | ||
|
||
"github.com/prometheus/common/promslog" | ||
|
||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity" | ||
"github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets" | ||
) | ||
|
||
func GetVaultSecret(vaultId string, secretName string) string { | ||
promLogConfig := &promslog.Config{} | ||
logger := promslog.New(promLogConfig) | ||
|
||
vaultURI := fmt.Sprintf("https://%s.vault.azure.net/", vaultId) | ||
|
||
// create a credential | ||
cred, err := azidentity.NewDefaultAzureCredential(nil) | ||
if err != nil { | ||
logger.Error("Failed to obtain an Azure Credential", "err", err) | ||
markxnelson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
os.Exit(1) | ||
} | ||
|
||
// establish a connection to the key vault client | ||
client, err := azsecrets.NewClient(vaultURI, cred, nil) | ||
markxnelson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if err != nil { | ||
logger.Error("Failed to create Azure Secrets Client", "err", err) | ||
os.Exit(1) | ||
} | ||
|
||
// get the secret - empty string version means "latest" | ||
version := "" | ||
secret := "" | ||
resp, err := client.GetSecret(context.TODO(), secretName, version, nil) | ||
if err != nil { | ||
logger.Error("Failed to get secret from vault", "err", err) | ||
os.Exit(1) | ||
} else { | ||
secret = *resp.Value | ||
} | ||
|
||
return strings.TrimRight(secret, "\r\n") // make sure a \r and/or \n didn't make it into the secret | ||
markxnelson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does Azure support the equivalent of OCI workload identity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see authentication, right below this, it has links to that info