File tree 2 files changed +29
-58
lines changed
2 files changed +29
-58
lines changed Original file line number Diff line number Diff line change @@ -85,10 +85,12 @@ function issueCertificate(werft: Werft, config: JobConfig) {
85
85
function decideHarvesterVMCreation ( werft : Werft , config : JobConfig ) {
86
86
if ( shouldCreateVM ( config ) ) {
87
87
createVM ( werft , config )
88
- applyLoadBalancer ( { name : config . previewEnvironment . destname } )
89
88
} else {
90
89
werft . currentPhaseSpan . setAttribute ( "werft.harvester.created_vm" , false )
91
90
}
91
+ if ( config . withVM ) {
92
+ applyLoadBalancer ( { name : config . previewEnvironment . destname } )
93
+ }
92
94
werft . done ( prepareSlices . BOOT_VM )
93
95
}
94
96
@@ -121,20 +123,6 @@ ${manifest}
121
123
EOF
122
124
` ) ;
123
125
}
124
- function getVMServiceIP ( ) {
125
- let ip = exec (
126
- `kubectl --kubeconfig ${ HARVESTER_KUBECONFIG_PATH } -n ${ namespace } get service proxy -o=jsonpath='{.spec.clusterIP}'` ,
127
- { silent : true } ,
128
- ) ;
129
- if ( ip . length > 4 ) {
130
- return ip ;
131
- }
132
- return null ;
133
- }
134
- let forwardIP = getVMServiceIP ( ) ;
135
- if ( forwardIP == null ) {
136
- throw new Error ( "Failed to get VM IP" ) ;
137
- }
138
- kubectlApplyManifest ( Manifests . LBDeployManifest ( { name : option . name , destIP : forwardIP } ) ) ;
126
+ kubectlApplyManifest ( Manifests . LBDeployManifest ( { name : option . name } ) ) ;
139
127
kubectlApplyManifest ( Manifests . LBServiceManifest ( { name : option . name } ) ) ;
140
128
}
Original file line number Diff line number Diff line change @@ -156,11 +156,11 @@ spec:
156
156
- name: ssh-gateway
157
157
protocol: TCP
158
158
port: 22
159
- targetPort: 22
159
+ targetPort: 2200
160
160
- name: https
161
161
protocol: TCP
162
162
port: 443
163
- targetPort: 443
163
+ targetPort: 4430
164
164
selector:
165
165
gitpod.io/lbName: ${ name }
166
166
type: LoadBalancer
@@ -169,10 +169,9 @@ spec:
169
169
170
170
type LBDeployManifestOptions = {
171
171
name : string
172
- destIP : string
173
172
}
174
173
175
- export function LBDeployManifest ( { name, destIP } : LBDeployManifestOptions ) {
174
+ export function LBDeployManifest ( { name } : LBDeployManifestOptions ) {
176
175
return `
177
176
apiVersion: apps/v1
178
177
kind: Deployment
@@ -192,45 +191,29 @@ spec:
192
191
labels:
193
192
gitpod.io/lbName: ${ name }
194
193
spec:
194
+ volumes:
195
+ - name: kubeconfig
196
+ secret:
197
+ secretName: harvester-kubeconfig
195
198
containers:
196
- - name: lb-port-22
197
- image: rancher/klipper-lb:v0.3.4
198
- ports:
199
- - name: lb-port-22
200
- containerPort: 22
201
- protocol: TCP
202
- env:
203
- - name: SRC_PORT
204
- value: '22'
205
- - name: DEST_PROTO
206
- value: TCP
207
- - name: DEST_PORT
208
- value: '22'
209
- - name: DEST_IPS
210
- value: ${ destIP }
211
- securityContext:
212
- capabilities:
213
- add:
214
- - NET_ADMIN
215
- - name: lb-port-443
216
- image: rancher/klipper-lb:v0.3.4
217
- ports:
218
- - name: lb-port-443
219
- containerPort: 443
220
- protocol: TCP
221
- env:
222
- - name: SRC_PORT
223
- value: '443'
224
- - name: DEST_PROTO
225
- value: TCP
226
- - name: DEST_PORT
227
- value: '443'
228
- - name: DEST_IPS
229
- value: ${ destIP }
230
- securityContext:
231
- capabilities:
232
- add:
233
- - NET_ADMIN
199
+ - name: kubectl
200
+ image: bitnami/kubectl:1.23.5
201
+ args:
202
+ - port-forward
203
+ - '--kubeconfig'
204
+ - /mnt/kubeconfig/harvester-kubeconfig.yml
205
+ - '-n'
206
+ - preview-${ name }
207
+ - --address=0.0.0.0
208
+ - --pod-running-timeout=2m
209
+ - svc/proxy
210
+ - '4430:443'
211
+ - '2200:22'
212
+ resources: {}
213
+ volumeMounts:
214
+ - name: kubeconfig
215
+ readOnly: true
216
+ mountPath: /mnt/kubeconfig/
234
217
serviceAccount: proxy
235
218
enableServiceLinks: false
236
219
`
You can’t perform that action at this time.
0 commit comments