Skip to content

Commit 7541e1a

Browse files
committed
feat: add a 'settings' section to 'config.yaml'
1 parent 0631890 commit 7541e1a

File tree

5 files changed

+36
-10
lines changed

5 files changed

+36
-10
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,29 @@ The [`config.yaml`](installer/config.yaml) file is structured to outline key com
6161
---
6262
tssc:
6363
namespace: tssc
64+
settings: {}
6465
products: {}
6566
dependencies: {}
6667
```
6768
6869
The attributes of the `tssc` object are as follows:
6970

7071
- `.namespace`: Specifies the default namespace used by the installer, set to `tssc`. This namespace acts as the primary operational area for the installation process.
72+
- `.settings`: Defines the settings of the deployment. This can control a wide set of properties.
7173
- `.products`: Defines the features to be deployed by the installer. Each feature is identified by a unique name and a set of properties.
7274
- `.dependencies`: Specifies the dependencies rolled out by the installer in the specific order defined in the configuration file.
7375

76+
## `tssc.settings`
77+
78+
Defines the settings of the deployment. This can control a wide set of properties. For example the following snippet flags the deployment as a CRC deployment, so that the configuration can be tuned to that particular usecase.
79+
80+
```yaml
81+
---
82+
tssc:
83+
settings:
84+
crc: true
85+
```
86+
7487
## `tssc.products`
7588

7689
Defines the products the installer will deploy. Each product is defined by a unique name and a set of properties. For instance, the following snippet defines a `productName` block:
@@ -118,6 +131,12 @@ Windows users must be aware that the hook scripts are written in Bash and may no
118131

119132
The following functions are available for use in the [`values.yaml.tpl`](./installer/charts/values.yaml.tpl) file:
120133

134+
### `{{ .Installer.Settings.* }}`
135+
136+
A dictionary of key-value pairs for the installer's settings.
137+
138+
This is currently mainly a placeholder for future configuration settings that would impact more than a single product.
139+
121140
### `{{ .Installer.Products.* }}`
122141

123142
- `{{ .Installer.Products.*.Enabled }}`: Returns the boolean value of the product's `enabled` field.

installer/charts/values.yaml.tpl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- $crc := required "CRC settings" .Installer.Products.crc -}}
1+
{{- $crc := required "CRC settings" .Installer.Settings.crc -}}
22
{{- $tas := required "TAS settings" .Installer.Products.trustedArtifactSigner -}}
33
{{- $tpa := required "TPA settings" .Installer.Products.trustedProfileAnalyzer -}}
44
{{- $keycloak := required "Keycloak settings" .Installer.Products.keycloak -}}
@@ -14,7 +14,7 @@
1414
{{- $odfNamespace := "openshift-storage" -}}
1515
---
1616
debug:
17-
ci: false
17+
ci: {{ dig "ci" "debug" false .Installer.Settings -}}
1818

1919
#
2020
# tssc-openshift
@@ -141,10 +141,10 @@ backingServices:
141141
route:
142142
host: {{ $keycloakRouteHost }}
143143
tls:
144-
enabled: {{ not $crc.Enabled }}
144+
enabled: {{ not $crc }}
145145
secretName: {{ $keycloakRouteTLSSecretName }}
146146
termination: reencrypt
147-
{{- if $crc.Enabled }}
147+
{{- if $crc }}
148148
annotations:
149149
route.openshift.io/termination: reencrypt
150150
{{- end }}
@@ -280,7 +280,7 @@ developerHub:
280280
{{- $tpaOIDCClientsSecretName := "tpa-realm-chicken-clients" }}
281281
{{- $tpaTestingUsersEnabled := false }}
282282
{{- $protocol := "https" -}}
283-
{{- if $crc.Enabled }}
283+
{{- if $crc }}
284284
{{- $protocol = "http" }}
285285
{{- end }}
286286
{{- $tpaRealmPath := "realms/chicken" }}
@@ -334,7 +334,7 @@ redhat-trusted-profile-analyzer:
334334
openshift: &tpaOpenShift
335335
# In practice it toggles "https" vs. "http" for TPA components, for CRC it's
336336
# easier to focus on "http" communication only.
337-
useServiceCa: {{ not $crc.Enabled }}
337+
useServiceCa: {{ not $crc }}
338338
database: &tpaDatabase
339339
name:
340340
valueFrom:
@@ -397,7 +397,7 @@ trustification:
397397
oidc: *tpaOIDC
398398
ingress: *tpaIngress
399399
tls:
400-
serviceEnabled: "{{ not $crc.Enabled }}"
400+
serviceEnabled: "{{ not $crc }}"
401401

402402
#
403403
# tssc-tas
@@ -419,7 +419,7 @@ trustedArtifactSigner:
419419
fulcio:
420420
oidc:
421421
clientID: trusted-artifact-signer
422-
{{- if $crc.Enabled }}
422+
{{- if $crc }}
423423
issuerURL: {{ printf "http://%s/%s" $keycloakRouteHost $tasRealmPath }}
424424
{{- else }}
425425
issuerURL: {{ printf "https://%s/%s" $keycloakRouteHost $tasRealmPath }}

installer/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
tssc:
33
namespace: &installerNamespace tssc
4+
settings:
5+
crc: false
46
products:
5-
crc:
6-
enabled: false
77
trustedProfileAnalyzer:
88
enabled: &tpaEnabled true
99
namespace: &trustedProfileAnalyzerNamespace tssc-tpa

pkg/config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ type Spec struct {
1616
// deployed. Note, Helm charts deployed by the installer are likely to use a
1717
// different namespace.
1818
Namespace string `yaml:"namespace"`
19+
// Settings contains the configuration for the installer settings.
20+
Settings map[string]interface{} `yaml:"settings"`
1921
// Products contains the configuration for the installer products.
2022
Products map[string]ProductSpec `yaml:"products"`
2123
// Dependencies contains the installer Helm chart dependencies.

pkg/engine/engine_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const testYamlTmpl = `
1616
---
1717
root:
1818
namespace: {{ .Installer.Namespace }}
19+
settings:
20+
key: value
1921
products:
2022
{{- range $k, $v := .Installer.Products }}
2123
{{- $k | nindent 4 }}:
@@ -62,6 +64,9 @@ func TestEngine_Render(t *testing.T) {
6264
g.Expect(root).To(o.HaveKey("namespace"))
6365
g.Expect(root["namespace"]).To(o.Equal(cfg.Installer.Namespace))
6466

67+
g.Expect(root).To(o.HaveKey("settings"))
68+
g.Expect(root["settings"]).NotTo(o.BeNil())
69+
6570
g.Expect(root).To(o.HaveKey("products"))
6671
g.Expect(root["products"]).NotTo(o.BeNil())
6772

0 commit comments

Comments
 (0)