mirror of
https://github.com/fluxcd/flux2.git
synced 2026-05-05 01:28:52 +00:00
Properly detect unsupported API errors
This can happen when Custom Resource Definitions do not exist on the cluster. For example, because only a subset of the Flux controllers are installed on the cluster. Previously, the detection was based on a combination of error type and string matching. However, a more reliable (and maintained) `apimeta.IsNoMatchError` checker is available upstream. Making it less likely this suddenly stops to matching properly when Kubernetes changes things. Signed-off-by: Hidde Beydals <hidde@hhh.computer>
This commit is contained in:
parent
bae59fde6a
commit
bf6754e20c
3 changed files with 5 additions and 10 deletions
|
|
@ -17,9 +17,8 @@ limitations under the License.
|
|||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2beta2"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
|
||||
|
|
@ -87,7 +86,7 @@ var getAllCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func logError(err error) {
|
||||
if !strings.Contains(err.Error(), "no matches for kind") {
|
||||
if !apimeta.IsNoMatchError(err) {
|
||||
logger.Failuref(err.Error())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue