-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update Signed-off-by: ysicing <i@ysicing.me>
- Loading branch information
Showing
6 changed files
with
95 additions
and
23 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
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
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,66 @@ | ||
package incluster | ||
|
||
import ( | ||
"github.com/ysicing/ergo/internal/pkg/cluster" | ||
"github.com/ysicing/ergo/internal/pkg/providers" | ||
"github.com/ysicing/ergo/internal/pkg/types" | ||
) | ||
|
||
// providerName is the name of this provider. | ||
const providerName = "incluster" | ||
|
||
const createUsageExample = ` | ||
create default cluster: | ||
ergo kube k3s init | ||
` | ||
|
||
type Native struct { | ||
*cluster.Cluster | ||
} | ||
|
||
func init() { | ||
providers.RegisterProvider(providerName, func() (providers.Provider, error) { | ||
return newProvider(), nil | ||
}) | ||
} | ||
|
||
func newProvider() *Native { | ||
c := cluster.NewCluster() | ||
c.Provider = providerName | ||
return &Native{ | ||
Cluster: c, | ||
} | ||
} | ||
|
||
// GetUsageExample returns native usage example prompt. | ||
func (p *Native) GetUsageExample(action string) string { | ||
switch action { | ||
case "create": | ||
return createUsageExample | ||
default: | ||
return "not support" | ||
} | ||
} | ||
|
||
// GetCreateFlags returns native create flags. | ||
func (p *Native) GetCreateFlags() []types.Flag { | ||
return nil | ||
} | ||
|
||
func (p *Native) GetProviderName() string { | ||
return p.Provider | ||
} | ||
|
||
// InitCluster init cluster. | ||
func (p *Native) InitCluster() (err error) { | ||
return nil | ||
} | ||
|
||
// JoinCluster join cluster. | ||
func (p *Native) JoinCluster() (err error) { | ||
return nil | ||
} | ||
|
||
func (p *Native) InitSystem() error { | ||
return nil | ||
} |
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