-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from mongodb/atlas-cluster
Atlas cluster
- Loading branch information
Showing
14 changed files
with
337 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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,20 @@ | ||
apiVersion: v2 | ||
name: atlas-cluster | ||
description: A Helm chart to manage Atlas resources with Atlas operator | ||
|
||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "0.4.0" | ||
maintainers: | ||
- name: MongoDB | ||
email: [email protected] | ||
home: https://github.com/mongodb/mongodb-atlas-kubernetes |
This file contains 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,9 @@ | ||
|
||
Thank you for installing {{ .Chart.Name }}. | ||
|
||
Your release is named {{ .Release.Name }}. | ||
|
||
To learn more about the release, try: | ||
|
||
$ helm status {{ .Release.Name }} | ||
$ helm get all {{ .Release.Name }} |
This file contains 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,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "atlas-cluster.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-cluster.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- 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-cluster.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "atlas-cluster.labels" -}} | ||
helm.sh/chart: {{ include "atlas-cluster.chart" . }} | ||
{{ include "atlas-cluster.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "atlas-cluster.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "atlas-cluster.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "atlas-cluster.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "atlas-cluster.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains 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,65 @@ | ||
apiVersion: atlas.mongodb.com/v1 | ||
kind: AtlasCluster | ||
metadata: | ||
name: {{ include "atlas-cluster.fullname" . }} | ||
labels: | ||
{{- include "atlas-cluster.labels" . | nindent 4 }} | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
name: {{ include "atlas-cluster.fullname" . }} | ||
projectRef: | ||
name: {{ include "atlas-cluster.fullname" . }}-{{ .Values.project.name }} | ||
providerSettings: | ||
{{- with .Values.mongodb.providerSettings }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.mongodb.autoScaling }} | ||
autoScaling: | ||
{{- with .Values.mongodb.autoScaling }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if .Values.mongodb.autoIndexingEnabled }} | ||
autoIndexingEnabled: false | ||
{{- end }} | ||
{{- if .Values.mongodb.biConnector }} | ||
biConnector: | ||
enabled: {{ .Values.mongodb.biConnector.enabled }} | ||
readPreference: {{ .Values.mongodb.biConnector.readPreference }} | ||
{{- end }} | ||
{{- if .Values.mongodb.clusterType }} | ||
clusterType: {{ .Values.mongodb.clusterType }} | ||
{{- end }} | ||
{{- if .Values.mongodb.diskSizeGB }} | ||
diskSizeGB: {{ .Values.mongodb.diskSizeGB }} | ||
{{- end }} | ||
{{- if .Values.mongodb.encryptionAtRestProvider }} | ||
encryptionAtRestProvider: {{ .Values.mongodb.encryptionAtRestProvider }} | ||
{{- end }} | ||
{{- if .Values.mongodb.labels }} | ||
labels: | ||
{{- with .Values.mongodb.labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if .Values.mongodb.mongoDBMajorVersion }} | ||
mongoDBMajorVersion: {{ .Values.mongodb.mongoDBMajorVersion }} | ||
{{- end }} | ||
{{- if .Values.mongodb.numShards }} | ||
numShards: {{ .Values.mongodb.numShards }} | ||
{{- end }} | ||
{{- if .Values.mongodb.paused }} | ||
paused: {{ .Values.mongodb.paused }} | ||
{{- end }} | ||
{{- if .Values.mongodb.pitEnabled }} | ||
pitEnabled: {{ .Values.mongodb.pitEnabled }} | ||
{{- end }} | ||
{{- if .Values.mongodb.providerBackupEnabled }} | ||
providerBackupEnabled: {{ .Values.mongodb.providerBackupEnabled }} | ||
{{- end }} | ||
{{- if .Values.mongodb.replicationSpecs }} | ||
replicationSpecs: | ||
{{- with .Values.mongodb.replicationSpecs }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
13 changes: 13 additions & 0 deletions
13
charts/atlas-cluster/templates/atlas-mongodb-user-secret.yaml
This file contains 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,13 @@ | ||
{{- range .Values.users }} | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ include "atlas-cluster.fullname" $ }}-{{ .username }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "atlas-cluster.labels" $ | nindent 4 }} | ||
type: Opaque | ||
stringData: | ||
password: {{ .password | quote }} | ||
{{- end }} |
This file contains 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,29 @@ | ||
|
||
{{- range .Values.users }} | ||
apiVersion: atlas.mongodb.com/v1 | ||
kind: AtlasDatabaseUser | ||
metadata: | ||
name: {{ include "atlas-cluster.fullname" $ }}-{{ .username }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "atlas-cluster.labels" $ | nindent 4 }} | ||
spec: | ||
username: {{ .username }} | ||
databaseName: {{ .databaseName }} | ||
passwordSecretRef: | ||
name: {{ include "atlas-cluster.fullname" $ }}-{{ .username }}-secret | ||
projectRef: | ||
name: {{ include "atlas-cluster.fullname" $ }}-{{ $.Values.project.name }} | ||
roles: | ||
{{- toYaml .roles | nindent 4 }} | ||
{{- if .deleteAfterDate }} | ||
deleteAfterDate: {{ .deleteAfterDate }} | ||
{{- end }} | ||
{{- if .labels }} | ||
labels: | ||
{{- toYaml .labels | nindent 4 }} | ||
{{- end }} | ||
{{- if .scopes }} | ||
scopes: {{ .scopes }} | ||
{{- end }} | ||
{{- end }} |
This file contains 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,21 @@ | ||
apiVersion: atlas.mongodb.com/v1 | ||
kind: AtlasProject | ||
metadata: | ||
name: {{ include "atlas-cluster.fullname" . }}-{{ .Values.project.name }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "atlas-cluster.labels" . | nindent 4 }} | ||
annotations: | ||
'helm.sh/hook': post-delete,pre-install,pre-upgrade | ||
spec: | ||
name: {{ .Values.project.atlasProjectName }} | ||
connectionSecretRef: | ||
{{- if .Values.atlas.connectionSecretName }} | ||
name: {{ .Values.atlas.connectionSecretName}} | ||
{{- else }} | ||
name: {{ include "atlas-cluster.fullname" . }}-secret | ||
{{- end }} | ||
projectIpAccessList: | ||
{{- with .Values.project.projectIpAccessList }} | ||
{{- toYaml . | nindent 2 }} | ||
{{- end }} |
This file contains 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,20 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
type: Opaque | ||
metadata: | ||
{{- if .Values.atlas.connectionSecretName }} | ||
name: {{ .Values.atlas.connectionSecretName}} | ||
{{- else }} | ||
name: {{ include "atlas-cluster.fullname" . }}-secret | ||
{{- end }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "atlas-cluster.labels" . | nindent 4 }} | ||
annotations: | ||
'helm.sh/hook': post-delete,pre-install,pre-upgrade | ||
data: | ||
orgId: {{ .Values.atlas.orgId| b64enc }} | ||
publicApiKey: {{ .Values.atlas.publicApiKey| b64enc }} | ||
privateApiKey: {{ .Values.atlas.privateApiKey| b64enc }} | ||
|
This file contains 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,61 @@ | ||
mongodb-atlas-operator: | ||
enabled: true | ||
|
||
# Please provide Atlas API credentials and Organization | ||
atlas: | ||
orgId: "<Atlas Organization ID>" | ||
publicApiKey: "<Atlas_api_public_key>" | ||
privateApiKey: "<Atlas_api_private_key>" | ||
|
||
connectionSecretName: "" | ||
|
||
project: | ||
name: my-project | ||
atlasProjectName: "Test Project" | ||
|
||
projectIpAccessList: | ||
- ipAddress: "192.0.2.15" | ||
comment: "IP address for Application Server A" | ||
- ipAddress: "203.0.113.0/24" | ||
comment: "CIDR block for Application Server B - D" | ||
|
||
mongodb: | ||
providerSettings: | ||
instanceSizeName: M10 | ||
providerName: AWS | ||
regionName: US_EAST_1 | ||
|
||
# Optional section. for more information visit | ||
# https://docs.atlas.mongodb.com/reference/api/clusters-create-one/ | ||
# # | ||
# autoScaling: | ||
# autoIndexingEnabled: false | ||
# compute: | ||
# enabled: false | ||
# maxInstanceSize: 'M40' | ||
# minInstanceSize: 'M10' | ||
# scaleDownEnabled: false | ||
# diskGBEnabled: false | ||
# biConnector: | ||
# enabled: false | ||
# readPreference: 'primary' | ||
# clusterType: 'REPLICASET' | ||
# diskSizeGB: '50' | ||
# encryptionAtRestProvider: 'AWS' | ||
# labels: | ||
# mongoDBMajorVersion: '4.4' | ||
# numShards: 2 | ||
# paused: false | ||
# pitEnabled: false | ||
# providerBackupEnabled: false | ||
# replicationSpecs: | ||
users: | ||
- username: admin-user | ||
databaseName: admin | ||
password: "%SomeLong%password$foradmin" | ||
roles: | ||
- databaseName: admin | ||
roleName: atlasAdmin | ||
# deleteAfterDate: | ||
# labels: | ||
# scopes: |
This file contains 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,6 @@ | ||
dependencies: | ||
- name: mongodb-atlas-operator-crds | ||
repository: https://mongodb.github.io/helm-charts | ||
version: 0.1.0 | ||
digest: sha256:a4ca57ea55097c76e2940b2b4146ad672fd093a5b97822bcc5f39c1b2fa536e8 | ||
generated: "2021-03-26T16:16:28.459076Z" |
This file contains 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 |
---|---|---|
|
@@ -16,3 +16,8 @@ home: https://github.com/mongodb/mongodb-atlas-kubernetes | |
maintainers: | ||
- name: MongoDB | ||
email: [email protected] | ||
dependencies: | ||
- name: mongodb-atlas-operator-crds | ||
version: "0.1.0" | ||
repository: "https://mongodb.github.io/helm-charts" | ||
condition: mongodb-enterprise-operator-crds.enabled |
This file contains 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 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