Skip to content

EDM-953: Use approved Postgres#3

Open
romfreiman wants to merge 1 commit intoromfreiman:mainfrom
avishayt:EDM-953
Open

EDM-953: Use approved Postgres#3
romfreiman wants to merge 1 commit intoromfreiman:mainfrom
avishayt:EDM-953

Conversation

@romfreiman
Copy link
Copy Markdown
Owner

@romfreiman romfreiman commented Dec 24, 2024

Allow setting an alternate image via variables to "make deploy". For example:
IMAGE_PULL_SECRET_PATH="/path/to/pull/secret.yaml" SQL_IMAGE="registry.redhat.io/rhel8/postgresql-12" SQL_VERSION="1-181"

Summary by CodeRabbit

  • New Features

    • Introduced a parameter for specifying an image pull secret in the deployment configuration.
    • Added flexibility for pulling images from private registries via a new script variable.
  • Bug Fixes

    • Enhanced error handling in the deployment script related to image pull secrets.
  • Chores

    • Updated deployment script to streamline image configuration management and improve usability.

Allow setting an alternate image via variables to "make deploy".  For
example:
IMAGE_PULL_SECRET_PATH="/path/to/pull/secret.yaml"
SQL_IMAGE="registry.redhat.io/rhel8/postgresql-12"
SQL_VERSION="1-181"
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 24, 2024

Walkthrough

The pull request introduces enhancements to the Helm deployment configuration for the FlightCTL project. The changes focus on improving image pull flexibility by adding support for a custom image pull secret, updating deployment scripts, and providing more configurable options for database image deployment. The modifications span across Helm template files, values configuration, and deployment scripts, aiming to provide more granular control over container image management.

Changes

File Change Summary
deploy/helm/flightctl/templates/flightctl-db-deployment.yaml Added conditional imagePullSecrets block to support custom image pull secrets
deploy/helm/flightctl/values.yaml Introduced imagePullSecretName parameter under global section
test/scripts/deploy_with_helm.sh Added variables for image pull secret path, SQL image, and version
Updated Helm deployment arguments and image configuration handling

Poem

🐰 Hopping through Helm's garden green,
Secrets tucked where none have seen,
Deploying images with rabbit's might,
Configuration now shines so bright!
A whisker's twitch of DevOps glee 🚀


🪧 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.

Copy link
Copy Markdown

@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 (4)
deploy/helm/flightctl/templates/flightctl-db-deployment.yaml (1)

20-23: Fix indentation in the imagePullSecrets block

The indentation of the imagePullSecrets block should be consistent with other spec fields.

Apply this diff to fix the indentation:

      {{- if .Values.global.imagePullSecretName }}
-      imagePullSecrets:
-        - name: {{ .Values.global.imagePullSecretName }}
+    imagePullSecrets:
+      - name: {{ .Values.global.imagePullSecretName }}
      {{- end }}
🧰 Tools
🪛 yamllint (1.35.1)

[warning] 21-21: wrong indentation: expected 4 but found 6

(indentation)


[error] 20-20: syntax error: expected the node content, but found '-'

(syntax)

deploy/helm/flightctl/values.yaml (1)

34-34: Add documentation for the imagePullSecretName parameter

The new parameter should be documented following the existing pattern:

Add this documentation above the parameter:

+## @param global.imagePullSecretName Name of the image pull secret for accessing private registries
  imagePullSecretName: ""
test/scripts/deploy_with_helm.sh (2)

7-10: Enhance variable documentation and validation

The new variables should be better documented and validated:

Apply this diff to improve the documentation and validation:

-# If using images from a private registry, specify a path to a Kubernetes Secret yaml for your pull secret (in the flightctl-internal namespace)
-# IMAGE_PULL_SECRET_PATH=
-SQL_VERSION=${SQL_VERSION:-"latest"}
-SQL_IMAGE=${SQL_IMAGE:-"quay.io/sclorg/postgresql-12-c8s"}
+# Configuration for PostgreSQL database
+# IMAGE_PULL_SECRET_PATH - Path to Kubernetes Secret yaml for private registry authentication (must be in flightctl-internal namespace)
+# SQL_IMAGE           - PostgreSQL image to use (default: quay.io/sclorg/postgresql-12-c8s)
+# SQL_VERSION         - PostgreSQL image version tag (default: latest)
+
+: "${SQL_VERSION:=latest}"
+: "${SQL_IMAGE:=quay.io/sclorg/postgresql-12-c8s}"

70-80: Enhance pull secret validation

The pull secret validation could be more robust:

Apply this diff to improve the validation:

 if [ ! -z "$IMAGE_PULL_SECRET_PATH" ]; then
+  if [ ! -f "$IMAGE_PULL_SECRET_PATH" ]; then
+    echo "Error: IMAGE_PULL_SECRET_PATH file does not exist: $IMAGE_PULL_SECRET_PATH"
+    exit 1
+  fi
+
   PULL_SECRET_NAME=$(cat "$IMAGE_PULL_SECRET_PATH" | yq .metadata.name)
   PULL_SECRET_NAMESPACE=$(cat "$IMAGE_PULL_SECRET_PATH" | yq .metadata.namespace)
 
+  if [ -z "$PULL_SECRET_NAME" ] || [ -z "$PULL_SECRET_NAMESPACE" ]; then
+    echo "Error: Invalid secret yaml: missing name or namespace"
+    exit 1
+  fi
+
   if [ "$PULL_SECRET_NAMESPACE" != "flightctl-internal" ]; then
     echo "Namespace for IMAGE_PULL_SECRET_PATH must be flightctl-internal"
     exit 1
   fi
 
   SQL_ARG="$SQL_ARG --set global.imagePullSecretName=${PULL_SECRET_NAME}"
   kubectl apply -f "$IMAGE_PULL_SECRET_PATH"
 fi
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 494974f and ea9dcfb.

📒 Files selected for processing (3)
  • deploy/helm/flightctl/templates/flightctl-db-deployment.yaml (1 hunks)
  • deploy/helm/flightctl/values.yaml (1 hunks)
  • test/scripts/deploy_with_helm.sh (5 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
deploy/helm/flightctl/templates/flightctl-db-deployment.yaml

[warning] 21-21: wrong indentation: expected 4 but found 6

(indentation)


[error] 20-20: syntax error: expected the node content, but found '-'

(syntax)

🔇 Additional comments (3)
deploy/helm/flightctl/templates/flightctl-db-deployment.yaml (1)

20-23: LGTM on imagePullSecrets implementation

The conditional block for imagePullSecrets is well implemented:

  • Only adds the secret when .Values.global.imagePullSecretName is defined
  • Correctly placed in the pod spec
  • Properly templated to use the configured secret name
🧰 Tools
🪛 yamllint (1.35.1)

[warning] 21-21: wrong indentation: expected 4 but found 6

(indentation)


[error] 20-20: syntax error: expected the node content, but found '-'

(syntax)

deploy/helm/flightctl/values.yaml (1)

Line range hint 67-69: Review PostgreSQL image configuration

A few concerns about the database image configuration:

  1. PostgreSQL 12 is approaching end of life (EOL: November 14, 2024)
  2. Using "latest" tag is not recommended for production as it makes deployments unpredictable

Consider:

  1. Upgrading to a newer PostgreSQL version (e.g., 15 or 16)
  2. Specifying a fixed version tag

Run this script to check available PostgreSQL versions:

test/scripts/deploy_with_helm.sh (1)

49-51: LGTM on Helm arguments construction

The construction of Helm arguments for images is well implemented:

  • Correctly uses the new variables
  • Maintains consistency across different components
  • Properly concatenates multiple settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants