Skip to content

Commit

Permalink
use go template for gitea registry
Browse files Browse the repository at this point in the history
  • Loading branch information
nabuskey committed Jul 30, 2024
1 parent 7396bbe commit b990573
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions pkg/kind/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ type IProvider interface {
}

type TemplateConfig struct {
util.CorePackageTemplateConfig
KubernetesVersion string
ExtraPortsMapping []PortMapping
IngressProtocol string
Port string
}

//go:embed resources/*
Expand Down Expand Up @@ -89,10 +88,9 @@ func (c *Cluster) getConfig() ([]byte, error) {

var retBuff []byte
if retBuff, err = util.ApplyTemplate(rawConfigTempl, TemplateConfig{
KubernetesVersion: c.kubeVersion,
ExtraPortsMapping: portMappingPairs,
IngressProtocol: c.cfg.Protocol,
Port: c.cfg.Port,
CorePackageTemplateConfig: c.cfg,
KubernetesVersion: c.kubeVersion,
ExtraPortsMapping: portMappingPairs,
}); err != nil {
return []byte{}, err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/kind/resources/kind.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ nodes:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: {{ if (eq .IngressProtocol "http") -}} 80 {{- else -}} 443 {{- end }}
- containerPort: {{ if (eq .Protocol "http") -}} 80 {{- else -}} 443 {{- end }}
hostPort: {{ .Port }}
protocol: TCP
{{ range .ExtraPortsMapping -}}
Expand All @@ -21,7 +21,7 @@ nodes:
{{ end }}
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."gitea.cnoe.localtest.me:8443"]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."{{ .Host }}:{{ .Port }}"]
endpoint = ["https://gitea.cnoe.localtest.me"]
[plugins."io.containerd.grpc.v1.cri".registry.configs."gitea.cnoe.localtest.me".tls]
[plugins."io.containerd.grpc.v1.cri".registry.configs."{{ .Host }}".tls]
insecure_skip_verify = true

0 comments on commit b990573

Please sign in to comment.