PaloAltoNetworks / prisma-cloud-compute-operator

15 stars 22 forks source link

Improve secret handling of credentials #9

Open mjnagel opened 3 years ago

mjnagel commented 3 years ago

Is your feature request related to a problem?

Currently you have two routes for storing credentials in a secret:

The issues I see with this:

Describe the solution you'd like

Provide a way that users can specify a secret with the credentials in the ConsoleDefender spec (and the others as necessary). Example implementation for the spec:

apiVersion: pcc.paloaltonetworks.com/v1alpha1
kind: ConsoleDefender
metadata:
  name: pcc-consoleplusdefender
  namespace: twistlock
spec:
  credentials:
    secret: my-secret-name

Then the operator would lookup a certain set of expected keys from that secret and use them for user/pass/license/token.

Describe alternatives you've considered

There are a number of ways to implement this. Another possibility that I have seen in other operators is something along these lines:

apiVersion: pcc.paloaltonetworks.com/v1alpha1
kind: ConsoleDefender
metadata:
  name: pcc-consoleplusdefender
  namespace: twistlock
spec:
  credentials:
    license: secret:my-secret-name:licensekey
    username: secret:my-secret-name:userkey
    ...

In this implementation the operator would look for secret: and then split the remainder of the value into name of secret : key in secret. This would keep the existing spec but expand the options for passing in values.

Additional context

Without this option a user has to choose between pre-creating the secret and having it stored in the operator or providing the values plaintext in the spec (which is obviously not ideal and doesn't currently work).