Skip to content

Commit 0381190

Browse files
committed
Fix issue with status sub-resource
After moving to a status sub-resource in the generated CRD the status had to be updated via UpdateStatus() on the Kubernetes clientset, not via Update() as we had it. The CRD is also made so that its status fields are optional so the status can be set whilst we have a hostID, but no hostIP yet. Requires a new release and helm chart version for the users to receive this fix. A big thank you to @munnerz for the hints on this. Fixes: #84 Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent 840555a commit 0381190

3 files changed

Lines changed: 11 additions & 17 deletions

File tree

artifacts/crds/inlets.inlets.dev_tunnels.yaml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
2-
---
31
apiVersion: apiextensions.k8s.io/v1beta1
42
kind: CustomResourceDefinition
53
metadata:
64
annotations:
7-
controller-gen.kubebuilder.io/version: (unknown)
5+
controller-gen.kubebuilder.io/version: v0.3.0
86
creationTimestamp: null
97
name: tunnels.inlets.inlets.dev
108
spec:
@@ -36,6 +34,7 @@ spec:
3634
validation:
3735
openAPIV3Schema:
3836
description: Tunnel is a specification for a Tunnel resource
37+
type: object
3938
properties:
4039
apiVersion:
4140
description: 'APIVersion defines the versioned schema of this representation
@@ -51,30 +50,25 @@ spec:
5150
type: object
5251
spec:
5352
description: TunnelSpec is the spec for a Tunnel resource
53+
type: object
5454
properties:
5555
auth_token:
5656
type: string
5757
client_deployment:
58-
nullable: true
5958
type: object
59+
nullable: true
6060
serviceName:
6161
type: string
62-
type: object
6362
status:
6463
description: TunnelStatus is the status for a Tunnel resource
64+
type: object
6565
properties:
6666
hostIP:
6767
type: string
6868
hostId:
6969
type: string
7070
hostStatus:
7171
type: string
72-
required:
73-
- hostIP
74-
- hostId
75-
- hostStatus
76-
type: object
77-
type: object
7872
version: v1alpha1
7973
versions:
8074
- name: v1alpha1
@@ -84,8 +78,5 @@ status:
8478
acceptedNames:
8579
kind: ""
8680
plural: ""
87-
# This is not generated
88-
# conditions: null
89-
# storedVersions: null
9081
conditions: []
9182
storedVersions: []

controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ func (c *Controller) updateTunnelProvisioningStatus(tunnel *inletsv1alpha1.Tunne
923923
tunnelCopy.Status.HostID = id
924924
tunnelCopy.Status.HostIP = ip
925925

926-
_, err := c.operatorclientset.InletsV1alpha1().Tunnels(tunnel.Namespace).Update(tunnelCopy)
926+
_, err := c.operatorclientset.InletsV1alpha1().Tunnels(tunnel.Namespace).UpdateStatus(tunnelCopy)
927927
return err
928928
}
929929

pkg/apis/inletsoperator/v1alpha1/types.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ type TunnelSpec struct {
5252

5353
// TunnelStatus is the status for a Tunnel resource
5454
type TunnelStatus struct {
55+
// + optional
5556
HostStatus string `json:"hostStatus,omitempty"`
56-
HostIP string `json:"hostIP,omitempty"`
57-
HostID string `json:"hostId,omitempty"`
57+
// + optional
58+
HostIP string `json:"hostIP,omitempty"`
59+
// + optional
60+
HostID string `json:"hostId,omitempty"`
5861
}
5962

6063
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

0 commit comments

Comments
 (0)