k8s-crds-cloud-native-pg 1.30.0

Kubernetes CRDs for cloudnative-pg
Documentation
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium -f clusterimagecatalogs.yml --schema=derived --docs -b --derive=Default --derive=PartialEq --smart-derive-elision
// kopium version: 0.23.0

#[allow(unused_imports)]
mod prelude {
    pub use kube_derive::CustomResource;
    #[cfg(feature = "schemars")]
    pub use schemars::JsonSchema;
    pub use serde::{Deserialize, Serialize};
    #[cfg(feature = "builder")]
    pub use typed_builder::TypedBuilder;
}

use self::prelude::*;

/// Specification of the desired behavior of the ClusterImageCatalog.
/// More info: <https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status>
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
#[cfg_attr(not(feature = "schemars"), kube(schema = "disabled"))]
#[kube(
    group = "postgresql.cnpg.io",
    version = "v1",
    kind = "ClusterImageCatalog",
    plural = "clusterimagecatalogs"
)]
#[kube(derive = "Default")]
#[kube(derive = "PartialEq")]
pub struct ClusterImageCatalogSpec {
    /// ComponentImages is a list of named images for components other than PostgreSQL
    /// (e.g. pgbouncer). Keys must be unique within a catalog.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "componentImages"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub component_images: Option<Vec<ClusterImageCatalogComponentImages>>,
    /// List of CatalogImages available in the catalog
    #[cfg_attr(feature = "builder", builder(default))]
    pub images: Vec<ClusterImageCatalogImages>,
}

/// CatalogComponentImage is a named image entry for a non-PostgreSQL component.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterImageCatalogComponentImages {
    /// Image is the container image reference.
    pub image: String,
    /// Key is the unique identifier for this image within the catalog.
    pub key: String,
}

/// CatalogImage defines the image and major version
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterImageCatalogImages {
    /// The configuration of the extensions to be added
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub extensions: Option<Vec<ClusterImageCatalogImagesExtensions>>,
    /// The image reference
    pub image: String,
    /// The PostgreSQL major version of the image. Must be unique within the catalog.
    pub major: i64,
}

/// ExtensionConfiguration is the configuration used to add
/// PostgreSQL extensions to the Cluster.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterImageCatalogImagesExtensions {
    /// A list of directories within the image to be appended to the
    /// PostgreSQL process's `PATH` environment variable.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub bin_path: Option<Vec<String>>,
    /// The list of directories inside the image which should be added to dynamic_library_path.
    /// If not defined, defaults to "/lib".
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub dynamic_library_path: Option<Vec<String>>,
    /// Env is a list of custom environment variables to be set in the
    /// PostgreSQL process for this extension. It is the responsibility of the
    /// cluster administrator to ensure the variables are correct for the
    /// specific extension. Note that changes to these variables require
    /// a manual cluster restart to take effect.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub env: Option<Vec<ClusterImageCatalogImagesExtensionsEnv>>,
    /// The list of directories inside the image which should be added to extension_control_path.
    /// If not defined, defaults to "/share".
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub extension_control_path: Option<Vec<String>>,
    /// The image containing the extension.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub image: Option<ClusterImageCatalogImagesExtensionsImage>,
    /// The list of directories inside the image which should be added to ld_library_path.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub ld_library_path: Option<Vec<String>>,
    /// The name of the extension, required. The limit of 59 characters
    /// leaves room for the prefix the operator adds when deriving the
    /// extension's Kubernetes Volume name (capped at 63 characters).
    pub name: String,
}

/// ExtensionEnvVar defines an environment variable for a specific extension
/// image volume.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterImageCatalogImagesExtensionsEnv {
    /// Name of the environment variable to be injected into the
    /// PostgreSQL process.
    pub name: String,
    /// Value of the environment variable. CloudNativePG performs a direct
    /// replacement of this value, with support for placeholder expansion.
    /// The ${`image_root`} placeholder resolves to the absolute mount path
    /// of the extension's volume (e.g., `/extensions/my-extension`). This
    /// is particularly useful for allowing applications or libraries to
    /// locate specific directories within the mounted image.
    /// Unrecognized placeholders are rejected. To include a literal ${...}
    /// in the value, escape it as $${...}.
    pub value: String,
}

/// The image containing the extension.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterImageCatalogImagesExtensionsImage {
    /// Policy for pulling OCI objects. Possible values are:
    /// Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails.
    /// Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present.
    /// IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails.
    /// Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "pullPolicy"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub pull_policy: Option<String>,
    /// Required: Image or artifact reference to be used.
    /// Behaves in the same way as pod.spec.containers[*].image.
    /// Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets.
    /// More info: <https://kubernetes.io/docs/concepts/containers/images>
    /// This field is optional to allow higher level config management to default or override
    /// container images in workload controllers like Deployments and StatefulSets.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub reference: Option<String>,
}