platz_chart_ext/features/
v1beta2.rs

1use super::v0::{ChartExtCardinality, ChartExtStatusFeature};
2use crate::versions::{ChartExtKindFeatures, ChartExtVersionV1Beta2};
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Debug, Default, Deserialize, Serialize)]
6#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7#[serde(rename_all = "camelCase")]
8pub struct ChartExtFeaturesV1Beta2 {
9    pub api_version: ChartExtVersionV1Beta2,
10    pub kind: ChartExtKindFeatures,
11    pub spec: ChartExtFeaturesSpec,
12}
13
14#[derive(Clone, Debug, Default, Deserialize, Serialize)]
15#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
16pub struct ChartExtFeaturesSpec {
17    /// When true, values.yaml is injected with an `ingress` section
18    /// that matches the structure generated by `helm create`. This
19    /// generates the hostname and sets TLS correctly.
20    #[serde(default)]
21    pub ingress: ChartExtIngress,
22
23    /// Sets an HTTP endpoint that returns a platz_sdk::PlatzStatus
24    /// and displayed as part of the deployment page.
25    pub status: Option<ChartExtStatusFeature>,
26
27    /// Allow deploying OnePerCluster or Many.
28    #[serde(default)]
29    pub cardinality: ChartExtCardinality,
30
31    /// Should dependent deployments be reinstalled when this deployment
32    /// config/values are updated. This doesn't apply to renames or
33    /// moving between clusters which always reinstalls dependencies.
34    #[serde(default = "yes")]
35    pub reinstall_dependencies: bool,
36
37    /// Paths to inject the node selector to. Node selector is always
38    /// added at the values top level `nodeSelector`.
39    #[serde(default)]
40    pub node_selector_paths: Vec<Vec<String>>,
41
42    /// Same for tolerations
43    #[serde(default)]
44    pub tolerations_paths: Vec<Vec<String>>,
45
46    /// Control how the deployment is displayed
47    #[serde(default)]
48    pub display: ChartExtDeploymentDisplay,
49}
50
51#[derive(Clone, Debug, Default, Deserialize, Serialize)]
52#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
53pub struct ChartExtIngress {
54    pub enabled: bool,
55    #[serde(default)]
56    pub hostname_format: ChartExtIngressHostnameFormat,
57}
58
59fn yes() -> bool {
60    true
61}
62
63impl From<bool> for ChartExtIngress {
64    fn from(standard_ingress: bool) -> Self {
65        Self {
66            enabled: standard_ingress,
67            hostname_format: Default::default(),
68        }
69    }
70}
71
72#[derive(Clone, Debug, Default, Deserialize, Serialize)]
73#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
74pub enum ChartExtIngressHostnameFormat {
75    Name,
76    #[default]
77    KindAndName,
78}
79
80#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)]
81#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
82#[serde(deny_unknown_fields)]
83pub struct ChartExtDeploymentDisplay {
84    pub name: Option<ChartExtDeploymentDisplayName>,
85    pub icon: Option<ChartExtDeploymentDisplayIcon>,
86}
87
88#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
89#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
90pub enum ChartExtDeploymentDisplayName {
91    DeploymentName,
92    InputField(ChartExtDeploymentDisplayNameInputField),
93}
94
95#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
96#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
97#[serde(deny_unknown_fields)]
98pub struct ChartExtDeploymentDisplayNameInputField {
99    pub name: String,
100}
101
102#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
103#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
104#[serde(deny_unknown_fields)]
105pub struct ChartExtDeploymentDisplayIcon {
106    pub font_awesome: String,
107}