From 77fa844e68e43e543e8ffb15012f62562cd1dbb4 Mon Sep 17 00:00:00 2001 From: Lisa Guo Date: Fri, 31 May 2024 11:48:38 -0400 Subject: [PATCH 1/2] Fix formatting --- controllers/common_test.go | 3 ++- .../validate_annotation_daemonset_test.go | 3 ++- .../annotations/validate_annotation_methods.go | 14 ++++++++------ .../validate_annotations_deployment_test.go | 6 ++++-- .../validate_annotations_namespace_test.go | 12 +++++++----- .../validate_annotations_statefulset_test.go | 3 ++- integration-tests/util/util.go | 3 ++- 7 files changed, 27 insertions(+), 17 deletions(-) diff --git a/controllers/common_test.go b/controllers/common_test.go index b9009676d..78a2201db 100644 --- a/controllers/common_test.go +++ b/controllers/common_test.go @@ -7,11 +7,12 @@ import ( "context" "testing" - "github.com/aws/amazon-cloudwatch-agent-operator/apis/v1alpha1" "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" logf "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/aws/amazon-cloudwatch-agent-operator/apis/v1alpha1" ) func TestEnabledAcceleratedComputeByAgentConfig(t *testing.T) { diff --git a/integration-tests/manifests/annotations/validate_annotation_daemonset_test.go b/integration-tests/manifests/annotations/validate_annotation_daemonset_test.go index 89e7ea77b..a4ab452b3 100644 --- a/integration-tests/manifests/annotations/validate_annotation_daemonset_test.go +++ b/integration-tests/manifests/annotations/validate_annotation_daemonset_test.go @@ -6,11 +6,12 @@ import ( "crypto/rand" "encoding/json" "fmt" - "github.com/aws/amazon-cloudwatch-agent-operator/pkg/instrumentation/auto" "math/big" "path/filepath" "testing" "time" + + "github.com/aws/amazon-cloudwatch-agent-operator/pkg/instrumentation/auto" ) func TestJavaAndPythonDaemonSet(t *testing.T) { diff --git a/integration-tests/manifests/annotations/validate_annotation_methods.go b/integration-tests/manifests/annotations/validate_annotation_methods.go index d5ccda38b..33af99616 100644 --- a/integration-tests/manifests/annotations/validate_annotation_methods.go +++ b/integration-tests/manifests/annotations/validate_annotation_methods.go @@ -6,23 +6,25 @@ package annotations import ( "context" "fmt" - "github.com/google/uuid" "strconv" "testing" + "github.com/google/uuid" + "github.com/aws/amazon-cloudwatch-agent-operator/integration-tests/util" + "os" + "os/exec" + "path/filepath" + "strings" + "time" + appsV1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" - "os" - "os/exec" - "path/filepath" - "strings" - "time" ) const ( diff --git a/integration-tests/manifests/annotations/validate_annotations_deployment_test.go b/integration-tests/manifests/annotations/validate_annotations_deployment_test.go index 421c38249..a17e7cae1 100644 --- a/integration-tests/manifests/annotations/validate_annotations_deployment_test.go +++ b/integration-tests/manifests/annotations/validate_annotations_deployment_test.go @@ -6,12 +6,14 @@ import ( "crypto/rand" "encoding/json" "fmt" - "github.com/aws/amazon-cloudwatch-agent-operator/pkg/instrumentation/auto" - "github.com/stretchr/testify/assert" "math/big" "path/filepath" "testing" "time" + + "github.com/stretchr/testify/assert" + + "github.com/aws/amazon-cloudwatch-agent-operator/pkg/instrumentation/auto" ) func TestJavaAndPythonDeployment(t *testing.T) { diff --git a/integration-tests/manifests/annotations/validate_annotations_namespace_test.go b/integration-tests/manifests/annotations/validate_annotations_namespace_test.go index 8db7b4b59..ea274912b 100644 --- a/integration-tests/manifests/annotations/validate_annotations_namespace_test.go +++ b/integration-tests/manifests/annotations/validate_annotations_namespace_test.go @@ -7,16 +7,18 @@ import ( "crypto/rand" "encoding/json" "fmt" - "github.com/aws/amazon-cloudwatch-agent-operator/integration-tests/util" - "github.com/aws/amazon-cloudwatch-agent-operator/pkg/instrumentation/auto" - "github.com/google/uuid" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "math/big" "os" "path/filepath" "testing" "time" + + "github.com/google/uuid" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/aws/amazon-cloudwatch-agent-operator/integration-tests/util" + "github.com/aws/amazon-cloudwatch-agent-operator/pkg/instrumentation/auto" ) func TestJavaAndPythonNamespace(t *testing.T) { diff --git a/integration-tests/manifests/annotations/validate_annotations_statefulset_test.go b/integration-tests/manifests/annotations/validate_annotations_statefulset_test.go index 9611f3a11..07993e3f9 100644 --- a/integration-tests/manifests/annotations/validate_annotations_statefulset_test.go +++ b/integration-tests/manifests/annotations/validate_annotations_statefulset_test.go @@ -6,11 +6,12 @@ import ( "crypto/rand" "encoding/json" "fmt" - "github.com/aws/amazon-cloudwatch-agent-operator/pkg/instrumentation/auto" "math/big" "path/filepath" "testing" "time" + + "github.com/aws/amazon-cloudwatch-agent-operator/pkg/instrumentation/auto" ) func TestJavaAndPythonStatefulSet(t *testing.T) { diff --git a/integration-tests/util/util.go b/integration-tests/util/util.go index 1061c8c93..616ee224c 100644 --- a/integration-tests/util/util.go +++ b/integration-tests/util/util.go @@ -6,12 +6,13 @@ package util import ( "context" "fmt" + "time" + appsV1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/kubernetes" - "time" ) const TimoutDuration = 2 * time.Minute From a7d7fc1ad161d1acf2dc5b2deb561fb2cc61dcdb Mon Sep 17 00:00:00 2001 From: Lisa Guo Date: Fri, 31 May 2024 12:09:06 -0400 Subject: [PATCH 2/2] Upgrade controller-tools to 0.14.0 and run make test --- Makefile | 2 +- apis/v1alpha1/zz_generated.deepcopy.go | 19 ++++++++++++++++--- apis/v1alpha2/zz_generated.deepcopy.go | 6 ++---- docs/api.md | 7 +++++++ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 45ee3652c..c839e739f 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ CHLOGGEN ?= $(LOCALBIN)/chloggen ADDLICENSE ?= $(LOCALBIN)/addlicense KUSTOMIZE_VERSION ?= v5.0.3 -CONTROLLER_TOOLS_VERSION ?= v0.12.0 +CONTROLLER_TOOLS_VERSION ?= v0.14.0 ALL_SRC := $(shell find . -name '*.go' -type f | sort) CW_AGENT_OPERATOR_IMPORT_PATH = "github.com/aws/amazon-cloudwatch-agent-operator" diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index c71931cd2..aa0d4b2fc 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -1,5 +1,4 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -8,9 +7,9 @@ package v1alpha1 import ( - v2 "k8s.io/api/autoscaling/v2" + "k8s.io/api/autoscaling/v2" corev1 "k8s.io/api/core/v1" - v1 "k8s.io/api/networking/v1" + "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -453,6 +452,13 @@ func (in *DcgmExporterSpec) DeepCopyInto(out *DcgmExporterSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]corev1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } if in.Volumes != nil { in, out := &in.Volumes, &out.Volumes *out = make([]corev1.Volume, len(*in)) @@ -886,6 +892,13 @@ func (in *NeuronMonitorSpec) DeepCopyInto(out *NeuronMonitorSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]corev1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } if in.Volumes != nil { in, out := &in.Volumes, &out.Volumes *out = make([]corev1.Volume, len(*in)) diff --git a/apis/v1alpha2/zz_generated.deepcopy.go b/apis/v1alpha2/zz_generated.deepcopy.go index 8ab5ffec1..e840621e9 100644 --- a/apis/v1alpha2/zz_generated.deepcopy.go +++ b/apis/v1alpha2/zz_generated.deepcopy.go @@ -1,5 +1,4 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -8,10 +7,9 @@ package v1alpha2 import ( - v1 "k8s.io/api/core/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - "github.com/aws/amazon-cloudwatch-agent-operator/apis/v1alpha1" + "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/docs/api.md b/docs/api.md index f5c1f4b2c..0402e3a10 100644 --- a/docs/api.md +++ b/docs/api.md @@ -375,6 +375,13 @@ AmazonCloudWatchAgentSpec defines the desired state of AmazonCloudWatchAgent. Volumes represents which volumes to use in the underlying collector deployment(s).
false + + workingDir + string + + WorkingDir represents Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.
+ + false