Skip to content

feat: Add timeout checker #16

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 1 commit into from
Apr 2, 2025
Merged

feat: Add timeout checker #16

merged 1 commit into from
Apr 2, 2025

Conversation

adityachoudhari26
Copy link
Contributor

@adityachoudhari26 adityachoudhari26 commented Apr 2, 2025

Summary by CodeRabbit

  • Chores
    • Updated the release version from 0.3.8 to 0.3.9.
  • New Features
    • Added a scheduled job that routinely checks for timeouts with built-in auto-retry capabilities and secure handling of sensitive configurations.

Copy link

coderabbitai bot commented Apr 2, 2025

Walkthrough

This pull request updates the version of the Helm chart for the ctrlplane application from 0.3.8 to 0.3.9 and introduces a new Kubernetes CronJob. The newly added CronJob, defined in the timeout-checker.yaml file, runs a Node.js application that performs timeout checks. The job configuration includes environment variables sourced from Kubernetes secrets, resource limits, and options to include extra environment variables via Helm templates.

Changes

File(s) Change Summary
charts/ctrlplane/Chart.yaml Updated Helm chart version from 0.3.8 to 0.3.9.
charts/ctrlplane/charts/.../timeout-checker.yaml Added a new Kubernetes CronJob resource that schedules a container running node index.js -r -j timeout-checker, with secure environment variable configurations.

Sequence Diagram(s)

sequenceDiagram
    participant Scheduler as K8s Scheduler
    participant CronJob as Timeout Checker CronJob
    participant Container as Timeout Checker Container
    participant App as Node.js Application

    CronJob->>Scheduler: Register schedule from Helm values
    Scheduler->>CronJob: Trigger job based on schedule
    CronJob->>Container: Launch container with command execution
    Container->>App: Execute `node index.js -r -j timeout-checker`
Loading

Suggested reviewers

  • zacharyblasczyk
  • jsbroks

Poem

In the garden of code, I hop with glee,
A new version blooms for all to see.
CronJobs sprout like carrots in a row,
Secrets tucked safe, as they rhythmically flow.
With each hop, I code and cheer,
A bunny’s delight—new change is here!
🐰🌿


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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

@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: 1

🧹 Nitpick comments (2)
charts/ctrlplane/charts/jobs/templates/timeout-checker.yaml (2)

5-8: Review Template Indentation for Labels
YAMLlint warns of indentation issues (extra spaces and unexpected indent levels) on lines 7–8. Although Helm templating can sometimes trigger these false positives, please verify that the final rendered YAML maintains proper indentation. You might consider adjusting the nindent value or reformatting the block if needed.

🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 7-7: wrong indentation: expected 2 but found 4

(indentation)


[warning] 7-7: too many spaces after hyphen

(hyphens)


[warning] 8-8: wrong indentation: expected 2 but found 4

(indentation)


9-12: Review Template Indentation for Annotations
Similar to the labels block, warnings on lines 11–12 indicate potential indentation issues. Ensure that the rendered annotations section is correctly indented. Adjust the templating or indentation settings (e.g., using nindent) if necessary.

🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 11-11: wrong indentation: expected 2 but found 4

(indentation)


[warning] 11-11: too many spaces after hyphen

(hyphens)


[warning] 12-12: wrong indentation: expected 2 but found 4

(indentation)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c382193 and 317e5b1.

📒 Files selected for processing (2)
  • charts/ctrlplane/Chart.yaml (1 hunks)
  • charts/ctrlplane/charts/jobs/templates/timeout-checker.yaml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
charts/ctrlplane/charts/jobs/templates/timeout-checker.yaml

[warning] 7-7: wrong indentation: expected 2 but found 4

(indentation)


[warning] 7-7: too many spaces after hyphen

(hyphens)


[warning] 8-8: wrong indentation: expected 2 but found 4

(indentation)


[warning] 11-11: wrong indentation: expected 2 but found 4

(indentation)


[warning] 11-11: too many spaces after hyphen

(hyphens)


[warning] 12-12: wrong indentation: expected 2 but found 4

(indentation)


[error] 4-4: syntax error: expected , but found ''

(syntax)

🔇 Additional comments (9)
charts/ctrlplane/Chart.yaml (1)

5-5: Version Bump Update
The chart’s version has been correctly updated from 0.3.8 to 0.3.9, which aligns with the introduction of the new CronJob feature.

charts/ctrlplane/charts/jobs/templates/timeout-checker.yaml (8)

1-3: API Version & Kind Setup
The API version batch/v1 and kind CronJob are correctly defined for this Kubernetes resource.


13-15: CronJob Specification Settings
The concurrencyPolicy and schedule fields are correctly templated. Verify that the schedule value (obtained from .Values.cron.schedule) conforms to Kubernetes CronJob syntax.


16-20: Job Template and Pod Specification
The structure for the job template and pod spec is well defined with a restart policy of OnFailure, which is appropriate for jobs that should retry on failure.


21-27: Container Configuration
The container for the timeout-checker is configured with a dynamic image (using .Values.image.repository and .Values.image.tag), a pull policy, and a command/args setup that calls Node.js correctly. Ensure that these values resolve properly in your values file.


28-42: Environment Variable Configuration
Environment variables are securely sourced from Kubernetes secrets (for REDIS_URL, POSTGRES_URL, and VARIABLES_AES_256_KEY), which is a good security practice.


43-44: Extra Environment Variables Inclusion
The file includes additional environment variables via templated includes (ctrlplane.extraEnv and ctrlplane.extraEnvFrom). This enhances flexibility. Please ensure that the referenced templates exist and render as expected.


45-46: Resource Configuration
Resources are inserted into the manifest using a templated toYaml call. Verify that .Values.resources is well defined in your values file to avoid runtime issues.


47-47: Trailing Newline Check
There is a blank line at the end of the file. While this is generally harmless, ensure that no unintended whitespace affects downstream processing.

Comment on lines +3 to +4
metadata:
name: {{ include "jobs.fullname" . }}-timeout-checker
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Quote the Dynamic Name Field
The metadata name uses a Helm template expression:

name: {{ include "jobs.fullname" . }}-timeout-checker

YAMLlint reports a syntax error on this line because the templated scalar is not quoted. Enclose the value in quotes to ensure valid YAML syntax. For example:

name: "{{ include \"jobs.fullname\" . }}-timeout-checker"
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 4-4: syntax error: expected , but found ''

(syntax)

@adityachoudhari26 adityachoudhari26 merged commit 0a0bfc9 into main Apr 2, 2025
2 checks passed
@adityachoudhari26 adityachoudhari26 deleted the timeout-checker branch April 2, 2025 20:52
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.

1 participant