ingress on first port

This commit is contained in:
w-mj 2023-02-17 16:02:44 +08:00
parent 5f6d11b972
commit c6eb0796ea
No known key found for this signature in database
GPG Key ID: 3A2CB5BE2F835897
2 changed files with 10 additions and 8 deletions

View File

@ -24,4 +24,6 @@ kubectl get secret dev-secret -o yaml
helm repo add traefik https://traefik.github.io/charts
helm repo update
helm install traefik traefik/traefik
helm uninstall traefik traefik/traefik
helm install traefik traefik/traefik --set expose.dashboard=true
```

View File

@ -264,13 +264,10 @@ func (c *K8sClient) IngressExists(name string) bool {
func (c *K8sClient) UpdateIngress(a *AppModel) {
ports := a.GetPorts()
var exportPort int32 = 0
for _, p := range ports {
if p == 80 || p == 8000 || p == 8080 || p == 8888 {
exportPort = p
break
}
if len(ports) == 0 {
return
}
exportPort := ports[0]
if exportPort == 0 {
return
}
@ -280,8 +277,11 @@ func (c *K8sClient) UpdateIngress(a *AppModel) {
label := map[string]string{k: v}
ingress := &netv1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: a.IngressName(),
Labels: label,
Name: a.IngressName(),
Labels: label,
Annotations: map[string]string{
//"traefik.ingress.kubernetes.io/router.middlewares": "default-strip-prefix-1@kubernetescrd",
},
},
Spec: netv1.IngressSpec{
Rules: []netv1.IngressRule{