From c77a7d832fda32c8eed09c8c2f5a0bf25d1298eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Martins?= Date: Fri, 3 Nov 2017 13:22:32 +0100 Subject: [PATCH] adding generated DeepCopy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add DeepCopy methods needed for kubernetes CRDs. Signed-off-by: André Martins --- daemon/k8s_watcher.go | 4 +- hack/custom-boilerplate.go.txt | 14 + pkg/k8s/apis/cilium.io/v2/types.go | 30 +- .../cilium.io/v2/zz_generated.deepcopy.go | 194 ++++++++ pkg/labels/doc.go | 19 + pkg/labels/filter.go | 1 + pkg/labels/labels.go | 27 +- pkg/labels/zz_generated.deepcopy.go | 84 ++++ pkg/policy/api/doc.go | 3 + pkg/policy/api/zz_generated.deepcopy.go | 446 ++++++++++++++++++ 10 files changed, 791 insertions(+), 31 deletions(-) create mode 100644 hack/custom-boilerplate.go.txt create mode 100644 pkg/k8s/apis/cilium.io/v2/zz_generated.deepcopy.go create mode 100644 pkg/labels/doc.go create mode 100644 pkg/labels/zz_generated.deepcopy.go create mode 100644 pkg/policy/api/zz_generated.deepcopy.go diff --git a/daemon/k8s_watcher.go b/daemon/k8s_watcher.go index 75427542d9fbb..588cacc20844d 100644 --- a/daemon/k8s_watcher.go +++ b/daemon/k8s_watcher.go @@ -1259,13 +1259,13 @@ func (d *Daemon) addCiliumNetworkPolicy(obj interface{}) { cnpns = cilium_crd.CiliumNetworkPolicyNodeStatus{ OK: false, Error: fmt.Sprintf("%s", err), - LastUpdated: time.Now(), + LastUpdated: cilium_crd.NewTimestamp(), } scopedLog.WithError(err).Warn("Unable to add CiliumNetworkPolicy") } else { cnpns = cilium_crd.CiliumNetworkPolicyNodeStatus{ OK: true, - LastUpdated: time.Now(), + LastUpdated: cilium_crd.NewTimestamp(), } scopedLog.Info("Imported CiliumNetworkPolicy") } diff --git a/hack/custom-boilerplate.go.txt b/hack/custom-boilerplate.go.txt new file mode 100644 index 0000000000000..d71eabcd7a78e --- /dev/null +++ b/hack/custom-boilerplate.go.txt @@ -0,0 +1,14 @@ +// Copyright 2017 Authors of Cilium +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/k8s/apis/cilium.io/v2/types.go b/pkg/k8s/apis/cilium.io/v2/types.go index e4c6c283e90ba..0b317b9a2b0ba 100644 --- a/pkg/k8s/apis/cilium.io/v2/types.go +++ b/pkg/k8s/apis/cilium.io/v2/types.go @@ -39,6 +39,9 @@ var ( log = logrus.WithField(logfields.LogSubsys, subsysK8s) ) +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + // CiliumNetworkPolicy is a Kubernetes third-party resource with an extended version // of NetworkPolicy type CiliumNetworkPolicy struct { @@ -71,7 +74,25 @@ type CiliumNetworkPolicyNodeStatus struct { Error string `json:"error,omitempty"` // LastUpdated contains the last time this status was updated - LastUpdated time.Time `json:"lastUpdated,omitempty"` + LastUpdated Timestamp `json:"lastUpdated,omitempty"` +} + +// NewTimestamp creates a new Timestamp with the current time.Now() +func NewTimestamp() Timestamp { + return Timestamp{time.Now()} +} + +// Timestamp is a wrapper of time.Time so that we can create our own +// implementation of DeepCopyInto. +type Timestamp struct { + time.Time +} + +// DeepCopyInto creates a deep-copy of the Time value. The underlying time.Time +// type is effectively immutable in the time API, so it is safe to +// copy-by-assign, despite the presence of (unexported) Pointer fields. +func (t *Timestamp) DeepCopyInto(out *Timestamp) { + *out = *t } // SetPolicyStatus sets the given policy status for the given nodes' map @@ -232,12 +253,7 @@ func (r *CiliumNetworkPolicy) Parse() (api.Rules, error) { return retRules, nil } -// DeepCopy will return the same receiver of the DeepCopy function. -// Deprecated -func (cnp *CiliumNetworkPolicy) DeepCopy() *CiliumNetworkPolicy { - // FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME - return cnp -} +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // CiliumNetworkPolicyList is a list of CiliumNetworkPolicy objects type CiliumNetworkPolicyList struct { diff --git a/pkg/k8s/apis/cilium.io/v2/zz_generated.deepcopy.go b/pkg/k8s/apis/cilium.io/v2/zz_generated.deepcopy.go new file mode 100644 index 0000000000000..80b5ee593f3cf --- /dev/null +++ b/pkg/k8s/apis/cilium.io/v2/zz_generated.deepcopy.go @@ -0,0 +1,194 @@ +// +build !ignore_autogenerated + +// Copyright 2017 Authors of Cilium +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file was autogenerated by deepcopy-gen. Do not edit it manually! + +package v2 + +import ( + api "github.com/cilium/cilium/pkg/policy/api" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + reflect "reflect" +) + +func init() { + SchemeBuilder.Register(RegisterDeepCopies) +} + +// RegisterDeepCopies adds deep-copy functions to the given scheme. Public +// to allow building arbitrary schemes. +// +// Deprecated: deepcopy registration will go away when static deepcopy is fully implemented. +func RegisterDeepCopies(scheme *runtime.Scheme) error { + return scheme.AddGeneratedDeepCopyFuncs( + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*CiliumNetworkPolicy).DeepCopyInto(out.(*CiliumNetworkPolicy)) + return nil + }, InType: reflect.TypeOf(&CiliumNetworkPolicy{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*CiliumNetworkPolicyList).DeepCopyInto(out.(*CiliumNetworkPolicyList)) + return nil + }, InType: reflect.TypeOf(&CiliumNetworkPolicyList{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*CiliumNetworkPolicyNodeStatus).DeepCopyInto(out.(*CiliumNetworkPolicyNodeStatus)) + return nil + }, InType: reflect.TypeOf(&CiliumNetworkPolicyNodeStatus{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*CiliumNetworkPolicyStatus).DeepCopyInto(out.(*CiliumNetworkPolicyStatus)) + return nil + }, InType: reflect.TypeOf(&CiliumNetworkPolicyStatus{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*Timestamp).DeepCopyInto(out.(*Timestamp)) + return nil + }, InType: reflect.TypeOf(&Timestamp{})}, + ) +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CiliumNetworkPolicy) DeepCopyInto(out *CiliumNetworkPolicy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Spec != nil { + in, out := &in.Spec, &out.Spec + if *in == nil { + *out = nil + } else { + *out = new(api.Rule) + (*in).DeepCopyInto(*out) + } + } + if in.Specs != nil { + in, out := &in.Specs, &out.Specs + *out = make(api.Rules, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(api.Rule) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNetworkPolicy. +func (in *CiliumNetworkPolicy) DeepCopy() *CiliumNetworkPolicy { + if in == nil { + return nil + } + out := new(CiliumNetworkPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CiliumNetworkPolicy) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CiliumNetworkPolicyList) DeepCopyInto(out *CiliumNetworkPolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CiliumNetworkPolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNetworkPolicyList. +func (in *CiliumNetworkPolicyList) DeepCopy() *CiliumNetworkPolicyList { + if in == nil { + return nil + } + out := new(CiliumNetworkPolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CiliumNetworkPolicyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CiliumNetworkPolicyNodeStatus) DeepCopyInto(out *CiliumNetworkPolicyNodeStatus) { + *out = *in + in.LastUpdated.DeepCopyInto(&out.LastUpdated) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNetworkPolicyNodeStatus. +func (in *CiliumNetworkPolicyNodeStatus) DeepCopy() *CiliumNetworkPolicyNodeStatus { + if in == nil { + return nil + } + out := new(CiliumNetworkPolicyNodeStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CiliumNetworkPolicyStatus) DeepCopyInto(out *CiliumNetworkPolicyStatus) { + *out = *in + if in.Nodes != nil { + in, out := &in.Nodes, &out.Nodes + *out = make(map[string]CiliumNetworkPolicyNodeStatus, len(*in)) + for key, val := range *in { + newVal := new(CiliumNetworkPolicyNodeStatus) + val.DeepCopyInto(newVal) + (*out)[key] = *newVal + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNetworkPolicyStatus. +func (in *CiliumNetworkPolicyStatus) DeepCopy() *CiliumNetworkPolicyStatus { + if in == nil { + return nil + } + out := new(CiliumNetworkPolicyStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Timestamp. +func (in *Timestamp) DeepCopy() *Timestamp { + if in == nil { + return nil + } + out := new(Timestamp) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/labels/doc.go b/pkg/labels/doc.go new file mode 100644 index 0000000000000..b356ddee2ef99 --- /dev/null +++ b/pkg/labels/doc.go @@ -0,0 +1,19 @@ +// Copyright 2016-2017 Authors of Cilium +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +k8s:deepcopy-gen=package + +// Package api defines the API of the Cilium network policy interface +// +groupName=labels +package labels diff --git a/pkg/labels/filter.go b/pkg/labels/filter.go index bf8732156cc2c..b22da4aa62531 100644 --- a/pkg/labels/filter.go +++ b/pkg/labels/filter.go @@ -38,6 +38,7 @@ const ( ) // LabelPrefix is the cilium's representation of a container label. +// +k8s:deepcopy-gen=false type LabelPrefix struct { // Ignore if true will cause this prefix to be ignored insted of being accepted Ignore bool `json:"invert"` diff --git a/pkg/labels/labels.go b/pkg/labels/labels.go index f7e7e7388286d..51ca2c0fc5eac 100644 --- a/pkg/labels/labels.go +++ b/pkg/labels/labels.go @@ -56,16 +56,6 @@ type OpLabels struct { OrchestrationInfo Labels } -// DeepCopy returns deep copy of the label. -func (o *OpLabels) DeepCopy() *OpLabels { - return &OpLabels{ - Custom: o.Custom.DeepCopy(), - Disabled: o.Disabled.DeepCopy(), - OrchestrationIdentity: o.OrchestrationIdentity.DeepCopy(), - OrchestrationInfo: o.OrchestrationInfo.DeepCopy(), - } -} - // IdentityLabels returns map of labels that are used when determining a // security identity. func (o *OpLabels) IdentityLabels() Labels { @@ -235,13 +225,6 @@ func NewLabel(key string, value string, source string) *Label { } } -// DeepCopy returns a Deep copy of the receiver's label. -func (l *Label) DeepCopy() *Label { - ret := NewLabel(l.Key, l.Value, l.Source) - ret.DeletionMark = l.DeletionMark - return ret -} - // Equals returns true if source, AbsoluteKey() and Value are equal and false otherwise. func (l *Label) Equals(b *Label) bool { if !l.IsAnySource() { @@ -378,12 +361,12 @@ func Map2Labels(m map[string]string, source string) Labels { // DeepCopy returns a deep copy of the labels. func (l Labels) DeepCopy() Labels { - o := Labels{} + o := make(Labels, len(l)) for k, v := range l { - o[k] = &Label{ - Key: v.Key, - Value: v.Value, - Source: v.Source, + if v == nil { + o[k] = nil + } else { + o[k] = v.DeepCopy() } } return o diff --git a/pkg/labels/zz_generated.deepcopy.go b/pkg/labels/zz_generated.deepcopy.go new file mode 100644 index 0000000000000..018ab7222969b --- /dev/null +++ b/pkg/labels/zz_generated.deepcopy.go @@ -0,0 +1,84 @@ +// +build !ignore_autogenerated + +// Copyright 2017 Authors of Cilium +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file was autogenerated by deepcopy-gen. Do not edit it manually! + +package labels + +import ( + conversion "k8s.io/apimachinery/pkg/conversion" + reflect "reflect" +) + +// GetGeneratedDeepCopyFuncs returns the generated funcs, since we aren't registering them. +// +// Deprecated: deepcopy registration will go away when static deepcopy is fully implemented. +func GetGeneratedDeepCopyFuncs() []conversion.GeneratedDeepCopyFunc { + return []conversion.GeneratedDeepCopyFunc{ + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*Label).DeepCopyInto(out.(*Label)) + return nil + }, InType: reflect.TypeOf(&Label{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*OpLabels).DeepCopyInto(out.(*OpLabels)) + return nil + }, InType: reflect.TypeOf(&OpLabels{})}, + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Label) DeepCopyInto(out *Label) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Label. +func (in *Label) DeepCopy() *Label { + if in == nil { + return nil + } + out := new(Label) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpLabels) DeepCopyInto(out *OpLabels) { + *out = *in + if in.Custom != nil { + out.Custom = in.Custom.DeepCopy() + } + if in.OrchestrationIdentity != nil { + out.OrchestrationIdentity = in.OrchestrationIdentity.DeepCopy() + } + if in.Disabled != nil { + out.Disabled = in.Disabled.DeepCopy() + } + if in.OrchestrationInfo != nil { + out.OrchestrationInfo = in.OrchestrationInfo.DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpLabels. +func (in *OpLabels) DeepCopy() *OpLabels { + if in == nil { + return nil + } + out := new(OpLabels) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/policy/api/doc.go b/pkg/policy/api/doc.go index bb959c00b428f..500c0fc304544 100644 --- a/pkg/policy/api/doc.go +++ b/pkg/policy/api/doc.go @@ -12,5 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// +k8s:deepcopy-gen=package + // Package api defines the API of the Cilium network policy interface +// +groupName=policy package api diff --git a/pkg/policy/api/zz_generated.deepcopy.go b/pkg/policy/api/zz_generated.deepcopy.go new file mode 100644 index 0000000000000..cbbb05419f99a --- /dev/null +++ b/pkg/policy/api/zz_generated.deepcopy.go @@ -0,0 +1,446 @@ +// +build !ignore_autogenerated + +// Copyright 2017 Authors of Cilium +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file was autogenerated by deepcopy-gen. Do not edit it manually! + +package api + +import ( + labels "github.com/cilium/cilium/pkg/labels" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + reflect "reflect" +) + +// GetGeneratedDeepCopyFuncs returns the generated funcs, since we aren't registering them. +// +// Deprecated: deepcopy registration will go away when static deepcopy is fully implemented. +func GetGeneratedDeepCopyFuncs() []conversion.GeneratedDeepCopyFunc { + return []conversion.GeneratedDeepCopyFunc{ + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*CIDRRule).DeepCopyInto(out.(*CIDRRule)) + return nil + }, InType: reflect.TypeOf(&CIDRRule{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*EgressRule).DeepCopyInto(out.(*EgressRule)) + return nil + }, InType: reflect.TypeOf(&EgressRule{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*EndpointSelector).DeepCopyInto(out.(*EndpointSelector)) + return nil + }, InType: reflect.TypeOf(&EndpointSelector{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*IngressRule).DeepCopyInto(out.(*IngressRule)) + return nil + }, InType: reflect.TypeOf(&IngressRule{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*K8sServiceNamespace).DeepCopyInto(out.(*K8sServiceNamespace)) + return nil + }, InType: reflect.TypeOf(&K8sServiceNamespace{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*L7Rules).DeepCopyInto(out.(*L7Rules)) + return nil + }, InType: reflect.TypeOf(&L7Rules{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*PortProtocol).DeepCopyInto(out.(*PortProtocol)) + return nil + }, InType: reflect.TypeOf(&PortProtocol{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*PortRule).DeepCopyInto(out.(*PortRule)) + return nil + }, InType: reflect.TypeOf(&PortRule{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*PortRuleHTTP).DeepCopyInto(out.(*PortRuleHTTP)) + return nil + }, InType: reflect.TypeOf(&PortRuleHTTP{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*PortRuleKafka).DeepCopyInto(out.(*PortRuleKafka)) + return nil + }, InType: reflect.TypeOf(&PortRuleKafka{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*Rule).DeepCopyInto(out.(*Rule)) + return nil + }, InType: reflect.TypeOf(&Rule{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*Service).DeepCopyInto(out.(*Service)) + return nil + }, InType: reflect.TypeOf(&Service{})}, + {Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ServiceSelector).DeepCopyInto(out.(*ServiceSelector)) + return nil + }, InType: reflect.TypeOf(&ServiceSelector{})}, + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CIDRRule) DeepCopyInto(out *CIDRRule) { + *out = *in + if in.ExceptCIDRs != nil { + in, out := &in.ExceptCIDRs, &out.ExceptCIDRs + *out = make([]CIDR, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CIDRRule. +func (in *CIDRRule) DeepCopy() *CIDRRule { + if in == nil { + return nil + } + out := new(CIDRRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EgressRule) DeepCopyInto(out *EgressRule) { + *out = *in + if in.ToPorts != nil { + in, out := &in.ToPorts, &out.ToPorts + *out = make([]PortRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ToCIDR != nil { + in, out := &in.ToCIDR, &out.ToCIDR + *out = make([]CIDR, len(*in)) + copy(*out, *in) + } + if in.ToCIDRSet != nil { + in, out := &in.ToCIDRSet, &out.ToCIDRSet + *out = make([]CIDRRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ToEntities != nil { + in, out := &in.ToEntities, &out.ToEntities + *out = make([]Entity, len(*in)) + copy(*out, *in) + } + if in.ToServices != nil { + in, out := &in.ToServices, &out.ToServices + *out = make([]Service, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressRule. +func (in *EgressRule) DeepCopy() *EgressRule { + if in == nil { + return nil + } + out := new(EgressRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointSelector) DeepCopyInto(out *EndpointSelector) { + *out = *in + if in.LabelSelector != nil { + in, out := &in.LabelSelector, &out.LabelSelector + if *in == nil { + *out = nil + } else { + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSelector. +func (in *EndpointSelector) DeepCopy() *EndpointSelector { + if in == nil { + return nil + } + out := new(EndpointSelector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IngressRule) DeepCopyInto(out *IngressRule) { + *out = *in + if in.FromEndpoints != nil { + in, out := &in.FromEndpoints, &out.FromEndpoints + *out = make([]EndpointSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FromRequires != nil { + in, out := &in.FromRequires, &out.FromRequires + *out = make([]EndpointSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ToPorts != nil { + in, out := &in.ToPorts, &out.ToPorts + *out = make([]PortRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FromCIDR != nil { + in, out := &in.FromCIDR, &out.FromCIDR + *out = make([]CIDR, len(*in)) + copy(*out, *in) + } + if in.FromCIDRSet != nil { + in, out := &in.FromCIDRSet, &out.FromCIDRSet + *out = make([]CIDRRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FromEntities != nil { + in, out := &in.FromEntities, &out.FromEntities + *out = make([]Entity, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressRule. +func (in *IngressRule) DeepCopy() *IngressRule { + if in == nil { + return nil + } + out := new(IngressRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *K8sServiceNamespace) DeepCopyInto(out *K8sServiceNamespace) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new K8sServiceNamespace. +func (in *K8sServiceNamespace) DeepCopy() *K8sServiceNamespace { + if in == nil { + return nil + } + out := new(K8sServiceNamespace) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *L7Rules) DeepCopyInto(out *L7Rules) { + *out = *in + if in.HTTP != nil { + in, out := &in.HTTP, &out.HTTP + *out = make([]PortRuleHTTP, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Kafka != nil { + in, out := &in.Kafka, &out.Kafka + *out = make([]PortRuleKafka, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L7Rules. +func (in *L7Rules) DeepCopy() *L7Rules { + if in == nil { + return nil + } + out := new(L7Rules) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortProtocol) DeepCopyInto(out *PortProtocol) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortProtocol. +func (in *PortProtocol) DeepCopy() *PortProtocol { + if in == nil { + return nil + } + out := new(PortProtocol) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortRule) DeepCopyInto(out *PortRule) { + *out = *in + if in.Ports != nil { + in, out := &in.Ports, &out.Ports + *out = make([]PortProtocol, len(*in)) + copy(*out, *in) + } + if in.Rules != nil { + in, out := &in.Rules, &out.Rules + if *in == nil { + *out = nil + } else { + *out = new(L7Rules) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortRule. +func (in *PortRule) DeepCopy() *PortRule { + if in == nil { + return nil + } + out := new(PortRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortRuleHTTP) DeepCopyInto(out *PortRuleHTTP) { + *out = *in + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortRuleHTTP. +func (in *PortRuleHTTP) DeepCopy() *PortRuleHTTP { + if in == nil { + return nil + } + out := new(PortRuleHTTP) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortRuleKafka) DeepCopyInto(out *PortRuleKafka) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortRuleKafka. +func (in *PortRuleKafka) DeepCopy() *PortRuleKafka { + if in == nil { + return nil + } + out := new(PortRuleKafka) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Rule) DeepCopyInto(out *Rule) { + *out = *in + in.EndpointSelector.DeepCopyInto(&out.EndpointSelector) + if in.Ingress != nil { + in, out := &in.Ingress, &out.Ingress + *out = make([]IngressRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Egress != nil { + in, out := &in.Egress, &out.Egress + *out = make([]EgressRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(labels.LabelArray, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(labels.Label) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rule. +func (in *Rule) DeepCopy() *Rule { + if in == nil { + return nil + } + out := new(Rule) + in.DeepCopyInto(out) + return out +} + +// 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 + in.K8sServiceSelector.DeepCopyInto(&out.K8sServiceSelector) + out.K8sService = in.K8sService + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service. +func (in *Service) DeepCopy() *Service { + if in == nil { + return nil + } + out := new(Service) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceSelector) DeepCopyInto(out *ServiceSelector) { + *out = *in + if in.LabelSelector != nil { + in, out := &in.LabelSelector, &out.LabelSelector + if *in == nil { + *out = nil + } else { + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceSelector. +func (in *ServiceSelector) DeepCopy() *ServiceSelector { + if in == nil { + return nil + } + out := new(ServiceSelector) + in.DeepCopyInto(out) + return out +}