From 0588f14ca9890461198f0c33994c4535da14981e Mon Sep 17 00:00:00 2001 From: Travis Raines Date: Fri, 5 Feb 2021 16:32:44 -0800 Subject: [PATCH] feat: use strings instead of float64s Convert the Upstream health threshold and Target createdat values from float64 to string. Use of float64 doesn't allow controller-gen to automate manifests from these types, and using string instead is the typical approach in other projects: https://github.com/kubernetes-sigs/controller-tools/issues/245 --- kong/types.go | 6 +++--- kong/zz_generated.deepcopy.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kong/types.go b/kong/types.go index 8e393a24c..82c229958 100644 --- a/kong/types.go +++ b/kong/types.go @@ -157,7 +157,7 @@ type PassiveHealthcheck struct { type Healthcheck struct { Active *ActiveHealthcheck `json:"active,omitempty" yaml:"active,omitempty"` Passive *PassiveHealthcheck `json:"passive,omitempty" yaml:"passive,omitempty"` - Threshold *float64 `json:"threshold,omitempty" yaml:"threshold,omitempty"` + Threshold *string `json:"threshold,omitempty" yaml:"threshold,omitempty"` } // HealthDataAddress represents the health data address of a target @@ -192,7 +192,7 @@ type HealthData struct { // +k8s:deepcopy-gen=true type UpstreamNodeHealth struct { ID *string `json:"id,omitempty" yaml:"id,omitempty"` - CreatedAt *float64 `json:"created_at,omitempty" yaml:"created_at,omitempty"` + CreatedAt *string `json:"created_at,omitempty" yaml:"created_at,omitempty"` Data *HealthData `json:"data,omitempty" yaml:"data,omitempty"` Health *string `json:"health,omitempty" yaml:"data,omitempty"` Target *string `json:"target,omitempty" yaml:"target,omitempty"` @@ -224,7 +224,7 @@ type Upstream struct { // Target represents a Target in Kong. // +k8s:deepcopy-gen=true type Target struct { - CreatedAt *float64 `json:"created_at,omitempty" yaml:"created_at,omitempty"` + CreatedAt *string `json:"created_at,omitempty" yaml:"created_at,omitempty"` ID *string `json:"id,omitempty" yaml:"id,omitempty"` Target *string `json:"target,omitempty" yaml:"target,omitempty"` Upstream *Upstream `json:"upstream,omitempty" yaml:"upstream,omitempty"` diff --git a/kong/zz_generated.deepcopy.go b/kong/zz_generated.deepcopy.go index f35133c90..69dd28291 100644 --- a/kong/zz_generated.deepcopy.go +++ b/kong/zz_generated.deepcopy.go @@ -595,7 +595,7 @@ func (in *Healthcheck) DeepCopyInto(out *Healthcheck) { } if in.Threshold != nil { in, out := &in.Threshold, &out.Threshold - *out = new(float64) + *out = new(string) **out = **in } return @@ -1536,7 +1536,7 @@ func (in *Target) DeepCopyInto(out *Target) { *out = *in if in.CreatedAt != nil { in, out := &in.CreatedAt, &out.CreatedAt - *out = new(float64) + *out = new(string) **out = **in } if in.ID != nil { @@ -1731,7 +1731,7 @@ func (in *UpstreamNodeHealth) DeepCopyInto(out *UpstreamNodeHealth) { } if in.CreatedAt != nil { in, out := &in.CreatedAt, &out.CreatedAt - *out = new(float64) + *out = new(string) **out = **in } if in.Data != nil {