Skip to content

Commit 4b566e3

Browse files
author
Kimonas Sotirchos
committed
fix(kimonas): reconcile httproutes for tensorboard-controller
Signed-off-by: Kimonas Sotirchos <kimonas.sotirchos@canonical.com>
1 parent 7055443 commit 4b566e3

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

components/tensorboard-controller/controllers/tensorboard_controller.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,20 @@ func (r *TensorboardReconciler) Reconcile(ctx context.Context, req ctrl.Request)
162162

163163
// SetupWithManager sets up the controller with the Manager.
164164
func (r *TensorboardReconciler) SetupWithManager(mgr ctrl.Manager) error {
165-
return ctrl.NewControllerManagedBy(mgr).
165+
builder := ctrl.NewControllerManagedBy(mgr).
166166
For(&tensorboardv1alpha1.Tensorboard{}).
167-
Owns(&appsv1.Deployment{}).
168-
Complete(r)
167+
Owns(&appsv1.Deployment{})
168+
169+
if os.Getenv("USE_GATEWAY_API") == "true" {
170+
builder.Owns(&gwapiv1beta1.HTTPRoute{})
171+
} else {
172+
virtualService := &unstructured.Unstructured{}
173+
virtualService.SetAPIVersion("networking.istio.io/v1alpha3")
174+
virtualService.SetKind("VirtualService")
175+
builder.Owns(virtualService)
176+
}
177+
178+
return builder.Complete(r)
169179
}
170180

171181
func generateDeployment(tb *tensorboardv1alpha1.Tensorboard, log logr.Logger, r *TensorboardReconciler) (*appsv1.Deployment, error) {

0 commit comments

Comments
 (0)