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

Separate S3 SD charts. #21

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
22 changes: 22 additions & 0 deletions mongoose-s3/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions mongoose-s3/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
appVersion: "4.2.17"
description: Mongoose chart with S3 storage driver and additional specfic params.
name: mongoose-s3
version: alpha
home: https://github.com/emc-mongoose/mongoose-storage-driver-s3
17 changes: 17 additions & 0 deletions mongoose-s3/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-----------------------------------------
Generate shell command for initContainers
-----------------------------------------
*/}}
{{- define "mongoose.makeShellCommand" -}}
{{- $nodeCount := ((add (.Values.replicas|int) -1)|int) -}}
{{- if gt $nodeCount 0 -}}
{{- range $index, $e := until $nodeCount -}}
{{- printf "\n\t\t" -}}
{{- printf `while [ $( curl -s -o /dev/null -w "%{http_code}" ` -}}
{{- printf "http://%s-%d.%s:%d/config" $.Values.pod.name $index $.Values.service.name 9999 -}}
{{- printf ") -ne 200]; do sleep 3; done;" -}}
{{- end -}}
{{- else }}
{{- print " " }}
{{- end }}
{{- end }}
63 changes: 63 additions & 0 deletions mongoose-s3/templates/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{- define "mnodes" -}}
{{- $dr := dict "nodes" (list) -}}
{{- $name := .Chart.Name -}}
{{- range int .Values.replicas | until -}}
{{- $noop := printf "%s-%d.%s" $name . $name | append $dr.nodes | set $dr "nodes" -}}
{{- end -}}
{{- join "," $dr.nodes -}}
{{- end -}}

apiVersion: v1
kind: Pod
metadata:
name: {{ .Chart.Name }}
labels:
mongoose-role: entry-node

spec:
initContainers:
- name: wait-for-nodes
image: busybox:1.28
command: ['sh',
'-c',
'{{ template "mongoose.makeShellCommand" . }}'
]
containers:
- image: "{{ .Values.image.name }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
name: mongoose-container
args: {{- printf " [" -}}

{{- $nodeCount := ((add (.Values.replicas|int) -1)|int) -}}
{{- if gt $nodeCount 0 -}}
{{- printf "\"--load-step-node-addrs=" -}}
{{ template "mnodes" . }}
{{- printf "\"" -}}
{{- end -}}

{{ if (ne $.Values.args "") and (ne $.Values.args nil) }}
{{- if gt $nodeCount 0 -}}
{{- printf "," }}
{{ end }}
{{- .Values.args -}}
{{ end }}

{{ if (eq $.Values.args "") or (eq $.Values.args nil) }}
--storage-auth-uid={{ required "s3.accessKey is required" .Values.s3.accessKey }}
Copy link
Member

Choose a reason for hiding this comment

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

I guess, we need also add --storage-net-node-port argument

--storage-auth-secret={{ required "s3.secretKey is required" .Values.s3.secretKey }}
--storage-net-node-addrs={{ required "s3.addresses is required" .Values.s3.addresses }}
{{ end }}

{{- printf "]" }}

{{- with .Values.resources }}
resources:
limits:
cpu: {{ quote .limits.cpu }}
memory: {{ quote .limits.memory }}
requests:
cpu: {{ quote .requests.cpu }}
memory: {{ quote .requests.memory }}
{{- end }}

restartPolicy: OnFailure
18 changes: 18 additions & 0 deletions mongoose-s3/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# service only for debug
{{- if .Values.debug }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.service.name }}
spec:
{{- if .Values.serviceAccount }}
serviceAccountName: {{ .Values.serviceAccount }}
{{- end }}
type: {{ .Values.service.type }}
ports:
- name: debug
port: 5005
targetPort: 5005
selector:
mongoose-role: entry-node
{{- end }}
54 changes: 54 additions & 0 deletions mongoose-s3/templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Values.pod.name }}
spec:
{{- $count := ((add (.Values.replicas|int) -1)|int) -}}
{{ if lt $count 1}}
replicas: 0
{{ else }}
replicas: {{ $count }}
{{ end }}
selector:
matchLabels:
name: {{ .Values.pod.name }}
serviceName: {{ .Values.pod.name }}
podManagementPolicy: Parallel
template:
metadata:
labels:
mongoose-role: additional-node
name: {{ .Values.pod.name }}
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values: [{{ quote .Values.pod.name }}]
topologyKey: "kubernetes.io/hostname"
containers:
- image: "{{ .Values.image.name }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
name: {{ .Values.pod.name }}
args: ["--run-node"]

{{- with .Values.resources }}
resources:
limits:
cpu: {{ quote .limits.cpu }}
memory: {{ quote .limits.memory }}
requests:
cpu: {{ quote .requests.cpu }}
memory: {{ quote .requests.memory }}
{{- end }}

ports:
- containerPort: 1099
- containerPort: 9999
{{ if .Values.debug }}
- containerPort: 5005
command: ["/opt/mongoose/entrypoint_debug.sh"]
{{- end }}
53 changes: 53 additions & 0 deletions mongoose-s3/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

########################################################
#### Default values for S3 SD chart.
########################################################

#### Number of Mongoose replicas to deploy

replicas: 1

#### Since mongoose version 4 there is one image for controller and for peer (driver) nodes
#### The mongoose image configuration

image:
name: emcmongoose/mongoose-storage-driver-s3
tag: "latest"
pullPolicy: Always

pod:
name: mongoose-node

service:
name: mongoose-svc
type: LoadBalancer

resources:
limits:
cpu: "4"
memory: "4Gi"
requests:
cpu: "4"
memory: "4Gi"

serviceAccount : ""

debug: false


################## Mongoose CLI args ##################

args: ""

############### Mongoose scenario #####################

scenario: "Load.run();"

############ Storage Driver S3 CLI args ##########

s3: {}
# REQUIRED SETTINGS
# addresses: my-cluster-s3.ecs.cluster.local
# port: 80
# accessKey: my-access-key
# secretKey: my-secret-key