1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 05:19:39 +02:00

feat(helm): helm apps deployed by portainer not marked as external EE-1624 (#5637)

* helm lib update

* helm handler requires kubernetes deployer to modify helm deployed resources

* AddAppLabels updated to be more generic - support for adding multiple labels using map

* path installed helm release manifest with portainer labels using kubectl

* updated helm handler unit tests to use mock KubernetesDeployer

* adding labels to manifest retrieved from release

* optional namespace support for k8s raw manifest deployment

* - inline postprocessing support when extracting
- get namespace from yaml support
- added and updated tests

* lowercase error wrapping

* updated libhelm dep
This commit is contained in:
zees-dev 2021-09-29 13:12:45 +13:00 committed by GitHub
parent 50f63ae865
commit af98660a55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 494 additions and 30 deletions

View file

@ -0,0 +1,21 @@
package exectest
import (
"net/http"
portainer "github.com/portainer/portainer/api"
)
type kubernetesMockDeployer struct{}
func NewKubernetesDeployer() portainer.KubernetesDeployer {
return &kubernetesMockDeployer{}
}
func (deployer *kubernetesMockDeployer) Deploy(request *http.Request, endpoint *portainer.Endpoint, data string, namespace string) (string, error) {
return "", nil
}
func (deployer *kubernetesMockDeployer) ConvertCompose(data []byte) ([]byte, error) {
return nil, nil
}

View file

@ -76,7 +76,7 @@ func (deployer *KubernetesDeployer) getToken(request *http.Request, endpoint *po
return token, nil
}
// Deploy will deploy a Kubernetes manifest inside a specific namespace in a Kubernetes environment(endpoint).
// Deploy will deploy a Kubernetes manifest inside an optional namespace in a Kubernetes environment(endpoint).
// Otherwise it will use kubectl to deploy the manifest.
func (deployer *KubernetesDeployer) Deploy(request *http.Request, endpoint *portainer.Endpoint, stackConfig string, namespace string) (string, error) {
command := path.Join(deployer.binaryPath, "kubectl")
@ -103,7 +103,9 @@ func (deployer *KubernetesDeployer) Deploy(request *http.Request, endpoint *port
}
args = append(args, "--token", token)
args = append(args, "--namespace", namespace)
if namespace != "" {
args = append(args, "--namespace", namespace)
}
args = append(args, "apply", "-f", "-")
var stderr bytes.Buffer