mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 23:09:41 +02:00
fix(EE-4782): add portainer internal label to created ingress rules (#8196)
This commit is contained in:
parent
e1b474d04f
commit
95558ed4ad
4 changed files with 16 additions and 4 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"strings"
|
||||
|
||||
models "github.com/portainer/portainer/api/http/models/kubernetes"
|
||||
"github.com/portainer/portainer/api/stacks/stackutils"
|
||||
"github.com/rs/zerolog/log"
|
||||
netv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -150,7 +151,7 @@ func (kcl *KubeClient) GetIngresses(namespace string) ([]models.K8sIngressInfo,
|
|||
}
|
||||
|
||||
// CreateIngress creates a new ingress in a given namespace in a k8s endpoint.
|
||||
func (kcl *KubeClient) CreateIngress(namespace string, info models.K8sIngressInfo) error {
|
||||
func (kcl *KubeClient) CreateIngress(namespace string, info models.K8sIngressInfo, owner string) error {
|
||||
ingressClient := kcl.cli.NetworkingV1().Ingresses(namespace)
|
||||
var ingress netv1.Ingress
|
||||
|
||||
|
@ -160,6 +161,10 @@ func (kcl *KubeClient) CreateIngress(namespace string, info models.K8sIngressInf
|
|||
ingress.Spec.IngressClassName = &info.ClassName
|
||||
}
|
||||
ingress.Annotations = info.Annotations
|
||||
if ingress.Labels == nil {
|
||||
ingress.Labels = make(map[string]string)
|
||||
}
|
||||
ingress.Labels["io.portainer.kubernetes.application.owner"] = stackutils.SanitizeLabel(owner)
|
||||
|
||||
// Store TLS information.
|
||||
var tls []netv1.IngressTLS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue