Skip to content

Commit

Permalink
Add azure IAM code samples
Browse files Browse the repository at this point in the history
  • Loading branch information
amitlicht committed Mar 7, 2024
1 parent bfe6bf7 commit e59ad19
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
33 changes: 33 additions & 0 deletions static/code-examples/azure-iam-aks/client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: v1
kind: Namespace
metadata:
name: otterize-tutorial-azure-iam
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: client
namespace: otterize-tutorial-azure-iam
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: client
namespace: otterize-tutorial-azure-iam
spec:
selector:
matchLabels:
app: client
template:
metadata:
labels:
app: client
azure.workload.identity/use: "true"
credentials-operator.otterize.com/create-azure-role-assignment: "true"
spec:
serviceAccountName: client
containers:
- name: client
image: mcr.microsoft.com/azure-cli
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do az login --federated-token \"$(cat $AZURE_FEDERATED_TOKEN_FILE)\" --service-principal -u $AZURE_CLIENT_ID -t $AZURE_TENANT_ID; az storage blob list --container test --account-name amitlichttest --auth-mode login; sleep 1; echo 'Client - The time is:'; curl -v --silent google.com 2>&1 | grep 'Date:'; sleep 2; done" ]
13 changes: 13 additions & 0 deletions static/code-examples/azure-iam-aks/clientintents.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: k8s.otterize.com/v1alpha3
kind: ClientIntents
metadata:
name: client
namespace: otterize-tutorial-azure-iam
spec:
service:
name: client
calls:
- name: "/subscriptions/ef54c90c-5351-4c8f-a126-16a6d789104f/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/amitlichttest/blobServices/default/containers/test"
type: azure
azureRoles: # pre-existing (preset or custom) role by name
- "Storage Blob Data Contributor"

0 comments on commit e59ad19

Please sign in to comment.