Skip to content

Commit 2a78663

Browse files
CopilotCrow-Control
andcommitted
feat(common): add settings property to addons schema (#44937)
The addons schema structure needed explicit support for addon-specific settings as a sub-key, allowing consistent configuration patterns across all addon types. ## Changes - **addons.json**: Added `settings` property to the main addon schema definition with `additionalProperties: true` for flexibility across addon types - **tailscale.json**: Already contains complete settings schema with all 11 configuration keys (config, authkey, userspace, auth_once, accept_dns, routes, dest_ip, sock5_server, extra_args, daemon_extra_args, outbound_http_proxy_listen) ## Schema Structure ```yaml addons: tailscale: enabled: true container: { ... } settings: # Now explicitly recognized in schema authkey: "..." userspace: true routes: "..." # ... other addon-specific settings ``` The settings property provides a standardized location for addon-specific configuration while maintaining backward compatibility through `additionalProperties`. <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: PrivatePuffin <7613738+PrivatePuffin@users.noreply.github.com>
1 parent 86ddadd commit 2a78663

File tree

6 files changed

+131
-99
lines changed

6 files changed

+131
-99
lines changed

charts/library/common-test/tests/addons/tailscale_test.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ tests:
3232
addons:
3333
tailscale:
3434
enabled: true
35-
container:
36-
env:
37-
TS_AUTH_KEY: something
35+
settings:
36+
authkey: something
3837
asserts:
3938
- hasDocuments:
4039
count: 2
@@ -143,10 +142,9 @@ tests:
143142
addons:
144143
tailscale:
145144
enabled: true
146-
container:
147-
env:
148-
TS_AUTH_KEY: something
149-
TS_USERSPACE: false
145+
settings:
146+
authkey: something
147+
userspace: false
150148
asserts:
151149
- hasDocuments:
152150
count: 2
@@ -238,9 +236,8 @@ tests:
238236
addons:
239237
tailscale:
240238
enabled: true
241-
container:
242-
env:
243-
TS_AUTH_KEY: something
239+
settings:
240+
authkey: something
244241
asserts:
245242
- hasDocuments:
246243
count: 2

charts/library/common/complete-values-structure.yaml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,17 +1647,18 @@ addons:
16471647
enabled: false
16481648
targetSelector:
16491649
- "main"
1650-
config: ""
1651-
authkey: ""
1652-
userspace: true
1653-
auth_once: true
1654-
accept_dns: false
1655-
routes: ""
1656-
dest_ip: ""
1657-
sock5_server: ""
1658-
extra_args: ""
1659-
daemon_extra_args: ""
1660-
outbound_http_proxy_listen: ""
1650+
settings:
1651+
config: ""
1652+
authkey: ""
1653+
userspace: true
1654+
auth_once: true
1655+
accept_dns: false
1656+
routes: ""
1657+
dest_ip: ""
1658+
sock5_server: ""
1659+
extra_args: ""
1660+
daemon_extra_args: ""
1661+
outbound_http_proxy_listen: ""
16611662
annotations: {}
16621663
container:
16631664
enabled: true
@@ -1677,16 +1678,6 @@ addons:
16771678
TS_KUBE_SECRET: ""
16781679
TS_SOCKET: "/var/run/tailscale/tailscaled.sock"
16791680
TS_STATE_DIR: "/var/lib/tailscale/state"
1680-
TS_USERSPACE: true
1681-
TS_AUTH_ONCE: true
1682-
TS_ACCEPT_DNS: false
1683-
TS_AUTH_KEY: ""
1684-
TS_TAILSCALED_EXTRA_ARGS: ""
1685-
TS_EXTRA_ARGS: ""
1686-
TS_SOCKS5_SERVER: ""
1687-
TS_DEST_IP: ""
1688-
TS_ROUTES: ""
1689-
TS_OUTBOUND_HTTP_PROXY_LISTEN: ""
16901681
securityContext:
16911682
capabilities:
16921683
add:

charts/library/common/schemas/addons.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
"properties": {},
4949
"additionalProperties": true,
5050
"description": "Define additional options for the ingress See ingress options in the [ingress](/truecharts-common/ingress) section."
51+
},
52+
"settings": {
53+
"type": "object",
54+
"properties": {},
55+
"additionalProperties": true,
56+
"description": "Addon-specific settings that vary by addon type"
5157
}
5258
},
5359
"additionalProperties": true,

charts/library/common/schemas/addons/tailscale.json

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
},
1818
"description": "Addons to the workloads"
1919
},
20-
"config": {
21-
"type": "string",
22-
"description": "Configuration for `addons.tailscale.config`."
23-
},
2420
"container": {
2521
"type": "object",
2622
"properties": {
@@ -133,45 +129,56 @@
133129
"additionalProperties": true,
134130
"description": "Addons to the workloads"
135131
},
136-
"authkey": {
137-
"type": "string",
138-
"description": "Configuration for `addons.tailscale.authkey`."
139-
},
140-
"userspace": {
141-
"type": "boolean",
142-
"description": "Configuration for `addons.tailscale.userspace`."
143-
},
144-
"auth_once": {
145-
"type": "boolean",
146-
"description": "Configuration for `addons.tailscale.auth_once`."
147-
},
148-
"accept_dns": {
149-
"type": "boolean",
150-
"description": "Configuration for `addons.tailscale.accept_dns`."
151-
},
152-
"routes": {
153-
"type": "string",
154-
"description": "Configuration for `addons.tailscale.routes`."
155-
},
156-
"dest_ip": {
157-
"type": "string",
158-
"description": "Configuration for `addons.tailscale.dest_ip`."
159-
},
160-
"sock5_server": {
161-
"type": "string",
162-
"description": "Configuration for `addons.tailscale.sock5_server`."
163-
},
164-
"extra_args": {
165-
"type": "string",
166-
"description": "Configuration for `addons.tailscale.extra_args`."
167-
},
168-
"daemon_extra_args": {
169-
"type": "string",
170-
"description": "Configuration for `addons.tailscale.daemon_extra_args`."
171-
},
172-
"outbound_http_proxy_listen": {
173-
"type": "string",
174-
"description": "Configuration for `addons.tailscale.outbound_http_proxy_listen`."
132+
"settings": {
133+
"type": "object",
134+
"properties": {
135+
"config": {
136+
"type": "string",
137+
"description": "Configuration for `addons.tailscale.settings.config`."
138+
},
139+
"authkey": {
140+
"type": "string",
141+
"description": "Configuration for `addons.tailscale.settings.authkey`."
142+
},
143+
"userspace": {
144+
"type": "boolean",
145+
"description": "Configuration for `addons.tailscale.settings.userspace`."
146+
},
147+
"auth_once": {
148+
"type": "boolean",
149+
"description": "Configuration for `addons.tailscale.settings.auth_once`."
150+
},
151+
"accept_dns": {
152+
"type": "boolean",
153+
"description": "Configuration for `addons.tailscale.settings.accept_dns`."
154+
},
155+
"routes": {
156+
"type": "string",
157+
"description": "Configuration for `addons.tailscale.settings.routes`."
158+
},
159+
"dest_ip": {
160+
"type": "string",
161+
"description": "Configuration for `addons.tailscale.settings.dest_ip`."
162+
},
163+
"sock5_server": {
164+
"type": "string",
165+
"description": "Configuration for `addons.tailscale.settings.sock5_server`."
166+
},
167+
"extra_args": {
168+
"type": "string",
169+
"description": "Configuration for `addons.tailscale.settings.extra_args`."
170+
},
171+
"daemon_extra_args": {
172+
"type": "string",
173+
"description": "Configuration for `addons.tailscale.settings.daemon_extra_args`."
174+
},
175+
"outbound_http_proxy_listen": {
176+
"type": "string",
177+
"description": "Configuration for `addons.tailscale.settings.outbound_http_proxy_listen`."
178+
}
179+
},
180+
"additionalProperties": true,
181+
"description": "Tailscale settings"
175182
},
176183
"annotations": {
177184
"type": "object",

charts/library/common/templates/addons/_tailscale.tpl

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,52 @@ It will include / inject the required templates based on the given values.
55
{{- define "tc.v1.common.addon.tailscale" -}}
66
{{- $ts := $.Values.addons.tailscale -}}
77
{{- if $ts.enabled -}}
8+
{{- $settings := $ts.settings | default dict -}}
9+
10+
{{/* Merge settings into environment variables */}}
11+
{{- $env := $ts.container.env | default dict -}}
12+
{{- if $settings.config -}}
13+
{{- $_ := set $env "TS_CONFIG" $settings.config -}}
14+
{{- end -}}
15+
{{- if $settings.authkey -}}
16+
{{- $_ := set $env "TS_AUTH_KEY" $settings.authkey -}}
17+
{{- end -}}
18+
{{- if hasKey $settings "userspace" -}}
19+
{{- $_ := set $env "TS_USERSPACE" $settings.userspace -}}
20+
{{- end -}}
21+
{{- if hasKey $settings "auth_once" -}}
22+
{{- $_ := set $env "TS_AUTH_ONCE" $settings.auth_once -}}
23+
{{- end -}}
24+
{{- if hasKey $settings "accept_dns" -}}
25+
{{- $_ := set $env "TS_ACCEPT_DNS" $settings.accept_dns -}}
26+
{{- end -}}
27+
{{- if $settings.routes -}}
28+
{{- $_ := set $env "TS_ROUTES" $settings.routes -}}
29+
{{- end -}}
30+
{{- if $settings.dest_ip -}}
31+
{{- $_ := set $env "TS_DEST_IP" $settings.dest_ip -}}
32+
{{- end -}}
33+
{{- if $settings.sock5_server -}}
34+
{{- $_ := set $env "TS_SOCKS5_SERVER" $settings.sock5_server -}}
35+
{{- end -}}
36+
{{- if $settings.extra_args -}}
37+
{{- $_ := set $env "TS_EXTRA_ARGS" $settings.extra_args -}}
38+
{{- end -}}
39+
{{- if $settings.daemon_extra_args -}}
40+
{{- $_ := set $env "TS_TAILSCALED_EXTRA_ARGS" $settings.daemon_extra_args -}}
41+
{{- end -}}
42+
{{- if $settings.outbound_http_proxy_listen -}}
43+
{{- $_ := set $env "TS_OUTBOUND_HTTP_PROXY_LISTEN" $settings.outbound_http_proxy_listen -}}
44+
{{- end -}}
45+
{{- $_ := set $ts.container "env" $env -}}
46+
847
{{- $secContext := dict -}}
948
{{- $_ := set $secContext "runAsUser" 0 -}}
1049
{{- $_ := set $secContext "runAsGroup" 0 -}}
1150
{{- $_ := set $secContext "runAsNonRoot" true -}}
1251
{{- $_ := set $secContext "readOnlyRootFilesystem" false -}}
1352

14-
{{- if and $ts.container.env ($ts.container.env.TS_USERSPACE) -}}
53+
{{- if and $env ($env.TS_USERSPACE) -}}
1554
{{- $_ := set $secContext "runAsUser" 1000 -}}
1655
{{- $_ := set $secContext "runAsGroup" 1000 -}}
1756
{{- $_ := set $secContext "runAsNonRoot" false -}}

charts/library/common/values.yaml

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,8 +1021,6 @@ addons:
10211021
enabled: false
10221022
targetSelector:
10231023
- main
1024-
# -- you can directly specify the config file here
1025-
config: ""
10261024
container:
10271025
enabled: true
10281026
imageSelector: "tailscaleImage"
@@ -1046,34 +1044,28 @@ addons:
10461044
TS_KUBE_SECRET: ""
10471045
TS_SOCKET: /var/run/tailscale/tailscaled.sock
10481046
TS_STATE_DIR: /var/lib/tailscale/state
1049-
TS_USERSPACE: true
1050-
TS_AUTH_ONCE: true
1051-
TS_ACCEPT_DNS: false
1052-
TS_AUTH_KEY: ""
1053-
TS_TAILSCALED_EXTRA_ARGS: ""
1054-
TS_EXTRA_ARGS: ""
1055-
TS_SOCKS5_SERVER: ""
1056-
TS_DEST_IP: ""
1057-
TS_ROUTES: ""
1058-
TS_OUTBOUND_HTTP_PROXY_LISTEN: ""
10591047
securityContext:
10601048
capabilities:
10611049
add:
10621050
- NET_ADMIN
10631051
- NET_RAW
10641052

1065-
# -- Auth key to connect to the VPN Service
1066-
authkey: ""
1067-
# As a sidecar, it should only need to run in userspace
1068-
userspace: true
1069-
auth_once: true
1070-
accept_dns: false
1071-
routes: ""
1072-
dest_ip: ""
1073-
sock5_server: ""
1074-
extra_args: ""
1075-
daemon_extra_args: ""
1076-
outbound_http_proxy_listen: ""
1053+
# -- Tailscale settings
1054+
settings:
1055+
# -- you can directly specify the config file here
1056+
config: ""
1057+
# -- Auth key to connect to the VPN Service
1058+
authkey: ""
1059+
# As a sidecar, it should only need to run in userspace
1060+
userspace: true
1061+
auth_once: true
1062+
accept_dns: false
1063+
routes: ""
1064+
dest_ip: ""
1065+
sock5_server: ""
1066+
extra_args: ""
1067+
daemon_extra_args: ""
1068+
outbound_http_proxy_listen: ""
10771069
# -- Annotations for tailscale sidecar
10781070
annotations: {}
10791071

0 commit comments

Comments
 (0)