Skip to content

Commit 88bf851

Browse files
committed
feat: update denylist and allowlist for a more flexible input
1 parent 2eba7d8 commit 88bf851

File tree

2 files changed

+48
-14
lines changed

2 files changed

+48
-14
lines changed

apis/nextdnsprofile/composition.yaml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,40 @@ spec:
8383
"parentalControl": {{ .observed.composite.resource.spec.parentalControl | toJson }}
8484
{{- end }}
8585
{{- if .observed.composite.resource.spec.denylist }},
86-
"denylist": {{ .observed.composite.resource.spec.denylist | toJson }}
86+
"denylist": [
87+
{{- range $i, $entry := .observed.composite.resource.spec.denylist }}
88+
{{- if $i }},{{- end }}
89+
{{- if kindIs "string" $entry }}
90+
{"id": {{ $entry | toJson }}, "active": true}
91+
{{- else }}
92+
{{- $domain := "" }}
93+
{{- range $key, $value := $entry }}
94+
{{- if ne $key "active" }}
95+
{{- $domain = $key }}
96+
{{- end }}
97+
{{- end }}
98+
{"id": {{ $domain | toJson }}, "active": {{ $entry.active | default true }}}
99+
{{- end }}
100+
{{- end }}
101+
]
87102
{{- end }}
88103
{{- if .observed.composite.resource.spec.allowlist }},
89-
"allowlist": {{ .observed.composite.resource.spec.allowlist | toJson }}
104+
"allowlist": [
105+
{{- range $i, $entry := .observed.composite.resource.spec.allowlist }}
106+
{{- if $i }},{{- end }}
107+
{{- if kindIs "string" $entry }}
108+
{"id": {{ $entry | toJson }}, "active": true}
109+
{{- else }}
110+
{{- $domain := "" }}
111+
{{- range $key, $value := $entry }}
112+
{{- if ne $key "active" }}
113+
{{- $domain = $key }}
114+
{{- end }}
115+
{{- end }}
116+
{"id": {{ $domain | toJson }}, "active": {{ $entry.active | default true }}}
117+
{{- end }}
118+
{{- end }}
119+
]
90120
{{- end }}
91121
{{- if .observed.composite.resource.spec.settings }},
92122
"settings": {{ .observed.composite.resource.spec.settings | toJson }}

apis/nextdnsprofile/definition.yaml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,25 @@ spec:
112112
denylist:
113113
type: array
114114
items:
115-
type: object
116-
properties:
117-
id:
118-
type: string
119-
active:
120-
type: boolean
115+
oneOf:
116+
- type: string
117+
- type: object
118+
properties:
119+
active:
120+
type: boolean
121+
additionalProperties:
122+
type: string
121123
allowlist:
122124
type: array
123125
items:
124-
type: object
125-
properties:
126-
id:
127-
type: string
128-
active:
129-
type: boolean
126+
oneOf:
127+
- type: string
128+
- type: object
129+
properties:
130+
active:
131+
type: boolean
132+
additionalProperties:
133+
type: string
130134
settings:
131135
type: object
132136
properties:

0 commit comments

Comments
 (0)