SecretExt

Trait SecretExt 

Source
pub trait SecretExt: ResourceBuilder + Sized {
Show 21 associated constants and 11 methods const SECRET_TYPE_OPAQUE: &str = "Opaque"; const SECRET_TYPE_SERVICE_ACCOUNT_TOKEN: &str = "kubernetes.io/service-account-token"; const SERVICE_ACCOUNT_NAME_KEY: &str = "kubernetes.io/service-account.name"; const SERVICE_ACCOUNT_UID_KEY: &str = "kubernetes.io/service-account.uid"; const SERVICE_ACCOUNT_TOKEN_KEY: &str = "token"; const SERVICE_ACCOUNT_KUBECONFIG_KEY: &str = "kubernetes.kubeconfig"; const SERVICE_ACCOUNT_ROOTCA_KEY: &str = "ca.crt"; const SERVICE_ACCOUNT_NAMESPACE_KEY: &str = "namespace"; const SECRET_TYPE_DOCKERCFG: &str = "kubernetes.io/dockercfg"; const DOCKER_CONFIG_KEY: &str = ".dockercfg"; const SECRET_TYPE_DOCKER_CONFIG_JSON: &str = "kubernetes.io/dockerconfigjson"; const DOCKER_CONFIG_JSON_KEY: &str = ".dockerconfigjson"; const SECRET_TYPE_BASIC_AUTH: &str = "kubernetes.io/basic-auth"; const BASIC_AUTH_USERNAME_KEY: &str = "username"; const BASIC_AUTH_PASSWORD_KEY: &str = "password"; const SECRET_TYPE_SSH_AUTH: &str = "kubernetes.io/ssh-auth"; const SSH_AUTH_PRIVATE_KEY: &str = "ssh-privatekey"; const SECRET_TYPE_TLS: &str = "kubernetes.io/tls"; const TLS_CERT_KEY: &str = "tls.crt"; const TLS_PRIVATE_KEY_KEY: &str = "tls.key"; const SECRET_TYPE_BOOTSTRAP_TOKEN: &str = "bootstrap.kubernetes.io/token"; // Required methods fn new(name: impl ToString) -> Self; fn immutable(self, yes: bool) -> Self; fn type(self, type: impl ToString) -> Self; fn data( self, data: impl IntoIterator<Item = (impl ToString, ByteString)>, ) -> Self; fn string_data( self, data: impl IntoIterator<Item = (impl ToString, impl ToString)>, ) -> Self; // Provided methods fn opaque(name: impl ToString) -> Self { ... } fn docker_config_json(name: impl ToString, config: impl ToString) -> Self { ... } fn docker_config_json_base64_encoded( name: impl ToString, config: ByteString, ) -> Self { ... } fn basic_auth( name: impl ToString, username: impl ToString, password: impl ToString, ) -> Self { ... } fn ssh_auth(name: impl ToString, private_key: impl ToString) -> Self { ... } fn image_pull_secret( name: impl ToString, registry: impl ToString, username: impl ToString, password: impl ToString, ) -> Self { ... }
}

Provided Associated Constants§

Source

const SECRET_TYPE_OPAQUE: &str = "Opaque"

SecretTypeOpaque is the default; arbitrary user-defined data

Source

const SECRET_TYPE_SERVICE_ACCOUNT_TOKEN: &str = "kubernetes.io/service-account-token"

SecretTypeServiceAccountToken contains a token that identifies a service account to the API

Required fields:

  • Secret.Annotations[“kubernetes.io/service-account.name”] - the name of the ServiceAccount the token identifies
  • Secret.Annotations[“kubernetes.io/service-account.uid”] - the UID of the ServiceAccount the token identifies
  • Secret.Data[“token”] - a token that identifies the service account to the API
Source

const SERVICE_ACCOUNT_NAME_KEY: &str = "kubernetes.io/service-account.name"

ServiceAccountNameKey is the key of the required annotation for SecretTypeServiceAccountToken secrets

Source

const SERVICE_ACCOUNT_UID_KEY: &str = "kubernetes.io/service-account.uid"

ServiceAccountUIDKey is the key of the required annotation for SecretTypeServiceAccountToken secrets

Source

const SERVICE_ACCOUNT_TOKEN_KEY: &str = "token"

ServiceAccountTokenKey is the key of the required data for SecretTypeServiceAccountToken secrets

Source

const SERVICE_ACCOUNT_KUBECONFIG_KEY: &str = "kubernetes.kubeconfig"

ServiceAccountKubeconfigKey is the key of the optional kubeconfig data for SecretTypeServiceAccountToken secrets

Source

const SERVICE_ACCOUNT_ROOTCA_KEY: &str = "ca.crt"

ServiceAccountRootCAKey is the key of the optional root certificate authority for SecretTypeServiceAccountToken secrets

Source

const SERVICE_ACCOUNT_NAMESPACE_KEY: &str = "namespace"

ServiceAccountNamespaceKey is the key of the optional namespace to use as the default for namespaced API calls

Source

const SECRET_TYPE_DOCKERCFG: &str = "kubernetes.io/dockercfg"

SecretTypeDockercfg contains a dockercfg file that follows the same format rules as ~/.dockercfg

Required fields:

  • Secret.Data[“.dockercfg”] - a serialized ~/.dockercfg file
Source

const DOCKER_CONFIG_KEY: &str = ".dockercfg"

DockerConfigKey is the key of the required data for SecretTypeDockercfg secrets

Source

const SECRET_TYPE_DOCKER_CONFIG_JSON: &str = "kubernetes.io/dockerconfigjson"

SecretTypeDockerConfigJSON contains a dockercfg file that follows the same format rules as ~/.docker/config.json

Required fields:

  • Secret.Data[“.dockerconfigjson”] - a serialized ~/.docker/config.json file
Source

const DOCKER_CONFIG_JSON_KEY: &str = ".dockerconfigjson"

DockerConfigJSONKey is the key of the required data for SecretTypeDockerConfigJson secrets

Source

const SECRET_TYPE_BASIC_AUTH: &str = "kubernetes.io/basic-auth"

SecretTypeBasicAuth contains data needed for basic authentication.

Required at least one of fields:

  • Secret.Data[“username”] - username used for authentication
  • Secret.Data[“password”] - password or token needed for authentication
Source

const BASIC_AUTH_USERNAME_KEY: &str = "username"

BasicAuthUsernameKey is the key of the username for SecretTypeBasicAuth secrets

Source

const BASIC_AUTH_PASSWORD_KEY: &str = "password"

BasicAuthPasswordKey is the key of the password or token for SecretTypeBasicAuth secrets

Source

const SECRET_TYPE_SSH_AUTH: &str = "kubernetes.io/ssh-auth"

SecretTypeSSHAuth contains data needed for SSH authentication.

Required field:

  • Secret.Data[“ssh-privatekey”] - private SSH key needed for authentication
Source

const SSH_AUTH_PRIVATE_KEY: &str = "ssh-privatekey"

SSHAuthPrivateKey is the key of the required SSH private key for SecretTypeSSHAuth secrets

Source

const SECRET_TYPE_TLS: &str = "kubernetes.io/tls"

SecretTypeTLS contains information about a TLS client or server secret. It is primarily used with TLS termination of the Ingress resource, but may be used in other types.

Required fields:

  • Secret.Data[“tls.key”] - TLS private key. Secret.Data[“tls.crt”] - TLS certificate.
Source

const TLS_CERT_KEY: &str = "tls.crt"

TLSCertKey is the key for tls certificates in a TLS secret.

Source

const TLS_PRIVATE_KEY_KEY: &str = "tls.key"

TLSPrivateKeyKey is the key for the private key field in a TLS secret.

Source

const SECRET_TYPE_BOOTSTRAP_TOKEN: &str = "bootstrap.kubernetes.io/token"

SecretTypeBootstrapToken is used during the automated bootstrap process (first implemented by kubeadm). It stores tokens that are used to sign well known ConfigMaps. They are used for authn.

Required Methods§

Source

fn new(name: impl ToString) -> Self

Creates new empty corev1::Secret object

Source

fn immutable(self, yes: bool) -> Self

Set immutability field

Source

fn type(self, type: impl ToString) -> Self

Source

fn data( self, data: impl IntoIterator<Item = (impl ToString, ByteString)>, ) -> Self

Source

fn string_data( self, data: impl IntoIterator<Item = (impl ToString, impl ToString)>, ) -> Self

Provided Methods§

Source

fn opaque(name: impl ToString) -> Self

Create new “Opaque” secret object with no data

Source

fn docker_config_json(name: impl ToString, config: impl ToString) -> Self

Create “kubernetes.io/dockerconfigjson” secret with config as plain text (i.e. string_data field)

Source

fn docker_config_json_base64_encoded( name: impl ToString, config: ByteString, ) -> Self

Create “kubernetes.io/dockerconfigjson” secret with config as base64 encoded text (i.e. data field)

Source

fn basic_auth( name: impl ToString, username: impl ToString, password: impl ToString, ) -> Self

Creates new basic authentication secret object

Source

fn ssh_auth(name: impl ToString, private_key: impl ToString) -> Self

Creates new ssh auth secret object

Source

fn image_pull_secret( name: impl ToString, registry: impl ToString, username: impl ToString, password: impl ToString, ) -> Self

Creates new image pull secret object

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§