Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Malte Münch <[email protected]>
  • Loading branch information
mxmxchere committed Aug 31, 2022
0 parents commit 2c20287
Show file tree
Hide file tree
Showing 10 changed files with 539 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A helmchart to deploy etcd for the garden-kube-apiserver
19 changes: 19 additions & 0 deletions charts/etcd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
description: Helm chart for etcd
name: garden-etcd
appVersion: v3.3.10
version: 4.0.0
90 changes: 90 additions & 0 deletions charts/etcd/templates/configmap-etcd-bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.name }}-bootstrap
namespace: {{ .Release.Namespace }}
labels:
app: etcd
data:
bootstrap.sh: |-
#!/bin/sh
if [ ! -d /var/etcd/data/new.etcd ]; then
mkdir /var/etcd/data/new.etcd
fi
while true;
do
wget http://localhost:8080/initialization/status -S -O status;
STATUS=`cat status`;
case $STATUS in
"New")
wget http://localhost:8080/initialization/start -S -O - ;;
"Progress")
sleep 1;
continue;;
"Failed")
continue;;
"Successful")
exec etcd --config-file /bootstrap/etcd.conf.yml
;;
esac;
done
etcd.conf.yml: |-
# This is the configuration file for the etcd server.
# Human-readable name for this member.
name: etcd
client-transport-security:
# Path to the client server TLS cert file.
cert-file: /var/etcd/ssl/server/tls.crt
# Path to the client server TLS key file.
key-file: /var/etcd/ssl/server/tls.key
# Enable client cert authentication.
client-cert-auth: true
# Path to the client server TLS trusted CA cert file.
trusted-ca-file: /var/etcd/ssl/ca/ca.crt
# Client TLS using generated certificates
auto-tls: false
# Path to the data directory.
data-dir: /var/etcd/data/new.etcd
# List of this member's client URLs to advertise to the public.
# The URLs needed to be a comma-separated list.
advertise-client-urls: https://0.0.0.0:2379
# List of comma separated URLs to listen on for client traffic.
listen-client-urls: https://0.0.0.0:2379
# Initial cluster token for the etcd cluster during bootstrap.
initial-cluster-token: 'new'
# Initial cluster state ('new' or 'existing').
initial-cluster-state: 'new'
# Number of committed transactions to trigger a snapshot to disk.
snapshot-count: 75000
# Raise alarms when backend size exceeds the given quota. 0 means use the
# default quota.
quota-backend-bytes: 8589934592
24 changes: 24 additions & 0 deletions charts/etcd/templates/secret-etcd-backup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if .Values.backup.storageProvider }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.name }}-backup
namespace: {{ .Release.Namespace }}
type: Opaque
data:
{{ toYaml .Values.backup.secretData | indent 2 }}
{{- end }}
23 changes: 23 additions & 0 deletions charts/etcd/templates/secret-etcd-ca.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.name }}-ca
namespace: {{ .Release.Namespace }}
type: Opaque
data:
ca.crt: {{ .Values.tls.ca.crt | b64enc }}
ca.key: {{ .Values.tls.ca.key | b64enc }}
24 changes: 24 additions & 0 deletions charts/etcd/templates/secret-etcd-client-tls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.name }}-client
namespace: {{ .Release.Namespace }}
type: kubernetes.io/tls
data:
ca.crt: {{ .Values.tls.ca.crt | b64enc }}
tls.crt: {{ .Values.tls.client.crt | b64enc }}
tls.key: {{ .Values.tls.client.key | b64enc }}
24 changes: 24 additions & 0 deletions charts/etcd/templates/secret-etcd-server-tls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.name }}-server
namespace: {{ .Release.Namespace }}
type: kubernetes.io/tls
data:
ca.crt: {{ .Values.tls.ca.crt | b64enc }}
tls.crt: {{ .Values.tls.server.crt | b64enc }}
tls.key: {{ .Values.tls.server.key | b64enc }}
33 changes: 33 additions & 0 deletions charts/etcd/templates/service-etcd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Service
metadata:
name: {{ .Values.name }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Values.name }}
component: etcd
spec:
type: ClusterIP
sessionAffinity: None
selector:
app: {{ .Values.name }}
component: etcd
ports:
- name: client
protocol: TCP
port: 2379
targetPort: 2379
Loading

0 comments on commit 2c20287

Please sign in to comment.