pub(crate) async fn check_crd_status(client: kube::Client) -> Result<()> {
    let crds = Api::<CustomResourceDefinition>::all(client.clone());
    let ts_crd = crds
        .get(CRD_NAME)
        .await
        .with_context(|| format!("Could not find the crd: {}", CRD_NAME))?;

    let versions = ts_crd
        .spec
        .versions
        .ok_or_else(|| anyhow!("The CRD is missing the version field."))?;

    if versions.len() != 1 {
        return Err(anyhow!("Only expected one version in the CRD."));
    }

    if versions[0].name != CRD_VERSION {
        return Err(anyhow!("CRD is not the expected version: {}", CRD_VERSION));
    }

    Ok(())
}
/// Checks that the CRD exists in the cluster
Checks that the CRD exists in the cluster
Checks that the CRD exists in the cluster
pub(crate) async fn check_crd_status(client: kube::Client) -> Result<()> {
    let crds = Api::<CustomResourceDefinition>::all(client.clone());
    let ts_crd = crds
        .get(CRD_NAME)
        .await
        .with_context(|| format!("Could not find the crd: {}", CRD_NAME))?;
    let versions = ts_crd
        .spec
        .versions
        .ok_or_else(|| anyhow!("The CRD is missing the version field."))?;
    if versions.len() != 1 {
        return Err(anyhow!("Only expected one version in the CRD."));
    }
    if versions[0].name != CRD_VERSION {
        return Err(anyhow!("CRD is not the expected version: {}", CRD_VERSION));
    }
    Ok(())
}
pub ( crate ) async fn check_crd_status ( client : kube :: Client ) -> Result < ( ) > { let crds = Api :: < CustomResourceDefinition > :: all ( client . clone ( ) ) ; let ts_crd = crds . get ( CRD_NAME ) . await . with_context ( | | format ! ( " " CRD_NAME ) ) ? ; let versions = ts_crd . spec . versions . ok_or_else ( | | anyhow ! ( " " ) ) ? ; if versions . len ( ) != 1 { return Err ( anyhow ! ( " " ) ) ; } if versions [ 0 ] . name != CRD_VERSION { return Err ( anyhow ! ( " " CRD_VERSION ) ) ; } Ok ( ( ) ) }
Checks that the CRD exists in the cluster
Checks that the CRD exists in the cluster
client
kube::Client