From 93c70fca9a7e12c22ada94cde48f7e2a4be41bb4 Mon Sep 17 00:00:00 2001 From: Jestin Woods Date: Tue, 3 Sep 2024 14:25:11 -0700 Subject: [PATCH] cleanup --- api/v1alpha1/zz_generated.deepcopy.go | 203 ++++++++++++++++++ controllers/humioaggregatealert_controller.go | 2 +- .../humioscheduledsearch_controller.go | 2 +- .../clusters/humiocluster_controller_test.go | 5 +- 4 files changed, 208 insertions(+), 4 deletions(-) diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index e48dd9ab..4b7b833e 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -335,6 +335,105 @@ func (in *HumioActionWebhookProperties) DeepCopy() *HumioActionWebhookProperties return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HumioAggregateAlert) DeepCopyInto(out *HumioAggregateAlert) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HumioAggregateAlert. +func (in *HumioAggregateAlert) DeepCopy() *HumioAggregateAlert { + if in == nil { + return nil + } + out := new(HumioAggregateAlert) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HumioAggregateAlert) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HumioAggregateAlertList) DeepCopyInto(out *HumioAggregateAlertList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HumioAggregateAlert, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HumioAggregateAlertList. +func (in *HumioAggregateAlertList) DeepCopy() *HumioAggregateAlertList { + if in == nil { + return nil + } + out := new(HumioAggregateAlertList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HumioAggregateAlertList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HumioAggregateAlertSpec) DeepCopyInto(out *HumioAggregateAlertSpec) { + *out = *in + if in.Actions != nil { + in, out := &in.Actions, &out.Actions + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HumioAggregateAlertSpec. +func (in *HumioAggregateAlertSpec) DeepCopy() *HumioAggregateAlertSpec { + if in == nil { + return nil + } + out := new(HumioAggregateAlertSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HumioAggregateAlertStatus) DeepCopyInto(out *HumioAggregateAlertStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HumioAggregateAlertStatus. +func (in *HumioAggregateAlertStatus) DeepCopy() *HumioAggregateAlertStatus { + if in == nil { + return nil + } + out := new(HumioAggregateAlertStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HumioAlert) DeepCopyInto(out *HumioAlert) { *out = *in @@ -731,6 +830,11 @@ func (in *HumioClusterTLSSpec) DeepCopyInto(out *HumioClusterTLSSpec) { *out = new(bool) **out = **in } + if in.ExtraHostnames != nil { + in, out := &in.ExtraHostnames, &out.ExtraHostnames + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HumioClusterTLSSpec. @@ -1649,6 +1753,105 @@ func (in *HumioRetention) DeepCopy() *HumioRetention { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HumioScheduledSearch) DeepCopyInto(out *HumioScheduledSearch) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HumioScheduledSearch. +func (in *HumioScheduledSearch) DeepCopy() *HumioScheduledSearch { + if in == nil { + return nil + } + out := new(HumioScheduledSearch) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HumioScheduledSearch) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HumioScheduledSearchList) DeepCopyInto(out *HumioScheduledSearchList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HumioScheduledSearch, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HumioScheduledSearchList. +func (in *HumioScheduledSearchList) DeepCopy() *HumioScheduledSearchList { + if in == nil { + return nil + } + out := new(HumioScheduledSearchList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HumioScheduledSearchList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HumioScheduledSearchSpec) DeepCopyInto(out *HumioScheduledSearchSpec) { + *out = *in + if in.Actions != nil { + in, out := &in.Actions, &out.Actions + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HumioScheduledSearchSpec. +func (in *HumioScheduledSearchSpec) DeepCopy() *HumioScheduledSearchSpec { + if in == nil { + return nil + } + out := new(HumioScheduledSearchSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HumioScheduledSearchStatus) DeepCopyInto(out *HumioScheduledSearchStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HumioScheduledSearchStatus. +func (in *HumioScheduledSearchStatus) DeepCopy() *HumioScheduledSearchStatus { + if in == nil { + return nil + } + out := new(HumioScheduledSearchStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HumioTokenSecretSpec) DeepCopyInto(out *HumioTokenSecretSpec) { *out = *in diff --git a/controllers/humioaggregatealert_controller.go b/controllers/humioaggregatealert_controller.go index 9f73c578..d654fe21 100644 --- a/controllers/humioaggregatealert_controller.go +++ b/controllers/humioaggregatealert_controller.go @@ -74,7 +74,7 @@ func (r *HumioAggregateAlertReconciler) Reconcile(ctx context.Context, req ctrl. r.Log = r.Log.WithValues("Request.UID", haa.UID) - cluster, err := helpers.NewCluster(ctx, r, haa.Spec.ManagedClusterName, haa.Spec.ExternalClusterName, haa.Namespace, helpers.UseCertManager(), true) + cluster, err := helpers.NewCluster(ctx, r, haa.Spec.ManagedClusterName, haa.Spec.ExternalClusterName, haa.Namespace, helpers.UseCertManager(), true, false) if err != nil || cluster == nil || cluster.Config() == nil { setStateErr := r.setState(ctx, humiov1alpha1.HumioAggregateAlertStateConfigError, haa) if setStateErr != nil { diff --git a/controllers/humioscheduledsearch_controller.go b/controllers/humioscheduledsearch_controller.go index 31d6b38e..af3b72fc 100644 --- a/controllers/humioscheduledsearch_controller.go +++ b/controllers/humioscheduledsearch_controller.go @@ -77,7 +77,7 @@ func (r *HumioScheduledSearchReconciler) Reconcile(ctx context.Context, req ctrl r.Log = r.Log.WithValues("Request.UID", hss.UID) - cluster, err := helpers.NewCluster(ctx, r, hss.Spec.ManagedClusterName, hss.Spec.ExternalClusterName, hss.Namespace, helpers.UseCertManager(), true) + cluster, err := helpers.NewCluster(ctx, r, hss.Spec.ManagedClusterName, hss.Spec.ExternalClusterName, hss.Namespace, helpers.UseCertManager(), true, false) if err != nil || cluster == nil || cluster.Config() == nil { setStateErr := r.setState(ctx, humiov1alpha1.HumioScheduledSearchStateConfigError, hss) if setStateErr != nil { diff --git a/controllers/suite/clusters/humiocluster_controller_test.go b/controllers/suite/clusters/humiocluster_controller_test.go index e67b58dd..d04e1c50 100644 --- a/controllers/suite/clusters/humiocluster_controller_test.go +++ b/controllers/suite/clusters/humiocluster_controller_test.go @@ -19,11 +19,12 @@ package clusters import ( "context" "fmt" - cmapi "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1" "os" "reflect" "strings" + cmapi "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1" + humiov1alpha1 "github.com/humio/humio-operator/api/v1alpha1" "github.com/humio/humio-operator/controllers" "github.com/humio/humio-operator/controllers/suite" @@ -1287,7 +1288,7 @@ var _ = Describe("HumioCluster Controller", func() { suite.UsingClusterBy(key.Name, "Creating a cluster") ctx := context.Background() - suite.CreateAndBootstrapCluster(ctx, k8sClient, humioClientForTestSuite, toCreate, true, humiov1alpha1.HumioClusterStateRunning, testTimeout) + suite.CreateAndBootstrapCluster(ctx, k8sClient, testHumioClient, toCreate, true, humiov1alpha1.HumioClusterStateRunning, testTimeout) defer suite.CleanupCluster(ctx, k8sClient, toCreate) suite.UsingClusterBy(key.Name, "Validating pod bootstrap token annotation hash")