Skip to content

Commit

Permalink
Merge pull request #2132 from Infisical/daniel/operator-azure-fix
Browse files Browse the repository at this point in the history
feat(k8-operator): customizable azure auth resource url
  • Loading branch information
DanielHougaard authored Jul 16, 2024
2 parents 9b0b14b + 6ceeccf commit df3a87f
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 74 deletions.
1 change: 1 addition & 0 deletions docs/integrations/platforms/kubernetes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ spec:
# Azure Auth
azureAuth:
identityId: <your-machine-identity-id>
resource: https://management.azure.com/&client_id=CLIENT_ID # (Optional) This is the Azure resource that you want to access. For example, "https://management.azure.com/". If no value is provided, it will default to "https://management.azure.com/"

# secretsScope is identical to the secrets scope in the universalAuth field in this sample.
secretsScope:
Expand Down
4 changes: 2 additions & 2 deletions helm-charts/secrets-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v0.6.4
version: v0.6.5
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v0.6.4"
appVersion: "v0.6.5"
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ spec:
properties:
identityId:
type: string
resource:
type: string
secretsScope:
properties:
envSlug:
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/secrets-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ controllerManager:
- ALL
image:
repository: infisical/kubernetes-operator
tag: v0.6.4
tag: v0.6.5
resources:
limits:
cpu: 500m
Expand Down
2 changes: 2 additions & 0 deletions k8-operator/api/v1alpha1/infisicalsecret_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ type AWSIamAuthDetails struct {
type AzureAuthDetails struct {
// +kubebuilder:validation:Required
IdentityID string `json:"identityId"`
// +kubebuilder:validation:Optional
Resource string `json:"resource"`

// +kubebuilder:validation:Required
SecretsScope MachineIdentityScopeInWorkspace `json:"secretsScope"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ spec:
properties:
identityId:
type: string
resource:
type: string
secretsScope:
properties:
envSlug:
Expand Down
1 change: 1 addition & 0 deletions k8-operator/config/samples/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ spec:
# Azure Auth
azureAuth:
identityId: <your-machine-identity-id>
resource: https://management.azure.com/&client_id=your_client_id # This field is optional, and will default to "https://management.azure.com/" if nothing is provided.

# secretsScope is identical to the secrets scope in the universalAuth field in this sample.
secretsScope:
Expand Down
2 changes: 1 addition & 1 deletion k8-operator/controllers/infisicalsecret_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (r *InfisicalSecretReconciler) handleAzureAuth(ctx context.Context, infisic
return AuthenticationDetails{}, ErrAuthNotApplicable
}

_, err := infisicalClient.Auth().AzureAuthLogin(azureAuthSpec.IdentityID)
_, err := infisicalClient.Auth().AzureAuthLogin(azureAuthSpec.IdentityID, azureAuthSpec.Resource) // If resource is empty(""), it will default to "https://management.azure.com/" in the SDK.
if err != nil {
return AuthenticationDetails{}, fmt.Errorf("unable to login with Azure auth [err=%s]", err)
}
Expand Down
2 changes: 1 addition & 1 deletion k8-operator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/Infisical/infisical/k8-operator
go 1.21

require (
github.com/infisical/go-sdk v0.2.1
github.com/infisical/go-sdk v0.3.2
github.com/onsi/ginkgo/v2 v2.6.0
github.com/onsi/gomega v1.24.1
k8s.io/apimachinery v0.26.1
Expand Down
71 changes: 2 additions & 69 deletions k8-operator/go.sum

Large diffs are not rendered by default.

0 comments on commit df3a87f

Please sign in to comment.