diff --git a/Makefile b/Makefile index 0c849754..1bf54273 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ ensure-generate-is-noop: set-image-controller generate bundle @# on make bundle config/manager/kustomization.yaml includes changes, which should be ignored for the below check @git restore config/manager/kustomization.yaml # TODO(splunk): Check if resources are in sync another way, this only checks if the resources are in sync from the last commit. - @git diff --exit-code apis/o11y/v1alpha1/zz_generated.*.go || (echo "Build failed: a model has been changed but the generated resources aren't up to date. Run 'make generate' and update your PR." && exit 1) + @git diff --exit-code apis/otel/v1alpha1/zz_generated.*.go || (echo "Build failed: a model has been changed but the generated resources aren't up to date. Run 'make generate' and update your PR." && exit 1) @git diff --exit-code bundle config || (echo "Build failed: the bundle, config files has been changed but the generated bundle, config files aren't up to date. Run 'make bundle' and update your PR." && exit 1) diff --git a/PROJECT b/PROJECT index 21f13958..b9908833 100644 --- a/PROJECT +++ b/PROJECT @@ -12,9 +12,9 @@ resources: namespaced: true controller: true domain: splunk.com - group: o11y - kind: SplunkOtelAgent - path: github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1 + group: otel + kind: Agent + path: github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1 version: v1alpha1 webhooks: defaulting: true diff --git a/README.md b/README.md index cf2a4686..c25d7cd4 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,8 @@ Once the `splunk-otel--operator` deployment is ready, create an Splunk OpenTelem ```console $ kubectl apply -f - < ``` -`clusterName` and `realm` are the only two required fields. Other than these, SplunkOtelAgent also accepts some optional fields that allow customization of agents, gateway and cluster receiver. The entire schema is detailed [here](../splunkotelagent_cr_spec.md) and source of truth can be located [here](../../apis/o11y/v1alpha1/splunkotelagent_types.go). +`clusterName` and `realm` are the only two required fields. Other than these, SplunkOtelAgent also accepts some optional fields that allow customization of agents, gateway and cluster receiver. The entire schema is detailed [here](../agent_cr_spec.md) and source of truth can be located [here](../../apis/otel/v1alpha1/agent_types.go). ## Webhook ![Webhook](./img/webhook.png) -The admission webhook is called synchronously when a user creates/applied/deletes a SplunkOtelAgent object. The webhook has two responsibilities: it sets default values on SplunkOtelAgent objects and it validates user provides values, returning errors for values that don't make sense. Such errors are directly reported back to end users by CLI tools like kubectl. Once a SplunkOtelAgent object is validated to be correct, it is automatically persisted by the cluster for controllers to manage. Webhook source code can be found [here](../../apis/o11y/v1alpha1/splunkotelagent_webhook.go). +The admission webhook is called synchronously when a user creates/applied/deletes a SplunkOtelAgent object. The webhook has two responsibilities: it sets default values on SplunkOtelAgent objects and it validates user provides values, returning errors for values that don't make sense. Such errors are directly reported back to end users by CLI tools like kubectl. Once a SplunkOtelAgent object is validated to be correct, it is automatically persisted by the cluster for controllers to manage. Webhook source code can be found [here](../../apis/otel/v1alpha1/agent_webhook.go). ## Controller & Reconcilers @@ -63,7 +63,7 @@ Most permissions (RBAC) the controller needs are auto-generated by the operator- ### OpenTelemetry Config -We supports OpenShift out of the box. This means that the operator must be smart enough to detect it is running on OpenShift and then apply OpenShift specific configuration to the deployed agents. Today vanilla Kubernetes and OpenShift deployments only have a single difference i.e, conditional configuration of the `k8s_cluster` receiver handled by webhook's `defaultClusterReceiver()` method [here](../../apis/o11y/v1alpha1/splunkotelagent_webhook.go). +We supports OpenShift out of the box. This means that the operator must be smart enough to detect it is running on OpenShift and then apply OpenShift specific configuration to the deployed agents. Today vanilla Kubernetes and OpenShift deployments only have a single difference i.e, conditional configuration of the `k8s_cluster` receiver handled by webhook's `defaultClusterReceiver()` method [here](../../apis/otel/v1alpha1/agent_webhook.go). ### SecurityContextConstraints diff --git a/docs/splunkotelagent_cr_spec.md b/docs/splunkotelagent_cr_spec.md index 4e76916a..9af74097 100644 --- a/docs/splunkotelagent_cr_spec.md +++ b/docs/splunkotelagent_cr_spec.md @@ -3,8 +3,8 @@ The below `SplunkOtelAgent` custom resource contains all the specification that can be configured. ```yaml -apiVersion: o11y.splunk.com/v1alpha1 -kind: SplunkOtelAgent +apiVersion: otel.splunk.com/v1alpha1 +kind: Agent metadata: name: example-splunk-otel-agent spec: diff --git a/internal/collector/agent.go b/internal/collector/agent.go index 6c841e3e..c98584e6 100644 --- a/internal/collector/agent.go +++ b/internal/collector/agent.go @@ -21,12 +21,12 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" "github.com/signalfx/splunk-otel-collector-operator/internal/naming" ) // Agent builds the deployment for the given instance. -func Agent(logger logr.Logger, otelcol v1alpha1.SplunkOtelAgent) appsv1.DaemonSet { +func Agent(logger logr.Logger, otelcol v1alpha1.Agent) appsv1.DaemonSet { labels := Labels(otelcol) labels["app.kubernetes.io/name"] = naming.Agent(otelcol) diff --git a/internal/collector/agent_test.go b/internal/collector/agent_test.go index 3c331ed8..5aaf8f57 100644 --- a/internal/collector/agent_test.go +++ b/internal/collector/agent_test.go @@ -21,17 +21,17 @@ import ( "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" . "github.com/signalfx/splunk-otel-collector-operator/internal/collector" ) func TestDaemonSetNewDefault(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ + otelcol := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ Tolerations: testTolerationValues, }}, } @@ -58,14 +58,14 @@ func TestDaemonSetNewDefault(t *testing.T) { func TestDaemonsetHostNetwork(t *testing.T) { // test - d1 := Agent(logger, v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{}, + d1 := Agent(logger, v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{}, }) assert.False(t, d1.Spec.Template.Spec.HostNetwork) // verify custom - d2 := Agent(logger, v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + d2 := Agent(logger, v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ HostNetwork: true, }}, }) diff --git a/internal/collector/annotations.go b/internal/collector/annotations.go index af214fd2..125aab86 100644 --- a/internal/collector/annotations.go +++ b/internal/collector/annotations.go @@ -19,11 +19,11 @@ import ( "crypto/sha256" "fmt" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) // Annotations return the annotations for SplunkOtelAgent pod. -func Annotations(instance v1alpha1.SplunkOtelAgent) map[string]string { +func Annotations(instance v1alpha1.Agent) map[string]string { // new map every time, so that we don't touch the instance's annotations annotations := map[string]string{} diff --git a/internal/collector/annotations_test.go b/internal/collector/annotations_test.go index 59d373df..6ad27646 100644 --- a/internal/collector/annotations_test.go +++ b/internal/collector/annotations_test.go @@ -21,17 +21,17 @@ import ( "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) func TestDefaultAnnotations(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ + otelcol := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-ns", }, - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ Config: "test", }}, } @@ -48,7 +48,7 @@ func TestDefaultAnnotations(t *testing.T) { func TestUserAnnotations(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ + otelcol := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-ns", @@ -58,7 +58,7 @@ func TestUserAnnotations(t *testing.T) { "splunk-otel-operator-config/sha256": "shouldBeOverwritten", }, }, - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ Config: "test", }}, } @@ -75,7 +75,7 @@ func TestUserAnnotations(t *testing.T) { func TestAnnotationsPropagateDown(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ + otelcol := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{"myapp": "mycomponent"}, }, diff --git a/internal/collector/clusterreceiver.go b/internal/collector/clusterreceiver.go index 9f9a6868..8c65b905 100644 --- a/internal/collector/clusterreceiver.go +++ b/internal/collector/clusterreceiver.go @@ -21,12 +21,12 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" "github.com/signalfx/splunk-otel-collector-operator/internal/naming" ) // ClusterReceiver builds the Splunk Cluster Receiver instance (deployment) for the given instance. -func ClusterReceiver(logger logr.Logger, otelcol v1alpha1.SplunkOtelAgent) appsv1.Deployment { +func ClusterReceiver(logger logr.Logger, otelcol v1alpha1.Agent) appsv1.Deployment { labels := Labels(otelcol) labels["app.kubernetes.io/name"] = naming.ClusterReciever(otelcol) diff --git a/internal/collector/clusterreceiver_test.go b/internal/collector/clusterreceiver_test.go index 38338c44..dee42056 100644 --- a/internal/collector/clusterreceiver_test.go +++ b/internal/collector/clusterreceiver_test.go @@ -22,7 +22,7 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" . "github.com/signalfx/splunk-otel-collector-operator/internal/collector" ) @@ -36,11 +36,11 @@ var testTolerationValues = []v1.Toleration{ func TestDeploymentNewDefault(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ + otelcol := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{}}, + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{}}, } // test diff --git a/internal/collector/container.go b/internal/collector/container.go index 777cde2b..8d06c6ff 100644 --- a/internal/collector/container.go +++ b/internal/collector/container.go @@ -21,12 +21,12 @@ import ( "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" "github.com/signalfx/splunk-otel-collector-operator/internal/naming" ) // Container builds a container for the given collector. -func Container(logger logr.Logger, spec v1alpha1.SplunkCollectorSpec) corev1.Container { +func Container(logger logr.Logger, spec v1alpha1.CollectorSpec) corev1.Container { image := spec.Image if len(image) == 0 { image = defaultCollectorImage diff --git a/internal/collector/container_test.go b/internal/collector/container_test.go index 9df0f64e..199931c6 100644 --- a/internal/collector/container_test.go +++ b/internal/collector/container_test.go @@ -23,7 +23,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" logf "sigs.k8s.io/controller-runtime/pkg/log" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" . "github.com/signalfx/splunk-otel-collector-operator/internal/collector" ) @@ -31,7 +31,7 @@ var logger = logf.Log.WithName("unit-tests") func TestContainerNewDefault(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{} + otelcol := v1alpha1.Agent{} // test c := Container(logger, otelcol.Spec.Agent) @@ -42,8 +42,8 @@ func TestContainerNewDefault(t *testing.T) { func TestContainerConfigFlagIsIgnored(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + otelcol := v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ Args: map[string]string{ "key": "value", "config": "/some-custom-file.yaml", @@ -62,8 +62,8 @@ func TestContainerConfigFlagIsIgnored(t *testing.T) { func TestContainerCustomVolumes(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + otelcol := v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ VolumeMounts: []corev1.VolumeMount{{ Name: "custom-volume-mount", }}, @@ -80,7 +80,7 @@ func TestContainerCustomVolumes(t *testing.T) { func TestContainerCustomSecurityContext(t *testing.T) { // default config without security context - c1 := Container(logger, v1alpha1.SplunkCollectorSpec{}) + c1 := Container(logger, v1alpha1.CollectorSpec{}) // verify assert.Nil(t, c1.SecurityContext) @@ -90,7 +90,7 @@ func TestContainerCustomSecurityContext(t *testing.T) { uid := int64(1234) // test - c2 := Container(logger, v1alpha1.SplunkCollectorSpec{ + c2 := Container(logger, v1alpha1.CollectorSpec{ SecurityContext: &corev1.SecurityContext{ Privileged: &isPrivileged, RunAsUser: &uid, @@ -104,8 +104,8 @@ func TestContainerCustomSecurityContext(t *testing.T) { } func TestContainerEnvVarsOverridden(t *testing.T) { - otelcol := v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + otelcol := v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ Env: []corev1.EnvVar{ { Name: "foo", @@ -125,8 +125,8 @@ func TestContainerEnvVarsOverridden(t *testing.T) { } func TestContainerEmptyEnvVarsByDefault(t *testing.T) { - otelcol := v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{}, + otelcol := v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{}, } // test @@ -137,8 +137,8 @@ func TestContainerEmptyEnvVarsByDefault(t *testing.T) { } func TestContainerResourceRequirements(t *testing.T) { - otelcol := v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + otelcol := v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ Resources: corev1.ResourceRequirements{ Limits: corev1.ResourceList{ corev1.ResourceCPU: resource.MustParse("100m"), @@ -163,8 +163,8 @@ func TestContainerResourceRequirements(t *testing.T) { } func TestContainerDefaultResourceRequirements(t *testing.T) { - otelcol := v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{}, + otelcol := v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{}, } // test @@ -176,8 +176,8 @@ func TestContainerDefaultResourceRequirements(t *testing.T) { func TestContainerArgs(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + otelcol := v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ Args: map[string]string{ "metrics-level": "detailed", "log-level": "debug", @@ -195,8 +195,8 @@ func TestContainerArgs(t *testing.T) { func TestContainerImagePullPolicy(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + otelcol := v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ ImagePullPolicy: corev1.PullIfNotPresent, }}, } diff --git a/internal/collector/labels.go b/internal/collector/labels.go index 37943f4a..956b774f 100644 --- a/internal/collector/labels.go +++ b/internal/collector/labels.go @@ -18,11 +18,11 @@ package collector import ( "fmt" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) // Labels return the common labels to all objects that are part of a managed . -func Labels(instance v1alpha1.SplunkOtelAgent) map[string]string { +func Labels(instance v1alpha1.Agent) map[string]string { // new map every time, so that we don't touch the instance's label base := map[string]string{} if nil != instance.Labels { diff --git a/internal/collector/labels_test.go b/internal/collector/labels_test.go index 1af00739..00cdf89c 100644 --- a/internal/collector/labels_test.go +++ b/internal/collector/labels_test.go @@ -21,13 +21,13 @@ import ( "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" . "github.com/signalfx/splunk-otel-collector-operator/internal/collector" ) func TestLabelsCommonSet(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ + otelcol := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-ns", @@ -44,7 +44,7 @@ func TestLabelsCommonSet(t *testing.T) { func TestLabelsPropagateDown(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ + otelcol := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"myapp": "mycomponent"}, }, diff --git a/internal/collector/reconcile/configmap_test.go b/internal/collector/reconcile/configmap_test.go index 697c4898..faa0395f 100644 --- a/internal/collector/reconcile/configmap_test.go +++ b/internal/collector/reconcile/configmap_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) func TestDesiredConfigMap(t *testing.T) { @@ -96,7 +96,7 @@ func TestExpectedConfigMap(t *testing.T) { param := Params{ Client: k8sClient, - Instance: v1alpha1.SplunkOtelAgent{ + Instance: v1alpha1.Agent{ TypeMeta: metav1.TypeMeta{ Kind: "splunk.com", APIVersion: "v1", diff --git a/internal/collector/reconcile/opentelemetry_test.go b/internal/collector/reconcile/opentelemetry_test.go index a587b3b8..43bac54b 100644 --- a/internal/collector/reconcile/opentelemetry_test.go +++ b/internal/collector/reconcile/opentelemetry_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/assert" "k8s.io/apimachinery/pkg/types" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) func TestSelf(t *testing.T) { @@ -32,7 +32,7 @@ func TestSelf(t *testing.T) { err := Self(context.Background(), params()) assert.NoError(t, err) - actual := v1alpha1.SplunkOtelAgent{} + actual := v1alpha1.Agent{} exists, err := populateObjectIfExists(t, &actual, types.NamespacedName{Namespace: "default", Name: "test"}) assert.NoError(t, err) assert.True(t, exists) diff --git a/internal/collector/reconcile/params.go b/internal/collector/reconcile/params.go index f705944e..c860b061 100644 --- a/internal/collector/reconcile/params.go +++ b/internal/collector/reconcile/params.go @@ -21,13 +21,13 @@ import ( "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) // Params holds the reconciliation-specific parameters. type Params struct { Client client.Client - Instance v1alpha1.SplunkOtelAgent + Instance v1alpha1.Agent Log logr.Logger Scheme *runtime.Scheme Recorder record.EventRecorder diff --git a/internal/collector/reconcile/service_test.go b/internal/collector/reconcile/service_test.go index 0b5359d4..c45a38fb 100644 --- a/internal/collector/reconcile/service_test.go +++ b/internal/collector/reconcile/service_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" "github.com/signalfx/splunk-otel-collector-operator/internal/collector" ) @@ -100,8 +100,8 @@ func TestDesiredService(t *testing.T) { params := Params{ Client: k8sClient, Log: logger, - Instance: v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{Gateway: v1alpha1.SplunkCollectorSpec{ + Instance: v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{Gateway: v1alpha1.CollectorSpec{ Config: `receivers: test: protocols: diff --git a/internal/collector/reconcile/suite_test.go b/internal/collector/reconcile/suite_test.go index a62dc7b9..c229c5da 100644 --- a/internal/collector/reconcile/suite_test.go +++ b/internal/collector/reconcile/suite_test.go @@ -37,7 +37,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/envtest" logf "sigs.k8s.io/controller-runtime/pkg/log" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) var k8sClient client.Client @@ -89,9 +89,9 @@ func params() Params { } return Params{ Client: k8sClient, - Instance: v1alpha1.SplunkOtelAgent{ + Instance: v1alpha1.Agent{ TypeMeta: metav1.TypeMeta{ - Kind: "o11y.splunk.com", + Kind: "otel.splunk.com", APIVersion: "v1alpha1", }, ObjectMeta: metav1.ObjectMeta{ @@ -99,7 +99,7 @@ func params() Params { Namespace: "default", UID: instanceUID, }, - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ Ports: []v1.ServicePort{{ Name: "web", Port: 80, diff --git a/internal/collector/serviceaccount.go b/internal/collector/serviceaccount.go index 0eede3ff..de57026f 100644 --- a/internal/collector/serviceaccount.go +++ b/internal/collector/serviceaccount.go @@ -19,12 +19,12 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" "github.com/signalfx/splunk-otel-collector-operator/internal/naming" ) // ServiceAccountName returns the name of the existing or self-provisioned service account to use for the given instance. -func ServiceAccountName(instance v1alpha1.SplunkOtelAgent) string { +func ServiceAccountName(instance v1alpha1.Agent) string { if len(instance.Spec.Agent.ServiceAccount) == 0 { return naming.ServiceAccount(instance) } @@ -33,7 +33,7 @@ func ServiceAccountName(instance v1alpha1.SplunkOtelAgent) string { } //ServiceAccount returns the service account for the given instance. -func ServiceAccount(otelcol v1alpha1.SplunkOtelAgent) corev1.ServiceAccount { +func ServiceAccount(otelcol v1alpha1.Agent) corev1.ServiceAccount { labels := Labels(otelcol) labels["app.kubernetes.io/name"] = naming.ServiceAccount(otelcol) diff --git a/internal/collector/serviceaccount_test.go b/internal/collector/serviceaccount_test.go index 6c696b37..417d5fbe 100644 --- a/internal/collector/serviceaccount_test.go +++ b/internal/collector/serviceaccount_test.go @@ -21,13 +21,13 @@ import ( "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" . "github.com/signalfx/splunk-otel-collector-operator/internal/collector" ) func TestServiceAccountNewDefault(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ + otelcol := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -42,11 +42,11 @@ func TestServiceAccountNewDefault(t *testing.T) { func TestServiceAccountOverride(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ + otelcol := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha1.SplunkOtelAgentSpec{Agent: v1alpha1.SplunkCollectorSpec{ + Spec: v1alpha1.AgentSpec{Agent: v1alpha1.CollectorSpec{ ServiceAccount: "my-special-sa", }}, } diff --git a/internal/collector/upgrade/noop.go b/internal/collector/upgrade/noop.go index f3e387e1..1b8f6b7d 100644 --- a/internal/collector/upgrade/noop.go +++ b/internal/collector/upgrade/noop.go @@ -18,10 +18,10 @@ package upgrade import ( "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) //nolint unused -func noop(cl client.Client, otelcol *v1alpha1.SplunkOtelAgent) (*v1alpha1.SplunkOtelAgent, error) { +func noop(cl client.Client, otelcol *v1alpha1.Agent) (*v1alpha1.Agent, error) { return otelcol, nil } diff --git a/internal/collector/upgrade/suite_test.go b/internal/collector/upgrade/suite_test.go index 9e0be80a..7b9ae5a3 100644 --- a/internal/collector/upgrade/suite_test.go +++ b/internal/collector/upgrade/suite_test.go @@ -26,7 +26,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/envtest" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" // +kubebuilder:scaffold:imports ) diff --git a/internal/collector/upgrade/upgrade.go b/internal/collector/upgrade/upgrade.go index de584e94..64ea5ddc 100644 --- a/internal/collector/upgrade/upgrade.go +++ b/internal/collector/upgrade/upgrade.go @@ -25,7 +25,7 @@ import ( "github.com/go-logr/logr" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" "github.com/signalfx/splunk-otel-collector-operator/internal/version" ) @@ -38,7 +38,7 @@ func ManagedInstances(ctx context.Context, logger logr.Logger, ver version.Versi "app.kubernetes.io/managed-by": "splunk-otel-operator", }), } - list := &v1alpha1.SplunkOtelAgentList{} + list := &v1alpha1.AgentList{} if err := cl.List(ctx, list, opts...); err != nil { return fmt.Errorf("failed to list: %w", err) } @@ -79,7 +79,7 @@ func ManagedInstances(ctx context.Context, logger logr.Logger, ver version.Versi } // ManagedInstance performs the necessary changes to bring the given otelcol instance to the current version. -func ManagedInstance(ctx context.Context, logger logr.Logger, currentV version.Version, cl client.Client, otelcol v1alpha1.SplunkOtelAgent) (v1alpha1.SplunkOtelAgent, error) { +func ManagedInstance(ctx context.Context, logger logr.Logger, currentV version.Version, cl client.Client, otelcol v1alpha1.Agent) (v1alpha1.Agent, error) { // this is likely a new instance, assume it's already up to date if otelcol.Status.Version == "" { return otelcol, nil diff --git a/internal/collector/upgrade/upgrade_test.go b/internal/collector/upgrade/upgrade_test.go index ecf4f2e9..82b51d84 100644 --- a/internal/collector/upgrade/upgrade_test.go +++ b/internal/collector/upgrade/upgrade_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/types" logf "sigs.k8s.io/controller-runtime/pkg/log" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" "github.com/signalfx/splunk-otel-collector-operator/internal/collector/upgrade" "github.com/signalfx/splunk-otel-collector-operator/internal/version" ) @@ -36,7 +36,7 @@ func TestShouldUpgradeAllToLatest(t *testing.T) { t.Skip("enable once we support upgrades") // prepare nsn := types.NamespacedName{Name: "my-instance", Namespace: "default"} - existing := v1alpha1.SplunkOtelAgent{ + existing := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Name: nsn.Name, Namespace: nsn.Namespace, @@ -56,7 +56,7 @@ func TestShouldUpgradeAllToLatest(t *testing.T) { currentV.Collector = upgrade.Latest.String() // sanity check - persisted := &v1alpha1.SplunkOtelAgent{} + persisted := &v1alpha1.Agent{} err = k8sClient.Get(context.Background(), nsn, persisted) require.NoError(t, err) require.Equal(t, "0.0.1", persisted.Status.Version) @@ -77,7 +77,7 @@ func TestShouldUpgradeAllToLatest(t *testing.T) { func TestUpgradeUpToLatestKnownVersion(t *testing.T) { // prepare nsn := types.NamespacedName{Name: "my-instance", Namespace: "default"} - existing := v1alpha1.SplunkOtelAgent{ + existing := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Name: nsn.Name, Namespace: nsn.Namespace, @@ -113,7 +113,7 @@ func TestVersionsShouldNotBeChanged(t *testing.T) { t.Run(tt.desc, func(t *testing.T) { // prepare nsn := types.NamespacedName{Name: "my-instance", Namespace: "default"} - existing := v1alpha1.SplunkOtelAgent{ + existing := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Name: nsn.Name, Namespace: nsn.Namespace, diff --git a/internal/collector/upgrade/v0_31_0.go b/internal/collector/upgrade/v0_31_0.go index f4b221d6..5f69a1f8 100644 --- a/internal/collector/upgrade/v0_31_0.go +++ b/internal/collector/upgrade/v0_31_0.go @@ -22,11 +22,11 @@ import ( "gopkg.in/yaml.v2" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" "github.com/signalfx/splunk-otel-collector-operator/internal/collector/adapters" ) -func upgrade0_31_0(cl client.Client, otelcol *v1alpha1.SplunkOtelAgent) (*v1alpha1.SplunkOtelAgent, error) { +func upgrade0_31_0(cl client.Client, otelcol *v1alpha1.Agent) (*v1alpha1.Agent, error) { if len(otelcol.Spec.Agent.Config) == 0 { return otelcol, nil } diff --git a/internal/collector/upgrade/v0_31_0_test.go b/internal/collector/upgrade/v0_31_0_test.go index e96e6947..349d19f0 100644 --- a/internal/collector/upgrade/v0_31_0_test.go +++ b/internal/collector/upgrade/v0_31_0_test.go @@ -23,7 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" "github.com/signalfx/splunk-otel-collector-operator/internal/collector/upgrade" "github.com/signalfx/splunk-otel-collector-operator/internal/version" ) @@ -31,7 +31,7 @@ import ( func TestInfluxdbReceiverPropertyDrop(t *testing.T) { // prepare nsn := types.NamespacedName{Name: "my-instance", Namespace: "default"} - existing := v1alpha1.SplunkOtelAgent{ + existing := v1alpha1.Agent{ ObjectMeta: metav1.ObjectMeta{ Name: nsn.Name, Namespace: nsn.Namespace, @@ -39,8 +39,8 @@ func TestInfluxdbReceiverPropertyDrop(t *testing.T) { "app.kubernetes.io/managed-by": "splunk-otel-operator", }, }, - Spec: v1alpha1.SplunkOtelAgentSpec{ - Agent: v1alpha1.SplunkCollectorSpec{ + Spec: v1alpha1.AgentSpec{ + Agent: v1alpha1.CollectorSpec{ Config: ` receivers: influxdb: diff --git a/internal/collector/upgrade/versions.go b/internal/collector/upgrade/versions.go index eebbb028..d12556ba 100644 --- a/internal/collector/upgrade/versions.go +++ b/internal/collector/upgrade/versions.go @@ -19,10 +19,10 @@ import ( "github.com/Masterminds/semver/v3" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) -type upgradeFunc func(cl client.Client, otelcol *v1alpha1.SplunkOtelAgent) (*v1alpha1.SplunkOtelAgent, error) +type upgradeFunc func(cl client.Client, otelcol *v1alpha1.Agent) (*v1alpha1.Agent, error) type otelcolVersion struct { semver.Version diff --git a/internal/collector/volume.go b/internal/collector/volume.go index ba4b4ae7..2ca35ceb 100644 --- a/internal/collector/volume.go +++ b/internal/collector/volume.go @@ -19,12 +19,12 @@ package collector import ( corev1 "k8s.io/api/core/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" "github.com/signalfx/splunk-otel-collector-operator/internal/naming" ) // Volumes builds the volumes for the given instance, including the config map volume. -func Volumes(spec v1alpha1.SplunkCollectorSpec, configmap string) []corev1.Volume { +func Volumes(spec v1alpha1.CollectorSpec, configmap string) []corev1.Volume { // create one volume per configmap (agent, gateway, clusterreceiver) volumes := []corev1.Volume{} diff --git a/internal/collector/volume_test.go b/internal/collector/volume_test.go index a63e5699..8ce6af49 100644 --- a/internal/collector/volume_test.go +++ b/internal/collector/volume_test.go @@ -21,14 +21,14 @@ import ( "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" . "github.com/signalfx/splunk-otel-collector-operator/internal/collector" "github.com/signalfx/splunk-otel-collector-operator/internal/naming" ) func TestVolumeNewDefault(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{} + otelcol := v1alpha1.Agent{} // test volumes := Volumes(otelcol.Spec.Agent, "splunk-agent") @@ -42,9 +42,9 @@ func TestVolumeNewDefault(t *testing.T) { func TestVolumeAllowsMoreToBeAdded(t *testing.T) { // prepare - otelcol := v1alpha1.SplunkOtelAgent{ - Spec: v1alpha1.SplunkOtelAgentSpec{ - Agent: v1alpha1.SplunkCollectorSpec{ + otelcol := v1alpha1.Agent{ + Spec: v1alpha1.AgentSpec{ + Agent: v1alpha1.CollectorSpec{ Volumes: []corev1.Volume{{ Name: "my-volume", }}, diff --git a/internal/naming/main.go b/internal/naming/main.go index 8a99e2e1..36954635 100644 --- a/internal/naming/main.go +++ b/internal/naming/main.go @@ -19,11 +19,11 @@ package naming import ( "fmt" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) // ConfigMap builds the name for the config map used in the SplunkOtelAgent containers. -func ConfigMap(spec v1alpha1.SplunkOtelAgent, kind string) string { +func ConfigMap(spec v1alpha1.Agent, kind string) string { return fmt.Sprintf("%s-%s", spec.Name, kind) } @@ -38,37 +38,37 @@ func Container() string { } // Gateway builds the gateway name based on the instance. -func Gateway(otelcol v1alpha1.SplunkOtelAgent) string { +func Gateway(otelcol v1alpha1.Agent) string { return fmt.Sprintf("%s-gateway", otelcol.Name) } // Agent builds the agent name based on the instance. -func Agent(otelcol v1alpha1.SplunkOtelAgent) string { +func Agent(otelcol v1alpha1.Agent) string { return fmt.Sprintf("%s-agent", otelcol.Name) } // ClusterReceiver builds the agent name based on the instance. -func ClusterReciever(otelcol v1alpha1.SplunkOtelAgent) string { +func ClusterReciever(otelcol v1alpha1.Agent) string { return fmt.Sprintf("%s-cluster-receiver", otelcol.Name) } // HeadlessService builds the name for the headless service based on the instance. -func HeadlessService(otelcol v1alpha1.SplunkOtelAgent) string { +func HeadlessService(otelcol v1alpha1.Agent) string { return fmt.Sprintf("%s-headless", Service(otelcol)) } // MonitoringService builds the name for the monitoring service based on the instance. -func MonitoringService(otelcol v1alpha1.SplunkOtelAgent) string { +func MonitoringService(otelcol v1alpha1.Agent) string { return fmt.Sprintf("%s-monitoring", Service(otelcol)) } // Service builds the service name based on the instance. -func Service(otelcol v1alpha1.SplunkOtelAgent) string { +func Service(otelcol v1alpha1.Agent) string { return fmt.Sprintf("%s-collector", otelcol.Name) } // ServiceAccount builds the service account name based on the instance. -func ServiceAccount(otelcol v1alpha1.SplunkOtelAgent) string { +func ServiceAccount(otelcol v1alpha1.Agent) string { // TODO(splunk): create separate accounts for agent, clusterreceiver // and gateway. // return fmt.Sprintf("%s-account", otelcol.Name) @@ -76,6 +76,6 @@ func ServiceAccount(otelcol v1alpha1.SplunkOtelAgent) string { } // Namespace builds the namespace name based on the instance. -func Namespace(otelcol v1alpha1.SplunkOtelAgent) string { +func Namespace(otelcol v1alpha1.Agent) string { return "splunk-otel-operator-system" } diff --git a/internal/webhooks/handler.go b/internal/webhooks/handler.go index 4e66f2c8..e047a6a0 100644 --- a/internal/webhooks/handler.go +++ b/internal/webhooks/handler.go @@ -14,12 +14,12 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) // +kubebuilder:webhook:path=/mutate-v1-pod,mutating=true,failurePolicy=ignore,groups="",resources=pods,verbs=create;update,versions=v1,name=mpod.kb.io,sideEffects=none,admissionReviewVersions={v1,v1beta1} // +kubebuilder:rbac:groups="",resources=namespaces,verbs=list;watch -// +kubebuilder:rbac:groups=o11y.splunk.com,resources=splunkotelagents,verbs=get;list;watch +// +kubebuilder:rbac:groups=otel.splunk.com,resources=agents,verbs=get;list;watch // +kubebuilder:rbac:groups="apps",resources=replicasets,verbs=get;list;watch const ( @@ -37,10 +37,10 @@ const ( exporterOTLP = "otlp" exporterJaeger = "jaeger-thrift-splunk" - annotationJava = "o11y.splunk.com/inject-java" - annotationConfig = "o11y.splunk.com/inject-config" - annotationStatus = "o11y.splunk.com/injection-status" - annotationReason = "o11y.splunk.com/injection-reason" + annotationJava = "otel.splunk.com/inject-java" + annotationConfig = "otel.splunk.com/inject-config" + annotationStatus = "otel.splunk.com/injection-status" + annotationReason = "otel.splunk.com/injection-reason" ) type injectFn func(ctx context.Context, cfg config, pod corev1.Pod, ns corev1.Namespace) (corev1.Pod, error) @@ -141,7 +141,7 @@ func (h *handler) Handle(ctx context.Context, req admission.Request) admission.R return h.patch(req, pod, nil) } -func configFromSpec(spec *v1alpha1.SplunkOtelAgentSpec) config { +func configFromSpec(spec *v1alpha1.AgentSpec) config { cfg := config{ exporter: exporterOTLP, @@ -269,8 +269,8 @@ func (h *handler) InjectDecoder(d *admission.Decoder) error { return nil } -func (h *handler) getAgentSpec(ctx context.Context) (*v1alpha1.SplunkOtelAgentSpec, error) { - specs := &v1alpha1.SplunkOtelAgentList{} +func (h *handler) getAgentSpec(ctx context.Context) (*v1alpha1.AgentSpec, error) { + specs := &v1alpha1.AgentList{} err := h.client.List(ctx, specs) if err != nil { return nil, err diff --git a/internal/webhooks/handler_test.go b/internal/webhooks/handler_test.go index 412deff2..0011bd18 100644 --- a/internal/webhooks/handler_test.go +++ b/internal/webhooks/handler_test.go @@ -24,17 +24,17 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" ) func TestConfigFromSpec(t *testing.T) { cases := []struct { - spec *v1alpha1.SplunkOtelAgentSpec + spec *v1alpha1.AgentSpec cfg config }{ { - spec: &v1alpha1.SplunkOtelAgentSpec{ - Agent: v1alpha1.SplunkCollectorSpec{}, + spec: &v1alpha1.AgentSpec{ + Agent: v1alpha1.CollectorSpec{}, Instrumentation: v1alpha1.Instrumentation{ Java: v1alpha1.AutoInstrumentation{ Image: "quay.io/signalfx/splunk-otel-instrumentation-java:v1.2.3", @@ -48,8 +48,8 @@ func TestConfigFromSpec(t *testing.T) { }, }, { - spec: &v1alpha1.SplunkOtelAgentSpec{ - Agent: v1alpha1.SplunkCollectorSpec{Disabled: true}, + spec: &v1alpha1.AgentSpec{ + Agent: v1alpha1.CollectorSpec{Disabled: true}, Instrumentation: v1alpha1.Instrumentation{ Java: v1alpha1.AutoInstrumentation{ Image: "quay.io/signalfx/splunk-otel-instrumentation-java:v1.6.0", @@ -63,9 +63,9 @@ func TestConfigFromSpec(t *testing.T) { }, }, { - spec: &v1alpha1.SplunkOtelAgentSpec{ - Agent: v1alpha1.SplunkCollectorSpec{Disabled: true}, - Gateway: v1alpha1.SplunkCollectorSpec{Disabled: true}, + spec: &v1alpha1.AgentSpec{ + Agent: v1alpha1.CollectorSpec{Disabled: true}, + Gateway: v1alpha1.CollectorSpec{Disabled: true}, Realm: "mars0", Instrumentation: v1alpha1.Instrumentation{ Java: v1alpha1.AutoInstrumentation{ diff --git a/internal/webhooks/suite_test.go b/internal/webhooks/suite_test.go index 0cae5950..3095f6bc 100644 --- a/internal/webhooks/suite_test.go +++ b/internal/webhooks/suite_test.go @@ -33,7 +33,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/envtest" - "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" + "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" "github.com/signalfx/splunk-otel-collector-operator/internal/autodetect" // +kubebuilder:scaffold:imports ) @@ -89,7 +89,7 @@ func TestMain(m *testing.M) { os.Exit(1) } - if err = (&v1alpha1.SplunkOtelAgent{}).SetupWebhookWithManager(mgr, autodetect.UnknownDistro); err != nil { + if err = (&v1alpha1.Agent{}).SetupWebhookWithManager(mgr, autodetect.UnknownDistro); err != nil { fmt.Printf("failed to SetupWebhookWithManager: %v", err) os.Exit(1) } diff --git a/main.go b/main.go index 8d97ec82..fc7eae1e 100644 --- a/main.go +++ b/main.go @@ -31,8 +31,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log/zap" "sigs.k8s.io/controller-runtime/pkg/webhook" - o11yv1alpha1 "github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1" - o11ycontrollers "github.com/signalfx/splunk-otel-collector-operator/controllers/o11y" + otelv1alpha1 "github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1" + otelcontrollers "github.com/signalfx/splunk-otel-collector-operator/controllers/otel" "github.com/signalfx/splunk-otel-collector-operator/internal/autodetect" "github.com/signalfx/splunk-otel-collector-operator/internal/version" "github.com/signalfx/splunk-otel-collector-operator/internal/webhooks" @@ -47,7 +47,7 @@ var ( func init() { utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - utilruntime.Must(o11yv1alpha1.AddToScheme(scheme)) + utilruntime.Must(otelv1alpha1.AddToScheme(scheme)) //+kubebuilder:scaffold:scheme } @@ -97,13 +97,13 @@ func main() { } distro := ad.Distro() - if err = (o11ycontrollers.NewReconciler(ctrl.Log.WithName("controllers").WithName("SplunkOtelAgent"), mgr.GetClient(), mgr.GetScheme(), mgr.GetEventRecorderFor("splunk-otel-operator"))).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "SplunkOtelAgent") + if err = (otelcontrollers.NewReconciler(ctrl.Log.WithName("controllers").WithName("Agent"), mgr.GetClient(), mgr.GetScheme(), mgr.GetEventRecorderFor("splunk-otel-operator"))).SetupWithManager(mgr); err != nil { + setupLog.Error(err, "unable to create controller", "controller", "Agent") os.Exit(1) } - if err = (&o11yv1alpha1.SplunkOtelAgent{}).SetupWebhookWithManager(mgr, distro); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "SplunkOtelAgent") + if err = (&otelv1alpha1.Agent{}).SetupWebhookWithManager(mgr, distro); err != nil { + setupLog.Error(err, "unable to create webhook", "webhook", "Agent") os.Exit(1) } diff --git a/tests/e2e/config-injection/01-install.yaml b/tests/e2e/config-injection/01-install.yaml index 030e557f..3409657e 100644 --- a/tests/e2e/config-injection/01-install.yaml +++ b/tests/e2e/config-injection/01-install.yaml @@ -1,5 +1,5 @@ -apiVersion: o11y.splunk.com/v1alpha1 -kind: SplunkOtelAgent +apiVersion: otel.splunk.com/v1alpha1 +kind: Agent metadata: name: test-conf-injection namespace: splunk-otel-operator-system diff --git a/tests/e2e/config-injection/03-assert.yaml b/tests/e2e/config-injection/03-assert.yaml index d1aee077..15a4675e 100644 --- a/tests/e2e/config-injection/03-assert.yaml +++ b/tests/e2e/config-injection/03-assert.yaml @@ -4,8 +4,8 @@ metadata: name: ubuntu namespace: config-injection-test-ns annotations: - o11y.splunk.com/inject-config: "true" - o11y.splunk.com/injection-status: "success" + otel.splunk.com/inject-config: "true" + otel.splunk.com/injection-status: "success" spec: containers: - name: ubuntu diff --git a/tests/e2e/config-injection/03-install.yaml b/tests/e2e/config-injection/03-install.yaml index a86d3c8b..d32bbe60 100644 --- a/tests/e2e/config-injection/03-install.yaml +++ b/tests/e2e/config-injection/03-install.yaml @@ -11,7 +11,7 @@ metadata: labels: app: ubuntu annotations: - o11y.splunk.com/inject-config: "true" + otel.splunk.com/inject-config: "true" spec: containers: - name: ubuntu diff --git a/tests/e2e/custom_all/01-install.yaml b/tests/e2e/custom_all/01-install.yaml index 2cd175e7..1b9890cc 100644 --- a/tests/e2e/custom_all/01-install.yaml +++ b/tests/e2e/custom_all/01-install.yaml @@ -1,5 +1,5 @@ -apiVersion: o11y.splunk.com/v1alpha1 -kind: SplunkOtelAgent +apiVersion: otel.splunk.com/v1alpha1 +kind: Agent metadata: name: test-custom spec: diff --git a/tests/e2e/disabled_all/01-assert.yaml b/tests/e2e/disabled_all/01-assert.yaml index 1d2c8c70..02d98750 100644 --- a/tests/e2e/disabled_all/01-assert.yaml +++ b/tests/e2e/disabled_all/01-assert.yaml @@ -2,8 +2,8 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert timeout: 350 --- -apiVersion: o11y.splunk.com/v1alpha1 -kind: SplunkOtelAgent +apiVersion: otel.splunk.com/v1alpha1 +kind: Agent metadata: name: test-default spec: diff --git a/tests/e2e/disabled_all/01-install.yaml b/tests/e2e/disabled_all/01-install.yaml index 02ae3187..0bb58939 100644 --- a/tests/e2e/disabled_all/01-install.yaml +++ b/tests/e2e/disabled_all/01-install.yaml @@ -1,5 +1,5 @@ -apiVersion: o11y.splunk.com/v1alpha1 -kind: SplunkOtelAgent +apiVersion: otel.splunk.com/v1alpha1 +kind: Agent metadata: name: test-default spec: diff --git a/tests/e2e/smoke-default/01-assert.yaml b/tests/e2e/smoke-default/01-assert.yaml index 0e6d7b7f..41ad0f65 100644 --- a/tests/e2e/smoke-default/01-assert.yaml +++ b/tests/e2e/smoke-default/01-assert.yaml @@ -1,5 +1,5 @@ -apiVersion: o11y.splunk.com/v1alpha1 -kind: SplunkOtelAgent +apiVersion: otel.splunk.com/v1alpha1 +kind: Agent metadata: labels: app.kubernetes.io/managed-by: splunk-otel-collector-operator diff --git a/tests/e2e/smoke-default/01-install.yaml b/tests/e2e/smoke-default/01-install.yaml index 10f0c087..4154d660 100644 --- a/tests/e2e/smoke-default/01-install.yaml +++ b/tests/e2e/smoke-default/01-install.yaml @@ -1,5 +1,5 @@ -apiVersion: o11y.splunk.com/v1alpha1 -kind: SplunkOtelAgent +apiVersion: otel.splunk.com/v1alpha1 +kind: Agent metadata: name: test-default spec: