Skip to content

Commit dfd8271

Browse files
committed
Merge branch 'bugfix/add-refresh-grains-after-sync-all' into q/130.0
2 parents 2740da4 + 4075bee commit dfd8271

File tree

9 files changed

+58
-10
lines changed

9 files changed

+58
-10
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
- Make sure the apiserver is running after reconfiguring the pod
1919
(PR[#4611](https://github.com/scality/metalk8s/pull/4611))
2020

21+
### Enhancements
22+
23+
- Add a `saltutil.refresh_grains` after each `saltutil.sync_all`
24+
to ensure the grains are up to date
25+
(PR[#4598](https://github.com/scality/metalk8s/pull/4598))
26+
2127
## Release 130.0.0
2228

2329
### Enhancements
@@ -77,12 +83,13 @@
7783
(PR[#4563](https://github.com/scality/metalk8s/pull/4563))
7884

7985
- Add a hash annotation to force restart backup server on
80-
certifacate renewal (PR[#4590](https://github.com/scality/metalk8s/pull/4590))
86+
certificate renewal (PR[#4590](https://github.com/scality/metalk8s/pull/4590))
8187

8288
- Add alerts for a CronJob owned Job failure and another one for
83-
non-CronJob owned Job failure
89+
non-CronJob owned Job failure
8490
(PR[#4584](https://github.com/scality/metalk8s/pull/4584))
8591

92+
8693
## Release 129.0.3 (in development)
8794

8895
### Enhancements

salt/metalk8s/orchestrate/apiserver.sls

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ Sync {{ node }} minion:
1717
- kwarg:
1818
saltenv: metalk8s-{{ dest_version }}
1919

20+
Refresh {{ node }} grains:
21+
salt.function:
22+
- name: saltutil.refresh_grains
23+
- tgt: {{ node }}
24+
- timeout: 120
25+
- require:
26+
- salt: Sync {{ node }} minion
27+
2028
Check pillar on {{ node }}:
2129
salt.function:
2230
- name: metalk8s.check_pillar_keys
@@ -31,7 +39,7 @@ Check pillar on {{ node }}:
3139
- retry:
3240
attempts: 5
3341
- require:
34-
- salt: Sync {{ node }} minion
42+
- salt: Refresh {{ node }} grains
3543

3644
Deploy apiserver {{ node }} to {{ dest_version }}:
3745
salt.state:

salt/metalk8s/orchestrate/bootstrap/init.sls

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ Sync bootstrap minion:
9090
- kwarg:
9191
saltenv: metalk8s-{{ version }}
9292

93+
Refresh bootstrap minion grains:
94+
salt.function:
95+
- name: saltutil.refresh_grains
96+
- tgt: {{ pillar.bootstrap_id }}
97+
- timeout: 120
98+
- require:
99+
- salt: Sync bootstrap minion
100+
93101
Deploy CA role on bootstrap minion:
94102
salt.state:
95103
- tgt: {{ pillar.bootstrap_id }}
@@ -98,15 +106,15 @@ Deploy CA role on bootstrap minion:
98106
- saltenv: metalk8s-{{ version }}
99107
- pillar: {{ pillar_data | tojson }}
100108
- require:
101-
- salt: Sync bootstrap minion
109+
- salt: Refresh bootstrap minion grains
102110

103111
Bring bootstrap minion to highstate:
104112
salt.state:
105113
- tgt: {{ pillar.bootstrap_id }}
106114
- highstate: true
107115
- pillar: {{ pillar_data | tojson }}
108116
- require:
109-
- salt: Sync bootstrap minion
117+
- salt: Refresh bootstrap minion grains
110118
- salt: Deploy CA role on bootstrap minion
111119

112120
Wait for API server to be available:

salt/metalk8s/orchestrate/deploy_node.sls

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,22 @@ Sync module on the node:
108108
- kwarg:
109109
saltenv: metalk8s-{{ version }}
110110
111+
Refresh the node grains:
112+
salt.function:
113+
- name: saltutil.refresh_grains
114+
- tgt: {{ node_name }}
115+
- timeout: 120
116+
- require:
117+
- salt: Sync module on the node
118+
111119
Set grains:
112120
salt.state:
113121
- tgt: {{ node_name }}
114122
- saltenv: metalk8s-{{ version }}
115123
- sls:
116124
- metalk8s.node.grains
117125
- require:
118-
- salt: Sync module on the node
126+
- salt: Refresh the node grains
119127
120128
Refresh the mine:
121129
salt.function:
@@ -167,7 +175,7 @@ Check pillar before salt-minion configuration:
167175
- retry:
168176
attempts: 5
169177
- require:
170-
- salt: Sync module on the node
178+
- salt: Refresh the node grains
171179
172180
Reconfigure salt-minion:
173181
salt.state:
@@ -216,7 +224,7 @@ Check pillar before etcd deployment:
216224
- retry:
217225
attempts: 5
218226
- require:
219-
- salt: Sync module on the node
227+
- salt: Refresh the node grains
220228
- salt: Wait minion available
221229
222230
Install etcd node:
@@ -271,7 +279,7 @@ Check pillar before highstate:
271279
- retry:
272280
attempts: 5
273281
- require:
274-
- salt: Sync module on the node
282+
- salt: Refresh the node grains
275283
- http: Wait for API server to be available before highstate
276284
277285
Run the highstate:

salt/metalk8s/orchestrate/etcd.sls

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ Sync {{ node }} minion:
1818
- kwarg:
1919
saltenv: metalk8s-{{ dest_version }}
2020

21+
Refresh {{ node }} grains:
22+
salt.function:
23+
- name: saltutil.refresh_grains
24+
- tgt: {{ node }}
25+
- timeout: 120
26+
- require:
27+
- salt: Sync {{ node }} minion
28+
2129
Check pillar on {{ node }}:
2230
salt.function:
2331
- name: metalk8s.check_pillar_keys
@@ -32,7 +40,7 @@ Check pillar on {{ node }}:
3240
- retry:
3341
attempts: 5
3442
- require:
35-
- salt: Sync {{ node }} minion
43+
- salt: Refresh {{ node }} grains
3644

3745
Deploy etcd {{ node }} to {{ dest_version }}:
3846
salt.state:

scripts/bootstrap.sh.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ orchestrate_bootstrap() {
133133
refresh=True \
134134
saltenv=metalk8s-@@VERSION
135135

136+
run "Refreshing grains on bootstrap minion" \
137+
salt-call --state-output=mixed saltutil.refresh_grains
138+
136139
run "Deploying bootstrap node (this may take a while)" \
137140
"${SALT_MASTER_CALL[@]}" salt-run --state-output=mixed state.orchestrate \
138141
metalk8s.orchestrate.bootstrap \

scripts/common.sh.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ configure_salt_minion_local_mode() {
307307

308308
"$SALT_CALL" --file-root="$file_root" \
309309
--local --retcode-passthrough saltutil.sync_all saltenv=base
310+
"$SALT_CALL" --file-root="$file_root" \
311+
--local --retcode-passthrough saltutil.refresh_grains
310312
# Workaround waiting for Rocky Linux support in Salt
311313
"$SALT_CALL" --file-root="$file_root" \
312314
--local --retcode-passthrough state.sls \

scripts/restore.sh.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ configure_salt_master() {
203203
refresh=True \
204204
saltenv=metalk8s-@@VERSION
205205

206+
"${SALT_CALL}" --retcode-passthrough saltutil.refresh_grains
207+
206208
"${SALT_CALL}" --retcode-passthrough --state-output=mixed state.sls \
207209
metalk8s.kubernetes.kubelet \
208210
saltenv=metalk8s-@@VERSION \

scripts/upgrade.sh.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ trap cleanup EXIT
7878

7979
upgrade_bootstrap () {
8080
"$SALT_CALL" saltutil.sync_all saltenv="$SALTENV"
81+
"$SALT_CALL" saltutil.refresh_grains
8182

8283
SALT_MASTER_CALL=(crictl exec -i "$(get_salt_container)")
8384
"${SALT_MASTER_CALL[@]}" salt-run state.orchestrate \
@@ -86,6 +87,7 @@ upgrade_bootstrap () {
8687

8788
# Upgrade salt-master in local mode since salt-master will restart
8889
"$SALT_CALL" --local saltutil.sync_all saltenv="$SALTENV" refresh=True
90+
"$SALT_CALL" --local saltutil.refresh_grains
8991
"$SALT_CALL" --local --retcode-passthrough state.sls \
9092
metalk8s.salt.master.installed saltenv="$SALTENV"
9193
}

0 commit comments

Comments
 (0)