This repository has been archived by the owner on Jan 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
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 #11 from clastix/issues/10
refactoring of helm chart
- Loading branch information
Showing
16 changed files
with
232 additions
and
163 deletions.
There are no files selected for viewing
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: keepalived-config | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "kubelived.labels" . | nindent 4 }} | ||
data: | ||
{{ .Values.keepalived.config_file }}: | | ||
# keepalived global configuration | ||
global_defs { | ||
default_interface KEEPALIVED_INTERFACE | ||
enable_script_security | ||
} | ||
vrrp_script {{ .Values.keepalived.health_service_name }} { | ||
script {{ quote .Values.keepalived.health_service_check }} | ||
interval {{ .Values.keepalived.health_service_interval }} | ||
timeout {{ .Values.keepalived.health_service_timeout }} | ||
rise {{ .Values.keepalived.health_service_rise }} | ||
fall {{ .Values.keepalived.health_service_fall }} | ||
user {{ .Values.keepalived.health_service_user }} | ||
} | ||
vrrp_instance VI_1 { | ||
state {{ upper .Values.keepalived.initial_state }} | ||
interface KEEPALIVED_INTERFACE | ||
virtual_router_id {{ .Values.keepalived.router_id }} | ||
priority KEEPALIVED_PRIORITY | ||
advert_int {{ .Values.keepalived.health_service_interval }} | ||
authentication { | ||
auth_type PASS | ||
auth_pass {{ .Values.keepalived.password | b64enc }} | ||
} | ||
track_script { | ||
{{ .Values.keepalived.health_service_name }} | ||
} | ||
virtual_ipaddress { | ||
{{ .Values.keepalived.virtual_address }} label KEEPALIVED_INTERFACE:VIP | ||
} | ||
{{- if .Values.keepalived.unicast_peers }} | ||
unicast_peer { | ||
{{- range .Values.keepalived.unicast_peers }} | ||
{{ . }} | ||
{{- 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: keepalived-scripts | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "kubelived.labels" . | nindent 4 }} | ||
data: | ||
install.sh: | | ||
#!/bin/sh | ||
if [ ! -e "/etc/kubernetes/manifests/kube-keepalived.yaml" ]; then | ||
echo $(date): "Copying keepalived manifest file to /etc/kubernetes/manifests/kube-keepalived.yaml" | ||
cp /opt/kube-keepalived.yaml /etc/kubernetes/manifests/kube-keepalived.yaml | ||
chmod 600 /etc/kubernetes/manifests/kube-keepalived.yaml | ||
echo $(date): "Copying keepalived config file to {{ .Values.keepalived.config_path }}/{{ .Values.keepalived.config_file }}" | ||
cp /opt/{{ .Values.keepalived.config_file }} {{ .Values.keepalived.config_path }}/{{ .Values.keepalived.config_file }} | ||
echo $(date): "Finding the keepalived interface:" $KEEPALIVED_INTERFACE | ||
KEEPALIVED_INTERFACE={{ .Values.keepalived.interface }} | ||
echo $(date): "Calculating the keepalived priority:" $KEEPALIVED_PRIORITY | ||
KEEPALIVED_PRIORITY=$(ifconfig $KEEPALIVED_INTERFACE | grep 'inet '| awk '{print $2}'| cut -d. -f4) | ||
sed -i "s|KEEPALIVED_INTERFACE|$KEEPALIVED_INTERFACE|g" {{ .Values.keepalived.config_path }}/{{ .Values.keepalived.config_file }} | ||
sed -i "s|KEEPALIVED_PRIORITY|$KEEPALIVED_PRIORITY|g" {{ .Values.keepalived.config_path }}/{{ .Values.keepalived.config_file }} | ||
echo $(date): "Updated the keepalived config file" | ||
else echo $(date): "Already installed keepalived, nothing to do!" | ||
fi | ||
uninstall.sh: | | ||
#!/bin/sh | ||
# | ||
echo $(date): "Removing keepalived manifest file from /etc/kubernetes/manifests/kube-keepalived.yaml" | ||
rm -rf /etc/kubernetes/manifests/kube-keepalived.yaml | ||
echo $(date): "Removing keepalived config file from {{ .Values.keepalived.config_path }}/{{ .Values.keepalived.config_file }}" | ||
rm -rf {{ .Values.keepalived.config_path }}/{{ .Values.keepalived.config_file }} |
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,59 @@ | ||
kind: PodSecurityPolicy | ||
apiVersion: policy/v1beta1 | ||
metadata: | ||
name: {{ include "kubelived.fullname" . }} | ||
labels: | ||
{{- include "kubelived.labels" . | nindent 4 }} | ||
spec: | ||
privileged: true | ||
allowPrivilegeEscalation: true | ||
allowedCapabilities: | ||
- 'NET_ADMIN' | ||
volumes: | ||
- 'configMap' | ||
- 'secret' | ||
- 'hostPath' | ||
hostNetwork: true | ||
runAsUser: | ||
rule: 'RunAsAny' | ||
seLinux: | ||
rule: 'RunAsAny' | ||
supplementalGroups: | ||
rule: 'RunAsAny' | ||
fsGroup: | ||
rule: 'RunAsAny' | ||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: {{ include "kubelived.fullname" . }}-use-psp | ||
labels: | ||
{{- include "kubelived.labels" . | nindent 4 }} | ||
rules: | ||
- apiGroups: | ||
- extensions | ||
resources: | ||
- podsecuritypolicies | ||
resourceNames: | ||
- {{ include "kubelived.fullname" . }} | ||
verbs: | ||
- use | ||
--- | ||
kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: {{ include "kubelived.fullname" . }}-use-psp | ||
labels: | ||
{{- include "kubelived.labels" . | nindent 4 }} | ||
namespace: {{ .Release.Namespace }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "kubelived.fullname" . }}-use-psp | ||
subjects: | ||
- apiGroup: "" | ||
kind: ServiceAccount | ||
name: {{ include "kubelived.serviceAccountName" . }} | ||
- apiGroup: rbac.authorization.k8s.io | ||
kind: Group | ||
name: system:nodes # required to start mirror pods |
4 changes: 2 additions & 2 deletions
4
helm/templates/serviceaccount.yaml → ...s/kubelived/templates/serviceaccount.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
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,45 @@ | ||
# Default values for kubelived. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
installer: | ||
image: | ||
repository: busybox | ||
pullPolicy: IfNotPresent | ||
tag: latest | ||
serviceAccount: | ||
create: true | ||
serviceAccountAnnotations: {} | ||
name: '' | ||
annotations: {} | ||
podAnnotations: {} | ||
hostNetwork: true | ||
nodeSelector: {} | ||
# node-role.kubernetes.io/master: "" | ||
tolerations: [] | ||
# - key: CriticalAddonsOnly | ||
# operator: Exists | ||
# - effect: NoSchedule | ||
# key: node-role.kubernetes.io/master | ||
|
||
keepalived: | ||
image: | ||
repository: bsctl/keepalived | ||
pullPolicy: IfNotPresent | ||
tag: '0.2.0' | ||
config_path: '/etc/keepalived' | ||
config_file: 'keepalived.conf' | ||
initial_state: 'backup' | ||
password: 'password' | ||
health_service_name: 'apiserver' | ||
health_service_check: '/usr/bin/curl -s -k https://localhost:6443/healthz -o /dev/null' | ||
health_service_user: 'root' | ||
health_service_interval: '20' | ||
health_service_timeout: '5' | ||
health_service_rise: '1' | ||
health_service_fall: '1' | ||
router_id: '100' | ||
advertisement_interval: '3' | ||
virtual_address: '10.10.10.250' | ||
interface: 'eth0' | ||
unicast_peers: [] |
Oops, something went wrong.