-
Notifications
You must be signed in to change notification settings - Fork 93
CLOUDP-299786: Removed helm-charts as submodule. Added helm-charts as a simple folder #2209
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b0f9338
Removed helm-charts as submodule. Added helm-charts as a simple folder
igor-karpukhin b968e25
Bumped up helm charts
igor-karpukhin 2a711ad
Added a way to verify if CRDs helm chart is synced with the bundle
igor-karpukhin 5aad976
Added job to sync helm-charts after every merged PR
igor-karpukhin 08c158e
Modified commit message
igor-karpukhin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: Sync helm-charts | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
verify-helm-changes: | ||
if: github.event.pull_request.merged == true && !startsWith(github.event.pull_request.title, 'dependabot') | ||
name: Verify if AKO helm charts need updates | ||
runs-on: ubuntu-latest | ||
environment: release | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout AKO repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install devbox | ||
uses: jetify-com/[email protected] | ||
with: | ||
enable-cache: "true" | ||
|
||
- name: Generate GitHub App Token | ||
id: generate_token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ secrets.AKO_RELEASER_APP_ID }} | ||
private-key: ${{ secrets.AKO_RELEASER_RSA_KEY }} | ||
owner: ${{ github.repository_owner }} | ||
repositories: | | ||
mongodb-atlas-kubernetes | ||
helm-charts | ||
|
||
- name: Checkout Helm charts repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: mongodb/helm-charts | ||
token: ${{ steps.generate_token.outputs.token }} | ||
path: helm-charts-cloned | ||
persist-credentials: true | ||
|
||
- name: Patch original AKO chart dependencies | ||
run: | | ||
sed -i 's|repository: "file://../../helm-charts/atlas-operator-crds"|repository: "https://mongodb.github.io/helm-charts"|' helm-charts/atlas-operator/Chart.yaml | ||
|
||
- name: Generate AKO bundle | ||
env: | ||
VERSION: "1.0.0" | ||
run: | | ||
devbox run -- "make generate bundle" | ||
|
||
- name: Verify if CRDs were changed | ||
id: crd-check | ||
env: | ||
HELM_CRDS_PATH: "./helm-charts-cloned/charts/atlas-operator-crds/templates" | ||
run: | | ||
devbox run -- "make helm-upd-crds" | ||
|
||
- name: Verify if RBAC were changed | ||
id: rbac-check | ||
env: | ||
HELM_RBAC_FILE: "./helm-charts-cloned/charts/atlas-operator/rbac.yaml" | ||
run: | | ||
devbox run -- "make helm-upd-rbac" | ||
|
||
- name: Verify if helm-charts need to be synced | ||
run: | | ||
for $dir in $(ls ./helm-charts); do | ||
if [[ -d "./helm-charts-cloned/charts/$dir" ]]; then | ||
if [[ -n $(diff -r ./helm-charts/$dir ./helm-charts-cloned/charts/$dir) ]]; then | ||
echo "Changes detected for the Chart: $dir" | ||
cp -r ./helm-charts/$dir ./helm-charts-cloned/charts/$dir | ||
fi | ||
fi | ||
done | ||
|
||
- name: Create PR for helm-charts repo | ||
env: | ||
GH_TOKEN: ${{ steps.generate_token.outputs.token }} | ||
run: | | ||
cd ./helm-charts-cloned | ||
|
||
if [[ -n $(git status --porcelain) ]]; then | ||
jobname=${{ github.run_id }} | ||
if [[ -n "${{ github.event.pull_request.title }}" ]]; then | ||
jobname=$(echo "${{ github.event.pull_request.title }}" | tr -c '[:alnum:]-_' '_') | ||
fi | ||
|
||
BRANCH_NAME=ako-helm-update-"${jobname}" | ||
COMMIT_MSG="[autogenerated] update AKO helm-charts ${jobname}" | ||
echo "Changes detected. Creating PR" | ||
|
||
git config --local user.email "[email protected]" | ||
git config --local user.name "ako-releaser" | ||
|
||
git checkout -b "${BRANCH_NAME}" | ||
git add . | ||
git commit -m "${COMMIT_MSG}" | ||
|
||
git push origin "${BRANCH_NAME}" | ||
|
||
gh pr create --base main --head "${BRANCH_NAME}" --title "${COMMIT_MSG}" --body "${COMMIT_MSG}" | ||
fi | ||
echo "Nothing to commit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
[submodule "helm-charts"] | ||
path = helm-charts | ||
url = [email protected]:mongodb/helm-charts.git | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule helm-charts
deleted from
e0df8b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: v2 | ||
name: atlas-advanced | ||
description: This chart showcases Atlas Advanced (dedicated) deployment | ||
|
||
type: application | ||
|
||
version: 1.0.0 | ||
|
||
keywords: | ||
- mongodb | ||
- database | ||
- nosql | ||
home: https://github.com/mongodb/mongodb-atlas-kubernetes | ||
icon: https://webimages.mongodb.com/_com_assets/cms/kuyjf3vea2hg34taa-horizontal_default_slate_blue.svg | ||
appVersion: "2.4.1" | ||
maintainers: | ||
- name: MongoDB | ||
email: [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "atlas-advanced.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "atlas-advanced.fullname" -}} | ||
{{- if .Values.deployment.name }} | ||
{{- .Values.deployment.name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.deployment.name }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "atlas-advanced.projectfullname" -}} | ||
{{- if .Values.project.name }} | ||
{{- .Values.project.name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.project.name }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "atlas-advanced.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "atlas-advanced.labels" -}} | ||
helm.sh/chart: {{ include "atlas-advanced.chart" . }} | ||
{{ include "atlas-advanced.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "atlas-advanced.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "atlas-advanced.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{- define "generateRandomString" -}} | ||
{{ randAlphaNum 5 }} | ||
{{- end }} | ||
|
||
{{- define "getInstanceSizeOrFail" -}} | ||
{{- $arg := . -}} | ||
{{ $instances := list "M10" "M20" "M30" "M40" "M50" "M60" "M80" "M100" "M140" "M200" "M300" "R40" "R50" "R60" "R80" "R200" "R300" "R400" "R700" "M40_NVME" "M50_NVME" "M60_NVME" "M80_NVME" "M200_NVME" "M400_NVME" }} | ||
{{- if not (has (toString $arg) $instances)}} | ||
{{- fail (printf "Instance size can only be one of: %s " (join "," $instances)) }} | ||
{{- end }} | ||
{{- $arg -}} | ||
{{- end }} | ||
|
||
{{- define "getProviderNameOrFail" -}} | ||
{{- $arg := . -}} | ||
{{ $providers := list "AWS" "GCP" "AZURE" }} | ||
{{- if not (has (toString $arg) $providers) }} | ||
{{- fail (printf "Provider name can only be one of: %s. Got %s" (join "," $providers) $arg) }} | ||
{{- end }} | ||
{{- $arg -}} | ||
{{- end }} |
33 changes: 33 additions & 0 deletions
33
helm-charts/atlas-advanced/templates/atlas-deployment.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: atlas.mongodb.com/v1 | ||
kind: AtlasDeployment | ||
metadata: | ||
name: {{ include "atlas-advanced.fullname" $ }} | ||
labels: | ||
{{- include "atlas-advanced.labels" $ | nindent 4 }} | ||
namespace: {{ $.Release.Namespace }} | ||
spec: | ||
projectRef: | ||
name: {{ include "atlas-advanced.projectfullname" $ }} | ||
namespace: {{ $.Release.Namespace }} | ||
deploymentSpec: | ||
name: {{ include "atlas-advanced.fullname" $ }} | ||
clusterType: REPLICASET | ||
replicationSpecs: | ||
- zoneName: Zone 1 | ||
regionConfigs: | ||
{{- range $idx, $val := index .Values.deployment.regions }} | ||
- regionName: {{ $val.name }} | ||
electableSpecs: | ||
instanceSize: {{ include "getInstanceSizeOrFail" $val.instanceSize }} | ||
nodeCount: {{ $val.nodeCount }} | ||
providerName: {{ include "getProviderNameOrFail" $val.providerName }} | ||
backingProviderName: {{ include "getProviderNameOrFail" $val.providerName }} | ||
priority: {{ $val.priority }} | ||
{{- if $val.autoscaling.enabled }} | ||
autoScaling: | ||
compute: | ||
enabled: true | ||
minInstanceSize: {{ include "getInstanceSizeOrFail" $val.autoscaling.min }} | ||
maxInstanceSize: {{ include "getInstanceSizeOrFail" $val.autoscaling.max }} | ||
{{- end }} | ||
{{- end }} |
11 changes: 11 additions & 0 deletions
11
helm-charts/atlas-advanced/templates/atlas-mongodb-user-secret.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ include "atlas-advanced.fullname" $ }}-{{ .Values.dbUser.name }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
atlas.mongodb.com/type: "credentials" | ||
{{- include "atlas-advanced.labels" $ | nindent 4 }} | ||
type: Opaque | ||
stringData: | ||
password: {{ .Values.dbUser.password | default (randAlphaNum 32 | b64enc)| quote }} |
18 changes: 18 additions & 0 deletions
18
helm-charts/atlas-advanced/templates/atlas-mongodb-user.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: atlas.mongodb.com/v1 | ||
kind: AtlasDatabaseUser | ||
metadata: | ||
name: {{ include "atlas-advanced.fullname" $ }}-{{ .Values.dbUser.name }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "atlas-advanced.labels" $ | nindent 4 }} | ||
spec: | ||
username: {{ .Values.dbUser.name }} | ||
databaseName: {{ .Values.dbUser.databaseName }} | ||
passwordSecretRef: | ||
name: {{ include "atlas-advanced.fullname" $ }}-{{ .Values.dbUser.name }} | ||
projectRef: | ||
name: {{ include "atlas-advanced.projectfullname" $ }} | ||
namespace: {{ $.Release.Namespace }} | ||
roles: | ||
- roleName: "readWriteAnyDatabase" | ||
databaseName: "admin" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: atlas.mongodb.com/v1 | ||
kind: AtlasProject | ||
metadata: | ||
name: {{ include "atlas-advanced.projectfullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "atlas-advanced.labels" . | nindent 4 }} | ||
spec: | ||
name: {{ include "atlas-advanced.projectfullname" . }} | ||
connectionSecretRef: | ||
name: {{ include "atlas-advanced.fullname" . }}-secret | ||
namespace: {{ $.Release.Namespace }} | ||
projectIpAccessList: | ||
- comment: "Example" | ||
cidrBlock: {{ .Values.project.cidrEntry }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
type: Opaque | ||
metadata: | ||
name: {{ include "atlas-advanced.fullname" . }}-secret | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
atlas.mongodb.com/type: "credentials" | ||
data: | ||
orgId: {{ .Values.secret.orgID | b64enc }} | ||
publicApiKey: {{ .Values.secret.publicKey | b64enc }} | ||
privateApiKey: {{ .Values.secret.privateKey | b64enc }} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: we can remove already right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet. I need to make sure the new workflow works as intended. Then we can remove the old workflow