@@ -66,6 +66,17 @@ func NewBinder(config *rest.Config, opts *BinderOptions) *Binder {
6666// https://github.com/kube-bind/kube-bind/issues/360
6767
6868func (b * Binder ) BindFromFile (ctx context.Context ) ([]* kubebindv1alpha2.APIServiceBinding , error ) {
69+ // Generate the kubectl command that would be equivalent
70+ remoteFlags := ""
71+ if b .opts .RemoteKubeconfigFile != "" {
72+ remoteFlags = fmt .Sprintf ("--remote-kubeconfig %s" , b .opts .RemoteKubeconfigFile )
73+ } else if b .opts .RemoteKubeconfigNamespace != "" && b .opts .RemoteKubeconfigName != "" {
74+ remoteFlags = fmt .Sprintf ("--remote-kubeconfig-namespace %s --remote-kubeconfig-name %s" , b .opts .RemoteKubeconfigNamespace , b .opts .RemoteKubeconfigName )
75+ }
76+ fmt .Fprintf (b .opts .IOStreams .ErrOut , "🚀 Executing: kubectl bind apiservice %s -f -\n " , remoteFlags )
77+ fmt .Fprintf (b .opts .IOStreams .ErrOut , "✨ Use \" -o yaml\" and \" --dry-run\" to get the APIServiceExportRequest.\n " )
78+ fmt .Fprintf (b .opts .IOStreams .ErrOut , " and pass it to \" kubectl bind apiservice\" directly. Great for automation.\n " )
79+
6980 // Ensure client side namespace exists
7081 err := b .ensureClientSideNamespaceExists (ctx )
7182 if err != nil {
@@ -99,9 +110,9 @@ func (b *Binder) BindFromFile(ctx context.Context) ([]*kubebindv1alpha2.APIServi
99110 }
100111
101112 if created {
102- fmt .Fprintf (b .opts .IOStreams .ErrOut , "Created secret %s/%s for host %s, namespace %s\n " , "kube-bind" , secret .Name , remoteHost , remoteNamespace )
113+ fmt .Fprintf (b .opts .IOStreams .ErrOut , "🔒 Created secret %s/%s for host %s, namespace %s\n " , "kube-bind" , secret .Name , remoteHost , remoteNamespace )
103114 } else {
104- fmt .Fprintf (b .opts .IOStreams .ErrOut , "Updated secret %s/%s for host %s, namespace %s\n " , "kube-bind" , secret .Name , remoteHost , remoteNamespace )
115+ fmt .Fprintf (b .opts .IOStreams .ErrOut , "🔒 Updated secret %s/%s for host %s, namespace %s\n " , "kube-bind" , secret .Name , remoteHost , remoteNamespace )
105116 }
106117
107118 if b .opts .DryRun {
@@ -184,9 +195,9 @@ func (b *Binder) BindFromResponse(ctx context.Context, response *kubebindv1alpha
184195 }
185196
186197 if created {
187- fmt .Fprintf (b .opts .IOStreams .ErrOut , "Created secret %s/%s for host %s, namespace %s\n " , "kube-bind" , secret .Name , remoteHost , remoteNamespace )
198+ fmt .Fprintf (b .opts .IOStreams .ErrOut , "🔒 Created secret %s/%s for host %s, namespace %s\n " , "kube-bind" , secret .Name , remoteHost , remoteNamespace )
188199 } else {
189- fmt .Fprintf (b .opts .IOStreams .ErrOut , "Updated secret %s/%s for host %s, namespace %s\n " , "kube-bind" , secret .Name , remoteHost , remoteNamespace )
200+ fmt .Fprintf (b .opts .IOStreams .ErrOut , "🔒 Updated secret %s/%s for host %s, namespace %s\n " , "kube-bind" , secret .Name , remoteHost , remoteNamespace )
190201 }
191202
192203 if b .opts .DryRun {
0 commit comments