generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e82244
commit 1ad656a
Showing
7 changed files
with
381 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
<!-- | ||
The file is auto-generated from the Go source code of the component using the | ||
[generator](https://github.com/kubernetes-sigs/kueue/tree/main/cmd/experimental/kjobctl/cmd/kjobctl-docs). | ||
--> | ||
|
||
# kjobctl version | ||
|
||
|
||
## Synopsis | ||
|
||
|
||
Prints the client version | ||
|
||
``` | ||
kjobctl version | ||
``` | ||
|
||
|
||
## Examples | ||
|
||
``` | ||
# Prints the client version | ||
kjobctl version | ||
``` | ||
|
||
|
||
## Options | ||
|
||
|
||
<table style="width: 100%; table-layout: fixed;"> | ||
<colgroup> | ||
<col span="1" style="width: 10px;" /> | ||
<col span="1" /> | ||
</colgroup> | ||
<tbody> | ||
<tr> | ||
<td colspan="2">-h, --help</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>help for version</p> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
|
||
|
||
## Options inherited from parent commands | ||
<table style="width: 100%; table-layout: fixed;"> | ||
<colgroup> | ||
<col span="1" style="width: 10px;" /> | ||
<col span="1" /> | ||
</colgroup> | ||
<tbody> | ||
<tr> | ||
<td colspan="2">--as string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>Username to impersonate for the operation. User could be a regular user or a service account in a namespace.</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--as-group strings</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>Group to impersonate for the operation, this flag can be repeated to specify multiple groups.</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--as-uid string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>UID to impersonate for the operation.</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--cache-dir string Default: "$HOME/.kube/cache"</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>Default cache directory</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--certificate-authority string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>Path to a cert file for the certificate authority</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--client-certificate string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>Path to a client certificate file for TLS</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--client-key string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>Path to a client key file for TLS</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--cluster string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>The name of the kubeconfig cluster to use</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--context string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>The name of the kubeconfig context to use</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--disable-compression</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>If true, opt-out of response compression for all requests to the server</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--insecure-skip-tls-verify</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--kubeconfig string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>Path to the kubeconfig file to use for CLI requests.</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">-n, --namespace string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>If present, the namespace scope for this CLI request</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--request-timeout string Default: "0"</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">-s, --server string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>The address and port of the Kubernetes API server</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--tls-server-name string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--token string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>Bearer token for authentication to the API server</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2">--user string</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td style="line-height: 130%; word-wrap: break-word;"> | ||
<p>The name of the kubeconfig user to use</p> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
|
||
|
||
## See Also | ||
|
||
* [kjobctl](../kjobctl.md) - ML/AI/Batch Jobs Made Easy | ||
|
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,69 @@ | ||
/* | ||
Copyright 2025 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package version | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
"k8s.io/cli-runtime/pkg/genericiooptions" | ||
"k8s.io/kubectl/pkg/util/templates" | ||
|
||
"sigs.k8s.io/kjob/pkg/version" | ||
) | ||
|
||
var ( | ||
versionExample = templates.Examples(` | ||
# Prints the client version | ||
kjobctl version | ||
`) | ||
) | ||
|
||
// VersionOptions is a struct to support version command | ||
type VersionOptions struct { | ||
genericiooptions.IOStreams | ||
} | ||
|
||
// NewOptions returns initialized Options | ||
func NewOptions(streams genericiooptions.IOStreams) *VersionOptions { | ||
return &VersionOptions{ | ||
IOStreams: streams, | ||
} | ||
} | ||
|
||
// NewVersionCmd returns a new cobra.Command for fetching version | ||
func NewVersionCmd(streams genericiooptions.IOStreams) *cobra.Command { | ||
o := NewOptions(streams) | ||
|
||
cmd := &cobra.Command{ | ||
Use: "version", | ||
Short: "Prints the client version", | ||
Example: versionExample, | ||
Args: cobra.NoArgs, | ||
DisableFlagsInUseLine: true, | ||
Run: func(_ *cobra.Command, _ []string) { | ||
o.Run() | ||
}, | ||
} | ||
|
||
return cmd | ||
} | ||
|
||
// Run executes version command | ||
func (o *VersionOptions) Run() { | ||
fmt.Fprintf(o.Out, "Client Version: %s\n", version.GitVersion) | ||
} |
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,50 @@ | ||
/* | ||
Copyright 2025 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package version | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
"github.com/google/go-cmp/cmp/cmpopts" | ||
"k8s.io/cli-runtime/pkg/genericiooptions" | ||
) | ||
|
||
func TestVersionCmd(t *testing.T) { | ||
streams, _, out, outErr := genericiooptions.NewTestIOStreams() | ||
|
||
cmd := NewVersionCmd(streams) | ||
cmd.SetArgs([]string{}) | ||
|
||
var wantErr error | ||
gotErr := cmd.Execute() | ||
if diff := cmp.Diff(wantErr, gotErr, cmpopts.EquateErrors()); diff != "" { | ||
t.Errorf("Unexpected error (-want/+got)\n%s", diff) | ||
} | ||
|
||
wantOut := "Client Version: v0.0.0-main\n" | ||
gotOut := out.String() | ||
if diff := cmp.Diff(wantOut, gotOut); diff != "" { | ||
t.Errorf("Unexpected output (-want/+got)\n%s", diff) | ||
} | ||
|
||
var wantOutErr string | ||
gotOutErr := outErr.String() | ||
if diff := cmp.Diff(wantOutErr, gotOutErr); diff != "" { | ||
t.Errorf("Unexpected output (-want/+got)\n%s", diff) | ||
} | ||
} |
Oops, something went wrong.