Skip to content

Commit c7c3d2b

Browse files
authored
Merge pull request #12163 from VannTen/cleanup/etcd_inv_sample
Move etcd inventory sample doc to role defaults
2 parents c89c34f + 9c2bdee commit c7c3d2b

File tree

9 files changed

+17
-80
lines changed

9 files changed

+17
-80
lines changed

inventory/sample/group_vars/etcd.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

roles/etcd/meta/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ dependencies:
66
- role: adduser
77
user: "{{ addusers.kube }}"
88
when: not (ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk", "ClearLinux"] or is_fedora_coreos)
9+
- role: etcd_defaults

roles/etcd/templates/etcd-events.env.j2

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,9 @@ ETCD_NAME={{ etcd_member_name }}-events
1313
ETCD_PROXY=off
1414
ETCD_INITIAL_CLUSTER={{ etcd_events_peer_addresses }}
1515
ETCD_AUTO_COMPACTION_RETENTION={{ etcd_compaction_retention }}
16-
{% if etcd_snapshot_count is defined %}
1716
ETCD_SNAPSHOT_COUNT={{ etcd_snapshot_count }}
18-
{% endif %}
19-
{% if etcd_quota_backend_bytes is defined %}
2017
ETCD_QUOTA_BACKEND_BYTES={{ etcd_quota_backend_bytes }}
21-
{% endif %}
22-
{% if etcd_max_request_bytes is defined %}
2318
ETCD_MAX_REQUEST_BYTES={{ etcd_max_request_bytes }}
24-
{% endif %}
2519

2620
# TLS settings
2721
ETCD_TRUSTED_CA_FILE={{ etcd_cert_dir }}/ca.pem

roles/etcd/templates/etcd.env.j2

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,12 @@ ETCD_NAME={{ etcd_member_name }}
1919
ETCD_PROXY=off
2020
ETCD_INITIAL_CLUSTER={{ etcd_peer_addresses }}
2121
ETCD_AUTO_COMPACTION_RETENTION={{ etcd_compaction_retention }}
22-
{% if etcd_snapshot_count is defined %}
2322
ETCD_SNAPSHOT_COUNT={{ etcd_snapshot_count }}
24-
{% endif %}
25-
{% if etcd_quota_backend_bytes is defined %}
2623
ETCD_QUOTA_BACKEND_BYTES={{ etcd_quota_backend_bytes }}
27-
{% endif %}
28-
{% if etcd_max_request_bytes is defined %}
2924
ETCD_MAX_REQUEST_BYTES={{ etcd_max_request_bytes }}
30-
{% endif %}
31-
{% if etcd_log_level is defined %}
3225
ETCD_LOG_LEVEL={{ etcd_log_level }}
33-
{% endif %}
34-
{% if etcd_max_snapshots is defined %}
3526
ETCD_MAX_SNAPSHOTS={{ etcd_max_snapshots }}
36-
{% endif %}
37-
{% if etcd_max_wals is defined %}
3827
ETCD_MAX_WALS={{ etcd_max_wals }}
39-
{% endif %}
4028
# Flannel need etcd v2 API
4129
ETCD_ENABLE_V2=true
4230

roles/etcd/defaults/main.yml renamed to roles/etcd_defaults/defaults/main.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ etcd_script_dir: "{{ bin_dir }}/etcd-scripts"
3434
etcd_heartbeat_interval: "250"
3535
etcd_election_timeout: "5000"
3636

37+
## Set level of detail for etcd exported metrics, specify 'extensive' to include histogram metrics.
3738
etcd_metrics: "basic"
3839

3940
# Define in inventory to set a separate port for etcd to expose metrics on
@@ -46,18 +47,21 @@ etcd_metrics: "basic"
4647
etcd_extra_vars: {}
4748

4849
# Limits
49-
# Limit memory only if <4GB memory on host. 0=unlimited
50-
# This value is only relevant when deploying etcd with `etcd_deployment_type: docker`
50+
## Etcd is restricted by default to 512M on systems under 4GB RAM, 512MB is not enough for much more than testing.
51+
## Set this if your etcd nodes have less than 4GB but you want more RAM for etcd. Set to 0 for unrestricted RAM.
52+
## This value is only relevant when deploying etcd with `etcd_deployment_type: docker`
5153
etcd_memory_limit: "{% if ansible_memtotal_mb < 4096 %}512M{% else %}0{% endif %}"
5254

53-
# The default storage size limit is 2G.
55+
## Etcd has a default of 2G for its space quota. If you put a value in etcd_memory_limit which is less than
56+
## etcd_quota_backend_bytes, you may encounter out of memory terminations of the etcd cluster. Please check
57+
## etcd documentation for more information.
5458
# 8G is a suggested maximum size for normal environments and etcd warns at startup if the configured value exceeds it.
55-
# etcd_quota_backend_bytes: "2147483648"
59+
etcd_quota_backend_bytes: "2147483648"
5660

5761
# Maximum client request size in bytes the server will accept.
5862
# etcd is designed to handle small key value pairs typical for metadata.
5963
# Larger requests will work, but may increase the latency of other requests
60-
# etcd_max_request_bytes: "1572864"
64+
etcd_max_request_bytes: "1572864"
6165

6266
# Uncomment to set CPU share for etcd
6367
# etcd_cpu_limit: 300m
@@ -66,6 +70,7 @@ etcd_blkio_weight: 1000
6670

6771
etcd_node_cert_hosts: "{{ groups['k8s_cluster'] }}"
6872

73+
## Etcd auto compaction retention for mvcc key value store in hour
6974
etcd_compaction_retention: "8"
7075

7176
# Force clients like etcdctl to use TLS certs (different than peer security)
@@ -75,10 +80,10 @@ etcd_secure_client: true
7580
etcd_peer_client_auth: true
7681

7782
# Maximum number of snapshot files to retain (0 is unlimited)
78-
# etcd_max_snapshots: 5
83+
etcd_max_snapshots: 5
7984

8085
# Maximum number of wal files to retain (0 is unlimited)
81-
# etcd_max_wals: 5
86+
etcd_max_wals: 5
8287

8388
# Number of loop retries
8489
etcd_retries: 4
@@ -120,9 +125,11 @@ unsafe_show_logs: false
120125
# Enable distributed tracing
121126
# https://etcd.io/docs/v3.5/op-guide/monitoring/#distributed-tracing
122127
etcd_experimental_enable_distributed_tracing: false
123-
etcd_experimental_distributed_tracing_sample_rate: 100
128+
etcd_experimental_distributed_tracing_sample_rate: 100 # Per million spans
124129
etcd_experimental_distributed_tracing_address: "localhost:4317"
125130
etcd_experimental_distributed_tracing_service_name: etcd
126131

127132
# The interval for etcd watch progress notify events
128133
etcd_experimental_watch_progress_notify_interval: 5s
134+
135+
etcd_log_level: info
File renamed without changes.

roles/kubernetes/control-plane/meta/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ dependencies:
77
- etcd_deployment_type == "kubeadm"
88
- not (ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk", "ClearLinux"] or is_fedora_coreos)
99
- role: network_plugin/calico_defaults
10+
- role: etcd_defaults

roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,10 @@ etcd:
5959
{% if etcd_listen_metrics_urls is defined %}
6060
listen-metrics-urls: "{{ etcd_listen_metrics_urls }}"
6161
{% endif %}
62-
{% if etcd_snapshot_count is defined %}
6362
snapshot-count: "{{ etcd_snapshot_count }}"
64-
{% endif %}
65-
{% if etcd_quota_backend_bytes is defined %}
6663
quota-backend-bytes: "{{ etcd_quota_backend_bytes }}"
67-
{% endif %}
68-
{% if etcd_max_request_bytes is defined %}
6964
max-request-bytes: "{{ etcd_max_request_bytes }}"
70-
{% endif %}
71-
{% if etcd_log_level is defined %}
7265
log-level: "{{ etcd_log_level }}"
73-
{% endif %}
7466
{% for key, value in etcd_extra_vars.items() %}
7567
{{ key }}: "{{ value }}"
7668
{% endfor %}

roles/kubernetes/control-plane/templates/kubeadm-config.v1beta4.yaml.j2

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,14 @@ etcd:
6868
- name: listen-metrics-urls
6969
value: "{{ etcd_listen_metrics_urls }}"
7070
{% endif %}
71-
{% if etcd_snapshot_count is defined %}
7271
- name: snapshot-count
7372
value: "{{ etcd_snapshot_count }}"
74-
{% endif %}
75-
{% if etcd_quota_backend_bytes is defined %}
7673
- name: quota-backend-bytes
7774
value: "{{ etcd_quota_backend_bytes }}"
78-
{% endif %}
79-
{% if etcd_max_request_bytes is defined %}
8075
- name: max-request-bytes
8176
value: "{{ etcd_max_request_bytes }}"
82-
{% endif %}
83-
{% if etcd_log_level is defined %}
8477
- name: log-level
8578
value: "{{ etcd_log_level }}"
86-
{% endif %}
8779
{% for key, value in etcd_extra_vars.items() %}
8880
- name: {{ key }}
8981
value: "{{ value }}"

0 commit comments

Comments
 (0)