digitalis-io / vals-operator

Kubernetes Operator to sync secrets between different secret backends and Kubernetes
Apache License 2.0
156 stars 8 forks source link

get parameter: ResourceNotFoundException: Secrets Manager can't find the specified secret #44

Closed absnamohammed closed 2 years ago

absnamohammed commented 2 years ago

Hi,

I am testing vals-operator to see it can fit in our current setup. I was able to install the helm charts using the instructions. Created a secret to be used by helm charts.

When I was trying to create using object kind: ValsSecret, get the above error, even though the secret exit. I have created a secret kube.test#username and kube.test#password in our region. FYI, my secret name in AWS secret manager is kube.test having two fields username and password.

Default AWS region is same for helm secrets and the following secret.

apiVersion: digitalis.io/v1
kind: ValsSecret
metadata:
  name: vals-secret-sample
  labels:
    owner: digitalis.io
spec:
  name: my-secret # Optional, default is the resource name
  #ttl: 3600       # Optional, default is 0. The secret will be checked at every "reconcile period". See below.
  type: Opaque    # Default type, others supported
  data:
    aws-user:
      ref: ref+awssecrets://kube.test#username
    aws-pass:
      ref: ref+awssecrets://kube.test#password

Logs from the vals-operator pod,

1.6590061832090268e+09  ERROR   controllers.vals-operator   Failed to get secrets from secrets store    {"name": "vals-secret-sample", "error": "expand awssecrets://kube.test#username: get parameter: ResourceNotFoundException: Secrets Manager can't find the specified secret."}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
    /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.2/pkg/internal/controller/controller.go:121
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
    /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.2/pkg/internal/controller/controller.go:320
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
    /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.2/pkg/internal/controller/controller.go:273
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
    /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.2/pkg/internal/controller/controller.go:234
1.6590061832092552e+09  INFO    controllers.vals-operator   errorBackoff: 5.47083928s  (jitter=470.83928ms)
1.6590061832097049e+09  DEBUG   events  Normal  {"object": {"kind":"ValsSecret","namespace":"default","name":"vals-secret-sample","uid":"74c0c393-67c5-4736-bd98-3dd0d031ab28","apiVersion":"digitalis.io/v1","resourceVersion":"100782694"}, "reason": "Failed", "message": "Failed to get secrets from secrets store expand awssecrets://kube.test#username: get parameter: ResourceNotFoundException: Secrets Manager can't find the specified secret."}

Can someone please shed some light, I might be missing something here? Thanks

Regards, Abdul

absnamohammed commented 2 years ago

This is issue is resolved now. I was using incorrect AWS creds, but the error is so misleading, it took time to figure out. Thanks