Validate TLS configuration consistency. Returns `Ok(())` when either all three TLS paths are set (full mTLS) or none are set (plaintext). Returns an error naming the missing fields when only a subset is provided — this prevents silent fallback to plaintext when an operator partially configures mTLS.
(&self)
| 152 | /// fields when only a subset is provided — this prevents silent |
| 153 | /// fallback to plaintext when an operator partially configures mTLS. |
| 154 | pub fn validate_tls_config(&self) -> Result<(), crate::client::PodmanApiError> { |
| 155 | let has_ca = self.guest_tls_ca.is_some(); |
| 156 | let has_cert = self.guest_tls_cert.is_some(); |
| 157 | let has_key = self.guest_tls_key.is_some(); |
| 158 | |
| 159 | // All set or none set — both are valid. |
| 160 | if (has_ca && has_cert && has_key) || (!has_ca && !has_cert && !has_key) { |
| 161 | return Ok(()); |
| 162 | } |
| 163 | |
| 164 | let mut missing = Vec::new(); |
| 165 | if !has_ca { |
| 166 | missing.push("--podman-tls-ca / OPENSHELL_PODMAN_TLS_CA"); |
| 167 | } |
| 168 | if !has_cert { |
| 169 | missing.push("--podman-tls-cert / OPENSHELL_PODMAN_TLS_CERT"); |
| 170 | } |
| 171 | if !has_key { |
| 172 | missing.push("--podman-tls-key / OPENSHELL_PODMAN_TLS_KEY"); |
| 173 | } |
| 174 | |
| 175 | Err(crate::client::PodmanApiError::InvalidInput(format!( |
| 176 | "Partial TLS configuration: all three TLS paths must be provided together. \ |
| 177 | Missing: {}", |
| 178 | missing.join(", ") |
| 179 | ))) |
| 180 | } |
| 181 | |
| 182 | /// Validate runtime resource-limit configuration. |
| 183 | pub fn validate_runtime_limits(&self) -> Result<(), crate::client::PodmanApiError> { |