Skip to content

Commit

Permalink
Merge pull request #15 from natrontech/fix-ingress
Browse files Browse the repository at this point in the history
feat: add agent ingressclass env
  • Loading branch information
svengerber authored Aug 4, 2023
2 parents 2facbbb + 10c0515 commit 52b90f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions kubelab-backend/pkg/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type config struct {
KubelabImage string `env:"KUBELAB_AGENT_IMAGE"`
AllowedHosts string `env:"ALLOWED_HOSTS"`
ResourceName string `env:"RESOURCE_NAME"`
IngressClass string `env:"AGENT_INGRESS_CLASS"`
PodsLimit string `env:"PODS_LIMIT"`
StorageLimit string `env:"STORAGE_LIMIT"`
}
Expand Down Expand Up @@ -38,6 +39,10 @@ func Init() {
Config.ResourceName = "kubelab"
}

if Config.IngressClass == "" {
Config.IngressClass = "nginx"
}

if Config.PodsLimit == "" {
Config.PodsLimit = "70"
}
Expand Down
3 changes: 2 additions & 1 deletion kubelab-backend/pkg/k8s/ingress.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package k8s

import (
"github.com/natrontech/kubelab/pkg/env"
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand All @@ -27,7 +28,7 @@ func CreateIngress(namespace string, name string, host string, serviceName strin
},
},
Spec: networkingv1.IngressSpec{
IngressClassName: func() *string { s := "nginx"; return &s }(),
IngressClassName: func() *string { s := env.Config.IngressClass; return &s }(),
TLS: []networkingv1.IngressTLS{
{
Hosts: []string{host},
Expand Down

0 comments on commit 52b90f2

Please sign in to comment.