Skip to content

Commit

Permalink
Merge pull request #204 from itdove/console_cluster
Browse files Browse the repository at this point in the history
Add cm console cluster
  • Loading branch information
itdove committed May 6, 2022
2 parents 0a9e34d + 96b3f14 commit 78ee355
Show file tree
Hide file tree
Showing 18 changed files with 374 additions and 122 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- [Support import of a cluster that is the non-active kubecontext in a kubeconfig #197](https://github.com/stolostron/cm-cli/issues/197)
- Add "--kubeconfig-creds" in `cm get cc` to display the kubeconfig
- [Open openshift console of an hypershift hosted #201](https://github.com/stolostron/cm-cli/issues/201)

- [Add cmd cm console cluster to open the console of a managedcluster either created by cc or hypershift #200](https://github.com/stolostron/cm-cli/issues/200)
## Breaking changes

- Remove commands "init, join, accept, get token, delete token" as they are pure OCM and should not be used on ACM/MCE. Please use commands like `cm attach cluster`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,15 @@ spec:
from which to claim a cluster.
type: string
lifetime:
description: Lifetime is the maximum lifetime of the claim
description: 'Lifetime is the maximum lifetime of the claim
after it is assigned a cluster. If the claim still exists
when the lifetime has elapsed, the claim will be deleted
by Hive. This is a Duration value; see https://pkg.go.dev/time#ParseDuration
for accepted formats.
format: duration
for accepted formats. Note: due to discrepancies in validation
vs parsing, we use a Pattern instead of `Format=duration`.
See https://bugzilla.redhat.com/show_bug.cgi?id=2050332
https://github.com/kubernetes/apimachinery/issues/131 https://github.com/kubernetes/apiextensions-apiserver/issues/56'
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
namespace:
description: Namespace is the namespace containing the ClusterDeployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,34 +93,67 @@ spec:
for the cluster pool.
properties:
default:
description: Default is the default lifetime of the claim
description: 'Default is the default lifetime of the claim
when no lifetime is set on the claim itself. This is
a Duration value; see https://pkg.go.dev/time#ParseDuration
for accepted formats.
format: duration
for accepted formats. Note: due to discrepancies in
validation vs parsing, we use a Pattern instead of `Format=duration`.
See https://bugzilla.redhat.com/show_bug.cgi?id=2050332
https://github.com/kubernetes/apimachinery/issues/131
https://github.com/kubernetes/apiextensions-apiserver/issues/56'
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
maximum:
description: Maximum is the maximum lifetime of the claim
description: 'Maximum is the maximum lifetime of the claim
after it is assigned a cluster. If the claim still exists
when the lifetime has elapsed, the claim will be deleted
by Hive. The lifetime of a claim is the mimimum of the
lifetimes set by the cluster pool and the claim itself.
This is a Duration value; see https://pkg.go.dev/time#ParseDuration
for accepted formats.
format: duration
for accepted formats. Note: due to discrepancies in
validation vs parsing, we use a Pattern instead of `Format=duration`.
See https://bugzilla.redhat.com/show_bug.cgi?id=2050332
https://github.com/kubernetes/apimachinery/issues/131
https://github.com/kubernetes/apiextensions-apiserver/issues/56'
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
type: object
hibernateAfter:
description: HibernateAfter will be applied to new ClusterDeployments
description: 'HibernateAfter will be applied to new ClusterDeployments
created for the pool. HibernateAfter will transition clusters
in the clusterpool to hibernating power state after it has
been running for the given duration. The time that a cluster
has been running is the time since the cluster was installed
or the time since the cluster last came out of hibernation.
This is a Duration value; see https://pkg.go.dev/time#ParseDuration
for accepted formats.
format: duration
for accepted formats. Note: due to discrepancies in validation
vs parsing, we use a Pattern instead of `Format=duration`.
See https://bugzilla.redhat.com/show_bug.cgi?id=2050332
https://github.com/kubernetes/apimachinery/issues/131 https://github.com/kubernetes/apiextensions-apiserver/issues/56'
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
hibernationConfig:
description: HibernationConfig configures the hibernation/resume
behavior of ClusterDeployments owned by the ClusterPool.
properties:
resumeTimeout:
description: 'ResumeTimeout is the maximum amount of time
we will wait for an unclaimed ClusterDeployment to resume
from hibernation (e.g. at the behest of runningCount,
or in preparation for being claimed). If this time is
exceeded, the ClusterDeployment will be considered Broken
and we will replace it. The default (unspecified or
zero) means no timeout -- we will allow the ClusterDeployment
to continue trying to resume "forever". This is a Duration
value; see https://pkg.go.dev/time#ParseDuration for
accepted formats. Note: due to discrepancies in validation
vs parsing, we use a Pattern instead of `Format=duration`.
See https://bugzilla.redhat.com/show_bug.cgi?id=2050332
https://github.com/kubernetes/apimachinery/issues/131
https://github.com/kubernetes/apiextensions-apiserver/issues/56'
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
type: object
imageSetRef:
description: ImageSetRef is a reference to a ClusterImageSet.
The release image specified in the ClusterImageSet will
Expand All @@ -133,6 +166,11 @@ spec:
required:
- name
type: object
installAttemptsLimit:
description: InstallAttemptsLimit is the maximum number of
times Hive will attempt to install the cluster.
format: int32
type: integer
installConfigSecretTemplateRef:
description: InstallConfigSecretTemplateRef is a secret with
the key install-config.yaml consisting of the content of
Expand Down Expand Up @@ -367,6 +405,42 @@ spec:
- credentialsSecretRef
- region
type: object
ibmcloud:
description: IBMCloud is the configuration used when installing
on IBM Cloud
properties:
accountID:
description: AccountID is the IBM Cloud Account ID.
AccountID is DEPRECATED and is gathered via the
IBM Cloud API for the provided credentials. This
field will be ignored.
type: string
cisInstanceCRN:
description: CISInstanceCRN is the IBM Cloud Internet
Services Instance CRN CISInstanceCRN is DEPRECATED
and gathered via the IBM Cloud API for the provided
credentials and cluster deployment base domain.
This field will be ignored.
type: string
credentialsSecretRef:
description: CredentialsSecretRef refers to a secret
that contains IBM Cloud account access credentials.
properties:
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
type: object
region:
description: Region specifies the IBM Cloud region
where the cluster will be created.
type: string
required:
- credentialsSecretRef
- region
type: object
openstack:
description: OpenStack is the configuration used when
installing on OpenStack
Expand Down Expand Up @@ -603,14 +677,19 @@ spec:
type: array
ready:
description: Ready is the number of unclaimed clusters that
have been installed and are ready to be claimed.
are installed and are running and ready to be claimed.
format: int32
type: integer
size:
description: Size is the number of unclaimed clusters that
have been created for the pool.
format: int32
type: integer
standby:
description: Standby is the number of unclaimed clusters that
are installed, but not running.
format: int32
type: integer
required:
- ready
- size
Expand Down
1 change: 1 addition & 0 deletions docs/help/cm_attach_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ cm attach cluster mycluster --values values.yaml
```
--cluster-kubeconfig string path to the kubeconfig the cluster to import
--cluster-kubeconfig-content string content of the kubeconfig the cluster to import
--cluster-kubecontext string context to use in the kubeconfig to import the cluster
--cluster-server string cluster server url of the cluster to import
--cluster-token string token to access the cluster to import
-h, --help help for cluster
Expand Down
1 change: 1 addition & 0 deletions docs/help/cm_console.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ open a console
### SEE ALSO

* [cm](cm.md) - CLI for Red Hat Advanced Cluster Management
* [cm console cluster](cm_console_cluster.md) - Open console of a managed cluster
* [cm console clusterclaims](cm_console_clusterclaims.md) - Open console of a clusterclaim
* [cm console clusterpoolhost](cm_console_clusterpoolhost.md) - open the console of a clusterpoolhost

85 changes: 85 additions & 0 deletions docs/help/cm_console_cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
## cm console cluster

Open console of a managed cluster

### Synopsis

Open the console of a managed cluster if the managed cluster was created using a hypershift or cluster claim

```
cm console cluster
```

### Examples

```
# open the console of a managedcluster cluster
cm concole cluster <managed-cluster-name>
```

### Options

```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
--cph string The clusterpoolhost to use
--creds If set the credentials will be displayed
-h, --help help for cluster
-L, --label-columns strings Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2...
--no-headers When using the default or custom-column output format, don't print headers (default print headers).
-o, --output string Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns-file|custom-columns|wide See custom columns [https://kubernetes.io/docs/reference/kubectl/overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [https://kubernetes.io/docs/reference/kubectl/jsonpath/].
--show-kind If present, list the resource type for the requested object(s).
--show-labels When printing, show all labels as the last column (default hide labels column)
--show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format.
--sort-by string If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--timeout int Timeout to get the cluster claim running (default 60)
```

### Options inherited from parent commands

```
--add-dir-header If true, adds the file directory to the header of the log messages
--alsologtostderr log to standard error as well as files
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
--as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--as-uid string UID to impersonate for the operation.
--beta If set commands or functionalities in beta version will be available
--cache-dir string Default cache directory (default "${HOME}/.kube/cache")
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
--context string The name of the kubeconfig context to use
--dry-run If set the generated resources will be displayed but not applied
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
--log-backtrace-at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log-dir string If non-empty, write log files in this directory
--log-file string If non-empty, use this log file
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
--logtostderr log to standard error instead of files (default true)
--match-server-version Require server version to match client version
-n, --namespace string If present, the namespace scope for this CLI request
--one-output If true, only write logs to their native severity level (vs also writing to each lower severity level)
--password string Password for basic authentication to the API server
--request-timeout string 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. (default "0")
-s, --server string The address and port of the Kubernetes API server
--server-namespace string The namespace where the server (RHACM/MCE) is installed
--skip-headers If true, avoid header prefixes in the log messages
--skip-log-headers If true, avoid headers when opening log files
--skip-server-check If set commands will not check the installed server (RHACM/MCE) target
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
--tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--username string Username for basic authentication to the API server
-v, --v Level number for the log level verbosity
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
```

### SEE ALSO

* [cm console](cm_console.md) - open a console

2 changes: 1 addition & 1 deletion docs/help/cm_console_clusterclaims.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cm console clusterclaims
# open the console of clusterclaim in current clusterpoolhost
cm console cc <cluster-name>
# pen the console clusterclaims of a given clusterpoolhost
# open the console clusterclaims of a given clusterpoolhost
cm concole cc <cluster-name> --cph <clusterpoolhosts>
```
Expand Down
Loading

0 comments on commit 78ee355

Please sign in to comment.