Skip to content

Commit 9c42d7d

Browse files
committed
Fix bug in ownerReference
The ownerReference had the wrong type, kind and group - that of the tunnel and not that of the service which caused the tunnel to be created. Tested e2e and shown to be fixed, the problem was observed when rebooting a machine running kubeadm or an RPi running k3s. Thanks to @stefanprodan for helping me to find this and to @utsavanand2 for confirming the issue. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent c74fa06 commit 9c42d7d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

controller.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ func NewController(
123123
},
124124
DeleteFunc: func(old interface{}) {
125125
r, ok := checkCustomResourceType(old)
126+
127+
log.Println("Delete event:", r.Name, r.Namespace, r.OwnerReferences)
128+
126129
if ok {
127130
if len(r.Status.HostID) > 0 {
128131
var provisioner provision.Provisioner
@@ -153,6 +156,7 @@ func NewController(
153156
}
154157
}
155158
}
159+
156160
},
157161
})
158162

@@ -342,9 +346,9 @@ func (c *Controller) syncHandler(key string) error {
342346
Namespace: service.ObjectMeta.Namespace,
343347
OwnerReferences: []metav1.OwnerReference{
344348
*metav1.NewControllerRef(service, schema.GroupVersionKind{
345-
Group: inletsv1alpha1.SchemeGroupVersion.Group,
346-
Version: inletsv1alpha1.SchemeGroupVersion.Version,
347-
Kind: "Tunnel",
349+
Group: "",
350+
Version: "v1",
351+
Kind: "Service",
348352
}),
349353
},
350354
},

0 commit comments

Comments
 (0)