Skip to content

Commit

Permalink
* [fix] fix typo systemd
Browse files Browse the repository at this point in the history
  • Loading branch information
ysicing committed Sep 18, 2024
1 parent 22bd763 commit c620733
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
20 changes: 5 additions & 15 deletions common/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,9 @@ ExecStart=/usr/local/bin/k3s \
--tls-san kubeapi.corp.cc \
--tls-san apiserver.cluster.local \
--tls-san {{ .KubeAPI }} \
{{- if .PodCIDR }}
--cluster-cidr {{ .PodCIDR }} \
{{- end -}}
{{- if .ServiceCIDR }}
--service-cidr {{ .ServiceCIDR }} \
{{- end -}}
{{if .PodCIDR }}--cluster-cidr {{ .PodCIDR }} \ {{end}}
{{if .ServiceCIDR }}--service-cidr {{ .ServiceCIDR }} \ {{end}}
{{if .CNI }}--flannel-backend {{ .CNI }} \ {{ end }}
{{- if .DataStore }}
--datastore-endpoint {{ .DataStore }} \
{{- else}}
Expand All @@ -176,19 +173,12 @@ ExecStart=/usr/local/bin/k3s \
--etcd-expose-metrics \
--etcd-snapshot-name auto-snapshot \
--etcd-snapshot-compress \
{{- end -}}
{{- if .LocalStorage }}
--disable servicelb,traefik \
{{else -}}
--disable servicelb,traefik,local-storage \
{{- end -}}
{{- end}}
--disable-cloud-controller \
--system-default-registry {{ .Registry }} \
--disable-network-policy \
--disable-helm-controller \
{{if .CNI }}
--flannel-backend {{ .CNI }} \
{{end -}}
{{if .LocalStorage }}--disable servicelb,traefik \ {{- else }}--disable servicelb,traefik,local-storage \ {{- end }}
{{- else}}
agent \
--server https://{{ .KubeAPI }}:6443 \
Expand Down
4 changes: 2 additions & 2 deletions hack/scripts/getk3s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
set -xe

if [ ! -f "hack/bin/k3s-linux-amd64" ]; then
wget -O hack/bin/k3s-linux-amd64 https://github.com/k3s-io/k3s/releases/download/v1.28.12%2Bk3s1/k3s
wget -O hack/bin/k3s-linux-amd64 https://github.com/k3s-io/k3s/releases/download/v1.28.13%2Bk3s1/k3s
fi
if [ ! -f "hack/bin/k3s-linux-arm64" ]; then
wget -O hack/bin/k3s-linux-arm64 https://github.com/k3s-io/k3s/releases/download/v1.28.12%2Bk3s1/k3s-arm64
wget -O hack/bin/k3s-linux-arm64 https://github.com/k3s-io/k3s/releases/download/v1.28.13%2Bk3s1/k3s-arm64
fi

chmod +x hack/bin/k3s-linux-amd64 hack/bin/k3s-linux-arm64
5 changes: 4 additions & 1 deletion internal/pkg/cli/k3stpl/k3stpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package k3stpl
import (
"bytes"
"os"
"regexp"
"text/template"

"github.com/ergoapi/util/exnet"
Expand Down Expand Up @@ -39,7 +40,8 @@ func render(data K3sArgs, temp string) string {
var b bytes.Buffer
t := template.Must(template.New("k3s").Parse(temp))
_ = t.Execute(&b, &data)
return b.String()
re := regexp.MustCompile(`(?m)^\s*$[\r\n]*|[\r\n]+\s+\z`)
return re.ReplaceAllString(b.String(), "")
}

func (k3s K3sArgs) Manifests(template string) string {
Expand Down Expand Up @@ -95,5 +97,6 @@ func EmbedCommand(f factory.Factory) *cobra.Command {
rootCmd.Flags().StringVar(&k3sargs.Master0IP, "master0ip", "", "master0ip, only work offline mode")
rootCmd.Flags().StringVar(&k3sargs.Registry, "registry", "hub.zentao.net", "registry")
rootCmd.Flags().StringVar(&k3sargs.DataStore, "datasource", "", "datasource")
rootCmd.Flags().StringVar(&k3sargs.CNI, "cni", "", "cni")
return rootCmd
}

0 comments on commit c620733

Please sign in to comment.