Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit 3461d9a

Browse files
author
viovanov
committed
Merge remote-tracking branch 'origin/master' into release-2.5
2 parents 8213dea + 888b997 commit 3461d9a

11 files changed

+47
-131
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{/*
2+
This sets labels on the generated StatefulSets to include the information about
3+
the helm chart.
4+
*/}}
5+
{{- include "_config.load" $ }}
6+
{{- range $ig_name, $ig := .Values.jobs }}
7+
{{- $included := false }}
8+
{{- range $job := $ig }}
9+
{{- $included = list $ $job.condition | include "_config.condition" | eq "true" | or $included }}
10+
{{- end }}
11+
{{- if $included }}
12+
{{- range $key, $value := list $ $ig_name | include "component.labels" | fromYaml }}
13+
- type: replace
14+
path: /instance_groups/name={{ $ig_name }}/env?/bosh/agent/settings/labels/{{ $key | replace "/" "~1" }}
15+
value: {{ $value | quote }}
16+
{{- end }}
17+
{{- end }}
18+
{{- end }}

chart/assets/scripts/jobs/pxc/active_passive_probe.sh

-18
This file was deleted.

chart/assets/scripts/jobs/pxc/entrypoint.sh

+3-24
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,11 @@ fi
2626
# shellcheck disable=SC1091
2727
. /startup-scripts/functions.sh
2828

29-
ipaddr=$(hostname -i | awk ' { print $1 } ')
30-
hostname=$(hostname)
31-
echo "I AM $hostname - $ipaddr"
32-
3329
# if command starts with an option, prepend mysqld
3430
if [ "${1:0:1}" = '-' ]; then
3531
CMDARG=( "$@" )
3632
fi
3733

38-
cluster_join=$(resolveip -s "${K8S_SERVICE_NAME}" || echo "")
39-
if [[ -z "${cluster_join}" ]]; then
40-
echo "I am the Primary Node"
41-
init_mysql
42-
write_password_file
43-
exec mysqld --user=mysql --wsrep_cluster_name="$SHORT_CLUSTER_NAME" --wsrep_node_name="$hostname" \
44-
--wsrep_cluster_address=gcomm:// --wsrep_sst_method=xtrabackup-v2 \
45-
--wsrep_sst_auth="xtrabackup:$XTRABACKUP_PASSWORD" \
46-
--wsrep_node_address="$ipaddr" --pxc_strict_mode="$PXC_STRICT_MODE" "${CMDARG[@]}"
47-
else
48-
echo "I am not the Primary Node"
49-
chown -R mysql:mysql /var/lib/mysql || true # default is root:root 777
50-
touch /var/log/mysqld.log
51-
chown mysql:mysql /var/log/mysqld.log
52-
write_password_file
53-
exec mysqld --user=mysql --wsrep_cluster_name="$SHORT_CLUSTER_NAME" --wsrep_node_name="$hostname" \
54-
--wsrep_cluster_address="gcomm://$cluster_join" --wsrep_sst_method=xtrabackup-v2 \
55-
--wsrep_sst_auth="xtrabackup:$XTRABACKUP_PASSWORD" \
56-
--wsrep_node_address="$ipaddr" --pxc_strict_mode="$PXC_STRICT_MODE" "${CMDARG[@]}"
57-
fi
34+
init_mysql
35+
write_password_file
36+
exec mysqld --user=mysql --pxc_strict_mode="$PXC_STRICT_MODE" "${CMDARG[@]}"

chart/config/unsupported.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ unsupported:
2626
You are reusing an old and incompatible configuration, either via a values.yaml file from an
2727
older release, or by using the --reuse-values option. Please start with a fresh configuration,
2828
only changing settings relative to the defaults in the current release.
29+
30+
# Do not allow replicas for the database; doing this well in Kubernetes is
31+
# more effort than we can expend, and is better handled by external databases.
32+
sizing.database.instances: >
33+
Database replicas are not supported.
34+
KubeCF does not support highly available database configurations;
35+
please use an external database instead.

chart/templates/_stacks.tpl

+9-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555

5656
{{- /* *** Create "$stack.install_buildpacks" and "$stack.releases" from the "api" buildpack jobs *** */}}
5757
{{- $_ := set $stack "install_buildpacks" list }}
58+
{{- $condition := printf "stacks.%s.enabled" $cc_stack.name }}
5859

5960
{{- $_ := include "_config.lookupManifest" (list $ "instance_groups/name=api/jobs") }}
6061
{{- range $job := $.kubecf.retval }}
@@ -66,10 +67,17 @@
6667
{{- $_ := set $stack.releases $job.release dict }}
6768
{{- end }}
6869
{{- /* Set job condition so no spurious references are generated when the stack is disabled */}}
69-
{{- $_ := set $.Values.jobs.api $job.name (dict "condition" (printf "stacks.%s.enabled" $cc_stack.name) "processes" list) }}
70+
{{- $_ := set $.Values.jobs.api $job.name (dict "condition" $condition "processes" list) }}
7071
{{- end }}
7172
{{- end }}
7273

74+
{{- /* Make sure the rootfs-setup job is not referenced when the stack is disabled */}}
75+
{{- $diego_cell := index $.Values.jobs "diego-cell" }}
76+
{{- /* Both stack condition and diego-cell condition must be true to enable rootfs-setup job */}}
77+
{{- $condition = printf "(%s) && (%s)" $condition (index $diego_cell "$default") }}
78+
{{- $job_name := printf "%s-rootfs-setup" $cc_stack.name }}
79+
{{- $_ := set $diego_cell $job_name (dict "condition" $condition "processes" list) }}
80+
7381
{{- /* +----------------------------------------------------------------------------------------------+ */}}
7482
{{- /* | Setup the additional stacks in .config.stacks and merge their releases into .config.releases | */}}
7583
{{- /* +----------------------------------------------------------------------------------------------+ */}}

chart/templates/database/db-configmaps.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ data:
2424
innodb_file_per_table = 1
2525
innodb_autoinc_lock_mode=2
2626
bind_address = 0.0.0.0
27-
wsrep_slave_threads=2
28-
wsrep_cluster_address=gcomm://
29-
wsrep_provider=/usr/lib/galera3/libgalera_smm.so
30-
wsrep_sst_method=xtrabackup-v2
27+
wsrep_on = off
3128
charset.cnf: |-
3229
[client]
3330
default_character_set = utf8

chart/templates/database/db-secrets.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,5 @@ metadata:
2222
spec:
2323
type: password
2424
secretName: var-pxc-password
25-
---
26-
apiVersion: quarks.cloudfoundry.org/v1alpha1
27-
kind: QuarksSecret
28-
metadata:
29-
name: var-xtrabackup-password
30-
namespace: {{ .Release.Namespace | quote }}
31-
labels:
32-
{{- list . "database" | include "component.labels" | nindent 4 }}
33-
spec:
34-
type: password
35-
secretName: var-xtrabackup-password
3625

3726
{{- end }}{{/* .Values.features.embedded_database.enabled */}}

chart/templates/database/db-services.yaml

-20
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,5 @@ spec:
1515
targetPort: mysql
1616
selector:
1717
{{- list . "database" | include "component.selector" | nindent 4 }}
18-
quarks.cloudfoundry.org/pod-active: active
19-
---
20-
apiVersion: v1
21-
kind: Service
22-
metadata:
23-
name: database-repl
24-
namespace: {{ .Release.Namespace | quote }}
25-
labels:
26-
{{- list . "database" | include "component.labels" | nindent 4 }}
27-
spec:
28-
clusterIP: None
29-
ports:
30-
- name: galera
31-
port: 4567
32-
- name: state-xfer
33-
port: 4568
34-
- name: state-snap
35-
port: 4444
36-
selector:
37-
{{- list . "database" | include "component.selector" | nindent 4 }}
3818

3919
{{- end }}{{/* .Values.features.embedded_database.enabled */}}

chart/templates/database/db-statefulset.yaml

+7-50
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,22 @@ metadata:
1010
{{- list . "database" | include "component.labels" | nindent 4 }}
1111
spec:
1212
updateOnConfigChange: true
13-
activePassiveProbes:
14-
database:
15-
periodSeconds: 5
16-
exec:
17-
command:
18-
- /bin/bash
19-
- -c
20-
- |
21-
{{- .Files.Get "assets/scripts/jobs/pxc/active_passive_probe.sh" | nindent 12 }}
2213
template:
2314
metadata:
2415
name: database
2516
namespace: {{ .Release.Namespace | quote }}
2617
labels:
2718
{{- list . "database" | include "component.labels" | nindent 8 }}
2819
spec:
29-
{{- $replicas := 1 }}
30-
{{- if $.Values.sizing.database.instances }}
31-
{{- $replicas = $.Values.sizing.database.instances }}
32-
{{- else if $.Values.high_availability }}
33-
{{- $replicas = 3 }}
34-
{{- end }}
35-
{{- if eq (mod $replicas 2) 0 }}
36-
{{- include "_config.fail" "The number of database instances must be odd to avoid split-brain" }}
37-
{{- end }}
38-
replicas: {{ $replicas }}
20+
# Database replicas are not allowed.
21+
# High-availability is not currently feasible to support in k8s.
22+
# Galera replication on rolling updates of the statefulset is hard to get
23+
# right and to maintain as part of KubeCF. For an HA database, prefer
24+
# using a specialized external one.
25+
replicas: 1
3926
selector:
4027
matchLabels:
41-
{{- list . "database" | include "component.labels" | nindent 10 }}
28+
{{- list . "database" | include "component.selector" | nindent 10 }}
4229
serviceName: database
4330
template:
4431
metadata:
@@ -47,19 +34,6 @@ spec:
4734
spec:
4835
{{- if $.Values.sizing.database.affinity }}
4936
affinity: {{ $.Values.sizing.database.affinity | toJson }}
50-
{{- else }}
51-
affinity:
52-
podAntiAffinity:
53-
preferredDuringSchedulingIgnoredDuringExecution:
54-
- weight: 100
55-
podAffinityTerm:
56-
labelSelector:
57-
matchExpressions:
58-
- key: quarks.cloudfoundry.org/quarks-statefulset-name
59-
operator: In
60-
values:
61-
- database
62-
topologyKey: kubernetes.io/hostname
6337
{{- end }}
6438
initContainers:
6539
- name: remove-lost-found
@@ -89,30 +63,13 @@ spec:
8963
secretKeyRef:
9064
name: var-pxc-password
9165
key: password
92-
- name: XTRABACKUP_PASSWORD
93-
valueFrom:
94-
secretKeyRef:
95-
name: var-xtrabackup-password
96-
key: password
9766
- name: ALLOW_ROOT_FROM
9867
value: "%"
99-
- name: CLUSTER_NAME
100-
value: {{ .Release.Name }}-database
101-
- name: SHORT_CLUSTER_NAME
102-
value: {{ .Release.Name }}-database
103-
- name: K8S_SERVICE_NAME
104-
value: database-repl
10568
- name: PXC_STRICT_MODE
10669
value: ENFORCING
10770
ports:
10871
- name: mysql
10972
containerPort: 3306
110-
- name: galera-repl
111-
containerPort: 4567
112-
- name: state-transfer
113-
containerPort: 4568
114-
- name: state-snapshot
115-
containerPort: 4444
11673
livenessProbe:
11774
exec:
11875
command:

chart/values.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ sizing:
102102
credhub:
103103
instances: ~
104104
database:
105-
instances: ~
106105
persistence:
107106
size: 20Gi
108107
diego_api:

dependencies.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ binaries:
103103
# Additional files we need to download; see http_file() invocation in WORKSPACE.
104104
external_files:
105105
cf_operator:
106-
sha256: b45835a3b629cf099901ba37d1ba99744d99ac32a41b35aafc2e445fd74ad016
106+
sha256: cb8893522bd1b81878186d866becb01bcc67f6c7dacb71e3e0a6e48e9b014410
107107
url: https://s3.amazonaws.com/cf-operators/release/helm-charts/cf-operator-{version}.tgz
108-
version: 6.1.12%2B0.gfc4e8327
108+
version: 6.1.15%2B0.g89a56300
109109
kube_dashboard:
110110
sha256: f849252870818a2971dfc3c4f8a8c5f58a57606bc2b5f221d7ab693e1d1190e0
111111
url: https://raw.githubusercontent.com/kubernetes/dashboard/{version}/aio/deploy/recommended.yaml

0 commit comments

Comments
 (0)