Skip to content
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

Feat/k8s #900

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft

Feat/k8s #900

wants to merge 3 commits into from

Conversation

rhanka
Copy link
Member

@rhanka rhanka commented Mar 12, 2024

Cf issue #903

@rhanka rhanka self-assigned this Mar 12, 2024
Copy link

coderabbitai bot commented Mar 12, 2024

Important

Auto Review Skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

The update to the Makefile introduces a series of enhancements and additions aimed at improving Kubernetes deployments. Key configurations such as KUBECONFIG, ES_MEM_KUBE, and namespace settings have been refined. New exports for storage access and secret keys are added to bolster security and access management. The deployment process for Kubernetes clusters, namespaces, Elasticsearch, Redis, backend, and frontend services has been significantly enhanced. Additionally, new targets for deploying services, local ingress, and updating base images have been introduced, streamlining the deployment and management process.

Changes

Files Change Summary
Makefile Added exports (KUBECONFIG, ES_MEM_KUBE, STORAGE_ACCESS_KEY_B64, STORAGE_SECRET_KEY_B64), modified KUBE_NAMESPACE export, updated deployment logic, introduced new deployment targets.

🐰✨
In the realm of code, where the bits align,
Changes were made, oh so fine.
With a hop and a skip, deployments refine,
Making the clusters, in harmony, entwine.
To the future we gaze, with eyes that shine,
For in our Makefile, the stars align.
🌟🐾

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>.
    • Generate unit-tests 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 tests 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@rhanka rhanka marked this pull request as draft March 12, 2024 02:19
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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 68b292e and 228b397.
Files ignored due to path filters (3)
  • k8s/elasticsearch.yaml is excluded by: !**/*.yaml
  • k8s/frontend.yaml is excluded by: !**/*.yaml
  • k8s/ingress-local.yaml is excluded by: !**/*.yaml
Files selected for processing (1)
  • Makefile (4 hunks)
Additional comments: 3
Makefile (3)
  • 116-119: The transformation applied to KUBE_NAMESPACE and the introduction of KUBECONFIG and ES_MEM_KUBE are good practices for dynamic and flexible Kubernetes deployments. However, ensure that the base64 encoding of sensitive keys (STORAGE_ACCESS_KEY_B64 and STORAGE_SECRET_KEY_B64) is securely handled and that these keys are not exposed in logs or error messages.
  • 542-568: The deployment scripts for Kubernetes services (deploy-k8s-services, deploy-k8s-namespace, deploy-k8s-elasticsearch, deploy-k8s-redis, deploy-k8s-backend, and deploy-k8s-frontend) are well-organized and make good use of environment variable substitution. Ensure that Kubernetes YAML files referenced (${KUBE_DIR}/<service>.yaml) are correctly formatted and that they include resource limits to prevent potential resource exhaustion.
  • 647-647: Introducing the update-base-image target is a significant enhancement for managing base Docker images. Ensure that the snapshot and image creation process is thoroughly tested to prevent any disruptions in the deployment pipeline.

Comment on lines +529 to +538
deploy-k8s-cluster-local:
@if ! (which k3s > /dev/null 2>&1); then\
(curl -sfL https://get.k3s.io | sh - 2>&1 |\
awk 'BEGIN{s=0}{printf "\r☸️ Installing k3s (" s++ "/16)"}') && echo -e "\r\033[2K☸️ Installed k3s";\
fi;\
mkdir -p ~/.kube;\
KUBECONFIG=${HOME}/.kube/config-local-k3s.yaml;\
sudo cp /etc/rancher/k3s/k3s.yaml $${KUBECONFIG};\
sudo chown ${USER} $${KUBECONFIG};\
cp $${KUBECONFIG} ${KUBECONFIG}
Copy link

Choose a reason for hiding this comment

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

The script for setting up a local Kubernetes cluster using k3s is well-structured. However, consider checking for existing ~/.kube/config-local-k3s.yaml before overwriting it to avoid accidental loss of existing configurations.

+ if [ ! -f "$${KUBECONFIG}" ]; then
    sudo cp /etc/rancher/k3s/k3s.yaml $${KUBECONFIG};
    sudo chown ${USER} $${KUBECONFIG};
    cp $${KUBECONFIG} ${KUBECONFIG}
+ fi

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.

Suggested change
deploy-k8s-cluster-local:
@if ! (which k3s > /dev/null 2>&1); then\
(curl -sfL https://get.k3s.io | sh - 2>&1 |\
awk 'BEGIN{s=0}{printf "\r☸️ Installing k3s (" s++ "/16)"}') && echo -e "\r\033[2K☸️ Installed k3s";\
fi;\
mkdir -p ~/.kube;\
KUBECONFIG=${HOME}/.kube/config-local-k3s.yaml;\
sudo cp /etc/rancher/k3s/k3s.yaml $${KUBECONFIG};\
sudo chown ${USER} $${KUBECONFIG};\
cp $${KUBECONFIG} ${KUBECONFIG}
deploy-k8s-cluster-local:
@if ! (which k3s > /dev/null 2>&1); then\
(curl -sfL https://get.k3s.io | sh - 2>&1 |\
awk 'BEGIN{s=0}{printf "\r☸️ Installing k3s (" s++ "/16)"}') && echo -e "\r\033[2K☸️ Installed k3s";\
fi;\
mkdir -p ~/.kube;\
KUBECONFIG=${HOME}/.kube/config-local-k3s.yaml;\
if [ ! -f "$${KUBECONFIG}" ]; then
sudo cp /etc/rancher/k3s/k3s.yaml $${KUBECONFIG};\
sudo chown ${USER} $${KUBECONFIG};\
cp $${KUBECONFIG} ${KUBECONFIG}
fi

@rhanka rhanka mentioned this pull request Apr 10, 2024
18 tasks
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