Skip to content

Commit

Permalink
fix: handle relative urls in index.yaml when getting helm repositories
Browse files Browse the repository at this point in the history
* fix: remove unused security context

* fix: remove security context from spec.containers

* fix: handle relative urls in index.yaml when getting helm repositories
  • Loading branch information
matteogastaldello authored Jul 9, 2024
1 parent c8ab089 commit 0da3baa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
13 changes: 12 additions & 1 deletion internal/helm/getter/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package getter

import (
"fmt"
"net/url"
"strings"

"github.com/krateoplatformops/core-provider/internal/helm/repo"
Expand Down Expand Up @@ -40,8 +41,18 @@ func (g *repoGetter) Get(opts GetOptions) ([]byte, string, error) {
return nil, "", fmt.Errorf("no package url found in index @ %s/%s", res.Name, res.Version)
}

chartUrlStr := res.URLs[0]
_, err = url.ParseRequestURI(chartUrlStr)
if err != nil {
chartUrlStr = fmt.Sprintf("%s/%s", opts.URI, chartUrlStr)
_, err = url.ParseRequestURI(chartUrlStr)
if err != nil {
return nil, "", fmt.Errorf("invalid chart url: %s", chartUrlStr)
}
}

newopts := GetOptions{
URI: res.URLs[0],
URI: chartUrlStr,
Version: res.Version,
Repo: res.Name,
InsecureSkipVerifyTLS: opts.InsecureSkipVerifyTLS,
Expand Down
20 changes: 10 additions & 10 deletions internal/templates/assets/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ spec:
name: metrics
protocol: TCP
resources: {}
securityContext:
allowPrivilegeEscalation: false
privileged: false
runAsGroup: 2000
runAsNonRoot: true
runAsUser: 2000
# securityContext:
# allowPrivilegeEscalation: false
# privileged: false
# runAsGroup: 2000
# runAsNonRoot: true
# runAsUser: 2000
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext:
runAsGroup: 2000
runAsNonRoot: true
runAsUser: 2000
# securityContext:
# runAsGroup: 2000
# runAsNonRoot: true
# runAsUser: 2000
serviceAccount: {{ .name }}
serviceAccountName: {{ .name }}
terminationGracePeriodSeconds: 30

0 comments on commit 0da3baa

Please sign in to comment.