istio-api-rs 0.12.0

A collection of CRDs for api used in Istio.
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium -Af resources/istio/v1_20_0/extensions/v1alpha1/WasmPlugin.yaml --api-version v1alpha1
// kopium version: 0.22.5

#[allow(unused_imports)]
mod prelude {
    pub use kube::CustomResource;
    pub use schemars::JsonSchema;
    pub use serde::{Serialize, Deserialize};
    pub use std::collections::BTreeMap;
}
use self::prelude::*;

/// Extend the functionality provided by the Istio proxy through WebAssembly filters. See more details at: <https://istio.io/docs/reference/config/proxy_extensions/wasm-plugin.html>
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema)]
#[kube(group = "extensions.istio.io", version = "v1alpha1", kind = "WasmPlugin", plural = "wasmplugins")]
#[kube(namespaced)]
pub struct WasmPluginSpec {
    /// Specifies the failure behavior for the plugin due to fatal errors.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "failStrategy")]
    pub fail_strategy: Option<WasmPluginFailStrategy>,
    /// The pull behaviour to be applied when fetching Wasm module by either OCI image or http/https.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "imagePullPolicy")]
    pub image_pull_policy: Option<WasmPluginImagePullPolicy>,
    /// Credentials to use for OCI image pulling.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "imagePullSecret")]
    pub image_pull_secret: Option<String>,
    /// Specifies the criteria to determine which traffic is passed to WasmPlugin.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "match")]
    pub r#match: Option<Vec<WasmPluginMatch>>,
    /// Determines where in the filter chain this `WasmPlugin` is to be injected.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub phase: Option<WasmPluginPhase>,
    /// The configuration that will be passed on to the plugin.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "pluginConfig")]
    pub plugin_config: Option<BTreeMap<String, serde_json::Value>>,
    /// The plugin name to be used in the Envoy configuration (used to be called `rootID`).
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "pluginName")]
    pub plugin_name: Option<String>,
    /// Determines ordering of `WasmPlugins` in the same `phase`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub priority: Option<i64>,
    /// Criteria used to select the specific set of pods/VMs on which this plugin configuration should be applied.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub selector: Option<WasmPluginSelector>,
    /// SHA256 checksum that will be used to verify Wasm module or OCI container.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub sha256: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "targetRef")]
    pub target_ref: Option<WasmPluginTargetRef>,
    /// Specifies the type of Wasm Extension to be used.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
    pub r#type: Option<WasmPluginType>,
    /// URL of a Wasm module or OCI container.
    pub url: String,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "verificationKey")]
    pub verification_key: Option<String>,
    /// Configuration for a Wasm VM.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "vmConfig")]
    pub vm_config: Option<WasmPluginVmConfig>,
}

/// Extend the functionality provided by the Istio proxy through WebAssembly filters. See more details at: <https://istio.io/docs/reference/config/proxy_extensions/wasm-plugin.html>
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub enum WasmPluginFailStrategy {
    #[serde(rename = "FAIL_CLOSE")]
    FailClose,
    #[serde(rename = "FAIL_OPEN")]
    FailOpen,
}

/// Extend the functionality provided by the Istio proxy through WebAssembly filters. See more details at: <https://istio.io/docs/reference/config/proxy_extensions/wasm-plugin.html>
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub enum WasmPluginImagePullPolicy {
    #[serde(rename = "UNSPECIFIED_POLICY")]
    UnspecifiedPolicy,
    IfNotPresent,
    Always,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct WasmPluginMatch {
    /// Criteria for selecting traffic by their direction.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mode: Option<WasmPluginMatchMode>,
    /// Criteria for selecting traffic by their destination port.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ports: Option<Vec<WasmPluginMatchPorts>>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub enum WasmPluginMatchMode {
    #[serde(rename = "UNDEFINED")]
    Undefined,
    #[serde(rename = "CLIENT")]
    Client,
    #[serde(rename = "SERVER")]
    Server,
    #[serde(rename = "CLIENT_AND_SERVER")]
    ClientAndServer,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct WasmPluginMatchPorts {
    pub number: i64,
}

/// Extend the functionality provided by the Istio proxy through WebAssembly filters. See more details at: <https://istio.io/docs/reference/config/proxy_extensions/wasm-plugin.html>
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub enum WasmPluginPhase {
    #[serde(rename = "UNSPECIFIED_PHASE")]
    UnspecifiedPhase,
    #[serde(rename = "AUTHN")]
    Authn,
    #[serde(rename = "AUTHZ")]
    Authz,
    #[serde(rename = "STATS")]
    Stats,
}

/// Criteria used to select the specific set of pods/VMs on which this plugin configuration should be applied.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct WasmPluginSelector {
    /// One or more labels that indicate a specific set of pods/VMs on which a policy should be applied.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
    pub match_labels: Option<BTreeMap<String, String>>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct WasmPluginTargetRef {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub group: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub namespace: Option<String>,
}

/// Extend the functionality provided by the Istio proxy through WebAssembly filters. See more details at: <https://istio.io/docs/reference/config/proxy_extensions/wasm-plugin.html>
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub enum WasmPluginType {
    #[serde(rename = "UNSPECIFIED_PLUGIN_TYPE")]
    UnspecifiedPluginType,
    #[serde(rename = "HTTP")]
    Http,
    #[serde(rename = "NETWORK")]
    Network,
}

/// Configuration for a Wasm VM.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct WasmPluginVmConfig {
    /// Specifies environment variables to be injected to this VM.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub env: Option<Vec<WasmPluginVmConfigEnv>>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct WasmPluginVmConfigEnv {
    /// Name of the environment variable.
    pub name: String,
    /// Value for the environment variable.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub value: Option<String>,
    /// Source for the environment variable's value.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "valueFrom")]
    pub value_from: Option<WasmPluginVmConfigEnvValueFrom>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub enum WasmPluginVmConfigEnvValueFrom {
    #[serde(rename = "INLINE")]
    Inline,
    #[serde(rename = "HOST")]
    Host,
}