|
| 1 | +use std::convert::Infallible; |
| 2 | + |
| 3 | +use k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition; |
| 4 | + |
| 5 | +use crate::apply_resource::ApplyResource; |
| 6 | + |
| 7 | +impl ApplyResource for CustomResourceDefinition { |
| 8 | + type Error = Infallible; |
| 9 | + |
| 10 | + fn apply(&self, _kube_client: kube::Client) -> Result<(), Self::Error> { |
| 11 | + // 1. Using the kube::Client, check if the CRD already exists. |
| 12 | + // If it does not exist, then simple apply. |
| 13 | + // |
| 14 | + // 2. If the CRD already exists, then get it, and check... |
| 15 | + // - spec.conversion (this is likely to change, which is fine) |
| 16 | + // - spec.group (this should probably never change) |
| 17 | + // - spec.names (it is ok to add names, probably not great to remove them) |
| 18 | + // - spec.preserve_unknown_fields (is this ok to change?) |
| 19 | + // - spec.scope (this should probably never change) |
| 20 | + // |
| 21 | + // 3. For spec.versions, where "A" is the sert of versions applied to the server, |
| 22 | + // and "B" is the set of versions to be applied... |
| 23 | + // - A - B: These versions are candidates for removal |
| 24 | + // - B - A: These versions can be safely appended |
| 25 | + // - A ∩ B: These versions are likely to change in the following ways: |
| 26 | + // - New fields added (safe for vXalphaY, vXbetaY, and vX) |
| 27 | + // - Fields changed (can happen in vXalphaY, vXbetaY, but shouldn't in vX) |
| 28 | + // - Fields removed (can happen in vXalphaY, vXbetaY, but shouldn't in vX) |
| 29 | + // |
| 30 | + // Complete the rest of the owl... |
| 31 | + Ok(()) |
| 32 | + } |
| 33 | +} |
0 commit comments