Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authToken with PagerDuty Destination for Service Integration is not working #33

Open
stevie-b-g opened this issue Dec 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@stevie-b-g
Copy link

What happened?

PagerDuty Destination for Service Integration is not working

I expect the created destination to work.

How can we reproduce it?

I'm trying to create pagerduty destination service integration as such:

cat <<EOF | kubectl apply -f -
apiVersion: alert.newrelic.upbound.io/v1alpha1
kind: Destination
metadata:
  name: pagerduty-destination-example
  namespace: crossplane-system
  labels:
    name: pagerduty-destination-example
spec:
  forProvider:
    name: "Test Service"
    type: "PAGERDUTY_SERVICE_INTEGRATION"
    authToken:
      - prefix: "Bearer"
        tokenSecretRef:
          key: "99e51c1cb0d44903e020cd90e270cd90"
          name: 'TLAP'
          namespace: 'crossplane-system'
  providerConfigRef:
    name: newrelic-provider
EOF

When I run this I get an error about missing property.

is invalid: spec: Invalid value: "object": spec.forProvider.property is a required parameter

So I then change it to:

cat <<EOF | kubectl apply -f -
apiVersion: alert.newrelic.upbound.io/v1alpha1
kind: Destination
metadata:
  name: pagerduty-destination-example
  namespace: crossplane-system
  labels:
    name: pagerduty-destination-example
spec:
  forProvider:
    name: "Test Service"
    type: "PAGERDUTY_SERVICE_INTEGRATION"
    authToken:
      - prefix: "Bearer"
        tokenSecretRef:
          key: "99e51c1cb0d44903e020cd90e270cd90"
          name: 'TLAP'
          namespace: 'crossplane-system'
    property:
      - key: "integration_key"
        value: "99e51c1cb0d44903e020cd90e270cd90"
  providerConfigRef:
    name: newrelic-provider
EOF

And now get an error:

│ Status: │ │ At Provider: │ │ Conditions: │ │ Last Transition Time: 2024-12-02T03:13:50Z │ │ Reason: Creating │ │ Status: False │ │ Type: Ready │ │ Last Transition Time: 2024-12-02T03:13:59Z │ │ Message: create failed: apply failed: maximum retries reached: An error occurred resolving this field: NOTICE: fields are statically typed. Make sure all fields are │ │ of the correct type │ │ Reason: ReconcileError │ │ Status: False │ │ Type: Synced │ │ Last Transition Time: 2024-12-02T03:13:59Z │ │ Reason: Finished │ │ Status: True │ │ Type: AsyncOperation │ │ Last Transition Time: 2024-12-02T03:13:59Z │ │ Message: apply failed: maximum retries reached: An error occurred resolving this field: NOTICE: fields are statically typed. Make sure all fields are of the correct │ │ type │ │ Reason: ApplyFailure │ │ Status: False │ │ Type: LastAsyncOperation

So I then change it again to this:

cat <<EOF | kubectl apply -f -
apiVersion: alert.newrelic.upbound.io/v1alpha1
kind: Destination
metadata:
  name: pagerduty-destination-example
  namespace: crossplane-system
  labels:
    name: pagerduty-destination-example
spec:
  forProvider:
    name: "Test Service"
    type: "PAGERDUTY_SERVICE_INTEGRATION"
    property:
      - key: "integration_key"
        value: "99e51c1cb0d44903e020cd90e270cd90"
  providerConfigRef:
    name: newrelic-provider
EOF

Which manages to deploy. However the terraform looks like:

resource "newrelic_notification_destination" "destination" {
  account_id = 12345
  name = "Test Service"
  type = "PAGERDUTY_SERVICE_INTEGRATION"

  property {
    key = "integration_key"
    value = "99e51c1cb0d44903e020cd90e270cd90"
  }

  property {
    key = "source"
    value = "terraform"
  }
}

And the destination does not work.

I'm excepting to see something like:

resource "newrelic_notification_destination" "destination" {
  account_id = 12345
  name = "Test Service - Clickops"
  type = "PAGERDUTY_SERVICE_INTEGRATION"

  auth_token {
    prefix = "Bearer"
    token = "***************"
  }
}

As shown here https://registry.terraform.io/providers/newrelic/newrelic/latest/docs/resources/notification_destination

I think there's an issue with authToken bit.

I'll be looking at slack destinations next and I assume the authToken is needed there too.

What environment did it happen in?

  • Crossplane version: 1.17.1
  • Kubernetes version: 1.31.3
  • Kubernetes distribution: AWS EKS
@stevie-b-g stevie-b-g added the bug Something isn't working label Dec 2, 2024
@stevie-b-g
Copy link
Author

FYI, My clickops generated destination is showing prefix = "Bearer"

However the doc referenced is showing prefix = "Token token="

@stevie-b-g
Copy link
Author

Managed to get this working with:

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
  name: newrelic-pagerduty-token
  namespace: crossplane-system
type: Opaque
stringData:
  token: 99e51c1cb0d44903e020cd90e270cd90
---
apiVersion: alert.newrelic.upbound.io/v1alpha1
kind: Destination
metadata:
  name: pagerduty-destination-example
  namespace: crossplane-system
  labels:
    name: pagerduty-destination-example
spec:
  forProvider:
    name: "Test Service"
    type: "PAGERDUTY_SERVICE_INTEGRATION"
    authToken:
      - prefix: "Token token="
        tokenSecretRef:
          key: token
          name: "newrelic-pagerduty-token"
          namespace: "crossplane-system"
    # required field - make it blank
    property:
      - key: ""
        value: ""
  providerConfigRef:
    name: newrelic-provider
EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant