Skip to content

Conversation

@sofiasimdianova
Copy link
Contributor

@sofiasimdianova sofiasimdianova commented Feb 6, 2025

Add existingSecret value to migrate secrets to AWS SM for token authorisation

@sofiasimdianova sofiasimdianova requested a review from a team as a code owner February 6, 2025 14:16
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2025

Walkthrough

This pull request updates the Helm chart versions for the "Agent" and "Regions" entries in multiple README files. The chart version for the "Agent" is changed from 2.4.2 to 2.5.0, and for "Regions," it is updated from 2.9.2 to 2.10.0. New configuration keys for authentication are added, enhancing the setup options. Additionally, the logic for setting the AUTHENTICATION_TOKEN in the agent template is modified to conditionally retrieve the token from a Kubernetes secret if specified, with a fallback to the original token.

Changes

File(s) Change Summary
README.md Updated Agent chart version from 2.4.2 to 2.5.0 and Regions chart version from 2.9.2 to 2.10.0.
charts/agent/README.md Updated chart version from 2.4.2 to 2.5.0; added new configuration keys agent.authentication.existingSecret and agent.authentication.secretKeys.secret, both with default value "".
charts/agent/templates/_helpers.tpl Introduced conditional logic to set AUTHENTICATION_TOKEN: if existingSecretToken is provided, retrieves the token via secretKeyRef, else uses the default token.
charts/regions/README.md Added new configuration key agent.agent.authentication.existingSecret with default value ""; updated version requirement for agent from 2.X to 2.5.0 and chart version from 2.9.2 to 2.10.0.

Sequence Diagram(s)

sequenceDiagram
    participant T as Template Engine
    participant V as Values
    participant K as Kubernetes Secret

    T->>V: Check length of agent.authentication.existingSecretToken
    alt Token provided
      T->>K: Retrieve token via secretKeyRef
      K-->>T: Return secret token
    else No token provided
      T->>V: Use agent.authentication.token value
      V-->>T: Return default token
    end
Loading

Possibly related PRs

  • feat(membership): upgrade v0.36.2  #80: The changes in this PR are related to the updates of Helm chart versions for the "Agent" and "Regions" entries, which aligns with the version updates in the retrieved PR for the "Membership" chart.
  • chore: bump Regions chart to version 2.6.0 #90: This PR is related to the updates of the Helm chart version for "Regions," which directly connects to the versioning updates in this PR that also modifies the "Regions" chart version.
  • feat: Update all releases in stable #91: This PR involves updates to the Helm chart versions for both the "Agent" and "Regions" entries, directly corresponding to the version updates in this PR.

Suggested labels

bug

Suggested reviewers

  • Dav-14

Poem

I hop along the charted way,
Skipping bumps from version to version today.
New keys and tokens, a secret delight,
My whiskers twitch with joy so bright.
With every line, I celebrate the change,
A rabbit’s cheer, forever in range!
🥕🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

{{- if gt (len .Values.agent.authentication.existingSecretToken) 0 }}
valueFrom:
secretKeyRef:
name: {{ .Values.agent.authentication.existingSecretToken }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you rename this to existingSecret as all charts ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 29 to 33
{{- if gt (len .Values.agent.authentication.existingSecretToken) 0 }}
valueFrom:
secretKeyRef:
name: {{ .Values.agent.authentication.existingSecretToken }}
key: "token"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardcoded, can you make the key available in values ?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
charts/agent/templates/_helpers.tpl (1)

29-36: Consider making the secret key configurable.

The implementation assumes the token is stored under the key "token" in the Kubernetes secret. Consider making this configurable to support different secret structures.

 {{- if gt (len .Values.agent.authentication.existingSecretToken) 0 }}
 valueFrom:
   secretKeyRef:
     name: {{ .Values.agent.authentication.existingSecretToken }}
-    key: "token"
+    key: {{ .Values.agent.authentication.existingSecretTokenKey | default "token" }}
 {{- else }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f64bf16 and f4e0caf.

⛔ Files ignored due to path filters (4)
  • charts/agent/Chart.yaml is excluded by !**/*.yaml
  • charts/agent/values.schema.json is excluded by !**/*.json
  • charts/agent/values.yaml is excluded by !**/*.yaml
  • charts/regions/Chart.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (4)
  • README.md (1 hunks)
  • charts/agent/README.md (2 hunks)
  • charts/agent/templates/_helpers.tpl (1 hunks)
  • charts/regions/README.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • README.md
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Tests

Comment on lines +35 to +36
value: {{ .Values.agent.authentication.token }}
{{- end }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add validation for empty token value.

The fallback case should validate that the token value is not empty to prevent authentication issues.

 {{- else }}
+{{- if not .Values.agent.authentication.token }}
+{{- fail "authentication.token is required when existingSecretToken is not provided" }}
+{{- end }}
 value: {{ .Values.agent.authentication.token }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
value: {{ .Values.agent.authentication.token }}
{{- end }}
{{- else }}
{{- if not .Values.agent.authentication.token }}
{{- fail "authentication.token is required when existingSecretToken is not provided" }}
{{- end }}
value: {{ .Values.agent.authentication.token }}
{{- end }}

| affinity | object | `{}` | |
| agent.authentication.clientID | string | `""` | |
| agent.authentication.clientSecret | string | `""` | |
| agent.authentication.existingSecretToken | string | `""` | |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance documentation for existingSecretToken.

The new configuration key needs a description explaining its purpose and usage. Consider adding:

  • Purpose: For using existing Kubernetes secrets
  • Format: Expected secret format
  • Example usage
-| agent.authentication.existingSecretToken | string | `""` |  |
+| agent.authentication.existingSecretToken | string | `""` | Name of an existing Kubernetes secret containing the authentication token. The secret must contain a key named 'token'. Example: "my-auth-secret" |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| agent.authentication.existingSecretToken | string | `""` | |
| agent.authentication.existingSecretToken | string | `""` | Name of an existing Kubernetes secret containing the authentication token. The secret must contain a key named 'token'. Example: "my-auth-secret" |

| agent.affinity | object | `{}` | |
| agent.agent.authentication.clientID | string | `""` | |
| agent.agent.authentication.clientSecret | string | `""` | |
| agent.agent.authentication.existingSecretToken | string | `""` | |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Maintain consistent documentation with agent chart.

Update the description to match the agent chart's documentation for consistency.

-| agent.agent.authentication.existingSecretToken | string | `""` |  |
+| agent.agent.authentication.existingSecretToken | string | `""` | Name of an existing Kubernetes secret containing the authentication token. The secret must contain a key named 'token'. Example: "my-auth-secret" |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| agent.agent.authentication.existingSecretToken | string | `""` | |
| agent.agent.authentication.existingSecretToken | string | `""` | Name of an existing Kubernetes secret containing the authentication token. The secret must contain a key named 'token'. Example: "my-auth-secret" |

Comment on lines 1 to 9
dependencies:
- name: agent
repository: file://../agent
version: 2.4.1
version: 2.5.0
- name: operator
repository: oci://ghcr.io/formancehq/helm
version: v2.6.0
digest: sha256:72eccae222d27466817cb2dedb8cacbce157ae43255d79fc194ad4fe99133830
generated: "2025-02-05T11:19:12.47191+01:00"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also bump regions charts ?

@sofiasimdianova sofiasimdianova force-pushed the feat/sm_migrate_secrets branch from ddefa2c to e5e09f5 Compare February 6, 2025 15:53
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
README.md (1)

7-7: Ensure Agent chart update and configuration keys documentation.

The Agent helm chart row has been updated to version 2.5.0, which aligns with the intended migration for secrets management using AWS SM. Please verify that the new configuration keys (such as agent.authentication.existingSecret and agent.authentication.secretKeys.secret) are clearly documented in the Agent chart's README or relevant configuration docs to help users properly utilize this feature.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ddefa2c and e5e09f5.

⛔ Files ignored due to path filters (5)
  • charts/agent/Chart.yaml is excluded by !**/*.yaml
  • charts/agent/values.schema.json is excluded by !**/*.json
  • charts/agent/values.yaml is excluded by !**/*.yaml
  • charts/regions/Chart.lock is excluded by !**/*.lock, !**/*.lock
  • charts/regions/Chart.yaml is excluded by !**/*.yaml
📒 Files selected for processing (4)
  • README.md (1 hunks)
  • charts/agent/README.md (2 hunks)
  • charts/agent/templates/_helpers.tpl (1 hunks)
  • charts/regions/README.md (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • charts/agent/templates/_helpers.tpl
  • charts/agent/README.md
  • charts/regions/README.md
🧰 Additional context used
🪛 LanguageTool
README.md

[style] ~13-~13: Using many exclamation marks might seem excessive (in this case: 10 exclamation marks for a text that’s 3025 characters long)
Context: ...tions, users, roles, and permissions. | Artifact HUB | | Portal | 2.0.5 | 5e7b404a3a208b1f38603719e02a8b1883c10acf | Formance Portal | Artifact HUB | | Regions | 2.9.4 | latest | Formance Private Regions Helm Chart | Artifact HUB | | Stargate | 0.6.1 | latest | Formance Stargate gRPC Gateway | [![Artifact HUB](https://img.shields.io/en...

(EN_EXCESSIVE_EXCLAMATION)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Tests
🔇 Additional comments (1)
README.md (1)

15-15: Confirm Regions chart version update.

The Regions helm chart row has been updated to version 2.9.4 with the app version specified as latest. Ensure that this version bump is consistent with all related documentation and any dependencies or version constraints, such as those in the Agent chart section, have been updated appropriately.


dependencies:
- name: agent
version: 2.X
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the 2.X

Comment on lines 4 to 5
version: 2.5.0
version: 2.5.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
README.md (1)

7-7: Agent Row Version Update & Secret Management Clarification
The Agent chart version has been updated to "2.5.0" as required. However, given the PR objective of migrating secrets to AWS Secrets Manager (with the addition of agent.authentication.existingSecret), please verify that the accompanying documentation in ./charts/agent/README.md accurately describes the new secret management configuration. This helps ensure that users understand how to configure the AWS SM integration.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e5e09f5 and 3a0b8ce.

⛔ Files ignored due to path filters (3)
  • charts/agent/Chart.yaml is excluded by !**/*.yaml
  • charts/regions/Chart.lock is excluded by !**/*.lock, !**/*.lock
  • charts/regions/Chart.yaml is excluded by !**/*.yaml
📒 Files selected for processing (3)
  • README.md (1 hunks)
  • charts/agent/README.md (2 hunks)
  • charts/regions/README.md (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • charts/regions/README.md
  • charts/agent/README.md
🧰 Additional context used
🪛 LanguageTool
README.md

[style] ~13-~13: Using many exclamation marks might seem excessive (in this case: 10 exclamation marks for a text that’s 3026 characters long)
Context: ...tions, users, roles, and permissions. | Artifact HUB | | Portal | 2.0.5 | 5e7b404a3a208b1f38603719e02a8b1883c10acf | Formance Portal | Artifact HUB | | Regions | 2.10.0 | latest | Formance Private Regions Helm Chart | Artifact HUB | | Stargate | 0.6.1 | latest | Formance Stargate gRPC Gateway | [![Artifact HUB](https://img.shields.io/en...

(EN_EXCESSIVE_EXCLAMATION)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Tests
🔇 Additional comments (1)
README.md (1)

15-15: Regions Chart Version Update and Dependency Consistency
The Regions chart version is updated to "2.10.0", which aligns with the intended improvements. As with the Agent row, please ensure that any associated configuration keys—especially those related to secret management—are clearly documented in the Regions chart README if applicable. This will provide a consistent user experience across the Helm charts.

@sofiasimdianova sofiasimdianova added this pull request to the merge queue Feb 17, 2025
Merged via the queue into main with commit 033a725 Feb 17, 2025
5 checks passed
@sofiasimdianova sofiasimdianova deleted the feat/sm_migrate_secrets branch February 17, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants