datreeio / CRDs-catalog

Popular Kubernetes CRDs (CustomResourceDefinition) in JSON schema format.
MIT License
481 stars 200 forks source link

Update Argo Workflow CRDs to v3.5.4 #261

Closed 0gajun closed 8 months ago

0gajun commented 8 months ago

Hi, thank you for maintaining this repository...! This is really helpful to improve our productivity by validating configurations before deploying it.

I tried to update Argo Workflow CRDs to v3.5.4 using the following script.


set -eu
set -o pipefail

ARGO_WORKFLOW_VERSION='3.5.4'
KUBECONFORM_DIR=<PATH to kubeconform repository>

kinds=(
  clusterworkflowtemplates
  cronworkflows
  workflowartifactgctasks
  workfloweventbindings
  workflows
  workflowtaskresults
  workflowtasksets
  workflowtemplates
)

for kind in "${kinds[@]}"; do
  python3 ${KUBECONFORM_DIR}/scripts/openapi2jsonschema.py https://raw.githubusercontent.com/argoproj/argo-workflows/v${ARGO_WORKFLOW_VERSION}/manifests/base/crds/full/argoproj.io_${kind}.yaml
done

CRDs-catalog has an utility tool to extract CRDs from an existing cluster, named CRD Extractor. In most cases, we can use the tool to update CRDs. However, in Argo Workflow, we cannot utilize the tool for it.

There are 2 types of manifests in Argo Workflow.

full has full schema validation. However, we cannot apply the manifest to a k8s cluster due to errors in applying the manifests. So, we cannot use CRD Extractor to update it.

minimal can be applied to a k8s cluster, but it doesn't have schema validation. So, using CRD Extractor against minimal manifest is meaningless.

Therefore, I directly used openapi2jsonchema.py in the kubeconform repository to update Argo Workflow's CRDs.