Skip to content

Commit

Permalink
chore(crd): rename spec.ingressEndpoint to spec.endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1302 committed Aug 21, 2024
1 parent 6ba090d commit d01d1a4
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion api/dash0monitoring/v1alpha1/dash0monitoring_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Dash0MonitoringSpec struct {
// `dash0.com:4317`.
//
// +kubebuilder:validation:Mandatory
IngressEndpoint string `json:"ingressEndpoint"`
Endpoint string `json:"endpoint"`

// The Dash0 authorization token. This property is optional, but either this property or the SecretRef property has
// to be provided. If both are provided, the AuthorizationToken will be used and SecretRef will be ignored. The
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/operator.dash0.com_dash0monitorings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
to be provided. If both are provided, the AuthorizationToken will be used and SecretRef will be ignored. The
authorization token for your Dash0 organization can be copied from https://app.dash0.com/settings.
type: string
ingressEndpoint:
endpoint:
description: |-
The URL of the observability backend to which telemetry data will be sent. This property is mandatory. The value
needs to be the OTLP/gRPC endpoint of your Dash0 organization. The correct OTLP/gRPC endpoint can be copied fom
Expand Down Expand Up @@ -102,7 +102,7 @@ spec:
can be copied from https://app.dash0.com/settings.
type: string
required:
- ingressEndpoint
- endpoint
type: object
status:
description: Dash0MonitoringStatus defines the observed state of the Dash0
Expand Down
6 changes: 3 additions & 3 deletions helm-chart/dash0-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ metadata:
name: dash0-monitoring-resource
spec:
# Replace this value with the actual OTLP/gRPC endpoint of your Dash0 organization.
ingressEndpoint: ingress... # TODO needs to be replaced with the actual value, see below
endpoint: ingress... # TODO needs to be replaced with the actual value, see below

# Either provide the Dash0 authorization token as a string via the property authorizationToken:
authorizationToken: auth_... # TODO needs to be replaced with the actual value, see below
Expand All @@ -68,7 +68,7 @@ spec:
```

At this point, you need to provide two configuration settings:
* `ingressEndpoint`: The URL of the observability backend to which telemetry data will be sent. This property is
* `endpoint`: The URL of the observability backend to which telemetry data will be sent. This property is
mandatory.
Replace the value in the example above with the OTLP/gRPC endpoint of your Dash0 organization.
The correct OTLP/gRPC endpoint can be copied fom https://app.dash0.com/settings.
Expand Down Expand Up @@ -178,7 +178,7 @@ metadata:
name: dash0-monitoring-resource
spec:
# Replace this value with the actual OTLP/gRPC endpoint of your Dash0 organization.
ingressEndpoint: ingress... # TODO needs to be replaced with the actual value, see below
endpoint: ingress... # TODO needs to be replaced with the actual value, see below

# Or provide the name of a secret existing in the Dash0 operator's namespace as the property secretRef:
secretRef: dash0-authorization-secret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
to be provided. If both are provided, the AuthorizationToken will be used and SecretRef will be ignored. The
authorization token for your Dash0 organization can be copied from https://app.dash0.com/settings.
type: string
ingressEndpoint:
endpoint:
description: |-
The URL of the observability backend to which telemetry data will be sent. This property is mandatory. The value
needs to be the OTLP/gRPC endpoint of your Dash0 organization. The correct OTLP/gRPC endpoint can be copied fom
Expand Down Expand Up @@ -101,7 +101,7 @@ spec:
can be copied from https://app.dash0.com/settings.
type: string
required:
- ingressEndpoint
- endpoint
type: object
status:
description: Dash0MonitoringStatus defines the observed state of the Dash0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ custom resource definition should match snapshot:
to be provided. If both are provided, the AuthorizationToken will be used and SecretRef will be ignored. The
authorization token for your Dash0 organization can be copied from https://app.dash0.com/settings.
type: string
ingressEndpoint:
endpoint:
description: |-
The URL of the observability backend to which telemetry data will be sent. This property is mandatory. The value
needs to be the OTLP/gRPC endpoint of your Dash0 organization. The correct OTLP/gRPC endpoint can be copied fom
Expand Down Expand Up @@ -102,7 +102,7 @@ custom resource definition should match snapshot:
can be copied from https://app.dash0.com/settings.
type: string
required:
- ingressEndpoint
- endpoint
type: object
status:
description: Dash0MonitoringStatus defines the observed state of the Dash0 monitoring resource.
Expand Down
4 changes: 2 additions & 2 deletions internal/backendconnection/backendconnection_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func (m *BackendConnectionManager) EnsureOpenTelemetryCollectorIsDeployedInDash0
) error {
logger := log.FromContext(ctx)

if dash0MonitoringResource.Spec.IngressEndpoint == "" {
err := fmt.Errorf("no ingress endpoint provided, unable to create the OpenTelemetry collector")
if dash0MonitoringResource.Spec.Endpoint == "" {
err := fmt.Errorf("no endpoint provided, unable to create the OpenTelemetry collector")
logger.Error(err, failedToCreateMsg)
return err
}
Expand Down
8 changes: 4 additions & 4 deletions internal/backendconnection/backendconnection_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (

dash0MonitoringResource = &dash0v1alpha1.Dash0Monitoring{
Spec: dash0v1alpha1.Dash0MonitoringSpec{
IngressEndpoint: IngressEndpointTest,
Endpoint: EndpointTest,
AuthorizationToken: AuthorizationTokenTest,
},
}
Expand Down Expand Up @@ -68,7 +68,7 @@ var _ = Describe("The backend connection manager", Ordered, func() {
})

Describe("when validation checks fail", func() {
It("should fail if no ingress endpoint is provided", func() {
It("should fail if no endpoint is provided", func() {
err := manager.EnsureOpenTelemetryCollectorIsDeployedInDash0OperatorNamespace(
ctx,
TestImages,
Expand All @@ -88,7 +88,7 @@ var _ = Describe("The backend connection manager", Ordered, func() {
operatorNamespace,
&dash0v1alpha1.Dash0Monitoring{
Spec: dash0v1alpha1.Dash0MonitoringSpec{
IngressEndpoint: IngressEndpointTest,
Endpoint: EndpointTest,
}})
Expect(err).NotTo(HaveOccurred())
VerifyCollectorResourcesExist(ctx, k8sClient, operatorNamespace)
Expand Down Expand Up @@ -222,7 +222,7 @@ var _ = Describe("The backend connection manager", Ordered, func() {
UID: "3c0e72bb-26a7-40a4-bbdd-b1c978278fc5",
},
Spec: dash0v1alpha1.Dash0MonitoringSpec{
IngressEndpoint: IngressEndpointTest,
Endpoint: EndpointTest,
AuthorizationToken: AuthorizationTokenTest,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ exporters:
verbosity: detailed
{{- if eq .ExportProtocol "grpc" }}
otlp:
endpoint: {{ .IngressEndpoint }}
endpoint: {{ .Endpoint }}
{{- if .HasExportAuthentication }}
headers:
Authorization: Bearer ${env:AUTH_TOKEN}
{{- end }}
{{- end }}
{{- if eq .ExportProtocol "http" }}
otlphttp:
endpoint: {{ .IngressEndpoint }}
endpoint: {{ .Endpoint }}
{{- if .HasExportAuthentication }}
headers:
Authorization: Bearer ${env:AUTH_TOKEN}
Expand Down
14 changes: 7 additions & 7 deletions internal/backendconnection/otelcolresources/desired_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
type oTelColConfig struct {
Namespace string
NamePrefix string
IngressEndpoint string
Endpoint string
AuthorizationToken string
SecretRef string
Images util.Images
Expand All @@ -46,7 +46,7 @@ const (

type collectorConfigurationTemplateValues struct {
HasExportAuthentication bool
IngressEndpoint string
Endpoint string
ExportProtocol exportProtocol
IgnoreLogsFromNamespaces []string
}
Expand Down Expand Up @@ -99,8 +99,8 @@ var (
)

func assembleDesiredState(config *oTelColConfig) ([]client.Object, error) {
if config.IngressEndpoint == "" {
return nil, fmt.Errorf("no ingress endpoint provided, unable to create the OpenTelemetry collector")
if config.Endpoint == "" {
return nil, fmt.Errorf("no endpoint provided, unable to create the OpenTelemetry collector")
}

var desiredState []client.Object
Expand Down Expand Up @@ -147,16 +147,16 @@ func renderCollectorConfigs(templateValues *collectorConfigurationTemplateValues
}

func collectorConfigMap(config *oTelColConfig) (*corev1.ConfigMap, error) {
ingressEndpoint := config.IngressEndpoint
endpoint := config.Endpoint
exportProtocol := grpcExportProtocol
if url, err := url.ParseRequestURI(ingressEndpoint); err != nil {
if url, err := url.ParseRequestURI(endpoint); err != nil {
// Not a valid URL, assume it's grpc
} else if url.Scheme == "https" || url.Scheme == "http" {
exportProtocol = httpExportProtocol
}

collectorConfiguration, err := renderCollectorConfigs(&collectorConfigurationTemplateValues{
IngressEndpoint: ingressEndpoint,
Endpoint: endpoint,
ExportProtocol: exportProtocol,
HasExportAuthentication: config.hasAuthentication(),
IgnoreLogsFromNamespaces: []string{
Expand Down
22 changes: 11 additions & 11 deletions internal/backendconnection/otelcolresources/desired_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
)

var _ = Describe("The desired state of the OpenTelemetry Collector resources", func() {
It("should fail if no ingress endpoint has been provided", func() {
It("should fail if no endpoint has been provided", func() {
_, err := assembleDesiredState(&oTelColConfig{
Namespace: namespace,
NamePrefix: namePrefix,
Expand All @@ -38,15 +38,15 @@ var _ = Describe("The desired state of the OpenTelemetry Collector resources", f
desiredState, err := assembleDesiredState(&oTelColConfig{
Namespace: namespace,
NamePrefix: namePrefix,
IngressEndpoint: IngressEndpointTest,
Endpoint: EndpointTest,
AuthorizationToken: AuthorizationTokenTest,
Images: TestImages,
})

Expect(err).ToNot(HaveOccurred())
Expect(desiredState).To(HaveLen(9))
collectorConfigConfigMapContent := getCollectorConfigConfigMapContent(desiredState)
Expect(collectorConfigConfigMapContent).To(ContainSubstring(fmt.Sprintf("endpoint: %s", IngressEndpointTest)))
Expect(collectorConfigConfigMapContent).To(ContainSubstring(fmt.Sprintf("endpoint: %s", EndpointTest)))
Expect(collectorConfigConfigMapContent).NotTo(ContainSubstring("file/traces"))
Expect(collectorConfigConfigMapContent).NotTo(ContainSubstring("file/metrics"))
Expect(collectorConfigConfigMapContent).NotTo(ContainSubstring("file/logs"))
Expand Down Expand Up @@ -113,7 +113,7 @@ var _ = Describe("The desired state of the OpenTelemetry Collector resources", f
desiredState, err := assembleDesiredState(&oTelColConfig{
Namespace: namespace,
NamePrefix: namePrefix,
IngressEndpoint: IngressEndpointTest,
Endpoint: EndpointTest,
AuthorizationToken: AuthorizationTokenTest,
})

Expand All @@ -130,10 +130,10 @@ var _ = Describe("The desired state of the OpenTelemetry Collector resources", f

It("should use the secret reference if provided (and no authorization token has been provided)", func() {
desiredState, err := assembleDesiredState(&oTelColConfig{
Namespace: namespace,
NamePrefix: namePrefix,
IngressEndpoint: IngressEndpointTest,
SecretRef: "some-secret",
Namespace: namespace,
NamePrefix: namePrefix,
Endpoint: EndpointTest,
SecretRef: "some-secret",
})

Expect(err).ToNot(HaveOccurred())
Expand All @@ -151,9 +151,9 @@ var _ = Describe("The desired state of the OpenTelemetry Collector resources", f

It("should not add the auth token env var if no authorization token has been provided", func() {
desiredState, err := assembleDesiredState(&oTelColConfig{
Namespace: namespace,
NamePrefix: namePrefix,
IngressEndpoint: IngressEndpointTest,
Namespace: namespace,
NamePrefix: namePrefix,
Endpoint: EndpointTest,
})

Expect(err).ToNot(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m *OTelColResourceManager) CreateOrUpdateOpenTelemetryCollectorResources(
config := &oTelColConfig{
Namespace: namespace,
NamePrefix: m.OTelCollectorNamePrefix,
IngressEndpoint: dash0MonitoringResource.Spec.IngressEndpoint,
Endpoint: dash0MonitoringResource.Spec.Endpoint,
AuthorizationToken: dash0MonitoringResource.Spec.AuthorizationToken,
SecretRef: dash0MonitoringResource.Spec.SecretRef,
Images: images,
Expand Down Expand Up @@ -210,7 +210,7 @@ func (m *OTelColResourceManager) DeleteResources(
config := &oTelColConfig{
Namespace: namespace,
NamePrefix: m.OTelCollectorNamePrefix,
IngressEndpoint: dash0MonitoringResource.Spec.IngressEndpoint,
Endpoint: dash0MonitoringResource.Spec.Endpoint,
AuthorizationToken: dash0MonitoringResource.Spec.AuthorizationToken,
SecretRef: dash0MonitoringResource.Spec.SecretRef,
Images: images,
Expand Down
2 changes: 1 addition & 1 deletion internal/dash0/controller/dash0_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ var _ = Describe("The Dash0 controller", Ordered, func() {
Namespace: Dash0MonitoringResourceQualifiedName.Namespace,
},
Spec: dash0v1alpha1.Dash0MonitoringSpec{
IngressEndpoint: IngressEndpointTest,
Endpoint: EndpointTest,
AuthorizationToken: AuthorizationTokenTest,
SecretRef: SecretRefTest,
InstrumentWorkloads: "invalid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: Dash0Monitoring
metadata:
name: dash0-monitoring-resource
spec:
# production: ingressEndpoint: ingress.eu-west-1.aws.dash0.com:4317
# production: endpoint: ingress.eu-west-1.aws.dash0.com:4317
# development: ingress.eu-west-1.aws.dash0-dev.com:4317
ingressEndpoint: ingress.eu-west-1.aws.dash0-dev.com:4317
endpoint: ingress.eu-west-1.aws.dash0-dev.com:4317

# Either provide the name of a secret existing in the Dash0 operator's namespace as secretRef:
secretRef: dash0-authorization-secret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: Dash0Monitoring
metadata:
name: dash0-monitoring-resource
spec:
# production: ingressEndpoint: ingress.eu-west-1.aws.dash0.com:4317
# production: endpoint: ingress.eu-west-1.aws.dash0.com:4317
# development: ingress.eu-west-1.aws.dash0-dev.com:4317
ingressEndpoint: ingress.eu-west-1.aws.dash0-dev.com:4317
endpoint: ingress.eu-west-1.aws.dash0-dev.com:4317

# Either provide the name of a secret existing in the Dash0 operator's namespace as secretRef:
# secretRef: dash0-authorization-secret
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/dash0_monitoring_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import (

type dash0MonitoringValues struct {
InstrumentWorkloads dash0v1alpha1.InstrumentWorkloadsMode
IngressEndpoint string
Endpoint string
}

const (
dash0MonitoringResourceName = "dash0-monitoring-resource-e2e"
defaultIngressEndpoint = "http://otlp-sink.otlp-sink.svc.cluster.local"
defaultEndpoint = "http://otlp-sink.otlp-sink.svc.cluster.local"
)

var (
Expand All @@ -33,7 +33,7 @@ var (
dash0MonitoringResourceTemplate *template.Template

defaultDash0MonitoringValues = dash0MonitoringValues{
IngressEndpoint: defaultIngressEndpoint,
Endpoint: defaultEndpoint,
InstrumentWorkloads: dash0v1alpha1.All,
}
)
Expand Down Expand Up @@ -85,13 +85,13 @@ func deployDash0MonitoringResource(
verifyThatCollectorIsRunning(operatorNamespace, operatorHelmChart)
}

func updateIngressEndpointOfDash0MonitoringResource(
func updateEndpointOfDash0MonitoringResource(
namespace string,
newIngressEndpoint string,
newEndpoint string,
) {
updateDash0MonitoringResource(
namespace,
fmt.Sprintf("{\"spec\":{\"ingressEndpoint\":\"%s\"}}", newIngressEndpoint),
fmt.Sprintf("{\"spec\":{\"endpoint\":\"%s\"}}", newEndpoint),
)
}

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/dash0monitoring.e2e.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ metadata:
name: dash0-monitoring-resource-e2e
spec:
instrumentWorkloads: {{ .InstrumentWorkloads }}
ingressEndpoint: {{ .IngressEndpoint }}
endpoint: {{ .Endpoint }}
10 changes: 5 additions & 5 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ var _ = Describe("Dash0 Kubernetes Operator", Ordered, func() {
deployDash0MonitoringResource(
applicationUnderTestNamespace,
dash0MonitoringValues{
IngressEndpoint: defaultIngressEndpoint,
Endpoint: defaultEndpoint,
InstrumentWorkloads: dash0v1alpha1.None,
},
operatorNamespace,
Expand Down Expand Up @@ -565,12 +565,12 @@ var _ = Describe("Dash0 Kubernetes Operator", Ordered, func() {
operatorHelmChart,
)

By("updating the Dash0 monitoring resource ingress endpoint")
newIngressEndpoint := "ingress.eu-east-1.aws.dash0-dev.com:4317"
updateIngressEndpointOfDash0MonitoringResource(applicationUnderTestNamespace, newIngressEndpoint)
By("updating the Dash0 monitoring resource endpoint setting")
newEndpoint := "ingress.eu-east-1.aws.dash0-dev.com:4317"
updateEndpointOfDash0MonitoringResource(applicationUnderTestNamespace, newEndpoint)

By("verify that the config map has been updated by the controller")
verifyConfigMapContainsString(operatorNamespace, newIngressEndpoint)
verifyConfigMapContainsString(operatorNamespace, newEndpoint)

By("verify that the configuration reloader says to have triggered a config change")
verifyCollectorContainerLogContainsStrings(
Expand Down
Loading

0 comments on commit d01d1a4

Please sign in to comment.