#[allow(unused_imports)]
mod prelude {
pub use std::collections::BTreeMap;
pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
pub use kube::CustomResource;
pub use schemars::JsonSchema;
pub use serde::{Deserialize, Serialize};
}
use self::prelude::*;
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
#[kube(
group = "gateway.networking.k8s.io",
version = "v1",
kind = "Gateway",
plural = "gateways"
)]
#[kube(namespaced)]
#[kube(status = "GatewayStatus")]
#[kube(derive = "Default")]
#[kube(derive = "PartialEq")]
pub struct GatewaySpec {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub addresses: Option<Vec<GatewayAddresses>>,
#[serde(default, skip_serializing_if = "Option::is_none", rename = "allowedListeners")]
pub allowed_listeners: Option<GatewayAllowedListeners>,
#[serde(default, skip_serializing_if = "Option::is_none", rename = "defaultScope")]
pub default_scope: Option<GatewayDefaultScope>,
#[serde(rename = "gatewayClassName")]
pub gateway_class_name: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub infrastructure: Option<GatewayInfrastructure>,
pub listeners: Vec<GatewayListeners>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tls: Option<GatewayTls>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayAddresses {
#[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
pub r#type: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayAllowedListeners {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub namespaces: Option<GatewayAllowedListenersNamespaces>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayAllowedListenersNamespaces {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub from: Option<GatewayAllowedListenersNamespacesFrom>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub selector: Option<GatewayAllowedListenersNamespacesSelector>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
pub enum GatewayAllowedListenersNamespacesFrom {
All,
Selector,
Same,
None,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayAllowedListenersNamespacesSelector {
#[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
pub match_expressions: Option<Vec<GatewayAllowedListenersNamespacesSelectorMatchExpressions>>,
#[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
pub match_labels: Option<BTreeMap<String, String>>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayAllowedListenersNamespacesSelectorMatchExpressions {
pub key: String,
pub operator: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub values: Option<Vec<String>>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
pub enum GatewayDefaultScope {
All,
None,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayInfrastructure {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub annotations: Option<BTreeMap<String, String>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub labels: Option<BTreeMap<String, String>>,
#[serde(default, skip_serializing_if = "Option::is_none", rename = "parametersRef")]
pub parameters_ref: Option<GatewayInfrastructureParametersRef>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayInfrastructureParametersRef {
pub group: String,
pub kind: String,
pub name: String,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayListeners {
#[serde(default, skip_serializing_if = "Option::is_none", rename = "allowedRoutes")]
pub allowed_routes: Option<GatewayListenersAllowedRoutes>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub hostname: Option<String>,
pub name: String,
pub port: i32,
pub protocol: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tls: Option<GatewayListenersTls>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayListenersAllowedRoutes {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub kinds: Option<Vec<GatewayListenersAllowedRoutesKinds>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub namespaces: Option<GatewayListenersAllowedRoutesNamespaces>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayListenersAllowedRoutesKinds {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub group: Option<String>,
pub kind: String,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayListenersAllowedRoutesNamespaces {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub from: Option<GatewayListenersAllowedRoutesNamespacesFrom>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub selector: Option<GatewayListenersAllowedRoutesNamespacesSelector>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
pub enum GatewayListenersAllowedRoutesNamespacesFrom {
All,
Selector,
Same,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayListenersAllowedRoutesNamespacesSelector {
#[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
pub match_expressions: Option<Vec<GatewayListenersAllowedRoutesNamespacesSelectorMatchExpressions>>,
#[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
pub match_labels: Option<BTreeMap<String, String>>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayListenersAllowedRoutesNamespacesSelectorMatchExpressions {
pub key: String,
pub operator: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub values: Option<Vec<String>>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayListenersTls {
#[serde(default, skip_serializing_if = "Option::is_none", rename = "certificateRefs")]
pub certificate_refs: Option<Vec<GatewayListenersTlsCertificateRefs>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mode: Option<GatewayListenersTlsMode>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub options: Option<BTreeMap<String, String>>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayListenersTlsCertificateRefs {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub group: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
pub name: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub namespace: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
pub enum GatewayListenersTlsMode {
Terminate,
Passthrough,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayTls {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub backend: Option<GatewayTlsBackend>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub frontend: Option<GatewayTlsFrontend>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayTlsBackend {
#[serde(default, skip_serializing_if = "Option::is_none", rename = "clientCertificateRef")]
pub client_certificate_ref: Option<GatewayTlsBackendClientCertificateRef>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayTlsBackendClientCertificateRef {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub group: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
pub name: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub namespace: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayTlsFrontend {
pub default: GatewayTlsFrontendDefault,
#[serde(default, skip_serializing_if = "Option::is_none", rename = "perPort")]
pub per_port: Option<Vec<GatewayTlsFrontendPerPort>>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayTlsFrontendDefault {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub validation: Option<GatewayTlsFrontendDefaultValidation>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayTlsFrontendDefaultValidation {
#[serde(rename = "caCertificateRefs")]
pub ca_certificate_refs: Vec<GatewayTlsFrontendDefaultValidationCaCertificateRefs>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mode: Option<GatewayTlsFrontendDefaultValidationMode>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayTlsFrontendDefaultValidationCaCertificateRefs {
pub group: String,
pub kind: String,
pub name: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub namespace: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
pub enum GatewayTlsFrontendDefaultValidationMode {
AllowValidOnly,
AllowInsecureFallback,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayTlsFrontendPerPort {
pub port: i32,
pub tls: GatewayTlsFrontendPerPortTls,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayTlsFrontendPerPortTls {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub validation: Option<GatewayTlsFrontendPerPortTlsValidation>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayTlsFrontendPerPortTlsValidation {
#[serde(rename = "caCertificateRefs")]
pub ca_certificate_refs: Vec<GatewayTlsFrontendPerPortTlsValidationCaCertificateRefs>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mode: Option<GatewayTlsFrontendPerPortTlsValidationMode>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayTlsFrontendPerPortTlsValidationCaCertificateRefs {
pub group: String,
pub kind: String,
pub name: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub namespace: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
pub enum GatewayTlsFrontendPerPortTlsValidationMode {
AllowValidOnly,
AllowInsecureFallback,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayStatus {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub addresses: Option<Vec<GatewayStatusAddresses>>,
#[serde(default, skip_serializing_if = "Option::is_none", rename = "attachedListenerSets")]
pub attached_listener_sets: Option<i32>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub conditions: Option<Vec<Condition>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub listeners: Option<Vec<GatewayStatusListeners>>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayStatusAddresses {
#[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
pub r#type: Option<String>,
pub value: String,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayStatusListeners {
#[serde(rename = "attachedRoutes")]
pub attached_routes: i32,
pub conditions: Vec<Condition>,
pub name: String,
#[serde(default, skip_serializing_if = "Option::is_none", rename = "supportedKinds")]
pub supported_kinds: Option<Vec<GatewayStatusListenersSupportedKinds>>,
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
pub struct GatewayStatusListenersSupportedKinds {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub group: Option<String>,
pub kind: String,
}