cmd/kgctl: add output options for showconf

This commit adds several output options to the `showconf` command of the
`kgctl` binary:
* `--as-peer`: this can be used to generate a peer configuration, which
can be used to configure the selected resource as a peer of another
WireGuard interface
* `--output`: this can be used to select the desired output format of
the peer resource, available options are: WireGuard, YAML, and JSON.
This commit is contained in:
Lucas Servén Marín
2019-05-08 01:31:36 +02:00
parent 5914a9468f
commit 90e68c7735
5 changed files with 185 additions and 17 deletions

View File

@@ -31,7 +31,7 @@ var (
const GroupName = "kilo.squat.ai"
// SchemeGroupVersion is the group version used to register these objects.
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}
// Resource takes an unqualified resource and returns a Group-qualified GroupResource.
func Resource(resource string) schema.GroupResource {

View File

@@ -21,15 +21,23 @@ import (
"net"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const (
// Version is the version of this API.
Version = "v1alpha1"
// PeerKind is the API kind for the peer resource.
PeerKind = "Peer"
// PeerPlural is the plural name for the peer resource.
PeerPlural = "peers"
)
var (
// PeerGVK is the GroupVersionKind for Peers.
PeerGVK = schema.GroupVersionKind{Group: GroupName, Version: Version, Kind: PeerKind}
)
// PeerShortNames are convenient shortnames for the peer resource.
var PeerShortNames = []string{"peer"}