From 01d333ccb4245d3e8efc8b0308568576c8453c97 Mon Sep 17 00:00:00 2001 From: Kamiel Ahmadpour Date: Fri, 1 Nov 2024 09:50:45 +0000 Subject: [PATCH] fix: keep default values for all primitive type see: https://gravitee.atlassian.net/browse/GKO-654 --- api/model/api/base/api.go | 4 +- api/model/api/base/flow.go | 8 +- api/model/api/base/http.go | 20 +- api/model/api/base/keystore.go | 36 +-- api/model/api/base/member.go | 4 +- api/model/api/base/metadata.go | 2 +- api/model/api/base/page.go | 10 +- api/model/api/base/plan.go | 4 +- api/model/api/base/plugin.go | 14 +- api/model/api/base/properties.go | 8 +- api/model/api/base/resource.go | 16 +- api/model/api/base/zz_generated.deepcopy.go | 284 +++++++++++++++++- api/model/api/v2/analytics.go | 2 +- api/model/api/v2/api.go | 4 +- api/model/api/v2/endpoints.go | 20 +- api/model/api/v2/flow.go | 18 +- api/model/api/v2/page.go | 2 +- api/model/api/v2/plan.go | 10 +- api/model/api/v2/proxy.go | 8 +- api/model/api/v2/services.go | 14 +- api/model/api/v2/zz_generated.deepcopy.go | 225 ++++++++++++-- api/model/api/v4/analytics.go | 4 +- api/model/api/v4/api.go | 2 +- api/model/api/v4/endpoints.go | 11 +- api/model/api/v4/flow.go | 8 +- api/model/api/v4/listeners.go | 4 +- api/model/api/v4/plan.go | 4 +- api/model/api/v4/services.go | 4 +- api/model/api/v4/zz_generated.deepcopy.go | 66 +++- api/model/application/application.go | 20 +- .../application/zz_generated.deepcopy.go | 56 +++- api/v1alpha1/apiv2definition_types.go | 7 +- api/v1alpha1/apiv4definition_types.go | 7 +- .../apim/ingress/internal/mapper/mapper.go | 42 +-- internal/admission/api/base/resource.go | 6 +- ...thContext_andInvalidResourceConfig_test.go | 2 +- ...thContext_andInvalidResourceConfig_test.go | 2 +- ...ext_templatingWithMissingConfigmap_test.go | 2 +- ...xt_templatingWithMissingSecreteKey_test.go | 2 +- ...ntext_templatingWithMissingSecrete_test.go | 2 +- .../admission/application/suite_test.go | 4 + ...ext_templatingWithMissingConfigmap_test.go | 2 +- ...ntext_templatingWithMissingSecrete_test.go | 2 +- .../create_withContext_andMardownPage_test.go | 2 +- .../update_withContext_andMardownPage_test.go | 4 +- ...-create_withContext_andMardownPage_test.go | 2 +- ...-update_withContext_andMardownPage_test.go | 4 +- ...te_withoutContext_andMultipleHosts_test.go | 12 +- .../create_withoutContext_andTLS_test.go | 4 +- .../create_withoutContext_andTemplate_test.go | 4 +- .../ingress/create_withoutContext_test.go | 4 +- test/integration/ingress/suite_test.go | 4 + test/unit/admission/mctx/suite_test.go | 2 +- 53 files changed, 800 insertions(+), 214 deletions(-) diff --git a/api/model/api/base/api.go b/api/model/api/base/api.go index b0724bc76..dc234ae0e 100644 --- a/api/model/api/base/api.go +++ b/api/model/api/base/api.go @@ -104,11 +104,11 @@ const ( type ResponseTemplate struct { // +kubebuilder:validation:Optional - StatusCode int `json:"status,omitempty"` + StatusCode *int `json:"status,omitempty"` // +kubebuilder:validation:Optional Headers map[string]string `json:"headers,omitempty"` // +kubebuilder:validation:Optional - Body string `json:"body,omitempty"` + Body *string `json:"body,omitempty"` } func (api *ApiBase) GetName() string { diff --git a/api/model/api/base/flow.go b/api/model/api/base/flow.go index a4428a4bb..4c8cad925 100644 --- a/api/model/api/base/flow.go +++ b/api/model/api/base/flow.go @@ -30,17 +30,17 @@ type FlowStep struct { Enabled bool `json:"enabled"` // FlowStep policy // +kubebuilder:validation:Optional - Policy string `json:"policy,omitempty"` + Policy *string `json:"policy,omitempty"` // FlowStep name // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` // FlowStep description // +kubebuilder:validation:Optional - Description string `json:"description,omitempty"` + Description *string `json:"description,omitempty"` // FlowStep configuration is a map of arbitrary key-values // +kubebuilder:validation:Optional Configuration *utils.GenericStringMap `json:"configuration,omitempty"` // FlowStep condition // +kubebuilder:validation:Optional - Condition string `json:"condition,omitempty"` + Condition *string `json:"condition,omitempty"` } diff --git a/api/model/api/base/http.go b/api/model/api/base/http.go index 20e8c61d4..4ed41b364 100644 --- a/api/model/api/base/http.go +++ b/api/model/api/base/http.go @@ -56,10 +56,10 @@ type Cors struct { type HttpClientOptions struct { // Idle Timeout for the http connection // +kubebuilder:validation:Optional - IdleTimeout uint64 `json:"idleTimeout,omitempty"` + IdleTimeout *uint64 `json:"idleTimeout,omitempty"` // Connection timeout of the http connection // +kubebuilder:validation:Optional - ConnectTimeout uint64 `json:"connectTimeout,omitempty"` + ConnectTimeout *uint64 `json:"connectTimeout,omitempty"` // +kubebuilder:validation:Optional // +kubebuilder:default:=true KeepAlive bool `json:"keepAlive"` @@ -69,13 +69,13 @@ type HttpClientOptions struct { KeepAliveTimeout uint64 `json:"keepAliveTimeout"` // Read timeout // +kubebuilder:validation:Optional - ReadTimeout uint64 `json:"readTimeout,omitempty"` + ReadTimeout *uint64 `json:"readTimeout,omitempty"` // +kubebuilder:default:=false // Should HTTP/1.1 pipelining be used for the connection or not ? Pipelining bool `json:"pipelining"` // HTTP max concurrent connections // +kubebuilder:validation:Optional - MaxConcurrentConnections int `json:"maxConcurrentConnections,omitempty"` + MaxConcurrentConnections *int `json:"maxConcurrentConnections,omitempty"` // +kubebuilder:default:=false // Should compression be used or not ? UseCompression bool `json:"useCompression"` @@ -117,16 +117,16 @@ type HttpProxy struct { UseSystemProxy bool `json:"useSystemProxy,omitempty"` // Proxy host name // +kubebuilder:validation:Optional - Host string `json:"host,omitempty"` + Host *string `json:"host,omitempty"` // The HTTP proxy port // +kubebuilder:validation:Optional - Port int `json:"port,omitempty"` + Port *int `json:"port,omitempty"` // The HTTP proxy username (if the proxy requires authentication) // +kubebuilder:validation:Optional - Username string `json:"username,omitempty"` + Username *string `json:"username,omitempty"` // The HTTP proxy password (if the proxy requires authentication) // +kubebuilder:validation:Optional - Password string `json:"password,omitempty"` + Password *string `json:"password,omitempty"` // The HTTP proxy type (possible values Http, Socks4, Socks5) HttpProxyType HttpProxyType `json:"type,omitempty"` } @@ -134,8 +134,8 @@ type HttpProxy struct { type HttpHeader struct { // The HTTP header name // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` // The HTTP header value // +kubebuilder:validation:Optional - Value string `json:"value,omitempty"` + Value *string `json:"value,omitempty"` } diff --git a/api/model/api/base/keystore.go b/api/model/api/base/keystore.go index 230a6e9d7..6fd343fb1 100644 --- a/api/model/api/base/keystore.go +++ b/api/model/api/base/keystore.go @@ -36,10 +36,10 @@ type PEMTrustStore struct { Type KeyStoreType `json:"type,omitempty"` // The path to the TrustStore // +kubebuilder:validation:Optional - Path string `json:"path,omitempty"` + Path *string `json:"path,omitempty"` // The base64 encoded trustStore content, if not relying on a path to a file // +kubebuilder:validation:Optional - Content string `json:"content,omitempty"` + Content *string `json:"content,omitempty"` } type PKCS12TrustStore struct { @@ -47,42 +47,42 @@ type PKCS12TrustStore struct { Type KeyStoreType `json:"type,omitempty"` // The TrustStore path // +kubebuilder:validation:Optional - Path string `json:"path,omitempty"` + Path *string `json:"path,omitempty"` // The base64 encoded trustStore content, if not relying on a path to a file // +kubebuilder:validation:Optional - Content string `json:"content,omitempty"` + Content *string `json:"content,omitempty"` // TrustStore password // +kubebuilder:validation:Optional - Password string `json:"password,omitempty"` + Password *string `json:"password,omitempty"` } type JKSTrustStore struct { // The TrustStore type (should be JKS in that case) Type KeyStoreType `json:"type,omitempty"` // TrustStore path // +kubebuilder:validation:Optional - Path string `json:"path,omitempty"` + Path *string `json:"path,omitempty"` // The base64 encoded trustStore content, if not relying on a path to a file // +kubebuilder:validation:Optional - Content string `json:"content,omitempty"` + Content *string `json:"content,omitempty"` // TrustStore password // +kubebuilder:validation:Optional - Password string `json:"password,omitempty"` + Password *string `json:"password,omitempty"` } type PEMKeyStore struct { // KeyStore type (should be PEM in that case) Type KeyStoreType `json:"type,omitempty"` // KeyStore key path // +kubebuilder:validation:Optional - KeyPath string `json:"keyPath,omitempty"` + KeyPath *string `json:"keyPath,omitempty"` // The base64 encoded trustStore content, if not relying on a path to a file // +kubebuilder:validation:Optional - KeyContent string `json:"keyContent,omitempty"` + KeyContent *string `json:"keyContent,omitempty"` // KeyStore cert path // +kubebuilder:validation:Optional - CertPath string `json:"certPath,omitempty"` + CertPath *string `json:"certPath,omitempty"` // KeyStore cert content // +kubebuilder:validation:Optional - CertContent string `json:"certContent,omitempty"` + CertContent *string `json:"certContent,omitempty"` } type PKCS12KeyStore struct { @@ -90,22 +90,22 @@ type PKCS12KeyStore struct { Type KeyStoreType `json:"type,omitempty"` // KeyStore path // +kubebuilder:validation:Optional - Path string `json:"path,omitempty"` + Path *string `json:"path,omitempty"` // The base64 encoded trustStore content, if not relying on a path to a file // +kubebuilder:validation:Optional - Content string `json:"content,omitempty"` + Content *string `json:"content,omitempty"` // +kubebuilder:validation:Optional - Password string `json:"password,omitempty"` + Password *string `json:"password,omitempty"` } type JKSKeyStore struct { Type KeyStoreType `json:"type,omitempty"` // +kubebuilder:validation:Optional - Path string `json:"path,omitempty"` + Path *string `json:"path,omitempty"` // The base64 encoded trustStore content, if not relying on a path to a file // +kubebuilder:validation:Optional - Content string `json:"content,omitempty"` + Content *string `json:"content,omitempty"` // KeyStore password // +kubebuilder:validation:Optional - Password string `json:"password,omitempty"` + Password *string `json:"password,omitempty"` } diff --git a/api/model/api/base/member.go b/api/model/api/base/member.go index 08db6c684..a4f9a2a54 100644 --- a/api/model/api/base/member.go +++ b/api/model/api/base/member.go @@ -27,7 +27,7 @@ type Member struct { SourceID string `json:"sourceId"` // Member display name // +kubebuilder:validation:Optional - DisplayName string `json:"displayName,omitempty"` + DisplayName *string `json:"displayName,omitempty"` // The API role associated with this Member // +kubebuilder:default:=USER Role string `json:"role,omitempty"` @@ -36,7 +36,7 @@ type Member struct { func (m *Member) String() string { return fmt.Sprintf( "{Source:%s,SourceID:%s,DisplayName:%s,Role:%s}", - m.Source, m.SourceID, m.DisplayName, m.Role, + m.Source, m.SourceID, *m.DisplayName, m.Role, ) } diff --git a/api/model/api/base/metadata.go b/api/model/api/base/metadata.go index a0d6f1494..c552d8873 100644 --- a/api/model/api/base/metadata.go +++ b/api/model/api/base/metadata.go @@ -28,5 +28,5 @@ type MetadataEntry struct { Value string `json:"value,omitempty"` // Metadata Default value // +kubebuilder:validation:Optional - DefaultValue string `json:"defaultValue,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` } diff --git a/api/model/api/base/page.go b/api/model/api/base/page.go index e49e41837..e9af0a03c 100644 --- a/api/model/api/base/page.go +++ b/api/model/api/base/page.go @@ -56,10 +56,10 @@ type Page struct { Type string `json:"type"` // +kubebuilder:validation:Optional // The content of the page, if any. - Content string `json:"content,omitempty"` + Content *string `json:"content,omitempty"` // +kubebuilder:validation:Optional // The order used to display the page in APIM and on the portal. - Order uint64 `json:"order,omitempty"` + Order *uint64 `json:"order,omitempty"` // +kubebuilder:validation:Optional // +kubebuilder:default:=false // If true, the page will be accessible from the portal (default is false) @@ -76,15 +76,15 @@ type Page struct { // +kubebuilder:validation:Optional // If your page contains a folder, setting this field to the map key associated to the // folder entry will be reflected into APIM by making the page a child of this folder. - Parent string `json:"parent,omitempty"` + Parent *string `json:"parent,omitempty"` // +kubebuilder:validation:Optional // The parent ID of the page. This field is mostly required when you are applying // an API exported from APIM to make the operator take control over it. Use `Parent` // in any other case. - ParentID string `json:"parentId,omitempty"` + ParentID *string `json:"parentId,omitempty"` // +kubebuilder:validation:Optional // The API of the page. If empty, will be set automatically to the generated ID of the API. - API string `json:"api,omitempty"` + API *string `json:"api,omitempty"` // +kubebuilder:validation:Optional // Source allow you to fetch pages from various external sources, overriding page content // each time the source is fetched. diff --git a/api/model/api/base/plan.go b/api/model/api/base/plan.go index cd7bb19e6..4e959864f 100644 --- a/api/model/api/base/plan.go +++ b/api/model/api/base/plan.go @@ -50,10 +50,10 @@ type Plan struct { Validation PlanValidation `json:"validation,omitempty"` // Indicate of comment is required for this plan or not // +kubebuilder:validation:Optional - CommentRequired bool `json:"comment_required,omitempty"` + CommentRequired *bool `json:"comment_required,omitempty"` // Plan order // +kubebuilder:validation:Optional - Order int `json:"order,omitempty"` + Order *int `json:"order,omitempty"` // +kubebuilder:default:=API // Plan type Type PlanType `json:"type,omitempty"` diff --git a/api/model/api/base/plugin.go b/api/model/api/base/plugin.go index 5916ac78b..7ecbaaf17 100644 --- a/api/model/api/base/plugin.go +++ b/api/model/api/base/plugin.go @@ -19,10 +19,10 @@ import "github.com/gravitee-io/gravitee-kubernetes-operator/api/model/utils" type Plugin struct { // Plugin Policy // +kubebuilder:validation:Optional - Policy string `json:"policy,omitempty"` + Policy *string `json:"policy,omitempty"` // Plugin Resource // +kubebuilder:validation:Optional - Resource string `json:"resource,omitempty"` + Resource *string `json:"resource,omitempty"` // Plugin Configuration, a map of arbitrary key-values // +kubebuilder:validation:Optional Configuration *utils.GenericStringMap `json:"configuration,omitempty"` @@ -31,13 +31,13 @@ type Plugin struct { type PluginReference struct { // Plugin Reference Namespace // +kubebuilder:validation:Optional - Namespace string `json:"namespace,omitempty"` + Namespace *string `json:"namespace,omitempty"` // Plugin Reference Resource // +kubebuilder:validation:Optional - Resource string `json:"resource,omitempty"` + Resource *string `json:"resource,omitempty"` // Plugin Reference Name // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` } type PluginRevision struct { @@ -45,10 +45,10 @@ type PluginRevision struct { PluginReference *PluginReference `json:"pluginReference,omitempty"` // Plugin Generation // +kubebuilder:validation:Optional - Generation int64 `json:"generation,omitempty"` + Generation *int64 `json:"generation,omitempty"` // Plugin Plugin *Plugin `json:"plugin,omitempty"` // Plugin Revision Hash code // +kubebuilder:validation:Optional - HashCode string `json:"hashCode,omitempty"` + HashCode *string `json:"hashCode,omitempty"` } diff --git a/api/model/api/base/properties.go b/api/model/api/base/properties.go index 0c4b8b4cf..1cf435fae 100644 --- a/api/model/api/base/properties.go +++ b/api/model/api/base/properties.go @@ -17,14 +17,14 @@ package base type Property struct { // Property Key // +kubebuilder:validation:Optional - Key string `json:"key,omitempty"` + Key *string `json:"key,omitempty"` // Property Value // +kubebuilder:validation:Optional - Value string `json:"value,omitempty"` + Value *string `json:"value,omitempty"` // Property Encrypted or not? // +kubebuilder:validation:Optional - Encrypted bool `json:"encrypted,omitempty"` + Encrypted *bool `json:"encrypted,omitempty"` // Property is dynamic or not? // +kubebuilder:validation:Optional - Dynamic bool `json:"dynamic,omitempty"` + Dynamic *bool `json:"dynamic,omitempty"` } diff --git a/api/model/api/base/resource.go b/api/model/api/base/resource.go index eb706eb8e..ec8ef75e2 100644 --- a/api/model/api/base/resource.go +++ b/api/model/api/base/resource.go @@ -30,21 +30,29 @@ type Resource struct { Enabled bool `json:"enabled"` // Resource Name // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` // Resource Type // +kubebuilder:validation:Optional - Type string `json:"type,omitempty"` + Type *string `json:"type,omitempty"` // Resource Configuration, arbitrary map of key-values // +kubebuilder:validation:Optional Configuration *utils.GenericStringMap `json:"configuration,omitempty"` } func (r *Resource) GetType() string { - return r.Type + if r.Type != nil { + return *r.Type + } + + return "" } func (r *Resource) GetResourceName() string { - return r.Name + if r.Name != nil { + return *r.Name + } + + return "" } func (r *Resource) GetConfig() *utils.GenericStringMap { diff --git a/api/model/api/base/zz_generated.deepcopy.go b/api/model/api/base/zz_generated.deepcopy.go index b67a9b738..2880e727d 100644 --- a/api/model/api/base/zz_generated.deepcopy.go +++ b/api/model/api/base/zz_generated.deepcopy.go @@ -59,7 +59,7 @@ func (in *ApiBase) DeepCopyInto(out *ApiBase) { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] *out = new(Property) - **out = **in + (*in).DeepCopyInto(*out) } } } @@ -70,7 +70,7 @@ func (in *ApiBase) DeepCopyInto(out *ApiBase) { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] *out = new(MetadataEntry) - **out = **in + (*in).DeepCopyInto(*out) } } } @@ -145,10 +145,30 @@ func (in *Cors) DeepCopy() *Cors { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FlowStep) DeepCopyInto(out *FlowStep) { *out = *in + if in.Policy != nil { + in, out := &in.Policy, &out.Policy + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } if in.Configuration != nil { in, out := &in.Configuration, &out.Configuration *out = (*in).DeepCopy() } + if in.Condition != nil { + in, out := &in.Condition, &out.Condition + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FlowStep. @@ -164,6 +184,26 @@ func (in *FlowStep) DeepCopy() *FlowStep { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HttpClientOptions) DeepCopyInto(out *HttpClientOptions) { *out = *in + if in.IdleTimeout != nil { + in, out := &in.IdleTimeout, &out.IdleTimeout + *out = new(uint64) + **out = **in + } + if in.ConnectTimeout != nil { + in, out := &in.ConnectTimeout, &out.ConnectTimeout + *out = new(uint64) + **out = **in + } + if in.ReadTimeout != nil { + in, out := &in.ReadTimeout, &out.ReadTimeout + *out = new(uint64) + **out = **in + } + if in.MaxConcurrentConnections != nil { + in, out := &in.MaxConcurrentConnections, &out.MaxConcurrentConnections + *out = new(int) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HttpClientOptions. @@ -204,6 +244,16 @@ func (in *HttpClientSslOptions) DeepCopy() *HttpClientSslOptions { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HttpHeader) DeepCopyInto(out *HttpHeader) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HttpHeader. @@ -219,6 +269,26 @@ func (in *HttpHeader) DeepCopy() *HttpHeader { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HttpProxy) DeepCopyInto(out *HttpProxy) { *out = *in + if in.Host != nil { + in, out := &in.Host, &out.Host + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int) + **out = **in + } + if in.Username != nil { + in, out := &in.Username, &out.Username + *out = new(string) + **out = **in + } + if in.Password != nil { + in, out := &in.Password, &out.Password + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HttpProxy. @@ -234,6 +304,21 @@ func (in *HttpProxy) DeepCopy() *HttpProxy { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *JKSKeyStore) DeepCopyInto(out *JKSKeyStore) { *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.Content != nil { + in, out := &in.Content, &out.Content + *out = new(string) + **out = **in + } + if in.Password != nil { + in, out := &in.Password, &out.Password + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JKSKeyStore. @@ -249,6 +334,21 @@ func (in *JKSKeyStore) DeepCopy() *JKSKeyStore { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *JKSTrustStore) DeepCopyInto(out *JKSTrustStore) { *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.Content != nil { + in, out := &in.Content, &out.Content + *out = new(string) + **out = **in + } + if in.Password != nil { + in, out := &in.Password, &out.Password + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JKSTrustStore. @@ -279,6 +379,11 @@ func (in *KeyStore) DeepCopy() *KeyStore { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Member) DeepCopyInto(out *Member) { *out = *in + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Member. @@ -294,6 +399,11 @@ func (in *Member) DeepCopy() *Member { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetadataEntry) DeepCopyInto(out *MetadataEntry) { *out = *in + if in.DefaultValue != nil { + in, out := &in.DefaultValue, &out.DefaultValue + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetadataEntry. @@ -309,6 +419,26 @@ func (in *MetadataEntry) DeepCopy() *MetadataEntry { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PEMKeyStore) DeepCopyInto(out *PEMKeyStore) { *out = *in + if in.KeyPath != nil { + in, out := &in.KeyPath, &out.KeyPath + *out = new(string) + **out = **in + } + if in.KeyContent != nil { + in, out := &in.KeyContent, &out.KeyContent + *out = new(string) + **out = **in + } + if in.CertPath != nil { + in, out := &in.CertPath, &out.CertPath + *out = new(string) + **out = **in + } + if in.CertContent != nil { + in, out := &in.CertContent, &out.CertContent + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PEMKeyStore. @@ -324,6 +454,16 @@ func (in *PEMKeyStore) DeepCopy() *PEMKeyStore { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PEMTrustStore) DeepCopyInto(out *PEMTrustStore) { *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.Content != nil { + in, out := &in.Content, &out.Content + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PEMTrustStore. @@ -339,6 +479,21 @@ func (in *PEMTrustStore) DeepCopy() *PEMTrustStore { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PKCS12KeyStore) DeepCopyInto(out *PKCS12KeyStore) { *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.Content != nil { + in, out := &in.Content, &out.Content + *out = new(string) + **out = **in + } + if in.Password != nil { + in, out := &in.Password, &out.Password + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PKCS12KeyStore. @@ -354,6 +509,21 @@ func (in *PKCS12KeyStore) DeepCopy() *PKCS12KeyStore { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PKCS12TrustStore) DeepCopyInto(out *PKCS12TrustStore) { *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.Content != nil { + in, out := &in.Content, &out.Content + *out = new(string) + **out = **in + } + if in.Password != nil { + in, out := &in.Password, &out.Password + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PKCS12TrustStore. @@ -369,6 +539,31 @@ func (in *PKCS12TrustStore) DeepCopy() *PKCS12TrustStore { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Page) DeepCopyInto(out *Page) { *out = *in + if in.Content != nil { + in, out := &in.Content, &out.Content + *out = new(string) + **out = **in + } + if in.Order != nil { + in, out := &in.Order, &out.Order + *out = new(uint64) + **out = **in + } + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(string) + **out = **in + } + if in.ParentID != nil { + in, out := &in.ParentID, &out.ParentID + *out = new(string) + **out = **in + } + if in.API != nil { + in, out := &in.API, &out.API + *out = new(string) + **out = **in + } if in.Source != nil { in, out := &in.Source, &out.Source *out = new(PageSource) @@ -425,6 +620,16 @@ func (in *Plan) DeepCopyInto(out *Plan) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.CommentRequired != nil { + in, out := &in.CommentRequired, &out.CommentRequired + *out = new(bool) + **out = **in + } + if in.Order != nil { + in, out := &in.Order, &out.Order + *out = new(int) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Plan. @@ -440,6 +645,16 @@ func (in *Plan) DeepCopy() *Plan { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Plugin) DeepCopyInto(out *Plugin) { *out = *in + if in.Policy != nil { + in, out := &in.Policy, &out.Policy + *out = new(string) + **out = **in + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = new(string) + **out = **in + } if in.Configuration != nil { in, out := &in.Configuration, &out.Configuration *out = (*in).DeepCopy() @@ -459,6 +674,21 @@ func (in *Plugin) DeepCopy() *Plugin { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PluginReference) DeepCopyInto(out *PluginReference) { *out = *in + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(string) + **out = **in + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PluginReference. @@ -477,6 +707,11 @@ func (in *PluginRevision) DeepCopyInto(out *PluginRevision) { if in.PluginReference != nil { in, out := &in.PluginReference, &out.PluginReference *out = new(PluginReference) + (*in).DeepCopyInto(*out) + } + if in.Generation != nil { + in, out := &in.Generation, &out.Generation + *out = new(int64) **out = **in } if in.Plugin != nil { @@ -484,6 +719,11 @@ func (in *PluginRevision) DeepCopyInto(out *PluginRevision) { *out = new(Plugin) (*in).DeepCopyInto(*out) } + if in.HashCode != nil { + in, out := &in.HashCode, &out.HashCode + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PluginRevision. @@ -499,6 +739,26 @@ func (in *PluginRevision) DeepCopy() *PluginRevision { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Property) DeepCopyInto(out *Property) { *out = *in + if in.Key != nil { + in, out := &in.Key, &out.Key + *out = new(string) + **out = **in + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(string) + **out = **in + } + if in.Encrypted != nil { + in, out := &in.Encrypted, &out.Encrypted + *out = new(bool) + **out = **in + } + if in.Dynamic != nil { + in, out := &in.Dynamic, &out.Dynamic + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Property. @@ -514,6 +774,16 @@ func (in *Property) DeepCopy() *Property { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Resource) DeepCopyInto(out *Resource) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } if in.Configuration != nil { in, out := &in.Configuration, &out.Configuration *out = (*in).DeepCopy() @@ -558,6 +828,11 @@ func (in *ResourceOrRef) DeepCopy() *ResourceOrRef { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResponseTemplate) DeepCopyInto(out *ResponseTemplate) { *out = *in + if in.StatusCode != nil { + in, out := &in.StatusCode, &out.StatusCode + *out = new(int) + **out = **in + } if in.Headers != nil { in, out := &in.Headers, &out.Headers *out = make(map[string]string, len(*in)) @@ -565,6 +840,11 @@ func (in *ResponseTemplate) DeepCopyInto(out *ResponseTemplate) { (*out)[key] = val } } + if in.Body != nil { + in, out := &in.Body, &out.Body + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResponseTemplate. diff --git a/api/model/api/v2/analytics.go b/api/model/api/v2/analytics.go index 7f1e647bc..2e0d21cf2 100644 --- a/api/model/api/v2/analytics.go +++ b/api/model/api/v2/analytics.go @@ -55,7 +55,7 @@ type Logging struct { Content LoggingContent `json:"content,omitempty"` // The logging condition (supports EL expressions) // +kubebuilder:validation:Optional - Condition string `json:"condition,omitempty"` + Condition *string `json:"condition,omitempty"` } type Analytics struct { diff --git a/api/model/api/v2/api.go b/api/model/api/v2/api.go index 89811b84a..773c6f781 100644 --- a/api/model/api/v2/api.go +++ b/api/model/api/v2/api.go @@ -38,7 +38,7 @@ type Api struct { LifecycleState base.LifecycleState `json:"lifecycle_state,omitempty"` // Shows the time that the API is deployed // +kubebuilder:validation:Optional - DeployedAt uint64 `json:"deployedAt,omitempty"` + DeployedAt *uint64 `json:"deployedAt,omitempty"` // +kubebuilder:default:=`2.0.0` // The definition version of the API. For v1alpha1 resources, this field should always set to `2.0.0`. DefinitionVersion base.DefinitionVersion `json:"gravitee,omitempty"` @@ -60,7 +60,7 @@ type Api struct { Plans []*Plan `json:"plans"` // A list of Response Templates for the API // +kubebuilder:validation:Optional - ResponseTemplates map[string]map[string]*base.ResponseTemplate `json:"response_templates,omitempty"` + ResponseTemplates *map[string]map[string]*base.ResponseTemplate `json:"response_templates,omitempty"` // List of members associated with the API // +kubebuilder:validation:Optional Members []*base.Member `json:"members"` diff --git a/api/model/api/v2/endpoints.go b/api/model/api/v2/endpoints.go index 6d32286fb..8f2f09950 100644 --- a/api/model/api/v2/endpoints.go +++ b/api/model/api/v2/endpoints.go @@ -28,16 +28,16 @@ const ( type Endpoint struct { // Name of the endpoint // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` // The end target of this endpoint (backend) // +kubebuilder:validation:Optional - Target string `json:"target,omitempty"` + Target *string `json:"target,omitempty"` // Endpoint weight used for load-balancing // +kubebuilder:validation:Optional - Weight int `json:"weight,omitempty"` + Weight *int `json:"weight,omitempty"` // Indicate that this ia a back-end endpoint // +kubebuilder:validation:Optional - Backup bool `json:"backup,omitempty"` + Backup *bool `json:"backup,omitempty"` // The endpoint tenants // +kubebuilder:validation:Optional Tenants []string `json:"tenants"` @@ -45,7 +45,7 @@ type Endpoint struct { Type EndpointType `json:"type,omitempty"` // Is endpoint inherited or not // +kubebuilder:validation:Optional - Inherit bool `json:"inherit,omitempty"` + Inherit *bool `json:"inherit,omitempty"` // Configure the HTTP Proxy settings to reach target if needed HttpProxy *base.HttpProxy `json:"proxy,omitempty"` // Custom HTTP client options used for this endpoint @@ -62,7 +62,7 @@ type Endpoint struct { func NewHttpEndpoint(name string) *Endpoint { return &Endpoint{ Type: HttpEndpointType, - Name: name, + Name: &name, } } @@ -89,7 +89,7 @@ func NewLoadBalancer(algo LoadBalancerType) *LoadBalancer { type EndpointGroup struct { // EndpointGroup name // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` // List of Endpoints belonging to this group // +kubebuilder:validation:Optional Endpoints []*Endpoint `json:"endpoints"` @@ -110,7 +110,7 @@ type EndpointGroup struct { func NewHttpEndpointGroup(name string) *EndpointGroup { return &EndpointGroup{ - Name: name, + Name: &name, Endpoints: []*Endpoint{}, Headers: map[string]string{}, } @@ -121,10 +121,10 @@ type FailoverCase string type Failover struct { // Maximum number of attempts // +kubebuilder:validation:Optional - MaxAttempts int `json:"maxAttempts,omitempty"` + MaxAttempts *int `json:"maxAttempts,omitempty"` // Retry timeout // +kubebuilder:validation:Optional - RetryTimeout int64 `json:"retryTimeout,omitempty"` + RetryTimeout *int64 `json:"retryTimeout,omitempty"` // List of Failover cases // +kubebuilder:validation:Optional Cases []FailoverCase `json:"cases"` diff --git a/api/model/api/v2/flow.go b/api/model/api/v2/flow.go index 7468f0cd8..c2ef24353 100644 --- a/api/model/api/v2/flow.go +++ b/api/model/api/v2/flow.go @@ -30,7 +30,7 @@ const ( type PathOperator struct { // Operator path // +kubebuilder:validation:Optional - Path string `json:"path,omitempty"` + Path *string `json:"path,omitempty"` // +kubebuilder:default:=STARTS_WITH // Operator (possible values STARTS_WITH or EQUALS) Operator base.Operator `json:"operator,omitempty"` @@ -38,7 +38,7 @@ type PathOperator struct { func NewPathOperator(path string, operator base.Operator) *PathOperator { return &PathOperator{ - Path: path, + Path: &path, Operator: operator, } } @@ -48,7 +48,7 @@ type Flow struct { ID string `json:"id,omitempty"` // Flow name // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` // List of path operators PathOperator *PathOperator `json:"path-operator,omitempty"` // Flow pre step @@ -65,7 +65,7 @@ type Flow struct { Methods []base.HttpMethod `json:"methods"` // Flow condition // +kubebuilder:validation:Optional - Condition string `json:"condition,omitempty"` + Condition *string `json:"condition,omitempty"` // List of the consumers of this Flow // +kubebuilder:validation:Optional Consumers []Consumer `json:"consumers"` @@ -73,20 +73,20 @@ type Flow struct { func NewFlow(name string) Flow { return Flow{ - Name: name, + Name: &name, Enabled: true, Pre: []base.FlowStep{}, Post: []base.FlowStep{}, Methods: []base.HttpMethod{}, Consumers: []Consumer{}, - Condition: "", + Condition: nil, } } type Policy struct { // Policy name // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` // Policy configuration is a map of arbitrary key-values // +kubebuilder:validation:Optional Configuration *utils.GenericStringMap `json:"configuration,omitempty"` @@ -100,8 +100,8 @@ type Rule struct { Policy *Policy `json:"policy,omitempty"` // Rule description // +kubebuilder:validation:Optional - Description string `json:"description,omitempty"` + Description *string `json:"description,omitempty"` // Indicate if the Rule is enabled or not // +kubebuilder:validation:Optional - Enabled bool `json:"enabled,omitempty"` + Enabled *bool `json:"enabled,omitempty"` } diff --git a/api/model/api/v2/page.go b/api/model/api/v2/page.go index d1ee677fc..7f5ebf702 100644 --- a/api/model/api/v2/page.go +++ b/api/model/api/v2/page.go @@ -24,5 +24,5 @@ type Page struct { // if true, the references defined in the accessControls list will be // denied access instead of being granted // +kubebuilder:validation:Optional - ExcludedAccessControl bool `json:"excludedAccessControls"` + ExcludedAccessControl *bool `json:"excludedAccessControls"` } diff --git a/api/model/api/v2/plan.go b/api/model/api/v2/plan.go index d8068439c..fcea667b2 100644 --- a/api/model/api/v2/plan.go +++ b/api/model/api/v2/plan.go @@ -29,7 +29,7 @@ type Consumer struct { ConsumerType ConsumerType `json:"consumerType,omitempty"` // Consumer ID // +kubebuilder:validation:Optional - ConsumerID string `json:"consumerId,omitempty"` + ConsumerID *string `json:"consumerId,omitempty"` } type Plan struct { @@ -43,16 +43,16 @@ type Plan struct { Security string `json:"security"` // Plan Security definition // +kubebuilder:validation:Optional - SecurityDefinition string `json:"securityDefinition,omitempty"` + SecurityDefinition *string `json:"securityDefinition,omitempty"` // A map of different paths (alongside their Rules) for this Plan // +kubebuilder:validation:Optional Paths map[string][]Rule `json:"paths,omitempty"` // Specify the API associated with this plan // +kubebuilder:validation:Optional - Api string `json:"api,omitempty"` + Api *string `json:"api,omitempty"` // Plan selection rule // +kubebuilder:validation:Optional - SelectionRule string `json:"selectionRule,omitempty"` + SelectionRule *string `json:"selectionRule,omitempty"` // List of different flows for this Plan // +kubebuilder:validation:Optional Flows []Flow `json:"flows"` @@ -87,7 +87,7 @@ func (plan *Plan) WithSecurity(security string) *Plan { type Path struct { // Path // +kubebuilder:validation:Optional - Path string `json:"path,omitempty"` + Path *string `json:"path,omitempty"` // Path Rules // +kubebuilder:validation:Optional Rules []*Rule `json:"rules"` diff --git a/api/model/api/v2/proxy.go b/api/model/api/v2/proxy.go index 9edaf8c1b..d23fa52a3 100644 --- a/api/model/api/v2/proxy.go +++ b/api/model/api/v2/proxy.go @@ -14,7 +14,9 @@ package v2 -import "github.com/gravitee-io/gravitee-kubernetes-operator/api/model/api/base" +import ( + "github.com/gravitee-io/gravitee-kubernetes-operator/api/model/api/base" +) type VirtualHost struct { // Host name @@ -50,8 +52,8 @@ type Proxy struct { Logging *Logging `json:"logging,omitempty"` // Strip Context Path // +kubebuilder:validation:Optional - StripContextPath bool `json:"strip_context_path,omitempty"` + StripContextPath *bool `json:"strip_context_path,omitempty"` // Preserve Host // +kubebuilder:validation:Optional - PreserveHost bool `json:"preserve_host,omitempty"` + PreserveHost *bool `json:"preserve_host,omitempty"` } diff --git a/api/model/api/v2/services.go b/api/model/api/v2/services.go index 91eae6a5b..4e72406fa 100644 --- a/api/model/api/v2/services.go +++ b/api/model/api/v2/services.go @@ -22,7 +22,7 @@ import ( type Service struct { // Service name // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` // +kubebuilder:default:=false // +kubebuilder:validation:Optional // Is service enabled or not? @@ -32,20 +32,20 @@ type Service struct { type ScheduledService struct { *Service `json:",inline"` // +kubebuilder:validation:Optional - Schedule string `json:"schedule,omitempty"` + Schedule *string `json:"schedule,omitempty"` } type EndpointDiscoveryService struct { *Service `json:",inline"` // Provider name // +kubebuilder:validation:Optional - Provider string `json:"provider,omitempty"` + Provider *string `json:"provider,omitempty"` // Configuration, arbitrary map of key-values // +kubebuilder:validation:Optional Config *utils.GenericStringMap `json:"configuration,omitempty"` // Is it secondary or not? // +kubebuilder:validation:Optional - Secondary bool `json:"secondary,omitempty"` + Secondary *bool `json:"secondary,omitempty"` // List of tenants // +kubebuilder:validation:Optional Tenants []string `json:"tenants"` @@ -91,7 +91,7 @@ type EndpointHealthCheckService struct { type HealthCheckStep struct { // Health Check Step Name // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` // Health Check Step Request Request HealthCheckRequest `json:"request,omitempty"` // Health Check Step Response @@ -101,7 +101,7 @@ type HealthCheckStep struct { type HealthCheckRequest struct { // The path of the endpoint handling the health check request // +kubebuilder:validation:Optional - Path string `json:"path,omitempty"` + Path *string `json:"path,omitempty"` // The HTTP method to use when issuing the health check request Method base.HttpMethod `json:"method,omitempty"` // List of HTTP headers to include in the health check request @@ -109,7 +109,7 @@ type HealthCheckRequest struct { Headers []base.HttpHeader `json:"headers"` // Health Check Request Body // +kubebuilder:validation:Optional - Body string `json:"body,omitempty"` + Body *string `json:"body,omitempty"` // If true, the health check request will be issued without prepending the context path of the API. FromRoot bool `json:"fromRoot"` } diff --git a/api/model/api/v2/zz_generated.deepcopy.go b/api/model/api/v2/zz_generated.deepcopy.go index abdb91203..2d957f6cb 100644 --- a/api/model/api/v2/zz_generated.deepcopy.go +++ b/api/model/api/v2/zz_generated.deepcopy.go @@ -35,7 +35,7 @@ func (in *Analytics) DeepCopyInto(out *Analytics) { if in.Logging != nil { in, out := &in.Logging, &out.Logging *out = new(Logging) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -62,6 +62,11 @@ func (in *Api) DeepCopyInto(out *Api) { *out = new(DefinitionContext) **out = **in } + if in.DeployedAt != nil { + in, out := &in.DeployedAt, &out.DeployedAt + *out = new(uint64) + **out = **in + } if in.Proxy != nil { in, out := &in.Proxy, &out.Proxy *out = new(Proxy) @@ -97,29 +102,33 @@ func (in *Api) DeepCopyInto(out *Api) { } if in.ResponseTemplates != nil { in, out := &in.ResponseTemplates, &out.ResponseTemplates - *out = make(map[string]map[string]*base.ResponseTemplate, len(*in)) - for key, val := range *in { - var outVal map[string]*base.ResponseTemplate - if val == nil { - (*out)[key] = nil - } else { - inVal := (*in)[key] - in, out := &inVal, &outVal - *out = make(map[string]*base.ResponseTemplate, len(*in)) - for key, val := range *in { - var outVal *base.ResponseTemplate - if val == nil { - (*out)[key] = nil - } else { - inVal := (*in)[key] - in, out := &inVal, &outVal - *out = new(base.ResponseTemplate) - (*in).DeepCopyInto(*out) + *out = new(map[string]map[string]*base.ResponseTemplate) + if **in != nil { + in, out := *in, *out + *out = make(map[string]map[string]*base.ResponseTemplate, len(*in)) + for key, val := range *in { + var outVal map[string]*base.ResponseTemplate + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = make(map[string]*base.ResponseTemplate, len(*in)) + for key, val := range *in { + var outVal *base.ResponseTemplate + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = new(base.ResponseTemplate) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal } - (*out)[key] = outVal } + (*out)[key] = outVal } - (*out)[key] = outVal } } if in.Members != nil { @@ -129,7 +138,7 @@ func (in *Api) DeepCopyInto(out *Api) { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] *out = new(base.Member) - **out = **in + (*in).DeepCopyInto(*out) } } } @@ -164,6 +173,11 @@ func (in *Api) DeepCopy() *Api { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Consumer) DeepCopyInto(out *Consumer) { *out = *in + if in.ConsumerID != nil { + in, out := &in.ConsumerID, &out.ConsumerID + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Consumer. @@ -218,20 +232,45 @@ func (in *DynamicPropertyService) DeepCopy() *DynamicPropertyService { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Endpoint) DeepCopyInto(out *Endpoint) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Target != nil { + in, out := &in.Target, &out.Target + *out = new(string) + **out = **in + } + if in.Weight != nil { + in, out := &in.Weight, &out.Weight + *out = new(int) + **out = **in + } + if in.Backup != nil { + in, out := &in.Backup, &out.Backup + *out = new(bool) + **out = **in + } if in.Tenants != nil { in, out := &in.Tenants, &out.Tenants *out = make([]string, len(*in)) copy(*out, *in) } + if in.Inherit != nil { + in, out := &in.Inherit, &out.Inherit + *out = new(bool) + **out = **in + } if in.HttpProxy != nil { in, out := &in.HttpProxy, &out.HttpProxy *out = new(base.HttpProxy) - **out = **in + (*in).DeepCopyInto(*out) } if in.HttpClientOptions != nil { in, out := &in.HttpClientOptions, &out.HttpClientOptions *out = new(base.HttpClientOptions) - **out = **in + (*in).DeepCopyInto(*out) } if in.HttpClientSslOptions != nil { in, out := &in.HttpClientSslOptions, &out.HttpClientSslOptions @@ -241,7 +280,9 @@ func (in *Endpoint) DeepCopyInto(out *Endpoint) { if in.Headers != nil { in, out := &in.Headers, &out.Headers *out = make([]base.HttpHeader, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.HealthCheck != nil { in, out := &in.HealthCheck, &out.HealthCheck @@ -266,12 +307,22 @@ func (in *EndpointDiscoveryService) DeepCopyInto(out *EndpointDiscoveryService) if in.Service != nil { in, out := &in.Service, &out.Service *out = new(Service) + (*in).DeepCopyInto(*out) + } + if in.Provider != nil { + in, out := &in.Provider, &out.Provider + *out = new(string) **out = **in } if in.Config != nil { in, out := &in.Config, &out.Config *out = (*in).DeepCopy() } + if in.Secondary != nil { + in, out := &in.Secondary, &out.Secondary + *out = new(bool) + **out = **in + } if in.Tenants != nil { in, out := &in.Tenants, &out.Tenants *out = make([]string, len(*in)) @@ -292,6 +343,11 @@ func (in *EndpointDiscoveryService) DeepCopy() *EndpointDiscoveryService { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EndpointGroup) DeepCopyInto(out *EndpointGroup) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } if in.Endpoints != nil { in, out := &in.Endpoints, &out.Endpoints *out = make([]*Endpoint, len(*in)) @@ -312,12 +368,12 @@ func (in *EndpointGroup) DeepCopyInto(out *EndpointGroup) { if in.HttpProxy != nil { in, out := &in.HttpProxy, &out.HttpProxy *out = new(base.HttpProxy) - **out = **in + (*in).DeepCopyInto(*out) } if in.HttpClientOptions != nil { in, out := &in.HttpClientOptions, &out.HttpClientOptions *out = new(base.HttpClientOptions) - **out = **in + (*in).DeepCopyInto(*out) } if in.HttpClientSslOptions != nil { in, out := &in.HttpClientSslOptions, &out.HttpClientSslOptions @@ -366,6 +422,16 @@ func (in *EndpointHealthCheckService) DeepCopy() *EndpointHealthCheckService { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Failover) DeepCopyInto(out *Failover) { *out = *in + if in.MaxAttempts != nil { + in, out := &in.MaxAttempts, &out.MaxAttempts + *out = new(int) + **out = **in + } + if in.RetryTimeout != nil { + in, out := &in.RetryTimeout, &out.RetryTimeout + *out = new(int64) + **out = **in + } if in.Cases != nil { in, out := &in.Cases, &out.Cases *out = make([]FailoverCase, len(*in)) @@ -386,10 +452,15 @@ func (in *Failover) DeepCopy() *Failover { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Flow) DeepCopyInto(out *Flow) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } if in.PathOperator != nil { in, out := &in.PathOperator, &out.PathOperator *out = new(PathOperator) - **out = **in + (*in).DeepCopyInto(*out) } if in.Pre != nil { in, out := &in.Pre, &out.Pre @@ -410,10 +481,17 @@ func (in *Flow) DeepCopyInto(out *Flow) { *out = make([]base.HttpMethod, len(*in)) copy(*out, *in) } + if in.Condition != nil { + in, out := &in.Condition, &out.Condition + *out = new(string) + **out = **in + } if in.Consumers != nil { in, out := &in.Consumers, &out.Consumers *out = make([]Consumer, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } } @@ -430,10 +508,22 @@ func (in *Flow) DeepCopy() *Flow { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HealthCheckRequest) DeepCopyInto(out *HealthCheckRequest) { *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } if in.Headers != nil { in, out := &in.Headers, &out.Headers *out = make([]base.HttpHeader, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Body != nil { + in, out := &in.Body, &out.Body + *out = new(string) + **out = **in } } @@ -501,6 +591,11 @@ func (in *HealthCheckService) DeepCopy() *HealthCheckService { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HealthCheckStep) DeepCopyInto(out *HealthCheckStep) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } in.Request.DeepCopyInto(&out.Request) in.Response.DeepCopyInto(&out.Response) } @@ -533,6 +628,11 @@ func (in *LoadBalancer) DeepCopy() *LoadBalancer { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Logging) DeepCopyInto(out *Logging) { *out = *in + if in.Condition != nil { + in, out := &in.Condition, &out.Condition + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Logging. @@ -558,6 +658,11 @@ func (in *Page) DeepCopyInto(out *Page) { *out = make([]base.AccessControl, len(*in)) copy(*out, *in) } + if in.ExcludedAccessControl != nil { + in, out := &in.ExcludedAccessControl, &out.ExcludedAccessControl + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Page. @@ -573,6 +678,11 @@ func (in *Page) DeepCopy() *Page { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Path) DeepCopyInto(out *Path) { *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } if in.Rules != nil { in, out := &in.Rules, &out.Rules *out = make([]*Rule, len(*in)) @@ -599,6 +709,11 @@ func (in *Path) DeepCopy() *Path { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PathOperator) DeepCopyInto(out *PathOperator) { *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PathOperator. @@ -619,6 +734,11 @@ func (in *Plan) DeepCopyInto(out *Plan) { *out = new(base.Plan) (*in).DeepCopyInto(*out) } + if in.SecurityDefinition != nil { + in, out := &in.SecurityDefinition, &out.SecurityDefinition + *out = new(string) + **out = **in + } if in.Paths != nil { in, out := &in.Paths, &out.Paths *out = make(map[string][]Rule, len(*in)) @@ -637,6 +757,16 @@ func (in *Plan) DeepCopyInto(out *Plan) { (*out)[key] = outVal } } + if in.Api != nil { + in, out := &in.Api, &out.Api + *out = new(string) + **out = **in + } + if in.SelectionRule != nil { + in, out := &in.SelectionRule, &out.SelectionRule + *out = new(string) + **out = **in + } if in.Flows != nil { in, out := &in.Flows, &out.Flows *out = make([]Flow, len(*in)) @@ -664,6 +794,11 @@ func (in *Plan) DeepCopy() *Plan { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Policy) DeepCopyInto(out *Policy) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } if in.Configuration != nil { in, out := &in.Configuration, &out.Configuration *out = (*in).DeepCopy() @@ -718,6 +853,16 @@ func (in *Proxy) DeepCopyInto(out *Proxy) { if in.Logging != nil { in, out := &in.Logging, &out.Logging *out = new(Logging) + (*in).DeepCopyInto(*out) + } + if in.StripContextPath != nil { + in, out := &in.StripContextPath, &out.StripContextPath + *out = new(bool) + **out = **in + } + if in.PreserveHost != nil { + in, out := &in.PreserveHost, &out.PreserveHost + *out = new(bool) **out = **in } } @@ -745,6 +890,16 @@ func (in *Rule) DeepCopyInto(out *Rule) { *out = new(Policy) (*in).DeepCopyInto(*out) } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rule. @@ -778,6 +933,11 @@ func (in *ScheduledService) DeepCopyInto(out *ScheduledService) { if in.Service != nil { in, out := &in.Service, &out.Service *out = new(Service) + (*in).DeepCopyInto(*out) + } + if in.Schedule != nil { + in, out := &in.Schedule, &out.Schedule + *out = new(string) **out = **in } } @@ -795,6 +955,11 @@ func (in *ScheduledService) DeepCopy() *ScheduledService { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Service) DeepCopyInto(out *Service) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service. diff --git a/api/model/api/v4/analytics.go b/api/model/api/v4/analytics.go index 2d3252401..a6ff5b264 100644 --- a/api/model/api/v4/analytics.go +++ b/api/model/api/v4/analytics.go @@ -17,11 +17,11 @@ package v4 type Logging struct { // The logging condition. This field is evaluated for HTTP requests and supports EL expressions. // +kubebuilder:validation:Optional - Condition string `json:"condition,omitempty"` + Condition *string `json:"condition,omitempty"` // The logging message condition. This field is evaluated for messages and supports EL expressions. // +kubebuilder:validation:Optional - MessageCondition string `json:"messageCondition,omitempty"` + MessageCondition *string `json:"messageCondition,omitempty"` // Defines which component of the request should be included in the log payload. Content *LoggingContent `json:"content,omitempty"` diff --git a/api/model/api/v4/api.go b/api/model/api/v4/api.go index 35d2d6091..473b83ab4 100644 --- a/api/model/api/v4/api.go +++ b/api/model/api/v4/api.go @@ -35,7 +35,7 @@ type Api struct { *base.ApiBase `json:",inline"` // API description // +kubebuilder:validation:Optional - Description string `json:"description,omitempty"` + Description *string `json:"description,omitempty"` // +kubebuilder:default:=`V4` // +kubebuilder:validation:Enum=`V4`; // The definition version of the API. diff --git a/api/model/api/v4/endpoints.go b/api/model/api/v4/endpoints.go index 345c85323..fd163363f 100644 --- a/api/model/api/v4/endpoints.go +++ b/api/model/api/v4/endpoints.go @@ -29,7 +29,7 @@ const ( type Endpoint struct { // The endpoint name (this value should be unique across endpoints) // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` // +kubebuilder:validation:Required // Endpoint Type @@ -37,7 +37,7 @@ type Endpoint struct { // Endpoint Weight // +kubebuilder:validation:Optional - Weight int `json:"weight,omitempty"` + Weight *int `json:"weight,omitempty"` // Should endpoint group configuration be inherited or not ? Inherit bool `json:"inheritConfiguration"` @@ -63,7 +63,7 @@ type Endpoint struct { func NewHttpEndpoint(name string) *Endpoint { return &Endpoint{ - Name: name, + Name: &name, Type: string(EndpointTypeHTTP), } } @@ -99,7 +99,7 @@ type EndpointGroup struct { Name string `json:"name"` // Endpoint group type // +kubebuilder:validation:Optional - Type string `json:"type,omitempty"` + Type *string `json:"type,omitempty"` // Endpoint group load balancer LoadBalancer *LoadBalancer `json:"loadBalancer,omitempty"` // Endpoint group shared configuration, arbitrary map of key-values @@ -120,9 +120,10 @@ type EndpointGroup struct { } func NewHttpEndpointGroup(name string) *EndpointGroup { + t := string(EndpointTypeHTTP) return &EndpointGroup{ Name: name, - Type: string(EndpointTypeHTTP), + Type: &t, } } diff --git a/api/model/api/v4/flow.go b/api/model/api/v4/flow.go index e771c7db8..036c47cac 100644 --- a/api/model/api/v4/flow.go +++ b/api/model/api/v4/flow.go @@ -27,7 +27,7 @@ type Flow struct { // Flow name // +kubebuilder:validation:Optional - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` // +kubebuilder:default:=true // Is flow enabled or not? @@ -60,7 +60,7 @@ type Flow struct { func NewFlow(name string) *Flow { return &Flow{ - Name: name, + Name: &name, Enabled: true, Selectors: []*FlowSelector{}, Request: []*FlowStep{}, @@ -82,7 +82,7 @@ type FlowStep struct { base.FlowStep `json:",inline"` // The message condition (supports EL expressions) // +kubebuilder:validation:Optional - MessageCondition string `json:"messageCondition,omitempty"` + MessageCondition *string `json:"messageCondition,omitempty"` } func NewFlowStep(base base.FlowStep) *FlowStep { @@ -92,7 +92,7 @@ func NewFlowStep(base base.FlowStep) *FlowStep { } func (step *FlowStep) WithMessageCondition(messageCondition string) *FlowStep { - step.MessageCondition = messageCondition + step.MessageCondition = &messageCondition return step } diff --git a/api/model/api/v4/listeners.go b/api/model/api/v4/listeners.go index fc7ddab6e..6e16de1ec 100644 --- a/api/model/api/v4/listeners.go +++ b/api/model/api/v4/listeners.go @@ -42,7 +42,7 @@ const ( type DLQ struct { // The endpoint to use when a message should be sent to the dead letter queue. // +kubebuilder:validation:Optional - Endpoint string `json:"endpoint,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` } type EntryPointType string @@ -184,7 +184,7 @@ type Entrypoint struct { func (ep *Entrypoint) ToGatewayDefinition() *Entrypoint { entryPoint := ep.DeepCopy() entryPoint.Qos = QosType(Enum(ep.Qos).ToGatewayDefinition()) - if ep.Dlq != nil && ep.Dlq.Endpoint == "" { + if ep.Dlq != nil && ep.Dlq.Endpoint == nil { entryPoint.Dlq = nil } return entryPoint diff --git a/api/model/api/v4/plan.go b/api/model/api/v4/plan.go index 5237a591a..7849a2f12 100644 --- a/api/model/api/v4/plan.go +++ b/api/model/api/v4/plan.go @@ -37,7 +37,7 @@ type Plan struct { // Plan Description // +kubebuilder:validation:Optional - Description string `json:"description,omitempty"` + Description *string `json:"description,omitempty"` // Plan definition version DefinitionVersion DefinitionVersion `json:"definitionVersion,omitempty"` @@ -53,7 +53,7 @@ type Plan struct { // Plan selection rule // +kubebuilder:validation:Optional - SelectionRule string `json:"selectionRule,omitempty"` + SelectionRule *string `json:"selectionRule,omitempty"` // +kubebuilder:validation:Optional // +kubebuilder:default:={} // List of plan flows diff --git a/api/model/api/v4/services.go b/api/model/api/v4/services.go index de4f8f223..4e6a6083d 100644 --- a/api/model/api/v4/services.go +++ b/api/model/api/v4/services.go @@ -22,7 +22,7 @@ type Service struct { // Service Type // +kubebuilder:validation:Optional - Type string `json:"type,omitempty"` + Type *string `json:"type,omitempty"` // Service Override Configuration or not? OverrideConfig bool `json:"overrideConfiguration"` @@ -35,7 +35,7 @@ type Service struct { func NewService(kind string, enabled bool) *Service { return &Service{ Enabled: enabled, - Type: kind, + Type: &kind, } } diff --git a/api/model/api/v4/zz_generated.deepcopy.go b/api/model/api/v4/zz_generated.deepcopy.go index 53f24cd43..a7ebcec70 100644 --- a/api/model/api/v4/zz_generated.deepcopy.go +++ b/api/model/api/v4/zz_generated.deepcopy.go @@ -88,6 +88,11 @@ func (in *Api) DeepCopyInto(out *Api) { *out = new(base.ApiBase) (*in).DeepCopyInto(*out) } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } if in.DefinitionContext != nil { in, out := &in.DefinitionContext, &out.DefinitionContext *out = new(DefinitionContext) @@ -191,7 +196,7 @@ func (in *Api) DeepCopyInto(out *Api) { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] *out = new(base.Member) - **out = **in + (*in).DeepCopyInto(*out) } } } @@ -246,6 +251,11 @@ func (in *ApiServices) DeepCopy() *ApiServices { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DLQ) DeepCopyInto(out *DLQ) { *out = *in + if in.Endpoint != nil { + in, out := &in.Endpoint, &out.Endpoint + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DLQ. @@ -276,6 +286,16 @@ func (in *DefinitionContext) DeepCopy() *DefinitionContext { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Endpoint) DeepCopyInto(out *Endpoint) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Weight != nil { + in, out := &in.Weight, &out.Weight + *out = new(int) + **out = **in + } if in.Config != nil { in, out := &in.Config, &out.Config *out = (*in).DeepCopy() @@ -309,6 +329,11 @@ func (in *Endpoint) DeepCopy() *Endpoint { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EndpointGroup) DeepCopyInto(out *EndpointGroup) { *out = *in + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } if in.LoadBalancer != nil { in, out := &in.LoadBalancer, &out.LoadBalancer *out = new(LoadBalancer) @@ -337,7 +362,7 @@ func (in *EndpointGroup) DeepCopyInto(out *EndpointGroup) { if in.HttpClientOptions != nil { in, out := &in.HttpClientOptions, &out.HttpClientOptions *out = new(base.HttpClientOptions) - **out = **in + (*in).DeepCopyInto(*out) } if in.HttpClientSslOptions != nil { in, out := &in.HttpClientSslOptions, &out.HttpClientSslOptions @@ -414,7 +439,7 @@ func (in *Entrypoint) DeepCopyInto(out *Entrypoint) { if in.Dlq != nil { in, out := &in.Dlq, &out.Dlq *out = new(DLQ) - **out = **in + (*in).DeepCopyInto(*out) } if in.Configuration != nil { in, out := &in.Configuration, &out.Configuration @@ -435,6 +460,11 @@ func (in *Entrypoint) DeepCopy() *Entrypoint { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Flow) DeepCopyInto(out *Flow) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } if in.Selectors != nil { in, out := &in.Selectors, &out.Selectors *out = make([]*FlowSelector, len(*in)) @@ -545,6 +575,11 @@ func (in *FlowSelector) DeepCopy() *FlowSelector { func (in *FlowStep) DeepCopyInto(out *FlowStep) { *out = *in in.FlowStep.DeepCopyInto(&out.FlowStep) + if in.MessageCondition != nil { + in, out := &in.MessageCondition, &out.MessageCondition + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FlowStep. @@ -681,6 +716,16 @@ func (in *LoadBalancer) DeepCopy() *LoadBalancer { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Logging) DeepCopyInto(out *Logging) { *out = *in + if in.Condition != nil { + in, out := &in.Condition, &out.Condition + *out = new(string) + **out = **in + } + if in.MessageCondition != nil { + in, out := &in.MessageCondition, &out.MessageCondition + *out = new(string) + **out = **in + } if in.Content != nil { in, out := &in.Content, &out.Content *out = new(LoggingContent) @@ -796,11 +841,21 @@ func (in *Plan) DeepCopyInto(out *Plan) { *out = new(base.Plan) (*in).DeepCopyInto(*out) } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } if in.Security != nil { in, out := &in.Security, &out.Security *out = new(PlanSecurity) (*in).DeepCopyInto(*out) } + if in.SelectionRule != nil { + in, out := &in.SelectionRule, &out.SelectionRule + *out = new(string) + **out = **in + } if in.Flows != nil { in, out := &in.Flows, &out.Flows *out = make([]*Flow, len(*in)) @@ -866,6 +921,11 @@ func (in *Sampling) DeepCopy() *Sampling { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Service) DeepCopyInto(out *Service) { *out = *in + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } if in.Config != nil { in, out := &in.Config, &out.Config *out = (*in).DeepCopy() diff --git a/api/model/application/application.go b/api/model/application/application.go index 852d9b98e..ceca6b450 100644 --- a/api/model/application/application.go +++ b/api/model/application/application.go @@ -24,7 +24,7 @@ type SimpleSettings struct { // Application Type AppType string `json:"type"` // ClientID is the client id of the application - ClientID string `json:"clientId,omitempty"` + ClientID *string `json:"clientId,omitempty"` } type OAuthClientSettings struct { @@ -69,15 +69,15 @@ type Metadata struct { Name string `json:"name"` // Metadata Value // +kubebuilder:validation:Optional - Value string `json:"value,omitempty"` + Value *string `json:"value,omitempty"` // Metadata DefaultValue // +kubebuilder:validation:Optional - DefaultValue string `json:"defaultValue,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` // Metadata Format Format *MetaDataFormat `json:"format,omitempty"` // Metadata is hidden or not? // +kubebuilder:validation:Optional - Hidden bool `json:"hidden,omitempty"` + Hidden *bool `json:"hidden,omitempty"` } type Member struct { @@ -91,7 +91,7 @@ type Member struct { SourceID string `json:"sourceId"` // Member display name // +kubebuilder:validation:Optional - DisplayName string `json:"displayName,omitempty"` + DisplayName *string `json:"displayName,omitempty"` // The API role associated with this Member // +kubebuilder:default:=USER Role string `json:"role,omitempty"` @@ -109,25 +109,25 @@ type Application struct { ID string `json:"id,omitempty"` // The base64 encoded background to use for this application when displaying it on the portal // +kubebuilder:validation:Optional - Background string `json:"background,omitempty"` + Background *string `json:"background,omitempty"` // Application domain // +kubebuilder:validation:Optional - Domain string `json:"domain,omitempty"` + Domain *string `json:"domain,omitempty"` // Application groups // +kubebuilder:validation:Optional Groups []string `json:"groups"` // The base64 encoded picture to use for this application when displaying it on the portal (if not relying on an URL) // +kubebuilder:validation:Optional - Picture string `json:"picture,omitempty"` + Picture *string `json:"picture,omitempty"` // A URL pointing to the picture to use when displaying the application on the portal // +kubebuilder:validation:Optional - PictureURL string `json:"pictureUrl,omitempty"` + PictureURL *string `json:"pictureUrl,omitempty"` // Application settings // +kubebuilder:validation:Required Settings *Setting `json:"settings"` // +kubebuilder:validation:Optional // Notify members when they are added to the application - NotifyMembers bool `json:"notifyMembers"` + NotifyMembers *bool `json:"notifyMembers"` // Application metadata // +kubebuilder:validation:Optional Metadata *[]Metadata `json:"metadata"` diff --git a/api/model/application/zz_generated.deepcopy.go b/api/model/application/zz_generated.deepcopy.go index af2330696..fd1add5db 100644 --- a/api/model/application/zz_generated.deepcopy.go +++ b/api/model/application/zz_generated.deepcopy.go @@ -25,16 +25,41 @@ import () // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Application) DeepCopyInto(out *Application) { *out = *in + if in.Background != nil { + in, out := &in.Background, &out.Background + *out = new(string) + **out = **in + } + if in.Domain != nil { + in, out := &in.Domain, &out.Domain + *out = new(string) + **out = **in + } if in.Groups != nil { in, out := &in.Groups, &out.Groups *out = make([]string, len(*in)) copy(*out, *in) } + if in.Picture != nil { + in, out := &in.Picture, &out.Picture + *out = new(string) + **out = **in + } + if in.PictureURL != nil { + in, out := &in.PictureURL, &out.PictureURL + *out = new(string) + **out = **in + } if in.Settings != nil { in, out := &in.Settings, &out.Settings *out = new(Setting) (*in).DeepCopyInto(*out) } + if in.NotifyMembers != nil { + in, out := &in.NotifyMembers, &out.NotifyMembers + *out = new(bool) + **out = **in + } if in.Metadata != nil { in, out := &in.Metadata, &out.Metadata *out = new([]Metadata) @@ -52,7 +77,9 @@ func (in *Application) DeepCopyInto(out *Application) { if **in != nil { in, out := *in, *out *out = make([]Member, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } } } @@ -70,6 +97,11 @@ func (in *Application) DeepCopy() *Application { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Member) DeepCopyInto(out *Member) { *out = *in + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Member. @@ -85,11 +117,26 @@ func (in *Member) DeepCopy() *Member { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Metadata) DeepCopyInto(out *Metadata) { *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(string) + **out = **in + } + if in.DefaultValue != nil { + in, out := &in.DefaultValue, &out.DefaultValue + *out = new(string) + **out = **in + } if in.Format != nil { in, out := &in.Format, &out.Format *out = new(MetaDataFormat) **out = **in } + if in.Hidden != nil { + in, out := &in.Hidden, &out.Hidden + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metadata. @@ -133,7 +180,7 @@ func (in *Setting) DeepCopyInto(out *Setting) { if in.App != nil { in, out := &in.App, &out.App *out = new(SimpleSettings) - **out = **in + (*in).DeepCopyInto(*out) } if in.Oauth != nil { in, out := &in.Oauth, &out.Oauth @@ -155,6 +202,11 @@ func (in *Setting) DeepCopy() *Setting { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SimpleSettings) DeepCopyInto(out *SimpleSettings) { *out = *in + if in.ClientID != nil { + in, out := &in.ClientID, &out.ClientID + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SimpleSettings. diff --git a/api/v1alpha1/apiv2definition_types.go b/api/v1alpha1/apiv2definition_types.go index 47f8b80a0..6b10dc510 100644 --- a/api/v1alpha1/apiv2definition_types.go +++ b/api/v1alpha1/apiv2definition_types.go @@ -196,7 +196,7 @@ func (api *ApiDefinition) generatePageIDs() { spec := &api.Spec pages := spec.Pages for name, page := range pages { - page.API = spec.ID + page.API = &spec.ID apiName := api.GetNamespacedName().String() if page.CrossID == "" { page.CrossID = uuid.FromStrings(apiName, separator, name) @@ -204,8 +204,9 @@ func (api *ApiDefinition) generatePageIDs() { if page.ID == "" { page.ID = uuid.FromStrings(spec.ID, separator, name) } - if page.Parent != "" { - page.ParentID = uuid.FromStrings(spec.ID, separator, page.Parent) + if page.Parent != nil { + pID := uuid.FromStrings(spec.ID, separator, *page.Parent) + page.ParentID = &pID } } } diff --git a/api/v1alpha1/apiv4definition_types.go b/api/v1alpha1/apiv4definition_types.go index f4424d575..829a370f8 100644 --- a/api/v1alpha1/apiv4definition_types.go +++ b/api/v1alpha1/apiv4definition_types.go @@ -148,7 +148,7 @@ func (api *ApiV4Definition) pickPageIDs() map[string]*v4.Page { for name, page := range api.Spec.Pages { p := page.DeepCopy() - p.API = api.Spec.ID + p.API = &api.Spec.ID apiName := api.GetNamespacedName().String() if page.ID == "" { p.ID = uuid.FromStrings(api.Spec.ID, separator, name) @@ -156,8 +156,9 @@ func (api *ApiV4Definition) pickPageIDs() map[string]*v4.Page { if page.CrossID == "" { p.CrossID = uuid.FromStrings(apiName, separator, name) } - if page.Parent != "" { - p.ParentID = uuid.FromStrings(api.Spec.ID, separator, page.Parent) + if page.Parent != nil { + pID := uuid.FromStrings(api.Spec.ID, separator, *page.Parent) + p.ParentID = &pID } pages[name] = p diff --git a/controllers/apim/ingress/internal/mapper/mapper.go b/controllers/apim/ingress/internal/mapper/mapper.go index 49f793b46..4580190c8 100644 --- a/controllers/apim/ingress/internal/mapper/mapper.go +++ b/controllers/apim/ingress/internal/mapper/mapper.go @@ -163,7 +163,8 @@ func (m *Mapper) buildPathFlows(rule v1.IngressRule, ruleIndex int) []v2.Flow { // of the incoming request. func (m *Mapper) buildRoutingFlow(rule v1.IngressRule, path *indexedPath) v2.Flow { flow := v2.Flow{Enabled: true} - flow.Name = rule.Host + path.Path + name := fmt.Sprintf("%s%s", rule.Host, path.Path) + flow.Name = &name flow.PathOperator = buildPathOperator(path) flow.Pre = buildRouting(path) @@ -180,12 +181,12 @@ func buildPathOperator(path *indexedPath) *v2.PathOperator { if *path.PathType == v1.PathTypeExact { return &v2.PathOperator{ Operator: base.EqualsOperator, - Path: rootPath, + Path: toPointer(rootPath), } } return &v2.PathOperator{ Operator: base.StartWithOperator, - Path: rootPath, + Path: toPointer(rootPath), } } @@ -193,7 +194,7 @@ func buildRouting(path *indexedPath) []base.FlowStep { return append([]base.FlowStep{}, buildRoutingStep(path)) } -func (m *Mapper) buildNoHostCondition(path *indexedPath) string { +func (m *Mapper) buildNoHostCondition(path *indexedPath) *string { condition := el.Empty() for host := range m.hosts { condition = condition.And(noHostCondition.Format(host)) @@ -203,22 +204,22 @@ func (m *Mapper) buildNoHostCondition(path *indexedPath) string { return m.storeCondition(condition) } -func (m *Mapper) buildHostCondition(rule v1.IngressRule, path *indexedPath) string { +func (m *Mapper) buildHostCondition(rule v1.IngressRule, path *indexedPath) *string { condition := hostCondition.Format(rule.Host) contextPath := strings.TrimSuffix(path.Path, rootPath) condition = condition.And(pathCondition.Format(contextPath)) return m.storeCondition(condition) } -func (m *Mapper) storeCondition(condition el.Expression) string { +func (m *Mapper) storeCondition(condition el.Expression) *string { m.conditions = append(m.conditions, condition.Parenthesized()) - return condition.Closed().String() + return toPointer(condition.Closed().String()) } func buildRoutingStep(path *indexedPath) base.FlowStep { return base.FlowStep{ - Name: routingStepName, - Policy: routingPolicyName, + Name: toPointer(routingStepName), + Policy: toPointer(routingPolicyName), Enabled: true, Configuration: utils.NewGenericStringMap(). Put(routingRulesKey, buildRoutingRules(path)), @@ -241,12 +242,12 @@ func buildRoutingTarget(path *indexedPath) string { // This flow is used to return a 404 HTTP response when no route is found. func (m *Mapper) buildNotFoundFlow() v2.Flow { flow := v2.Flow{ - Name: mockStepName, + Name: toPointer(mockStepName), Pre: []base.FlowStep{m.buildNotFoundStep()}, Enabled: true, PathOperator: &v2.PathOperator{ Operator: base.StartWithOperator, - Path: rootPath, + Path: toPointer(rootPath), }, } @@ -256,7 +257,7 @@ func (m *Mapper) buildNotFoundFlow() v2.Flow { condition = condition.Or(c) } - flow.Condition = condition.Parenthesized().Negated().Closed().String() + flow.Condition = toPointer(condition.Parenthesized().Negated().Closed().String()) return flow } @@ -265,8 +266,8 @@ func (m *Mapper) buildNotFoundStep() base.FlowStep { template := m.opts.Templates[http.StatusNotFound] return base.FlowStep{ - Name: mockStepName, - Policy: mockPolicyName, + Name: toPointer(mockStepName), + Policy: toPointer(mockPolicyName), Enabled: true, Configuration: &utils.GenericStringMap{ Unstructured: unstructured.Unstructured{ @@ -290,7 +291,7 @@ func buildProxy(ingress *v1.Ingress) *v2.Proxy { VirtualHosts: buildVirtualHosts(ingress), Groups: []*v2.EndpointGroup{ { - Name: proxyName, + Name: toPointer(proxyName), Endpoints: buildEndpoints(ingress), }, }, @@ -312,14 +313,15 @@ func buildEndpoints(ingress *v1.Ingress) []*v2.Endpoint { // in order to be able to match it in the routing step when handling an incoming request for routing. func buildEndpoint(ingress *v1.Ingress, path *indexedPath) *v2.Endpoint { return &v2.Endpoint{ - Name: path.String(), + Name: toPointer(path.String()), Target: buildEndpointTarget(ingress, path), } } -func buildEndpointTarget(ingress *v1.Ingress, path *indexedPath) string { +func buildEndpointTarget(ingress *v1.Ingress, path *indexedPath) *string { svc := path.Backend.Service - return fmt.Sprintf(serviceURIPattern, svc.Name, ingress.Namespace, svc.Port.Number) + et := fmt.Sprintf(serviceURIPattern, svc.Name, ingress.Namespace, svc.Port.Number) + return &et } // For each ingress host and path, build a virtual host. @@ -336,3 +338,7 @@ func buildVirtualHosts(ingress *v1.Ingress) []*v2.VirtualHost { func buildVirtualHost(rule v1.IngressRule, path v1.HTTPIngressPath) *v2.VirtualHost { return &v2.VirtualHost{Host: rule.Host, Path: path.Path} } + +func toPointer(s string) *string { + return &s +} diff --git a/internal/admission/api/base/resource.go b/internal/admission/api/base/resource.go index 76782802c..69f7312ae 100644 --- a/internal/admission/api/base/resource.go +++ b/internal/admission/api/base/resource.go @@ -46,10 +46,12 @@ func validateResourceOrRefs(ctx context.Context, api core.ApiDefinitionObject) * } func toResourceOrRef(r core.ResourceModel) core.ResourceModel { + rn := r.GetResourceName() + t := r.GetType() return &base.Resource{ Enabled: true, - Name: r.GetResourceName(), - Type: r.GetType(), + Name: &rn, + Type: &t, Configuration: r.GetConfig(), } } diff --git a/test/integration/admission/api/v4/create_withContext_andInvalidResourceConfig_test.go b/test/integration/admission/api/v4/create_withContext_andInvalidResourceConfig_test.go index 9460b941b..f66e6ccf3 100644 --- a/test/integration/admission/api/v4/create_withContext_andInvalidResourceConfig_test.go +++ b/test/integration/admission/api/v4/create_withContext_andInvalidResourceConfig_test.go @@ -71,7 +71,7 @@ var _ = Describe("Validate create", labels.WithContext, func() { "severe", errors.NewSeveref( "Resource [%s] configuration is not valid", - fixtures.APIv4.Spec.Resources[0].Name, + *fixtures.APIv4.Spec.Resources[0].Name, ).Error(), err.Error(), ) diff --git a/test/integration/admission/api/v4/update_withContext_andInvalidResourceConfig_test.go b/test/integration/admission/api/v4/update_withContext_andInvalidResourceConfig_test.go index 3f4210aa9..afe0b9cae 100644 --- a/test/integration/admission/api/v4/update_withContext_andInvalidResourceConfig_test.go +++ b/test/integration/admission/api/v4/update_withContext_andInvalidResourceConfig_test.go @@ -69,7 +69,7 @@ var _ = Describe("Validate update", labels.WithContext, func() { "severe", errors.NewSeveref( "Resource [%s] configuration is not valid", - fixtures.APIv4.Spec.Resources[0].Name, + *fixtures.APIv4.Spec.Resources[0].Name, ).Error(), err.Error(), ) diff --git a/test/integration/admission/application/create_withContext_templatingWithMissingConfigmap_test.go b/test/integration/admission/application/create_withContext_templatingWithMissingConfigmap_test.go index 7ec79c46c..bcc399fb6 100644 --- a/test/integration/admission/application/create_withContext_templatingWithMissingConfigmap_test.go +++ b/test/integration/admission/application/create_withContext_templatingWithMissingConfigmap_test.go @@ -38,7 +38,7 @@ var _ = Describe("Validate create", labels.WithContext, func() { By("updating app domain") - fixtures.Application.Spec.Domain = "[[ configmap `missing-configmap/domain` ]]" + fixtures.Application.Spec.Domain = toPointer("[[ configmap `missing-configmap/domain` ]]") By("checking that Application creation does not pass validation") diff --git a/test/integration/admission/application/create_withContext_templatingWithMissingSecreteKey_test.go b/test/integration/admission/application/create_withContext_templatingWithMissingSecreteKey_test.go index 783a480a7..4a97f4cff 100644 --- a/test/integration/admission/application/create_withContext_templatingWithMissingSecreteKey_test.go +++ b/test/integration/admission/application/create_withContext_templatingWithMissingSecreteKey_test.go @@ -38,7 +38,7 @@ var _ = Describe("Validate create", labels.WithContext, func() { By("updating app domain") - fixtures.Application.Spec.Domain = "[[ secret `graviteeio-templating/unknown` ]]" + fixtures.Application.Spec.Domain = toPointer("[[ secret `graviteeio-templating/unknown` ]]") By("checking that Application creation does not pass validation") diff --git a/test/integration/admission/application/create_withContext_templatingWithMissingSecrete_test.go b/test/integration/admission/application/create_withContext_templatingWithMissingSecrete_test.go index 8956616e9..08ad6e306 100644 --- a/test/integration/admission/application/create_withContext_templatingWithMissingSecrete_test.go +++ b/test/integration/admission/application/create_withContext_templatingWithMissingSecrete_test.go @@ -38,7 +38,7 @@ var _ = Describe("Validate create", labels.WithContext, func() { By("updating app domain") - fixtures.Application.Spec.Domain = "[[ secret `missing-secret/domain` ]]" + fixtures.Application.Spec.Domain = toPointer("[[ secret `missing-secret/domain` ]]") By("checking that Application creation does not pass validation") diff --git a/test/integration/admission/application/suite_test.go b/test/integration/admission/application/suite_test.go index 16dad9b71..ec78ad8e3 100644 --- a/test/integration/admission/application/suite_test.go +++ b/test/integration/admission/application/suite_test.go @@ -50,3 +50,7 @@ var _ = SynchronizedAfterSuite(func() { }, func() { // NOSONAR ignore this noop func }) + +func toPointer(s string) *string { + return &s +} diff --git a/test/integration/admission/application/update_withContext_templatingWithMissingConfigmap_test.go b/test/integration/admission/application/update_withContext_templatingWithMissingConfigmap_test.go index 9e6baef1b..30b2c7c70 100644 --- a/test/integration/admission/application/update_withContext_templatingWithMissingConfigmap_test.go +++ b/test/integration/admission/application/update_withContext_templatingWithMissingConfigmap_test.go @@ -39,7 +39,7 @@ var _ = Describe("Validate update", labels.WithContext, func() { By("updating app domain") - fixtures.Application.Spec.Domain = "[[ configmap `missing-configmap/domain` ]]" + fixtures.Application.Spec.Domain = toPointer("[[ configmap `missing-configmap/domain` ]]") By("checking that Application update does not pass validation") diff --git a/test/integration/admission/application/update_withContext_templatingWithMissingSecrete_test.go b/test/integration/admission/application/update_withContext_templatingWithMissingSecrete_test.go index 0fb86898d..6d7297efd 100644 --- a/test/integration/admission/application/update_withContext_templatingWithMissingSecrete_test.go +++ b/test/integration/admission/application/update_withContext_templatingWithMissingSecrete_test.go @@ -39,7 +39,7 @@ var _ = Describe("Validate update", labels.WithContext, func() { By("updating app domain") - fixtures.Application.Spec.Domain = "[[ secret `missing-secret/domain` ]]" + fixtures.Application.Spec.Domain = toPointer("[[ secret `missing-secret/domain` ]]") By("checking that Application update does not pass validation") diff --git a/test/integration/apidefinition/v2/create_withContext_andMardownPage_test.go b/test/integration/apidefinition/v2/create_withContext_andMardownPage_test.go index d06ebdc70..ae5555b5d 100644 --- a/test/integration/apidefinition/v2/create_withContext_andMardownPage_test.go +++ b/test/integration/apidefinition/v2/create_withContext_andMardownPage_test.go @@ -69,7 +69,7 @@ var _ = Describe("Create", labels.WithContext, func() { return err } page := pages[0] - return assert.Equals("markdown content", markdown.Content, page.Content) + return assert.Equals("markdown content", markdown.Content, &page.Content) }, timeout, interval).Should(Succeed(), fixtures.API.Name) }) }) diff --git a/test/integration/apidefinition/v2/update_withContext_andMardownPage_test.go b/test/integration/apidefinition/v2/update_withContext_andMardownPage_test.go index 00bee72ad..5d4dca118 100644 --- a/test/integration/apidefinition/v2/update_withContext_andMardownPage_test.go +++ b/test/integration/apidefinition/v2/update_withContext_andMardownPage_test.go @@ -48,8 +48,8 @@ var _ = Describe("Update", labels.WithContext, func() { By("updating markdown content") markdown := fixtures.API.Spec.Pages["markdown"] - updatedContent := markdown.Content + "\n" + "This is an update." - markdown.Content = updatedContent + updatedContent := *markdown.Content + "\n" + "This is an update." + markdown.Content = &updatedContent Eventually(func() error { return manager.UpdateSafely(ctx, fixtures.API) diff --git a/test/integration/apidefinition/v4/v4-create_withContext_andMardownPage_test.go b/test/integration/apidefinition/v4/v4-create_withContext_andMardownPage_test.go index b4f67989c..2ce37a8e3 100644 --- a/test/integration/apidefinition/v4/v4-create_withContext_andMardownPage_test.go +++ b/test/integration/apidefinition/v4/v4-create_withContext_andMardownPage_test.go @@ -73,7 +73,7 @@ var _ = Describe("Create", labels.WithContext, func() { } else { page = pages[1] } - return assert.Equals("markdown content", markdown.Content, page.Content) + return assert.Equals("markdown content", markdown.Content, &page.Content) }, timeout, interval).Should(Succeed(), fixtures.APIv4.Name) }) }) diff --git a/test/integration/apidefinition/v4/v4-update_withContext_andMardownPage_test.go b/test/integration/apidefinition/v4/v4-update_withContext_andMardownPage_test.go index fe77c5cd5..2e70098c5 100644 --- a/test/integration/apidefinition/v4/v4-update_withContext_andMardownPage_test.go +++ b/test/integration/apidefinition/v4/v4-update_withContext_andMardownPage_test.go @@ -48,8 +48,8 @@ var _ = Describe("Update", labels.WithContext, func() { By("updating markdown content") markdown := fixtures.APIv4.Spec.Pages["markdown"] - updatedContent := markdown.Content + "\n" + "This is an update." - markdown.Content = updatedContent + updatedContent := *markdown.Content + "\n" + "This is an update." + markdown.Content = &updatedContent Eventually(func() error { return manager.UpdateSafely(ctx, fixtures.APIv4) diff --git a/test/integration/ingress/create_withoutContext_andMultipleHosts_test.go b/test/integration/ingress/create_withoutContext_andMultipleHosts_test.go index 7b7f8351b..95fc7a2af 100644 --- a/test/integration/ingress/create_withoutContext_andMultipleHosts_test.go +++ b/test/integration/ingress/create_withoutContext_andMultipleHosts_test.go @@ -101,16 +101,16 @@ var _ = Describe("Create", labels.WithoutContext, func() { Expect(endpoints).To(Equal( []*v2.Endpoint{ { - Name: "rule01-path01", - Target: "http://httpbin-1.default.svc.cluster.local:8080", + Name: toPointer("rule01-path01"), + Target: toPointer("http://httpbin-1.default.svc.cluster.local:8080"), }, { - Name: "rule02-path01", - Target: "http://httpbin-2.default.svc.cluster.local:8080", + Name: toPointer("rule02-path01"), + Target: toPointer("http://httpbin-2.default.svc.cluster.local:8080"), }, { - Name: "rule03-path01", - Target: "http://httpbin-3.default.svc.cluster.local:8080", + Name: toPointer("rule03-path01"), + Target: toPointer("http://httpbin-3.default.svc.cluster.local:8080"), }, }, )) diff --git a/test/integration/ingress/create_withoutContext_andTLS_test.go b/test/integration/ingress/create_withoutContext_andTLS_test.go index d495162bc..39e3069d5 100644 --- a/test/integration/ingress/create_withoutContext_andTLS_test.go +++ b/test/integration/ingress/create_withoutContext_andTLS_test.go @@ -71,8 +71,8 @@ var _ = Describe("Create", labels.WithoutContext, func() { Expect(endpoints).To(Equal( []*v2.Endpoint{ { - Name: "rule01-path01", - Target: "http://httpbin-1.default.svc.cluster.local:8080", + Name: toPointer("rule01-path01"), + Target: toPointer("http://httpbin-1.default.svc.cluster.local:8080"), }, }, )) diff --git a/test/integration/ingress/create_withoutContext_andTemplate_test.go b/test/integration/ingress/create_withoutContext_andTemplate_test.go index 3d1b8a27e..4e597912e 100644 --- a/test/integration/ingress/create_withoutContext_andTemplate_test.go +++ b/test/integration/ingress/create_withoutContext_andTemplate_test.go @@ -68,8 +68,8 @@ var _ = Describe("Create", labels.WithoutContext, func() { Expect(endpoints).To(Equal( []*v2.Endpoint{ { - Name: "rule01-path01", - Target: "http://httpbin-1.default.svc.cluster.local:8080", + Name: toPointer("rule01-path01"), + Target: toPointer("http://httpbin-1.default.svc.cluster.local:8080"), }, }, )) diff --git a/test/integration/ingress/create_withoutContext_test.go b/test/integration/ingress/create_withoutContext_test.go index 6d0f4b601..47fc154cd 100644 --- a/test/integration/ingress/create_withoutContext_test.go +++ b/test/integration/ingress/create_withoutContext_test.go @@ -71,8 +71,8 @@ var _ = Describe("Create", labels.WithoutContext, func() { Expect(endpoints).To(Equal( []*v2.Endpoint{ { - Name: "rule01-path01", - Target: "http://httpbin-1.default.svc.cluster.local:8080", + Name: toPointer("rule01-path01"), + Target: toPointer("http://httpbin-1.default.svc.cluster.local:8080"), }, }, )) diff --git a/test/integration/ingress/suite_test.go b/test/integration/ingress/suite_test.go index 56c19fd32..bb30e5def 100644 --- a/test/integration/ingress/suite_test.go +++ b/test/integration/ingress/suite_test.go @@ -46,3 +46,7 @@ var _ = SynchronizedAfterSuite(func() { }, func() { // NOSONAR ignore this noop func }) + +func toPointer(s string) *string { + return &s +} diff --git a/test/unit/admission/mctx/suite_test.go b/test/unit/admission/mctx/suite_test.go index d1c84b444..7d2578ee8 100644 --- a/test/unit/admission/mctx/suite_test.go +++ b/test/unit/admission/mctx/suite_test.go @@ -1,4 +1,4 @@ -package mctx_test +package mctx // Copyright (C) 2015 The Gravitee team (http://gravitee.io) //