mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59: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
|
@ -10,6 +10,7 @@ import (
|
|||
portainer "github.com/portainer/portainer/api"
|
||||
portainerDsErrors "github.com/portainer/portainer/api/dataservices/errors"
|
||||
models "github.com/portainer/portainer/api/http/models/kubernetes"
|
||||
"github.com/portainer/portainer/api/http/security"
|
||||
)
|
||||
|
||||
func (handler *Handler) getKubernetesIngressControllers(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
||||
|
@ -515,6 +516,12 @@ func (handler *Handler) createKubernetesIngress(w http.ResponseWriter, r *http.R
|
|||
)
|
||||
}
|
||||
|
||||
owner := "admin"
|
||||
tokenData, err := security.RetrieveTokenData(r)
|
||||
if err == nil && tokenData != nil {
|
||||
owner = tokenData.Username
|
||||
}
|
||||
|
||||
cli, ok := handler.KubernetesClientFactory.GetProxyKubeClient(
|
||||
strconv.Itoa(endpointID), r.Header.Get("Authorization"),
|
||||
)
|
||||
|
@ -525,7 +532,7 @@ func (handler *Handler) createKubernetesIngress(w http.ResponseWriter, r *http.R
|
|||
)
|
||||
}
|
||||
|
||||
err = cli.CreateIngress(namespace, payload)
|
||||
err = cli.CreateIngress(namespace, payload, owner)
|
||||
if err != nil {
|
||||
return httperror.InternalServerError(
|
||||
"Unable to retrieve the ingress",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue