Skip to content

Commit

Permalink
Merge pull request #33 from cho4036/main
Browse files Browse the repository at this point in the history
minor fix: change splitter to support backslash dot(\.)
  • Loading branch information
ktkfree authored May 22, 2023
2 parents a857d52 + da6cf3c commit 7faa456
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ type ChartSource struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"`
}

//nolint: golint
//noinspection GoUnusedGlobalVariable
// nolint: golint
// noinspection GoUnusedGlobalVariable
var KustomizePlugin plugin

func (p *plugin) Config(
Expand Down Expand Up @@ -168,7 +168,8 @@ func (p *plugin) getResourceFromChart(replacedChart ReplacedChart) (r *resource.
if err != nil {
return nil, err
}
p.createMapFromPaths(patchMap, strings.Split(inlinePath, "."), newVal)
paths := splitButIgnoreEscapedDot(inlinePath, "\uffff")
p.createMapFromPaths(patchMap, paths, newVal)
}

resource := p.h.ResmapFactory().RF().FromMap(map[string]interface{}{
Expand Down Expand Up @@ -238,3 +239,13 @@ func (p *plugin) replaceGlobalVar(original interface{}) (interface{}, error) {
}
return inlineStr, nil
}

func splitButIgnoreEscapedDot(input, placeholder string) []string {
temp := strings.ReplaceAll(input, "\\.", placeholder)
parts := strings.Split(temp, ".")

for i := range parts {
parts[i] = strings.ReplaceAll(parts[i], placeholder, ".")
}
return parts
}
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,22 @@ global:
docker_registry: sktdev
image_tag: taco-0.1.0
storageClassName: ceph
grafanaDomain: grafana.example.com
keycloakDomain: keycloak.example.com
realms: openinfradev
charts:
- name: glance
source:
repository: http://repository-a:8879
version: 1.0.1
override:
grafana\.ini:
server:
domain: $(grafanaDomain)
root_url: $(grafanaDomain)/grafana
auth.generic_oauth:
enabled: true
auth_url: https://$(keycloakDomain)/auth/realms/$(realms)/protocol/openid-connect/auth
conf.ceph.admin_keyring: $(glance_admin_keyring)
conf.ceph.enabled: true
images.tags.ks_user: $(docker_registry)/ubuntu-source-heat-engine-stein:$(image_tag)
Expand Down Expand Up @@ -265,6 +275,7 @@ spec:
releaseName: glance
targetNamespace: openstack
values:
grafana.ini:
conf:
ceph:
admin_keyring: TO_BE_FIXED
Expand Down Expand Up @@ -309,6 +320,13 @@ spec:
ceph:
admin_keyring: abcdefghijklmn
enabled: true
grafana.ini:
auth.generic_oauth:
auth_url: https://keycloak.example.com/auth/realms/openinfradev/protocol/openid-connect/auth
enabled: true
server:
domain: grafana.example.com
root_url: grafana.example.com/grafana
images:
tags:
ks_user: sktdev/ubuntu-source-heat-engine-stein:taco-0.1.0
Expand Down

0 comments on commit 7faa456

Please sign in to comment.