@@ -73,9 +73,18 @@ func runKfwd(cmd *cobra.Command, _ []string) error {
73
73
74
74
fmt .Println (upstream , "=" , port )
75
75
76
- deployment := makeDeployment (eth , port , upstream , ns )
76
+ inletsToken , passwordErr := generateAuth ()
77
+ if passwordErr != nil {
78
+ return passwordErr
79
+ }
80
+
81
+ deployment := makeDeployment (eth , port , upstream , ns , inletsToken )
77
82
tmpPath := path .Join (os .TempDir (), "inlets-" + upstream + ".yaml" )
78
- ioutil .WriteFile (tmpPath , []byte (deployment ), 0600 )
83
+ err = ioutil .WriteFile (tmpPath , []byte (deployment ), 0600 )
84
+ if err != nil {
85
+ return err
86
+ }
87
+ fmt .Printf ("%s written.\n " , tmpPath )
79
88
80
89
task := v1.ExecTask {
81
90
Command : "kubectl" ,
@@ -130,6 +139,7 @@ Hit Control+C to cancel.`, eth, port)
130
139
Args : []string {
131
140
"server" ,
132
141
"--port=" + fmt .Sprintf ("%s" , port ),
142
+ "--token=" + inletsToken ,
133
143
},
134
144
}
135
145
serverRes , serverErr := serverTask .Execute ()
@@ -146,7 +156,7 @@ Hit Control+C to cancel.`, eth, port)
146
156
return nil
147
157
}
148
158
149
- func makeDeployment (remote , port , upstream , ns string ) string {
159
+ func makeDeployment (remote , port , upstream , ns , inletsToken string ) string {
150
160
151
161
return fmt .Sprintf (`apiVersion: apps/v1
152
162
kind: Deployment
@@ -172,5 +182,6 @@ spec:
172
182
- "client"
173
183
- "--remote=ws://%s:%s"
174
184
- "--upstream=http://%s:%s"
175
- ` , upstream , ns , remote , port , upstream , port )
185
+ - "--token=%s"
186
+ ` , upstream , ns , remote , port , upstream , port , inletsToken )
176
187
}
0 commit comments