feat: add ability to install nginx instead of traefik

This commit is contained in:
Jose Diaz-Gonzalez committed 2024-02-06 21:19:14 -05:00
1 parent ea4767f2d8
commit 81286a0673
5 files changed
+144 -7

No files matched your search

+21 -2
View File
@@ -59,7 +59,11 @@ func CommandAnnotationsSet(appName string, processType string, resourceType stri
}
// CommandInitialize initializes a k3s cluster on the local server
func CommandInitialize(serverIP string, taintScheduling bool) error {
func CommandInitialize(proxy string, serverIP string, taintScheduling bool) error {
if proxy != "nginx" && proxy != "traefik" {
return fmt.Errorf("Invalid proxy: %s", proxy)
}
if err := isK3sInstalled(); err == nil {
return fmt.Errorf("k3s already installed, cannot re-initialize k3s")
}
@@ -219,6 +223,11 @@ func CommandInitialize(serverIP string, taintScheduling bool) error {
args = append(args, "--node-taint", "CriticalAddonsOnly=true:NoSchedule")
}
common.CommandPropertySet("scheduler-k3s", "--global", "proxy", proxy, DefaultProperties, GlobalProperties)
if proxy == "nginx" {
args = append(args, "--disable", "traefik")
}
common.LogInfo2Quiet("Running k3s installer")
installerCmd, err := common.CallExecCommand(common.ExecCommandInput{
Command: f.Name(),
@@ -298,7 +307,17 @@ func CommandInitialize(serverIP string, taintScheduling bool) error {
}
common.LogInfo2Quiet("Installing helm charts")
err = installHelmCharts(ctx, clientset)
err = installHelmCharts(ctx, clientset, func(chart HelmChart) bool {
if chart.ChartPath == "traefik" && proxy == "nginx" {
return false
}
if chart.ChartPath == "nginx" && proxy == "traefik" {
return false
}
return true
})
if err != nil {
return fmt.Errorf("Unable to install helm charts: %w", err)
}