Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add more CRDs from openshift/api #79

Merged
merged 2 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions code-generator/create-custom-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@ for file in ./crd-catalog/**/*.yaml; do

path="${file%.*}"
ignore_file="${path}.ignore"
args_file="${path}.args"
crd=$(basename "${path}")
version=$(basename "$(dirname "${file}")")
group=$(basename "$(dirname "$(dirname "${file}")")")
resource_filename=$(echo "${crd}" | sed -e 's/\./_/g' -e 's/-/_/g')
cargo_group=$(echo "${group}" | sed -e 's/\./_/g' -e 's/-/_/g')
cargo_feature="${cargo_group}"
feature_directory="./kube-custom-resources-rs/src/${cargo_feature}"
version_directory="${feature_directory}/${version}"

if [ ! -f "${ignore_file}" ]; then
args="${path}.args"
crd=$(basename "${path}")
version=$(basename "$(dirname "${file}")")
group=$(basename "$(dirname "$(dirname "${file}")")")
resource_filename=$(echo "${crd}" | sed -e 's/\./_/g' -e 's/-/_/g')
cargo_group=$(echo "${group}" | sed -e 's/\./_/g' -e 's/-/_/g')
cargo_feature="${cargo_group}"
feature_directory="./kube-custom-resources-rs/src/${cargo_feature}"
version_directory="${feature_directory}/${version}"
if [ -f "${ignore_file}" ]; then
rm --force "${version_directory}/${resource_filename}.rs"
else
mkdir --parents "${version_directory}"

mkdir --parents "${feature_directory}/${version}"

if [ -f "${args}" ]; then
if ! xargs --arg-file="${args}" --delimiter='\n' kopium --docs --filename="${file}" > "${version_directory}/${resource_filename}.rs"; then
if [ -f "${args_file}" ]; then
if ! xargs --arg-file="${args_file}" --delimiter='\n' kopium --docs --filename="${file}" > "${version_directory}/${resource_filename}.rs"; then
echo " error in ${file}"
fi
else
Expand Down
11 changes: 1 addition & 10 deletions code-generator/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,7 @@ cargo run --package code-generator --bin crd_v1_fetcher "${FILTER}"
cargo run --package code-generator --bin dep5_generator

# fix YAMLs
shopt -s globstar nullglob
for file in ./crd-catalog/**/fixup.sh; do
if [ -n "${FILTER}" ]; then
if ! echo -n "${file}" | grep --quiet "${FILTER}"; then
continue
fi
fi

"${file}"
done
./code-generator/run-fixups.sh "${FILTER}"

# generate Rust code
./code-generator/create-custom-resources.sh "${FILTER}"
Expand Down
18 changes: 18 additions & 0 deletions code-generator/run-fixups.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# SPDX-FileCopyrightText: The kube-custom-resources-rs Authors
# SPDX-License-Identifier: 0BSD

FILTER="${1:-}"

# fix YAMLs
shopt -s globstar nullglob
for file in ./crd-catalog/**/fixup.sh; do
if [ -n "${FILTER}" ]; then
if ! echo -n "${file}" | grep --quiet "${FILTER}"; then
continue
fi
fi

"${file}"
done
79 changes: 79 additions & 0 deletions code-generator/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1761,12 +1761,91 @@ pub const CRD_V1_SOURCES: &'static [UpstreamSource] = &[
project_name: "openshift/api",
license: APACHE_V2,
urls: &[
"https://github.com/openshift/api/blob/master/authorization/v1/0000_03_authorization-openshift_01_rolebindingrestriction.crd.yaml",
"https://github.com/openshift/api/blob/master/cloudnetwork/v1/001-cloudprivateipconfig.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_00_cluster-version-operator_01_clusteroperator.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_00_cluster-version-operator_01_clusterversion.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_03_config-operator_01_proxy.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_03_marketplace-operator_01_operatorhub.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_apiserver-Default.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_authentication.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_console.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_dns-Default.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_featuregate.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_image.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_imagecontentpolicy.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_imagedigestmirrorset.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_imagetagmirrorset.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_infrastructure-Default.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_ingress.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_network.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_node.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_oauth.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_project.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_config-operator_01_scheduler.crd.yaml",
"https://github.com/openshift/api/blob/master/config/v1/0000_10_openshift-controller-manager-operator_01_build.crd.yaml",
"https://github.com/openshift/api/blob/master/console/v1/00_consoleclidownload.crd.yaml",
"https://github.com/openshift/api/blob/master/console/v1/00_consoleexternalloglink.crd.yaml",
"https://github.com/openshift/api/blob/master/console/v1/00_consolelink.crd.yaml",
"https://github.com/openshift/api/blob/master/console/v1/00_consolenotification.crd.yaml",
"https://github.com/openshift/api/blob/master/console/v1/00_consolequickstart.crd.yaml",
"https://github.com/openshift/api/blob/master/console/v1/00_consolesample.crd.yaml",
"https://github.com/openshift/api/blob/master/console/v1/00_consoleyamlsample.crd.yaml",
"https://github.com/openshift/api/blob/master/console/v1/90_consoleplugin.crd.yaml",
"https://github.com/openshift/api/blob/master/example/v1/0000_50_stabletype-Default.crd.yaml",
"https://github.com/openshift/api/blob/master/helm/v1beta1/00_helm-chart-repository.crd.yaml",
"https://github.com/openshift/api/blob/master/helm/v1beta1/00_project-helm-chart-repository.crd.yaml",
"https://github.com/openshift/api/blob/master/imageregistry/v1/00_imageregistry.crd.yaml",
"https://github.com/openshift/api/blob/master/imageregistry/v1/01_imagepruner.crd.yaml",
"https://github.com/openshift/api/blob/master/insights/v1alpha1/0000_10_01_datagather.crd.yaml",
"https://github.com/openshift/api/blob/master/machine/v1/0000_10_controlplanemachineset-Default.crd.yaml",
"https://github.com/openshift/api/blob/master/machine/v1beta1/0000_10_machine.crd.yaml",
"https://github.com/openshift/api/blob/master/machine/v1beta1/0000_10_machinehealthcheck.yaml",
"https://github.com/openshift/api/blob/master/machine/v1beta1/0000_10_machineset.crd.yaml",
"https://github.com/openshift/api/blob/master/machineconfiguration/v1/0000_80_containerruntimeconfig.crd.yaml",
"https://github.com/openshift/api/blob/master/machineconfiguration/v1/0000_80_controllerconfig.crd.yaml",
"https://github.com/openshift/api/blob/master/machineconfiguration/v1/0000_80_kubeletconfig.crd.yaml",
"https://github.com/openshift/api/blob/master/machineconfiguration/v1/0000_80_machineconfig.crd.yaml",
"https://github.com/openshift/api/blob/master/machineconfiguration/v1/0000_80_machineconfigpool.crd.yaml",
"https://github.com/openshift/api/blob/master/machineconfiguration/v1alpha1/0000_80_machineconfignode-CustomNoUpgrade.crd.yaml",
"https://github.com/openshift/api/blob/master/monitoring/v1/0000_50_monitoring_01_alertingrules.crd.yaml",
"https://github.com/openshift/api/blob/master/monitoring/v1/0000_50_monitoring_02_alertrelabelconfigs.crd.yaml",
"https://github.com/openshift/api/blob/master/network/v1/001-clusternetwork-crd.yaml",
"https://github.com/openshift/api/blob/master/network/v1/002-hostsubnet-crd.yaml",
"https://github.com/openshift/api/blob/master/network/v1/003-netnamespace-crd.yaml",
"https://github.com/openshift/api/blob/master/network/v1/004-egressnetworkpolicy-crd.yaml",
"https://github.com/openshift/api/blob/master/networkoperator/v1/001-egressrouter.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_10_config-operator_01_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_12_etcd-operator_01_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_20_kube-apiserver-operator_01_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_25_kube-controller-manager-operator_01_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_25_kube-scheduler-operator_01_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_30_openshift-apiserver-operator_01_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_40_kube-storage-version-migrator-operator_00_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_50_cluster-authentication-operator_01_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_50_cluster-openshift-controller-manager-operator_02_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_50_cluster_storage_operator_01_crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_50_ingress-operator_00-ingresscontroller.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_50_insights-operator_00-insightsoperator.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_50_service-ca-operator_02_crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_70_cluster-network-operator_01.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_70_dns-operator_00.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_80_csi_snapshot_controller_operator_01_crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_80_machine-config-operator_01_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/0000_90_cluster_csi_driver_01_config.crd.yaml",
"https://github.com/openshift/api/blob/master/operator/v1/00_console-operator.crd.yaml",
"https://github.com/openshift/api/blob/master/operatorcontrolplane/v1alpha1/0000_10-pod-network-connectivity-check.crd.yaml",
"https://github.com/openshift/api/blob/master/operatoringress/v1/0000_50_dns-record.yaml",
"https://github.com/openshift/api/blob/master/platform/v1alpha1/platformoperators.crd.yaml",
"https://github.com/openshift/api/blob/master/quota/v1/0000_03_quota-openshift_01_clusterresourcequota.crd.yaml",
"https://github.com/openshift/api/blob/master/route/v1/route.crd.yaml",
"https://github.com/openshift/api/blob/master/samples/v1/00_samplesconfig.crd.yaml",
"https://github.com/openshift/api/blob/master/security/v1/0000_03_security-openshift_01_scc.crd.yaml",
"https://github.com/openshift/api/blob/master/securityinternal/v1/0000_03_securityinternal-openshift_02_rangeallocation.crd.yaml",
"https://github.com/openshift/api/blob/master/securityinternal/v1/0000_03_securityinternal-openshift_02_rangeallocation.crd.yaml-patch",
"https://github.com/openshift/api/blob/master/sharedresource/v1alpha1/0000_10_sharedconfigmap.crd.yaml",
"https://github.com/openshift/api/blob/master/sharedresource/v1alpha1/0000_10_sharedsecret.crd.yaml",
],
},
UpstreamSource {
Expand Down
Loading