Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/rhoas/pkged.go

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions locales/cluster/kubernetes/active.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,19 @@ one = '''Process of watching ManagedKafkaConnection timed out'''
[cluster.kubernetes.watchForManagedKafkaStatus.log.info.wait]
one = '''
Waiting for status from ManagedKafkaConnection resource.
Created ManagedKafkaConnection can be already injected to your application
by creating Service Binding (requires ServiceBindingOperator):
Created ManagedKafkaConnection can be already injected to your application:
You can bind credentials to your application using:
- odo cli
- OpenShift topology view
- manually using kubectl

To bind you need to have Service Binding Operator installed:
https://github.com/redhat-developer/service-binding-operator
'''

[cluster.kubernetes.watchForManagedKafkaStatus.binding]
one = '''
cat <<EOF | kubectl apply -f -
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should print to stdout.

Copy link
Collaborator Author

@wtrocki wtrocki Mar 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to ensure order of the messages ?
I really want this to be also printed in the bash in proper order.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be split into three messages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah.. ok so bash will print both error and stdout.

  1. printErr(Success)
  2. printSTD binding
  3. printErro more bessages

Great idea! Will do that today!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly!

apiVersion: binding.operators.coreos.com/v1alpha1
kind: ServiceBinding
metadata:
Expand All @@ -75,10 +85,11 @@ spec:
version: {{.Version}}
kind: {{.Kind}}
name: {{.Name}}

For OpenShift you can also create service binding by using odo cli or directly in the UI topology view.
EOF
'''



[cluster.kubernetes.serviceaccountsecret.error.createError]
one = 'Could not create Service Account secret'

Expand Down
16 changes: 15 additions & 1 deletion locales/cmd/cluster/active.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,18 @@
one = 'cluster'

[cluster.cmd.shortDescription]
one = 'View and perform operations on your Kubernetes or OpenShift cluster'
one = 'View and perform operations on your Kubernetes or OpenShift cluster'

[cluster.cmd.example]
one = '''
# connect with cluster without including currently selected services
$ rhoas cluster connect --ignore-context

# connect with cluster using specified token
$ rhoas cluster connect --token=value

# connect with cluster and save script to create service binding
$ rhoas cluster connect --force > create_service_binding.sh
'''


7 changes: 6 additions & 1 deletion pkg/cluster/mkcManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package cluster
import (
"context"
"fmt"
"time"

"github.com/bf2fc6cc711aee1a0c2a/cli/internal/localizer"
kasclient "github.com/bf2fc6cc711aee1a0c2a/cli/pkg/api/kas/client"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -14,7 +16,6 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/watch"
"time"
)

var MKCGroup = "rhoas.redhat.com"
Expand Down Expand Up @@ -82,6 +83,10 @@ func getKafkaConnectionsAPIURL(namespace string) string {
func watchForManagedKafkaStatus(c *KubernetesCluster, crName string, namespace string) error {
c.logger.Info(localizer.MustLocalize(&localizer.Config{
MessageID: "cluster.kubernetes.watchForManagedKafkaStatus.log.info.wait",
}))

fmt.Fprint(c.io.Out, localizer.MustLocalize(&localizer.Config{
MessageID: "cluster.kubernetes.watchForManagedKafkaStatus.binding",
TemplateData: map[string]interface{}{
"Name": crName,
"Namespace": namespace,
Expand Down
7 changes: 4 additions & 3 deletions pkg/cmd/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (
// NewServiceAccountCommand creates a new command sub-group to manage service accounts
func NewClusterCommand(f *factory.Factory) *cobra.Command {
cmd := &cobra.Command{
Use: localizer.MustLocalizeFromID("cluster.cmd.use"),
Short: localizer.MustLocalizeFromID("cluster.cmd.shortDescription"),
Args: cobra.ExactArgs(1),
Use: localizer.MustLocalizeFromID("cluster.cmd.use"),
Short: localizer.MustLocalizeFromID("cluster.cmd.shortDescription"),
Example: localizer.MustLocalizeFromID("cluster.cmd.example"),
Args: cobra.ExactArgs(1),
}

cmd.AddCommand(
Expand Down