# Scope

> Stackable Secret Operator supports scopes for secrets like node, pod, and service, adding context like IP, pod names, and DNS to credentials.

Secrets often cover some specific aspect of a workload. For example:

-   A Kerberos credential may be bound to one node IP.

-   An internal TLS certificate’s `subjectAlternateName` section must match the Pod object’s name and service.


To solve this, the Stackable Secret Operator has a concept of "scopes", which allow a [Volume](https://docs.stackable.tech/home/stable/secret-operator/volume/index.md) to selectively include this extra context. The exact effect of the scope depends on which [`backend`](https://docs.stackable.tech/home/stable/secret-operator/secretclass/index.md) is used.

## Supported Scopes

### `listener-volume`

**Syntax**: `listener-volume=<VOLUME>` (for example: `listener-volume=my-listener`)

The `listener-volume` scope is resolved according to a [Listener](https://docs.stackable.tech/home/stable/listener-operator/listener/index.md).

The [Listener](https://docs.stackable.tech/home/stable/listener-operator/listener/index.md) should be mounted as a [volume](https://docs.stackable.tech/home/stable/listener-operator/volume/index.md) alongside the Secret volume, and takes the name of that volume as its parameter. This way, the scope will automatically adapt to the [ListenerClass](https://docs.stackable.tech/home/stable/listener-operator/listenerclass/index.md) that it uses.

Multiple [Listener](https://docs.stackable.tech/home/stable/listener-operator/listener/index.md)s can be bound by specifying the scope multiple times.

note

The parameter is the name of the Pod’s _volume_, not the name of the PersistentVolumeClaim, PersistentVolume, or [Listener](https://docs.stackable.tech/home/stable/listener-operator/listener/index.md). This allows the scope to bind to replica-specific or ephemeral [Listener](https://docs.stackable.tech/home/stable/listener-operator/listener/index.md)s.

### `pod`

**Syntax**: `pod`

The `pod` scope is resolved to the name of the Kubernetes Pod. This allows the secret to differentiate between StatefulSet replicas.

### `node`

**Syntax**: `node`

The `node` scope is resolved to the name of the Kubernetes Node object that the Pod is running on. This will typically be the DNS name of the node.

> **Note:** Consider using the [`listener-volume`](https://docs.stackable.tech/home/stable/secret-operator/scope/index.md) scope instead, which also allows the scope to automatically adjust to how the Pod is exposed.

### `service`

**Syntax**: `service=<SERVICE>` (for example: `service=my-service`)

The `service` scope is resolved to an arbitrary Kubernetes Service in the same Namespace.

> **Note:** This scope only supports cluster-internal (`ClusterIP`) Services. Consider using the [`listener-volume`](https://docs.stackable.tech/home/stable/secret-operator/scope/index.md) scope instead.

## Example

For example, a TLS certificate provisioned by the [`autoTls`](https://docs.stackable.tech/home/stable/secret-operator/secretclass/index.md) backend, with the scopes [`node`](https://docs.stackable.tech/home/stable/secret-operator/scope/index.md) and [`pod`](https://docs.stackable.tech/home/stable/secret-operator/scope/index.md) would contain the following values in its `subjectAlternateName` (SAN) extension field:

-   The node’s IP address

-   The node’s fully qualified domain name (`my-node.example.com`, without a trailing dot)

-   The pod’s fully qualified domain name (`my-pod.my-service.my-namespace.svc.cluster.local`, without a trailing dot)
