-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
template
command that renders all manifests that will be …
…created by the kubernetes provider for a given configuration
- Loading branch information
1 parent
d60cc0e
commit d8da8ac
Showing
2,162 changed files
with
172,279 additions
and
79,939 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package cmd | ||
|
||
import ( | ||
"context" | ||
"os" | ||
|
||
"github.com/loft-sh/devpod-provider-kubernetes/pkg/kubernetes" | ||
"github.com/loft-sh/devpod-provider-kubernetes/pkg/options" | ||
"github.com/loft-sh/log" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// TemplateCmd holds the cmd flags | ||
type TemplateCmd struct{} | ||
|
||
// NewTemplateCmd defines a command | ||
func NewTemplateCmd() *cobra.Command { | ||
cmd := &TemplateCmd{} | ||
templateCmd := &cobra.Command{ | ||
Use: "template", | ||
Short: "Render Template for provider", | ||
RunE: func(_ *cobra.Command, args []string) error { | ||
options, err := options.FromEnv() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return cmd.Run(context.Background(), options, log.Default.ErrorStreamOnly()) | ||
}, | ||
} | ||
|
||
return templateCmd | ||
} | ||
|
||
// Run runs the command logic | ||
func (cmd *TemplateCmd) Run(ctx context.Context, options *options.Options, log log.Logger) error { | ||
verbose := os.Getenv("DEVPOD_VERBOSE") == "true" | ||
return kubernetes.NewKubernetesDriver(options, log).RenderTemplate(ctx, options.DevContainerID, verbose) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.