mongodb / helm-charts

Apache License 2.0
90 stars 91 forks source link

Support AtlasProject using not local but global AKO secret -api-key in the "atlas-cluster" chart. #93

Closed denist-huma closed 1 year ago

denist-huma commented 2 years ago

What's the expected behavior?

My use case is to create AtlasProject without connectionSecretRef. I use a global secret and it works as expected. https://docs.atlas.mongodb.com/atlas-operator/#ak8so-workflow

To connect to the Atlas Administration API, Atlas Kubernetes Operator reads the organization ID and API keys from one of the following locations:

  • spec.connectionSecretRef.name (if specified in AtlasProject).
    • global Atlas Kubernetes Operator secret -api-key (if spec.connectionSecretRef.name is not specified) .

I need my result to be like:

# Source: atlas-cluster/templates/atlas-project.yaml
apiVersion: atlas.mongodb.com/v1
kind: AtlasProject
metadata:
  name: my-chart-my-project
  namespace: default
  labels:
    helm.sh/chart: atlas-cluster-0.1.7
    app.kubernetes.io/name: atlas-cluster
    app.kubernetes.io/instance: a
    app.kubernetes.io/version: "0.6.1"
    app.kubernetes.io/managed-by: Helm
spec:
  name: Test Project
  projectIpAccessList:
  - comment: REMOVE ME
    ipAddress: 0.0.0.0/1

It should be the case of values equals:

# Please provide Atlas API credentials and Organization
atlas:
  create: false

project:
  create: false
  name: my-project
  atlasProjectName: "Test Project"
  annotations:
    {}
    # mongodb.com/atlas-resource-policy: keep
  # fullnameOverride: ""

  projectIpAccessList:
    - ipAddress: "0.0.0.0/1"
      comment: "REMOVE ME"

What is the current behavior?

What we have now is inconsistent. This command creates a reference to a non-existing secret.

$ helm template my-chart . --set atlas.create=false --set project.create=true
---
# Source: atlas-cluster/templates/atlas-project.yaml
apiVersion: atlas.mongodb.com/v1
kind: AtlasProject
metadata:
  name: my-chart-my-project
  namespace: default
  labels:
    helm.sh/chart: atlas-cluster-0.1.7
    app.kubernetes.io/name: atlas-cluster
    app.kubernetes.io/instance: my-chart
    app.kubernetes.io/version: "0.6.1"
    app.kubernetes.io/managed-by: Helm
spec:
  name: Test Project
  connectionSecretRef:
    name: my-chart-atlas-cluster-secret
  projectIpAccessList:
  - comment: REMOVE ME
    ipAddress: 0.0.0.0/1
github-actions[bot] commented 1 year ago

This issue is being marked stale because it has been open for 60 days with no activity. Please comment if this issue is still affecting you. If there is no change, this issue will be closed in 30 days.

github-actions[bot] commented 1 year ago

This issue was closed because it became stale and did not receive further updates. If the issue is still affecting you, please re-open it, or file a fresh Issue with updated information.