Skip to content

Commit 8842cac

Browse files
committed
fix: use stdout for binding
1 parent 9d8faaf commit 8842cac

File tree

5 files changed

+41
-21
lines changed

5 files changed

+41
-21
lines changed

cmd/rhoas/pkged.go

Lines changed: 0 additions & 12 deletions
This file was deleted.

locales/cluster/kubernetes/active.en.toml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,19 @@ one = '''Process of watching ManagedKafkaConnection timed out'''
5454
[cluster.kubernetes.watchForManagedKafkaStatus.log.info.wait]
5555
one = '''
5656
Waiting for status from ManagedKafkaConnection resource.
57-
Created ManagedKafkaConnection can be already injected to your application
58-
by creating Service Binding (requires ServiceBindingOperator):
57+
Created ManagedKafkaConnection can be already injected to your application:
58+
You can bind credentials to your application using:
59+
- odo cli
60+
- openshift topology view
61+
- manually using kubectl
62+
63+
To bind you need to have Service Binding Operator installed:
64+
https://github.com/redhat-developer/service-binding-operator
65+
'''
5966

67+
[cluster.kubernetes.watchForManagedKafkaStatus.binding]
68+
one = '''
69+
cat <<EOF | kubectl apply -f -
6070
apiVersion: binding.operators.coreos.com/v1alpha1
6171
kind: ServiceBinding
6272
metadata:
@@ -75,10 +85,11 @@ spec:
7585
version: {{.Version}}
7686
kind: {{.Kind}}
7787
name: {{.Name}}
78-
79-
For OpenShift you can also create service binding by using odo cli or directly in the UI topology view.
88+
EOF
8089
'''
8190

91+
92+
8293
[cluster.kubernetes.serviceaccountsecret.error.createError]
8394
one = 'Could not create Service Account secret'
8495

locales/cmd/cluster/active.en.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,18 @@
22
one = 'cluster'
33

44
[cluster.cmd.shortDescription]
5-
one = 'View and perform operations on your Kubernetes or OpenShift cluster'
5+
one = 'View and perform operations on your Kubernetes or OpenShift cluster'
6+
7+
[cluster.cmd.example]
8+
one = '''
9+
# connect with cluster without including currently selected services
10+
$ rhoas cluster connect --ignore-context
11+
12+
# connect with cluster using specified token
13+
$ rhoas cluster connect --token=value
14+
15+
# connect with cluster and save script to create service binding
16+
$ rhoas cluster connect --force > create_service_binding.sh
17+
'''
18+
19+

pkg/cluster/mkcManager.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ package cluster
66
import (
77
"context"
88
"fmt"
9+
"os"
10+
"time"
11+
912
"github.com/bf2fc6cc711aee1a0c2a/cli/internal/localizer"
1013
kasclient "github.com/bf2fc6cc711aee1a0c2a/cli/pkg/api/kas/client"
1114
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -14,7 +17,6 @@ import (
1417
"k8s.io/apimachinery/pkg/runtime"
1518
"k8s.io/apimachinery/pkg/runtime/schema"
1619
"k8s.io/apimachinery/pkg/watch"
17-
"time"
1820
)
1921

2022
var MKCGroup = "rhoas.redhat.com"
@@ -82,6 +84,10 @@ func getKafkaConnectionsAPIURL(namespace string) string {
8284
func watchForManagedKafkaStatus(c *KubernetesCluster, crName string, namespace string) error {
8385
c.logger.Info(localizer.MustLocalize(&localizer.Config{
8486
MessageID: "cluster.kubernetes.watchForManagedKafkaStatus.log.info.wait",
87+
}))
88+
89+
fmt.Fprint(os.Stdout, localizer.MustLocalize(&localizer.Config{
90+
MessageID: "cluster.kubernetes.watchForManagedKafkaStatus.binding",
8591
TemplateData: map[string]interface{}{
8692
"Name": crName,
8793
"Namespace": namespace,

pkg/cmd/cluster/cluster.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import (
1111
// NewServiceAccountCommand creates a new command sub-group to manage service accounts
1212
func NewClusterCommand(f *factory.Factory) *cobra.Command {
1313
cmd := &cobra.Command{
14-
Use: localizer.MustLocalizeFromID("cluster.cmd.use"),
15-
Short: localizer.MustLocalizeFromID("cluster.cmd.shortDescription"),
16-
Args: cobra.ExactArgs(1),
14+
Use: localizer.MustLocalizeFromID("cluster.cmd.use"),
15+
Short: localizer.MustLocalizeFromID("cluster.cmd.shortDescription"),
16+
Example: localizer.MustLocalizeFromID("cluster.cmd.example"),
17+
Args: cobra.ExactArgs(1),
1718
}
1819

1920
cmd.AddCommand(

0 commit comments

Comments
 (0)