Skip to content

Commit

Permalink
chore: explicit error message about required Flux api versions
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlocph committed Mar 7, 2024
1 parent 4eaea63 commit 0f8bcf7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/flux/flux.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ func inventory(dc *dynamic.DynamicClient) ([]object.ObjMetadata, error) {
Namespace("").
List(context.TODO(), metav1.ListOptions{})
if err != nil {
if strings.Contains(err.Error(), "the server could not find the requested resource") {
return nil, fmt.Errorf("capacitor requires kustomize.toolkit.fluxcd.io/v1: %s", err)
}
return nil, err
}
for _, k := range kustomizations.Items {
Expand Down Expand Up @@ -326,6 +329,9 @@ func State(c *kubernetes.Clientset, dc *dynamic.DynamicClient) (*FluxState, erro
Namespace("").
List(context.TODO(), metav1.ListOptions{})
if err != nil {
if strings.Contains(err.Error(), "the server could not find the requested resource") {
return nil, fmt.Errorf("capacitor requires source.toolkit.fluxcd.io/v1: %s", err)
}
return nil, err
}
for _, repo := range gitRepositories.Items {
Expand Down

0 comments on commit 0f8bcf7

Please sign in to comment.