Skip to content

Commit 9cb5ad8

Browse files
authored
Merge pull request #83366 from ShaunaDiaz/OSDOCS-11688
OSDOCS-11688: adds drop-in config MicroShift
2 parents 64d47d6 + 7e7afb5 commit 9cb5ad8

File tree

2 files changed

+164
-0
lines changed

2 files changed

+164
-0
lines changed

microshift_configuring/microshift-using-config-yaml.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ include::modules/microshift-config-yaml-custom.adoc[leveloffset=+1]
1818

1919
include::modules/microshift-config-parameters-table.adoc[leveloffset=+2]
2020

21+
include::modules/microshift-config-snippets.adoc[leveloffset=+2]
22+
2123
include::modules/microshift-nw-advertise-address.adoc[leveloffset=+2]
2224

2325
include::modules/microshift-config-nodeport-limits.adoc[leveloffset=+2]
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * microshift_configuring/microshift-using-config-yaml.adoc
4+
5+
:_mod-docs-content-type: CONCEPT
6+
[id="microshift-config-snippets_{context}"]
7+
= Using configuration snippets
8+
9+
If you want to configure one or two settings, such as adding subject alternative names (SANs), you can use the `/etc/microshift/config.d/` configuration directory to drop in configuration snippet YAML files. You must restart {microshift-short} for new configurations to apply.
10+
11+
To return to previous values, you can delete a configuration snippet and restart {microshift-short}.
12+
13+
[id="microshift-how-config-snippets-work_{context}"]
14+
== How configuration snippets work
15+
16+
At runtime, the YAML files inside `/etc/microshift/config.d` are merged into the existing {microshift-short} configuration, whether that configuration is a result of default values or a user-created `config.yaml` file. You do not need to create a `config.yaml` file to use a configuration snippet.
17+
18+
Files in the snippet directory are sorted in lexicographical order and run sequentially. You can use numerical prefixes for snippets so that each is read in the order you want. The last-read file takes precedence when there is more than one YAML for the same parameter.
19+
20+
[IMPORTANT]
21+
====
22+
Configuration snippets take precedence over both default values and a customized `config.yaml` configuration file.
23+
====
24+
25+
[id="microshift-example-list-config-snippets_{context}"]
26+
== Example list configuration snippets
27+
28+
Lists, or arrays, are not merged, they are overwritten. For example, you can replace a SAN or list of SANs by creating an additional snippet for the same field that is read after the first:
29+
30+
.{microshift-short} configuration directory contents
31+
* `/etc/microshift/config.yaml.default` or `/etc/microshift/config.yaml`
32+
33+
.Example {microshift-short} configuration snippet directory contents
34+
* `/etc/microshift/config.d/10-san.yaml`
35+
* `/etc/microshift/config.d/20-san.yaml`
36+
+
37+
.Example `10-san.yaml` snippet
38+
[source,yaml]
39+
----
40+
apiServer:
41+
subjectAltNames:
42+
- host1
43+
- host2
44+
----
45+
+
46+
.Example `20-san.yaml` snippet
47+
[source,yaml]
48+
----
49+
apiServer:
50+
subjectAltNames:
51+
- hostZ
52+
----
53+
+
54+
.Example configuration result
55+
[source,yaml]
56+
----
57+
apiServer:
58+
subjectAltNames:
59+
- hostZ
60+
----
61+
62+
If you want to add a value to an existing list, you can add it to an existing snippet. For example, to add `hostZ` to an existing list of SANs, edit the snippet you have instead of creating a new one:
63+
64+
.Example `10-san.yaml` snippet
65+
[source,yaml]
66+
----
67+
apiServer:
68+
subjectAltNames:
69+
- host1
70+
- host2
71+
- hostZ
72+
----
73+
74+
.Example configuration result
75+
[source,yaml]
76+
----
77+
apiServer:
78+
subjectAltNames:
79+
- host1
80+
- host2
81+
- hostZ
82+
----
83+
84+
[id="microshift-example-object-config-snippets_{context}"]
85+
== Example object configuration snippets
86+
87+
Objects are merged together.
88+
89+
.Example `10-advertiseAddress.yaml` snippet
90+
[source,yaml]
91+
----
92+
apiServer:
93+
advertiseAddress: "microshift-example"
94+
----
95+
96+
.Example `20-audit-log.yaml` snippet
97+
[source,yaml]
98+
----
99+
apiServer:
100+
auditLog:
101+
maxFileAge: 12
102+
----
103+
104+
.Example configuration result
105+
[source,yaml]
106+
----
107+
apiServer:
108+
advertiseAddress: "microshift-example"
109+
auditLog:
110+
maxFileAge: 12
111+
----
112+
113+
[id="microshift-example-mixed-config-snippets_{context}"]
114+
== Example mixed configuration snippets
115+
116+
In this example, the values of both `advertiseAddress` and `auditLog.maxFileAge` fields are merged into the configuration, but only the `c.com` and `d.com` `subjectAltNames` values are retained because the numbering in the filename indicates that they are higher priority.
117+
118+
.Example `10-advertiseAddress.yaml` snippet
119+
[source,yaml]
120+
----
121+
apiServer:
122+
advertiseAddress: "microshift-example"
123+
----
124+
125+
.Example `20-audit-log.yaml` snippet
126+
[source,yaml]
127+
----
128+
apiServer:
129+
auditLog:
130+
maxFileAge: 12
131+
----
132+
133+
.Example `30-SAN.yaml` snippet
134+
[source,yaml]
135+
----
136+
apiServer:
137+
subjectAltNames:
138+
- a.com
139+
- b.com
140+
----
141+
142+
.Example `40-SAN.yaml` snippet
143+
[source,yaml]
144+
----
145+
apiServer:
146+
subjectAltNames:
147+
- c.com
148+
- d.com
149+
----
150+
151+
.Example configuration result
152+
[source,yaml]
153+
----
154+
apiServer:
155+
advertiseAddress: "microshift-example"
156+
auditLog:
157+
maxFileAge: 12
158+
subjectAltNames:
159+
- c.com
160+
- d.com
161+
----
162+

0 commit comments

Comments
 (0)