From 703a7995522f515e4140cca63aab045447697e5a Mon Sep 17 00:00:00 2001 From: Johannes Schicktanz Date: Tue, 19 Apr 2022 17:26:28 +0200 Subject: [PATCH] adds gardener images to component descriptor (#5818) * adds gardener images to component descriptor * Update component_descriptor * adds missing images --- .ci/resources.yaml | 63 +++++++++++++++++++++++++++++++++++ hack/.ci/component_descriptor | 28 ++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 .ci/resources.yaml diff --git a/.ci/resources.yaml b/.ci/resources.yaml new file mode 100644 index 00000000000..9f46812f24d --- /dev/null +++ b/.ci/resources.yaml @@ -0,0 +1,63 @@ +--- +name: 'admission-controller' +version: '${COMPONENT_VERSION}' +type: 'ociImage' +relation: 'local' +access: + type: 'ociRegistry' + imageReference: 'eu.gcr.io/gardener-project/gardener/admission-controller:${COMPONENT_VERSION}' +--- +--- +name: 'apiserver' +version: '${COMPONENT_VERSION}' +type: 'ociImage' +relation: 'local' +access: + type: 'ociRegistry' + imageReference: 'eu.gcr.io/gardener-project/gardener/apiserver:${COMPONENT_VERSION}' +--- +--- +name: 'controller-manager' +version: '${COMPONENT_VERSION}' +type: 'ociImage' +relation: 'local' +access: + type: 'ociRegistry' + imageReference: 'eu.gcr.io/gardener-project/gardener/controller-manager:${COMPONENT_VERSION}' +--- +--- +name: 'gardenlet' +version: '${COMPONENT_VERSION}' +type: 'ociImage' +relation: 'local' +access: + type: 'ociRegistry' + imageReference: 'eu.gcr.io/gardener-project/gardener/gardenlet:${COMPONENT_VERSION}' +--- +--- +name: 'resource-manager' +version: '${COMPONENT_VERSION}' +type: 'ociImage' +relation: 'local' +access: + type: 'ociRegistry' + imageReference: 'eu.gcr.io/gardener-project/gardener/resource-manager:${COMPONENT_VERSION}' +--- +--- +name: 'scheduler' +version: '${COMPONENT_VERSION}' +type: 'ociImage' +relation: 'local' +access: + type: 'ociRegistry' + imageReference: 'eu.gcr.io/gardener-project/gardener/scheduler:${COMPONENT_VERSION}' +--- +--- +name: 'seed-admission-controller' +version: '${COMPONENT_VERSION}' +type: 'ociImage' +relation: 'local' +access: + type: 'ociRegistry' + imageReference: 'eu.gcr.io/gardener-project/gardener/seed-admission-controller:${COMPONENT_VERSION}' +--- diff --git a/hack/.ci/component_descriptor b/hack/.ci/component_descriptor index cdf65cfc708..e9a1b228bd9 100755 --- a/hack/.ci/component_descriptor +++ b/hack/.ci/component_descriptor @@ -6,6 +6,34 @@ repo_root_dir="$1" repo_name="${2:-github.com/gardener/gardener}" descriptor_out_file="${COMPONENT_DESCRIPTOR_PATH}" +resources_file="$repo_root_dir/.ci/resources.yaml" +if [[ -f ${resources_file} ]]; then + echo "Adding additional resources from ${resources_file}" + + # component-cli expects a directory where the component descriptor file is named component-descriptor.yaml. + # however the pre-rendered component descriptors of the pipeline have different filenames. + # therefore create a tempdir and copy the pre-rendered component descriptor to it with the correct filename. + tmp_dir="$(mktemp -d)" + tmp_cd="${tmp_dir}/component-descriptor.yaml" + cp "${BASE_DEFINITION_PATH}" "${tmp_cd}" + echo "${tmp_cd}" + + # read component component version. + if [[ -z ${VERSION_PATH} ]]; then + echo "The env variable VERSION_PATH must be set" + exit 1 + fi + component_version="$(cat ${VERSION_PATH}/version)" + + # adds all resources defined in the resources file to the component descriptor. + component-cli component-archive resources add ${tmp_dir} ${resources_file} -v=3 -- COMPONENT_VERSION=${component_version} + + # move modified component descriptor back to the original file. + mv "${tmp_cd}" "${BASE_DEFINITION_PATH}" +else + echo "Resources file ${resources_file} not found. Skip adding additional resources." +fi + echo "Enriching component descriptor from ${BASE_DEFINITION_PATH}" if [[ -f "$repo_root_dir/charts/images.yaml" ]]; then