Skip to content

Commit 7faa456

Browse files
authored
Merge pull request #33 from cho4036/main
minor fix: change splitter to support backslash dot(\.)
2 parents a857d52 + da6cf3c commit 7faa456

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

plugin/openinfradev.github.com/v1/helmvaluestransformer/HelmValuesTransformer.go

+14-3
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ type ChartSource struct {
4343
Type string `json:"type,omitempty" yaml:"type,omitempty"`
4444
}
4545

46-
//nolint: golint
47-
//noinspection GoUnusedGlobalVariable
46+
// nolint: golint
47+
// noinspection GoUnusedGlobalVariable
4848
var KustomizePlugin plugin
4949

5050
func (p *plugin) Config(
@@ -168,7 +168,8 @@ func (p *plugin) getResourceFromChart(replacedChart ReplacedChart) (r *resource.
168168
if err != nil {
169169
return nil, err
170170
}
171-
p.createMapFromPaths(patchMap, strings.Split(inlinePath, "."), newVal)
171+
paths := splitButIgnoreEscapedDot(inlinePath, "\uffff")
172+
p.createMapFromPaths(patchMap, paths, newVal)
172173
}
173174

174175
resource := p.h.ResmapFactory().RF().FromMap(map[string]interface{}{
@@ -238,3 +239,13 @@ func (p *plugin) replaceGlobalVar(original interface{}) (interface{}, error) {
238239
}
239240
return inlineStr, nil
240241
}
242+
243+
func splitButIgnoreEscapedDot(input, placeholder string) []string {
244+
temp := strings.ReplaceAll(input, "\\.", placeholder)
245+
parts := strings.Split(temp, ".")
246+
247+
for i := range parts {
248+
parts[i] = strings.ReplaceAll(parts[i], placeholder, ".")
249+
}
250+
return parts
251+
}

plugin/openinfradev.github.com/v1/helmvaluestransformer/HelmValuesTransformer_test.go

+18
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,22 @@ global:
232232
docker_registry: sktdev
233233
image_tag: taco-0.1.0
234234
storageClassName: ceph
235+
grafanaDomain: grafana.example.com
236+
keycloakDomain: keycloak.example.com
237+
realms: openinfradev
235238
charts:
236239
- name: glance
237240
source:
238241
repository: http://repository-a:8879
239242
version: 1.0.1
240243
override:
244+
grafana\.ini:
245+
server:
246+
domain: $(grafanaDomain)
247+
root_url: $(grafanaDomain)/grafana
248+
auth.generic_oauth:
249+
enabled: true
250+
auth_url: https://$(keycloakDomain)/auth/realms/$(realms)/protocol/openid-connect/auth
241251
conf.ceph.admin_keyring: $(glance_admin_keyring)
242252
conf.ceph.enabled: true
243253
images.tags.ks_user: $(docker_registry)/ubuntu-source-heat-engine-stein:$(image_tag)
@@ -265,6 +275,7 @@ spec:
265275
releaseName: glance
266276
targetNamespace: openstack
267277
values:
278+
grafana.ini:
268279
conf:
269280
ceph:
270281
admin_keyring: TO_BE_FIXED
@@ -309,6 +320,13 @@ spec:
309320
ceph:
310321
admin_keyring: abcdefghijklmn
311322
enabled: true
323+
grafana.ini:
324+
auth.generic_oauth:
325+
auth_url: https://keycloak.example.com/auth/realms/openinfradev/protocol/openid-connect/auth
326+
enabled: true
327+
server:
328+
domain: grafana.example.com
329+
root_url: grafana.example.com/grafana
312330
images:
313331
tags:
314332
ks_user: sktdev/ubuntu-source-heat-engine-stein:taco-0.1.0

0 commit comments

Comments
 (0)