···11+use k8s_openapi::apimachinery::pkg::api::resource::Quantity;
22+use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
33+use kube::CustomResource;
44+use schemars::JsonSchema;
55+use serde::{Deserialize, Serialize};
66+77+#[derive(CustomResource, Debug, Serialize, Deserialize, Default, Clone, JsonSchema)]
88+#[kube(
99+ group = "kaap.nesv.ca",
1010+ version = "v1alpha1",
1111+ kind = "Application",
1212+ plural = "apps",
1313+ status = "ApplicationStatus",
1414+ namespaced
1515+)]
1616+pub struct ApplicationSpec {
1717+ pub replicas: Option<i32>,
1818+ pub image: String,
1919+ pub memory: Quantity,
2020+ pub ports: Option<Vec<ApplicationPort>>,
2121+}
2222+2323+#[derive(Debug, Clone, JsonSchema, Serialize, Deserialize)]
2424+pub struct ApplicationPort {
2525+ /// The name of the port. It must be unique across all port definitions. While required, this
2626+ /// is mostly used for diagnostic purposes.
2727+ pub name: String,
2828+ /// The port exposed by this application.
2929+ /// This is the port clients will be expected to connect to.
3030+ pub port: i32,
3131+ /// Maps the external `port` to a different port on the container. This allows the container to
3232+ /// listen on an unprivileged port.
3333+ ///
3434+ /// For example, the application may specify an external port 443 for HTTPS clients, but listen
3535+ /// on port 8443 within the container.
3636+ pub container_port: Option<i32>,
3737+ /// The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". Defaults to "TCP".
3838+ pub protocol: Option<String>,
3939+}
4040+4141+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, JsonSchema)]
4242+pub struct ApplicationStatus {
4343+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
4444+ // #[schemars(schema_with = "conditions")]
4545+ pub conditions: Vec<Condition>,
4646+}
+2
src/api/v1alpha1/mod.rs
···11+mod application;
22+pub use application::{Application, ApplicationPort, ApplicationSpec};