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: add db pass from secret ability #16

Merged
merged 7 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- name: lint_pr_title
id: lint_pr_title
uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! πŸ‘‹πŸΌ

We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.

Details:

```
${{ steps.lint_pr_title.outputs.error_message }}
```
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
2 changes: 1 addition & 1 deletion charts/keep/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: keep
version: 0.0.3
version: 0.0.4
description: Keep Helm Chart
type: application
icon: https://platform.keephq.dev/_next/image?url=%2Fkeep.png&w=48&q=75
Expand Down
21 changes: 12 additions & 9 deletions charts/keep/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# keep

![Version: 0.0.3](https://img.shields.io/badge/Version-0.0.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.1](https://img.shields.io/badge/AppVersion-0.2.1-informational?style=flat-square)
![Version: 0.0.4](https://img.shields.io/badge/Version-0.0.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.1](https://img.shields.io/badge/AppVersion-0.2.1-informational?style=flat-square)

Keep Helm Chart

Expand All @@ -26,15 +26,18 @@ Keep Helm Chart
| backend.autoscaling.maxReplicas | int | `3` | |
| backend.autoscaling.minReplicas | int | `1` | |
| backend.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| backend.databaseConnectionStringFromSecret.enabled | bool | `false` | |
| backend.databaseConnectionStringFromSecret.secretKey | string | `""` | |
| backend.databaseConnectionStringFromSecret.secretName | string | `""` | |
| backend.enabled | bool | `true` | |
| backend.env[0].name | string | `"SECRET_MANAGER_TYPE"` | |
| backend.env[0].value | string | `"k8s"` | |
| backend.env[1].name | string | `"PORT"` | |
| backend.env[1].value | string | `"8080"` | |
| backend.env[2].name | string | `"SECRET_MANAGER_DIRECTORY"` | |
| backend.env[2].value | string | `"/state"` | |
| backend.env[3].name | string | `"DATABASE_CONNECTION_STRING"` | |
| backend.env[3].value | string | `"mysql+pymysql://root@keep-database:3306/keep"` | |
| backend.env[0].name | string | `"DATABASE_CONNECTION_STRING"` | |
| backend.env[0].value | string | `"mysql+pymysql://root@keep-database:3306/keep"` | |
| backend.env[1].name | string | `"SECRET_MANAGER_TYPE"` | |
| backend.env[1].value | string | `"k8s"` | |
| backend.env[2].name | string | `"PORT"` | |
| backend.env[2].value | string | `"8080"` | |
| backend.env[3].name | string | `"SECRET_MANAGER_DIRECTORY"` | |
| backend.env[3].value | string | `"/state"` | |
| backend.env[4].name | string | `"PUSHER_APP_ID"` | |
| backend.env[4].value | int | `1` | |
| backend.env[5].name | string | `"PUSHER_APP_KEY"` | |
Expand Down
7 changes: 7 additions & 0 deletions charts/keep/templates/keep-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.backend.databaseConnectionStringFromSecret.enabled }}
- name: DATABASE_CONNECTION_STRING
valueFrom:
secretKeyRef:
name: {{ .Values.backend.databaseConnectionStringFromSecret.secretName }}
key: {{ .Values.backend.databaseConnectionStringFromSecret.secretKey }}
{{- end }}
volumeMounts:
- name: state-volume
mountPath: /state
Expand Down
2 changes: 1 addition & 1 deletion charts/keep/templates/keep-db-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "keep.fullname" . }}-database
name: {{ include "keep.name" . }}-database
labels:
{{- include "keep.labels" . | nindent 4 }}
keep-component: database-service
Expand Down
10 changes: 8 additions & 2 deletions charts/keep/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,21 @@
# if true, wait for the database to be ready before starting the API
# if you use external database, you can set this to false
waitForDatabase: true
# if true, the database connection string will be read from a secret
# if it is false, the DATABASE_CONNECTION_STRING value can be set directly
databaseConnectionStringFromSecret:
enabled: false
secretName: ""
secretKey: ""
env:
- name: DATABASE_CONNECTION_STRING
value: mysql+pymysql://root@keep-database:3306/keep
- name: SECRET_MANAGER_TYPE
value: k8s
- name: PORT
value: "8080"
- name: SECRET_MANAGER_DIRECTORY
value: /state
- name: DATABASE_CONNECTION_STRING
value: mysql+pymysql://root@keep-database:3306/keep
- name: PUSHER_APP_ID
value: 1
- name: PUSHER_APP_KEY
Expand Down Expand Up @@ -188,7 +194,7 @@
tag: "latest"
env:
- name: MYSQL_ALLOW_EMPTY_PASSWORD
value: yes

Check warning on line 197 in charts/keep/values.yaml

View workflow job for this annotation

GitHub Actions / lint-chart

197:14 [truthy] truthy value should be one of [false, true]
- name: MYSQL_DATABASE
value: keep
- name: MYSQL_PASSWORD
Expand Down
4 changes: 1 addition & 3 deletions ct.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
remote: origin
target-branch: main
debug: true
check-version-increment: false
check-version-increment: true
helm-extra-args: --timeout 15m
validate-maintainers: false
charts:
- charts/keep
chart-repos:
- keep=https://keephq.github.io/helm-charts
Loading