mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
fix(pending-actions): correctly detect unreachable/down cluster [EE-7049] (#11811)
Some checks are pending
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Some checks are pending
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
This commit is contained in:
parent
39088b16b3
commit
2f1b5ec979
3 changed files with 15 additions and 4 deletions
7
api/kubernetes/cli/server_version.go
Normal file
7
api/kubernetes/cli/server_version.go
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package cli
|
||||||
|
|
||||||
|
import "k8s.io/apimachinery/pkg/version"
|
||||||
|
|
||||||
|
func (kcl *KubeClient) ServerVersion() (*version.Info, error) {
|
||||||
|
return kcl.cli.Discovery().ServerVersion()
|
||||||
|
}
|
|
@ -76,10 +76,11 @@ func (service *PendingActionsService) Execute(id portainer.EndpointID) error {
|
||||||
|
|
||||||
// For Kubernetes endpoints, we need to check if the endpoint is up by creating a kube client
|
// For Kubernetes endpoints, we need to check if the endpoint is up by creating a kube client
|
||||||
if isKubernetesEndpoint {
|
if isKubernetesEndpoint {
|
||||||
_, err := service.kubeFactory.GetKubeClient(endpoint)
|
if client, _ := service.kubeFactory.GetKubeClient(endpoint); client != nil {
|
||||||
if err != nil {
|
if _, err = client.ServerVersion(); err != nil {
|
||||||
log.Debug().Err(err).Msgf("Environment %q (id: %d) is not up", endpoint.Name, id)
|
log.Debug().Err(err).Msgf("Environment %q (id: %d) is not up", endpoint.Name, id)
|
||||||
return fmt.Errorf("environment %q (id: %d) is not up", endpoint.Name, id)
|
return fmt.Errorf("environment %q (id: %d) is not up", endpoint.Name, id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/portainer/portainer/pkg/featureflags"
|
"github.com/portainer/portainer/pkg/featureflags"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -1496,6 +1497,8 @@ type (
|
||||||
|
|
||||||
// KubeClient represents a service used to query a Kubernetes environment(endpoint)
|
// KubeClient represents a service used to query a Kubernetes environment(endpoint)
|
||||||
KubeClient interface {
|
KubeClient interface {
|
||||||
|
ServerVersion() (*version.Info, error)
|
||||||
|
|
||||||
SetupUserServiceAccount(userID int, teamIDs []int, restrictDefaultNamespace bool) error
|
SetupUserServiceAccount(userID int, teamIDs []int, restrictDefaultNamespace bool) error
|
||||||
IsRBACEnabled() (bool, error)
|
IsRBACEnabled() (bool, error)
|
||||||
GetServiceAccount(tokendata *TokenData) (*v1.ServiceAccount, error)
|
GetServiceAccount(tokendata *TokenData) (*v1.ServiceAccount, error)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue