Skip to content

Commit

Permalink
Disable airgap list-images for dynamic config
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
  • Loading branch information
kke committed Jun 6, 2023
1 parent 7e42dba commit 1e5e6b6
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions cmd/airgap/listimages.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ limitations under the License.
package airgap

import (
"context"
"fmt"
"time"

"github.com/k0sproject/k0s/pkg/airgap"
"github.com/k0sproject/k0s/pkg/config"
"github.com/k0sproject/k0s/pkg/kubernetes"
"github.com/sirupsen/logrus"

"github.com/spf13/cobra"
)
Expand All @@ -42,18 +38,13 @@ func NewAirgapListImagesCmd() *cobra.Command {
return err
}

adminClientFactory := kubernetes.NewAdminClientFactory(opts.K0sVars.AdminKubeConfigPath)

ctx, cancel := context.WithTimeout(cmd.Context(), 2*time.Minute)
defer cancel()
if opts.EnableDynamicConfig {
return fmt.Errorf("dynamic config is not supported for airgap list-images")
}

clusterConfig, err := opts.K0sVars.FetchDynamicConfig(ctx, adminClientFactory)
clusterConfig, err := opts.K0sVars.NodeConfig()
if err != nil {
logrus.WithError(err).Warn("Failed to get cluster config, falling back to local config")
clusterConfig, err = opts.K0sVars.NodeConfig()
if err != nil {
return fmt.Errorf("failed to get local config: %w", err)
}
return fmt.Errorf("failed to get config: %w", err)
}

for _, uri := range airgap.GetImageURIs(clusterConfig.Spec, all) {
Expand Down

0 comments on commit 1e5e6b6

Please # to comment.