Skip to content

Commit

Permalink
feat(install_ingress_aks): Create slu s k install-ingress-aks
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejsika committed Aug 29, 2023
1 parent e8ba735 commit be0cd5a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ import (
_ "github.com/sikalabs/slu/cmd/scripts/kubernetes/install_cluster_issuer_cloudflare"
_ "github.com/sikalabs/slu/cmd/scripts/kubernetes/install_hello_world"
_ "github.com/sikalabs/slu/cmd/scripts/kubernetes/install_ingress"
_ "github.com/sikalabs/slu/cmd/scripts/kubernetes/install_ingress_aks"
_ "github.com/sikalabs/slu/cmd/scripts/kubernetes/install_maildev"
_ "github.com/sikalabs/slu/cmd/scripts/kubernetes/install_metrics_server"
_ "github.com/sikalabs/slu/cmd/scripts/kubernetes/install_prometheus_operator_crd"
Expand Down
47 changes: 47 additions & 0 deletions cmd/scripts/kubernetes/install_ingress_aks/install_ingress_aks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package install_ingress

import (
parent_cmd "github.com/sikalabs/slu/cmd/scripts/kubernetes"
"github.com/sikalabs/slu/utils/k8s_scripts"
"github.com/spf13/cobra"
)

var FlagDry bool
var FlagLoadBalancerIP string
var FlagResourceGroupName string

var Cmd = &cobra.Command{
Use: "install-ingress-aks",
Short: "Install Ingress Nginx AKS (Azure)",
Aliases: []string{"iiaks"},
Args: cobra.NoArgs,
Run: func(c *cobra.Command, args []string) {
k8s_scripts.InstallIngressAKS(FlagLoadBalancerIP, FlagResourceGroupName, FlagDry)
},
}

func init() {
parent_cmd.Cmd.AddCommand(Cmd)
Cmd.Flags().BoolVar(
&FlagDry,
"dry",
false,
"Dry run",
)
Cmd.Flags().StringVarP(
&FlagLoadBalancerIP,
"loadbalancer-ip",
"i",
"",
"LoadBalancer IP",
)
Cmd.MarkFlagRequired("loadbalancer-ip")
Cmd.Flags().StringVarP(
&FlagResourceGroupName,
"resource-group-name",
"r",
"",
"Resource Group Name",
)
Cmd.MarkFlagRequired("resource-group-name")
}
22 changes: 22 additions & 0 deletions utils/k8s_scripts/k8s_scripts_ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,25 @@ func InstallIngress(useProxyProtocol bool, dry bool) {
--set controller.config.use-proxy-protocol=`+useProxyProtocolStr+` \
--wait`, dry)
}

func InstallIngressAKS(
loadBalancerIP string,
resourceGroupName string,
dry bool,
) {
sh(`helm upgrade --install \
ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--create-namespace \
--namespace ingress-nginx \
--set controller.service.type=LoadBalancer \
--set controller.ingressClassResource.default=true \
--set controller.kind=DaemonSet \
--set controller.hostPort.enabled=true \
--set controller.metrics.enabled=true \
--set controller.config.use-proxy-protocol=false \
--set controller.service.loadBalancerIP=`+loadBalancerIP+` \
--set controller.service.annotations.service\.beta\.kubernetes\.io/azure-load-balancer-resource-group=`+resourceGroupName+` \
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-health-probe-request-path"=/healthz \
--wait`, dry)
}

0 comments on commit be0cd5a

Please sign in to comment.