-
Notifications
You must be signed in to change notification settings - Fork 12
allow creation of pg-stac secrets from azure secret vault, refs #186 #187
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 42 commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
16d83b8
allow creation of pg-stac secrets from azure secret vault, refs #186
batpad 122d7ff
bump version in chart
batpad a0e2a41
add serviceAccount to create azure service account from values
batpad bec9d40
change version in chart yaml
batpad 46da4cb
fix secret order since we need multiple secrets derived from a single…
batpad d38a5e8
bump chart version to 0.5.3-azure-test-3 and add support for Azure AK…
emmanuelmathot d8c2440
refactor deployment templates to properly handle Azure AKS secrets pr…
emmanuelmathot 6e2b57d
bump chart version to 0.5.3-azure-test-4
emmanuelmathot 6d43e78
fix: update template to use correct context for Azure AKS secrets pro…
emmanuelmathot 18a707f
fix: adjust secret reference formatting and add service account confi…
emmanuelmathot 788c163
fix: add volume mounts for Azure AKS secrets provider in deployment t…
emmanuelmathot 752b097
bump chart version to 0.5.3-azure-test-7
emmanuelmathot 497e686
bump chart version to 0.5.3-azure-test-8 and add Azure AKS secrets pr…
emmanuelmathot adb7db8
bump chart version to 0.5.3-azure-test-9 and add Azure workload ident…
emmanuelmathot 30e8b03
bump chart version to 0.5.3-azure-test-10 and add service account con…
emmanuelmathot 103993b
use the service account name from values
geohacker b8414ee
name in the deploy for service account should match values
geohacker e018acb
key names in vault still not working, try replacing _ with -
batpad 6bad923
bump version in Chart.yaml
batpad b6724b3
oops, replace _ with - everywhere
batpad ca25162
bump chart version to azure-test-14
batpad 5986eca
bump chart version to 0.5.3-azure-test-15 and update job.yaml for Azu…
emmanuelmathot 258c428
bump chart version to 0.5.3-azure-test-16 and update job.yaml for con…
emmanuelmathot 7afd2e4
bump chart version to 0.5.3-azure-test-17 and update job.yaml for env…
emmanuelmathot 8f61225
bump chart version to 0.5.3-azure-test-18 and update job.yaml for Pos…
emmanuelmathot 8741207
bump chart version to 0.5.3-azure-test-19 and update job.yaml and con…
emmanuelmathot 7a947c9
bump chart version to 0.5.3-azure-test-20 and update configmap.yaml t…
emmanuelmathot 96f665c
bump chart version to 0.5.3-azure-test-21 and update PGADMIN_URI init…
emmanuelmathot f01823f
bump chart version to 0.5.3-azure-test-21 and update job.yaml and con…
emmanuelmathot 075d382
Merge branch 'feature/azure-secrets' of https://github.com/developmen…
emmanuelmathot 8f67933
update deployment.yaml to allow forwarded IPs in root path configuration
emmanuelmathot fca2f76
Refactor Azure integration: deprecate specific service account config…
emmanuelmathot 2bdc64d
Add support for additional labels, environment variables, and volume …
emmanuelmathot fadfb82
Remove redundant value assignment for KEEP_ALIVE in pgstacbootstrap j…
emmanuelmathot 99725bc
Enable backups in PostgreSQL operator installation
emmanuelmathot 2527aee
Enable backups for PostgreSQL cluster in test configuration
emmanuelmathot 7c1bbe8
Enhance cleanup step to extract and display pod logs for debugging on…
emmanuelmathot 07efaf2
Enhance cleanup step to extract and display logs from PGSTACBootstrap…
emmanuelmathot 54dbbdb
Refactor ServiceAccount name in RBAC configuration to use template fu…
emmanuelmathot b921b18
Refactor endpoint exports in helm-tests workflow for consistency and …
emmanuelmathot 02b73f1
Fix endpoint URLs in helm-tests workflow to include release name for …
emmanuelmathot 64695d0
Enhance error handling in test execution by extracting and displaying…
emmanuelmathot c1c7461
remove azure specifics
emmanuelmathot 8d92172
Update PGO_VERSION to 5.7.0 and remove backupsEnabled comment from te…
emmanuelmathot ca5fe8f
Revert chart version to 0.5.3-azure-test-21 for consistency with appl…
emmanuelmathot 2332237
Update chart version to 0.5.3-azure-test-21 for consistency with appl…
emmanuelmathot 136deb2
Add service account configuration and update values.yaml with ingress…
emmanuelmathot 2cb1dbe
Update database connection wait command to use POSTGRES_HOST variable
emmanuelmathot 3824b07
Add environment variables to wait-for-db init container
emmanuelmathot 62873a3
Enable pgstacBootstrap and update environment variables for database …
emmanuelmathot 14c8f00
Fix wait-for-db command to correctly reference POSTGRES_PORT environm…
emmanuelmathot 434c2d3
Enhance pgstacbootstrap job configuration by adding extra volume moun…
emmanuelmathot 94aeeaf
Refactor pgstacBootstrap to support additional environment variables …
emmanuelmathot 83997cd
Refactor deployment.yaml to correctly reference extraEnvVars in pgsta…
emmanuelmathot 9be81f7
Refactor pgstacBootstrap job configuration to use extraEnvFrom and ex…
emmanuelmathot 0027863
Fix reference to extraEnvFrom in pgstacBootstrap job configuration
emmanuelmathot 0aadc9d
Refactor pgstacBootstrap configuration to add extraEnvFrom, extraVolu…
emmanuelmathot bc7dfad
Fix DUMMY_ENV_VAR value type in deployment.yaml to use string format
emmanuelmathot 8e52252
Refactor PostgreSQL configuration and remove deprecated database setup
emmanuelmathot 637dc91
Add PostgreSQL host reader and writer environment variables, and incl…
emmanuelmathot 9b6b092
Merge remote-tracking branch 'origin/main' into unified_pg
emmanuelmathot 5f45f50
Merge branch 'main' into unified_pg
emmanuelmathot ee41f4b
Added a clarifying comment in values.yaml to explain that values in t…
emmanuelmathot db8fd56
Merge branch 'unified_pg' into feature/azure-secrets
emmanuelmathot 4810aa9
Enhance Azure PostgreSQL setup documentation with detailed setup inst…
emmanuelmathot fb23fa0
Remove unused ingress and values.yaml configurations
emmanuelmathot d941a76
Merge branch 'main' into feature/azure-secrets
emmanuelmathot 360303d
Bump chart version to 0.6.0 for release
emmanuelmathot 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 hidden or 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 hidden or 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,234 @@ | ||
| # Microsoft Azure Setup | ||
|
|
||
| ## Using Azure managed PostgreSQL | ||
| To use Azure managed PostgreSQL with the `eoapi-k8s` chart, you need to set up the following: | ||
| 1. **Create an Azure PostgreSQL server**: You can create a PostgreSQL server using the Azure portal or the Azure CLI. Make sure to note down the server name, username, and password. | ||
| 2. **Create a PostgreSQL database**: After creating the server, create a database that will be used by the `eoapi-k8s` chart. | ||
| 3. **Configure firewall rules**: Ensure that the PostgreSQL server allows connections from your Kubernetes cluster's IP address. You can do this by adding a firewall rule in the Azure portal or using the Azure CLI. | ||
|
|
||
| ## Azure Configuration for eoapi-k8s | ||
|
|
||
| When deploying on Azure, you'll need to configure several settings in your values.yaml file. Below are the configurations needed for proper integration with Azure services. | ||
|
|
||
| ### Common Azure Configuration | ||
|
|
||
| Add the following to your values.yaml: | ||
|
|
||
| ```yaml | ||
| # Main Azure Configuration | ||
| azure: | ||
| aksSecretsProviderAvailable: true # set to true when using Azure Key Vault | ||
| keyvault: | ||
| name: "your-keyvault-name" | ||
| clientId: "your-client-id" | ||
| tenantId: "your-tenant-id" | ||
| # Mapping of name inside Azure Vault to name inside k8s secret object | ||
| secretKeys: | ||
| pgpassword: POSTGRES_PASSWORD | ||
| pghost: POSTGRES_HOST | ||
| dbname: POSTGRES_DBNAME | ||
| # Add any other secrets your services need | ||
|
|
||
| # Service Account Configuration | ||
| serviceAccount: | ||
| create: true | ||
| annotations: | ||
| azure.workload.identity/client-id: "your-client-id" | ||
| azure.workload.identity/tenant-id: "your-tenant-id" | ||
| ``` | ||
|
|
||
| ### PostgreSQL Configuration | ||
|
|
||
| Disable the internal PostgreSQL cluster when using Azure's managed PostgreSQL: | ||
|
|
||
| ```yaml | ||
| postgrescluster: | ||
| enabled: false | ||
| ``` | ||
|
|
||
| ### PgSTAC Bootstrap Configuration | ||
|
|
||
| Configure the pgstacBootstrap service for Azure: | ||
|
|
||
| ```yaml | ||
| pgstacBootstrap: | ||
| enabled: true | ||
| settings: | ||
| labels: | ||
| azure.workload.identity/use: "true" | ||
| extraEnvVars: | ||
| - name: POSTGRES_USER | ||
| value: postgres | ||
| - name: POSTGRES_PORT | ||
| value: "5432" | ||
| extraEnvFrom: | ||
| - secretRef: | ||
| name: pgstac-secrets-{{ $.Release.Name }} | ||
| extraVolumeMounts: | ||
| - name: azure-keyvault-secrets | ||
| mountPath: /mnt/secrets-store | ||
| readOnly: true | ||
| extraVolumes: | ||
| - name: azure-keyvault-secrets | ||
| csi: | ||
| driver: secrets-store.csi.k8s.io | ||
| readOnly: true | ||
| volumeAttributes: | ||
| secretProviderClass: azure-secret-provider-{{ $.Release.Name }} | ||
| ``` | ||
|
|
||
| ### API Services Configuration | ||
|
|
||
| For each API service (raster, multidim, stac, vector), add the following configuration: | ||
|
|
||
| ```yaml | ||
| # Example for the raster service | ||
| raster: | ||
| enabled: true | ||
| settings: | ||
| labels: | ||
| azure.workload.identity/use: "true" | ||
| extraEnvFrom: | ||
| - secretRef: | ||
| name: pgstac-secrets-{{ $.Release.Name }} | ||
| extraVolumeMounts: | ||
| - name: azure-keyvault-secrets | ||
| mountPath: /mnt/secrets-store | ||
| readOnly: true | ||
| extraVolumes: | ||
| - name: azure-keyvault-secrets | ||
| csi: | ||
| driver: secrets-store.csi.k8s.io | ||
| readOnly: true | ||
| volumeAttributes: | ||
| secretProviderClass: azure-secret-provider-{{ $.Release.Name }} | ||
|
|
||
| # Example for the stac service | ||
| stac: | ||
| enabled: true | ||
| settings: | ||
| labels: | ||
| azure.workload.identity/use: "true" | ||
| extraEnvFrom: | ||
| - secretRef: | ||
| name: pgstac-secrets-{{ $.Release.Name }} | ||
| extraVolumeMounts: | ||
| - name: azure-keyvault-secrets | ||
| mountPath: /mnt/secrets-store | ||
| readOnly: true | ||
| extraVolumes: | ||
| - name: azure-keyvault-secrets | ||
| csi: | ||
| driver: secrets-store.csi.k8s.io | ||
| readOnly: true | ||
| volumeAttributes: | ||
| secretProviderClass: azure-secret-provider-{{ $.Release.Name }} | ||
|
|
||
| # Example for the vector service | ||
| vector: | ||
| enabled: true | ||
| settings: | ||
| labels: | ||
| azure.workload.identity/use: "true" | ||
| extraEnvFrom: | ||
| - secretRef: | ||
| name: pgstac-secrets-{{ $.Release.Name }} | ||
| extraVolumeMounts: | ||
| - name: azure-keyvault-secrets | ||
| mountPath: /mnt/secrets-store | ||
| readOnly: true | ||
| extraVolumes: | ||
| - name: azure-keyvault-secrets | ||
| csi: | ||
| driver: secrets-store.csi.k8s.io | ||
| readOnly: true | ||
| volumeAttributes: | ||
| secretProviderClass: azure-secret-provider-{{ $.Release.Name }} | ||
|
|
||
| # Example for the multidim service (if enabled) | ||
| multidim: | ||
| enabled: false # set to true if needed | ||
| settings: | ||
| labels: | ||
| azure.workload.identity/use: "true" | ||
| extraEnvFrom: | ||
| - secretRef: | ||
| name: pgstac-secrets-{{ $.Release.Name }} | ||
| extraVolumeMounts: | ||
| - name: azure-keyvault-secrets | ||
| mountPath: /mnt/secrets-store | ||
| readOnly: true | ||
| extraVolumes: | ||
| - name: azure-keyvault-secrets | ||
| csi: | ||
| driver: secrets-store.csi.k8s.io | ||
| readOnly: true | ||
| volumeAttributes: | ||
| secretProviderClass: azure-secret-provider-{{ $.Release.Name }} | ||
| ``` | ||
|
|
||
| ## Azure Key Vault Secret Provider Configuration | ||
|
|
||
| Create the following Secret Provider Class to access the secrets in Azure Key Vault: | ||
|
|
||
| ```yaml | ||
| apiVersion: secrets-store.csi.x-k8s.io/v1 | ||
| kind: SecretProviderClass | ||
| metadata: | ||
| name: azure-secret-provider-{{ $.Release.Name }} | ||
| spec: | ||
| provider: azure | ||
| parameters: | ||
| usePodIdentity: "false" | ||
| clientID: {{ .Values.azure.keyvault.clientId }} | ||
| keyvaultName: {{ .Values.azure.keyvault.name }} | ||
| tenantId: {{ .Values.azure.keyvault.tenantId }} | ||
| objects: | | ||
| array: | ||
| {{- range $name, $value := .Values.azure.secretKeys }} | ||
| - | | ||
| objectName: {{ $value | replace "_" "-" }} | ||
| objectType: secret | ||
| {{- end }} | ||
| secretObjects: | ||
| - secretName: pgstac-secrets-{{ $.Release.Name }} | ||
| type: Opaque | ||
| data: | ||
| {{- range $name, $value := .Values.azure.secretKeys }} | ||
| - objectName: {{ $value | replace "_" "-" }} | ||
| key: {{ $name }} | ||
| {{- end }} | ||
| ``` | ||
|
|
||
| ## Azure Managed Identity Setup | ||
|
|
||
| To use Azure Managed Identity with your Kubernetes cluster: | ||
|
|
||
| 1. **Enable Workload Identity on your AKS cluster**: | ||
| ```bash | ||
| az aks update -g <resource-group> -n <cluster-name> --enable-workload-identity | ||
| ``` | ||
|
|
||
| 2. **Create a Managed Identity**: | ||
| ```bash | ||
| az identity create -g <resource-group> -n eoapi-identity | ||
| ``` | ||
|
|
||
| 3. **Configure Key Vault access**: | ||
| ```bash | ||
| # Get the client ID of the managed identity | ||
| CLIENT_ID=$(az identity show -g <resource-group> -n eoapi-identity --query clientId -o tsv) | ||
|
|
||
| # Grant access to Key Vault | ||
| az keyvault set-policy -n <keyvault-name> --secret-permissions get list --spn $CLIENT_ID | ||
| ``` | ||
|
|
||
| 4. **Create a federated identity credential** to connect the Kubernetes service account to the Azure managed identity: | ||
| ```bash | ||
| az identity federated-credential create \ | ||
| --name eoapi-federated-credential \ | ||
| --identity-name eoapi-identity \ | ||
| --resource-group <resource-group> \ | ||
| --issuer <aks-oidc-issuer> \ | ||
| --subject system:serviceaccount:<namespace>:eoapi-sa | ||
| ``` | ||
35 changes: 35 additions & 0 deletions
35
helm-chart/eoapi/templates/azure/azure-secret-provider.yaml
This file contains hidden or 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 @@ | ||
| # TODO DEPRECATE THIS FILE | ||
| # This file is used to create a SecretProviderClass for Azure Key Vault | ||
| # and mount the secrets in the pod using the Secrets Store CSI driver. | ||
| # It should not be part of the base chart and should be moved to a specific deployment | ||
| # chart when using the Azure Key Vault. | ||
| {{- if .Values.azure.aksSecretsProviderAvailable -}} | ||
|
|
||
| apiVersion: secrets-store.csi.x-k8s.io/v1 | ||
| kind: SecretProviderClass | ||
| metadata: | ||
| name: azure-secret-provider-{{ $.Release.Name }} | ||
| spec: | ||
| provider: azure | ||
| parameters: | ||
| usePodIdentity: "false" | ||
| clientID: {{ .Values.azure.keyvault.clientId }} | ||
| keyvaultName: {{ .Values.azure.keyvault.name }} | ||
| tenantId: {{ .Values.azure.keyvault.tenantId }} | ||
| objects: | | ||
| array: | ||
| {{- range $name, $value := .Values.azure.secretKeys }} | ||
| - | | ||
| objectName: {{ $value | replace "_" "-" }} | ||
| objectType: secret | ||
| {{- end }} | ||
| secretObjects: | ||
| - secretName: pgstac-secrets-{{ $.Release.Name }} | ||
| type: Opaque | ||
| data: | ||
| {{- range $name, $value := .Values.azure.secretKeys }} | ||
| - objectName: {{ $value | replace "_" "-" }} | ||
| key: {{ $name }} | ||
| {{- end }} | ||
|
|
||
| {{- end }} |
This file contains hidden or 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.
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.
@geohacker I need your review on this part or a link to a reference documentation to setup an azure managed postgres with postgis and the related keyvault creation and access