From 67b34673a078263f607f24bd8e30b587d71e13db Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Thu, 11 May 2023 12:56:44 +0300 Subject: [PATCH 01/18] reset from upstream --- charts/gitops-runtime/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitops-runtime/Chart.yaml b/charts/gitops-runtime/Chart.yaml index 7e0b4c88..38856f20 100644 --- a/charts/gitops-runtime/Chart.yaml +++ b/charts/gitops-runtime/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 appVersion: 0.1.29 description: A Helm chart for Codefresh gitops runtime -name: gitops-runtime +name: gitops-runtime-sandbox version: 0.2.1-alpha.14 home: https://github.com/codefresh-io/gitops-runtime-helm icon: https://codefresh.io/wp-content/uploads/2022/02/Codefresh_Logo_Vertical_LightBkgd.png From 42a9ff4de35e1cc340f6413e69de72948e34d392 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Sun, 28 May 2023 20:26:36 +0300 Subject: [PATCH 02/18] replace registry script --- scripts/helper-scripts/replace-registry.py | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 scripts/helper-scripts/replace-registry.py diff --git a/scripts/helper-scripts/replace-registry.py b/scripts/helper-scripts/replace-registry.py new file mode 100644 index 00000000..514b4771 --- /dev/null +++ b/scripts/helper-scripts/replace-registry.py @@ -0,0 +1,55 @@ +import yaml +import sys +import re + + + +def replace_registry_in_image(image_string, new_registry): + if '/' in image_string: + parts = image_string.split('/') + if len(parts) >= 2: + parts[0] = new_registry + return '/'.join(parts) + else: + return new_registry + '/' + image_string + +# Try to identify whether a string is a docker image +def is_docker_image(image_string): + pattern = r'^[a-zA-Z0-9/_-]+:[a-zA-Z0-9_.-]+$' + return bool(re.match(pattern, image_string)) + + +def recurse_replace_registry(currValue,new_registry): + if type(currValue) is dict: + for key in currValue.keys(): + if key == "registry": + currValue[key]=new_registry + elif key == "repository" and "registry" not in currValue: + currValue[key] = replace_registry_in_image(currValue[key],new_registry) + elif type(currValue[key]) is str: + if is_docker_image(currValue[key]): + currValue[key] = replace_registry_in_image(currValue[key],new_registry) + else: + recurse_replace_registry(currValue[key],new_registry) + elif type(currValue) is list: + for item in currValue: + recurse_replace_registry(item,new_registry) + + +def main(yamlFilepath, newRegistry): + # Open yaml + with open(yamlFilepath, 'r') as stream: + try: + d=yaml.safe_load(stream) + except yaml.YAMLError as e: + print(e) + + recurse_replace_registry(d,newRegistry) + print(yaml.dump(d)) + # + +if __name__ == "__main__": + if len(sys.argv) != 3: + raise SyntaxError("Wrong number of arguments. Usage: replace-registry.py Date: Sun, 28 May 2023 20:59:13 +0300 Subject: [PATCH 03/18] add possibility to provide list of source and target --- scripts/helper-scripts/replace-registry.py | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/scripts/helper-scripts/replace-registry.py b/scripts/helper-scripts/replace-registry.py index 514b4771..1402b4b0 100644 --- a/scripts/helper-scripts/replace-registry.py +++ b/scripts/helper-scripts/replace-registry.py @@ -1,6 +1,7 @@ import yaml import sys import re +import csv @@ -35,6 +36,31 @@ def recurse_replace_registry(currValue,new_registry): for item in currValue: recurse_replace_registry(item,new_registry) +def recurse_get_source_target(currValue,new_registry,lstSourceTarget): + oldImage = "" + if type(currValue) is dict: + for key in currValue.keys(): + if key == "registry": + oldImage += currValue[key] + "/" + if key == "repository": + oldImage += currValue[key] + if key == "tag": + oldImage += ":" + currValue[key] + + elif type(currValue[key]) is str: + if is_docker_image(currValue[key]): + oldImage = currValue[key] + + recurse_get_source_target(currValue[key],new_registry,lstSourceTarget) + + if len(oldImage) > 0: + lstSourceTarget.append({"source_image": oldImage, "target_image": replace_registry_in_image(oldImage,new_registry)}) + + + elif type(currValue) is list: + for item in currValue: + recurse_get_source_target(item,new_registry,lstSourceTarget) + def main(yamlFilepath, newRegistry): # Open yaml @@ -44,8 +70,12 @@ def main(yamlFilepath, newRegistry): except yaml.YAMLError as e: print(e) - recurse_replace_registry(d,newRegistry) - print(yaml.dump(d)) + lstSourceTarget = [] + recurse_get_source_target(d,newRegistry,lstSourceTarget) + print(yaml.dump(lstSourceTarget)) + #recurse_replace_registry(d,newRegistry) + #print(yaml.dump(d)) + # if __name__ == "__main__": From 8500fe9c00073197ab0d24815672c4a2d6c0ca70 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Mon, 29 May 2023 14:27:33 +0300 Subject: [PATCH 04/18] add airgapped scripts --- .../gitops-runtime/ci/values-all-images.yaml | 2 +- scripts/all-image-values.sh | 4 - scripts/list-images-for-mirrror.sh | 6 - scripts/private-registry-utils/.dockerignore | 2 + scripts/private-registry-utils/Dockerfile | 13 ++ scripts/private-registry-utils/README.md | 15 ++ .../helper-scripts/yaml-filter.py | 46 ++++++ .../output-calculated-values.sh | 3 +- .../private-registry-utils.py | 150 ++++++++++++++++++ .../python-requirements.txt | 1 + 10 files changed, 229 insertions(+), 13 deletions(-) delete mode 100755 scripts/all-image-values.sh delete mode 100755 scripts/list-images-for-mirrror.sh create mode 100644 scripts/private-registry-utils/.dockerignore create mode 100644 scripts/private-registry-utils/Dockerfile create mode 100644 scripts/private-registry-utils/README.md create mode 100755 scripts/private-registry-utils/helper-scripts/yaml-filter.py rename scripts/{ => private-registry-utils}/output-calculated-values.sh (96%) create mode 100644 scripts/private-registry-utils/private-registry-utils.py create mode 100644 scripts/private-registry-utils/python-requirements.txt diff --git a/charts/gitops-runtime/ci/values-all-images.yaml b/charts/gitops-runtime/ci/values-all-images.yaml index 345138bc..69d212b5 100644 --- a/charts/gitops-runtime/ci/values-all-images.yaml +++ b/charts/gitops-runtime/ci/values-all-images.yaml @@ -1,3 +1,4 @@ +# Values file used to render all image values global: codefresh: accountId: 628a80b693a15c0f9c13ab75 # Codefresh Account id for ilia-codefresh for now, needs to be some test account @@ -13,7 +14,6 @@ global: runtime: name: default - cluster: test-cluster ingress: enabled: false diff --git a/scripts/all-image-values.sh b/scripts/all-image-values.sh deleted file mode 100755 index b66e25b0..00000000 --- a/scripts/all-image-values.sh +++ /dev/null @@ -1,4 +0,0 @@ -MYDIR=$(dirname $0) - -$MYDIR/output-calculated-values.sh /tmp/gitops-runtime-values.yaml > /dev/null -python3 $MYDIR/helper-scripts/yaml-filter.py /tmp/gitops-runtime-values.yaml image.repository,image.registry,image.tag,argo-events.configs.nats.versions,argo-events.configs.jetstream.versions \ No newline at end of file diff --git a/scripts/list-images-for-mirrror.sh b/scripts/list-images-for-mirrror.sh deleted file mode 100755 index 7ef7f8bd..00000000 --- a/scripts/list-images-for-mirrror.sh +++ /dev/null @@ -1,6 +0,0 @@ -MYDIR=$(dirname $0) -CHARTDIR="${MYDIR}/../charts/gitops-runtime" -VALUESFILE="${CHARTDIR}/ci/values-all-images.yaml" -helm dependency update $CHARTDIR > /dev/null -helm template --values $VALUESFILE $CHARTDIR | grep -E -i ".*Image: " | awk -F ':' '{if ($2) printf "%s:%s\n", $2, $3}' | tr -d "\"|[:blank:]" | sort -u |uniq -i -# Current limitation - the image for argoexec is missing, since it's sent as a parameter in the command in the template, and it's hard to match it with a regex. \ No newline at end of file diff --git a/scripts/private-registry-utils/.dockerignore b/scripts/private-registry-utils/.dockerignore new file mode 100644 index 00000000..9b54c5ba --- /dev/null +++ b/scripts/private-registry-utils/.dockerignore @@ -0,0 +1,2 @@ +README.md +Dockerfile diff --git a/scripts/private-registry-utils/Dockerfile b/scripts/private-registry-utils/Dockerfile new file mode 100644 index 00000000..04ceadfb --- /dev/null +++ b/scripts/private-registry-utils/Dockerfile @@ -0,0 +1,13 @@ +FROM --platform=$BUILDPLATFORM python:3.11.3-slim-bullseye +ARG TARGETARCH +RUN cd /tmp && python3 -c "from urllib.request import urlretrieve; urlretrieve('https://get.helm.sh/helm-v3.12.0-linux-${TARGETARCH}.tar.gz', 'helm-v3.12.0-linux-${TARGETARCH}.tar.gz')" && tar -xvf helm-v3.12.0-linux-${TARGETARCH}.tar.gz && chmod +x linux-${TARGETARCH}/helm && mv linux-${TARGETARCH}/helm /usr/local/bin/helm && rm -rf /tmp/* +COPY charts/gitops-runtime /chart +RUN helm dependency update /chart +COPY scripts/private-registry-utils/python-requirements.txt /scripts/python-requirements.txt +RUN pip3 install -r /scripts/python-requirements.txt +COPY scripts/private-registry-utils /scripts +RUN chmod -R +x /scripts +WORKDIR /scripts +# Output calculated values and filter image values +RUN ./output-calculated-values.sh ./all-values.yaml && python3 ./helper-scripts/yaml-filter.py all-values.yaml image.repository,image.registry,image.tag,argo-events.configs.nats.versions,argo-events.configs.jetstream.versions > all-image-values.yaml +ENTRYPOINT ["python3", "private-registry-utils.py", "all-image-values.yaml"] diff --git a/scripts/private-registry-utils/README.md b/scripts/private-registry-utils/README.md new file mode 100644 index 00000000..eb57de50 --- /dev/null +++ b/scripts/private-registry-utils/README.md @@ -0,0 +1,15 @@ +Utilities to assist with image mirroring to private registries + +## How it works? + +1. The all calculated values are outputed using output-calculated-values.sh. The script contains a special template that handles image values. Specifically it derives tags for images that don't have explicit tags sepcified from the subchart appverstion. +2. Those values are then filtered using the helper script yaml-filter.py to filter only the values that contain images. +3. image-values-utils.py then uses the output of the previous steps and can generate: + 1. A list of all images + 2. Values files with and without tags including a custom registry for each image. + 3. A csv file with source and target image names (can help with image mirroring). + +## Execution +1. Build the image with buildcontext being the root of the repo `docker build -f scripts/private-registry-utils/Dockerfile -t .` For example: `docker build -f scripts/private-registry-utils/Dockerfile -t gitops-runtime-priv-reg .` +2. Execute with: `docker run -v :/output -it ` for example: `docker run -v /tmp/output:/output -it gitops-runtime-priv-reg myregisry.example.com` +3. See the generated files in local output folder diff --git a/scripts/private-registry-utils/helper-scripts/yaml-filter.py b/scripts/private-registry-utils/helper-scripts/yaml-filter.py new file mode 100755 index 00000000..1e9b9a34 --- /dev/null +++ b/scripts/private-registry-utils/helper-scripts/yaml-filter.py @@ -0,0 +1,46 @@ +# Program to convert yaml file to dictionary +import yaml +import sys + +def set_nested_dict_value(nested_dict, path, value): + """Set a value in a nested dictionary using a dot-delimited path.""" + keys = path.split('.') + for key in keys[:-1]: + nested_dict = nested_dict.setdefault(key, {}) + nested_dict[keys[-1]] = value + +def recurse_filter(currValue, filteredDict, filterKeyPathList, currentPath): + bMatched = False + for filterKeyPath in filterKeyPathList: + if currentPath.endswith(filterKeyPath) and currValue: + bMatched = True + if bMatched == True: + set_nested_dict_value(filteredDict,currentPath,currValue) + elif type(currValue) is dict: + for key in currValue.keys(): + if not currentPath: + path = key + else: + path = currentPath + "." + key + recurse_filter(currValue[key], filteredDict, filterKeyPathList, path) + else: + return + +def main(yamlFilepath, filterKeys): + # Open yaml + with open(yamlFilepath, 'r') as stream: + try: + d=yaml.safe_load(stream) + except yaml.YAMLError as e: + print(e) + + filteredDict = {} + lstFilterKeys = filterKeys.split(",") + recurse_filter(d, filteredDict, lstFilterKeys, "") + print(yaml.dump(filteredDict)) + +if __name__ == "__main__": + if len(sys.argv) != 3: + raise SyntaxError("Wrong number of arguments. Usage: filter-values.py ") + else: + main(sys.argv[1], sys.argv[2]) \ No newline at end of file diff --git a/scripts/output-calculated-values.sh b/scripts/private-registry-utils/output-calculated-values.sh similarity index 96% rename from scripts/output-calculated-values.sh rename to scripts/private-registry-utils/output-calculated-values.sh index cfd12040..91a3c918 100755 --- a/scripts/output-calculated-values.sh +++ b/scripts/private-registry-utils/output-calculated-values.sh @@ -1,6 +1,6 @@ #!/bin/bash MYDIR=$(dirname $0) -CHARTDIR="${MYDIR}/../charts/gitops-runtime" +CHARTDIR="/chart" VALUESFILE="${CHARTDIR}/ci/values-all-images.yaml" OUTPUTFILE=$1 # This template prints all values and also sets tags for all images with non-empty repository value, where the tag is empty and should be derived from the appVersion of the subchart. @@ -47,6 +47,5 @@ END ) echo -e "$ALL_VALUES_TEMPLATE" > $CHARTDIR/templates/all-values.yaml -helm dependency update $CHARTDIR helm template --values $VALUESFILE --set getImages=true --show-only templates/all-values.yaml $CHARTDIR > $OUTPUTFILE rm $CHARTDIR/templates/all-values.yaml \ No newline at end of file diff --git a/scripts/private-registry-utils/private-registry-utils.py b/scripts/private-registry-utils/private-registry-utils.py new file mode 100644 index 00000000..edb9cd55 --- /dev/null +++ b/scripts/private-registry-utils/private-registry-utils.py @@ -0,0 +1,150 @@ +import argparse +import yaml +import sys +import re +import csv + +DEFAULT_REGISTRY_URL = "registry.example.com" + +def remove_duplicates(list_of_dicts, key): + seen = set() + deduplicated_list = [] + + for d in list_of_dicts: + if d[key] not in seen: + deduplicated_list.append(d) + seen.add(d[key]) + + return deduplicated_list + +def replace_registry_in_image(image_string, new_registry): + if '/' in image_string: + parts = image_string.split('/') + if len(parts) >= 2: + parts[0] = new_registry + return '/'.join(parts) + else: + return new_registry + '/' + image_string + +# Try to identify whether a string is a docker image +def is_docker_image(image_string): + pattern = r'^[a-zA-Z0-9/_-]+:[a-zA-Z0-9_.-]+$' + return bool(re.match(pattern, image_string)) + + +def recurse_replace_registry(currValue,new_registry): + if type(currValue) is dict: + for key in currValue.keys(): + if key == "registry": + currValue[key]=new_registry + elif key == "repository" and "registry" not in currValue: + currValue[key] = replace_registry_in_image(currValue[key],new_registry) + elif type(currValue[key]) is str: + if is_docker_image(currValue[key]): + currValue[key] = replace_registry_in_image(currValue[key],new_registry) + else: + recurse_replace_registry(currValue[key],new_registry) + elif type(currValue) is list: + for item in currValue: + recurse_replace_registry(item,new_registry) + +def recurse_remove_tags(currValue): + if type(currValue) is dict: + if "tag" in currValue: + currValue.pop("tag") + else: + for key in currValue.keys(): + recurse_remove_tags(currValue[key]) + elif type(currValue) is list: + for item in currValue: + recurse_remove_tags(item) + + +def recurse_get_source_target(currValue,new_registry,lstSourceTarget): + sourceImage = "" + if type(currValue) is dict: + for key in currValue.keys(): + if key == "registry": + sourceImage += currValue[key] + "/" + if key == "repository": + sourceImage += currValue[key] + if key == "tag": + sourceImage += ":" + currValue[key] + + elif type(currValue[key]) is str: + if is_docker_image(currValue[key]): + sourceImage = currValue[key] + + recurse_get_source_target(currValue[key],new_registry,lstSourceTarget) + + if len(sourceImage) > 0: + lstSourceTarget.append({"source_image": sourceImage, "target_image": replace_registry_in_image(sourceImage,new_registry)}) + + + elif type(currValue) is list: + for item in currValue: + recurse_get_source_target(item,new_registry,lstSourceTarget) + +def generate_file_from_field(list_of_dicts, field_name, output_file): + with open(output_file, 'w+') as file: + for d in list_of_dicts: + field_value = d.get(field_name) + if field_value: + file.write(str(field_value) + '\n') + +def generate_image_values(dictImageValues,outputDir): + + with open(f"{outputDir}/values-images-with-tags.yaml", 'w+') as file: + yaml.dump(dictImageValues, file) + + recurse_remove_tags(dictImageValues) + + with open(f"{outputDir}/values-images-no-tags.yaml", 'w+') as file: + yaml.dump(dictImageValues, file) + +def generate_image_list(): + # Code for generating image list + print("Generating image list") + +def generate_mirror_csv(lstSourceTarget, outputDir): + + fields = ['source_image', 'target_image'] + + with open(f"{outputDir}/image-mirror.csv", 'w+') as csvfile: + writer = csv.DictWriter(csvfile, fieldnames = fields) + writer.writeheader() + writer.writerows(lstSourceTarget) + +def main(): + + parser = argparse.ArgumentParser(description="Codefresh gitops runtime - private registry utils") + parser.add_argument("images_values_file", help="Input values.yaml file") + parser.add_argument("private_registry_url", nargs="?", default=DEFAULT_REGISTRY_URL, help="Private Registry URL") + parser.add_argument("--output-dir", help="Output directory",default="/output") + parser.add_argument("--action", choices=["generate-image-values", "generate-image-list", "generate-mirror-csv"], help="Action to execute") + args = parser.parse_args() + + # Open yaml + with open(args.images_values_file, 'r') as stream: + try: + dictImageValues=yaml.safe_load(stream) + except yaml.YAMLError as e: + print(e) + + lstSourceTarget = [] + recurse_get_source_target(dictImageValues,args.private_registry_url,lstSourceTarget) + lstSourceTarget = remove_duplicates(lstSourceTarget, "source_image") + recurse_replace_registry(dictImageValues,args.private_registry_url) + + + if args.action == "generate-mirror-csv" or args.action is None: + generate_mirror_csv(lstSourceTarget,args.output_dir) + + if args.action == "generate-image-list" or args.action is None: + generate_file_from_field(lstSourceTarget,"source_image", f"{args.output_dir}/image-list.txt") + + if args.action == "generate-image-values" or args.action is None: + generate_image_values(dictImageValues,args.output_dir) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/scripts/private-registry-utils/python-requirements.txt b/scripts/private-registry-utils/python-requirements.txt new file mode 100644 index 00000000..a3db8990 --- /dev/null +++ b/scripts/private-registry-utils/python-requirements.txt @@ -0,0 +1 @@ +PyYAML==6.0 \ No newline at end of file From 91bf910126fd6697125dbe4818ed41b7abefedaa Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Mon, 29 May 2023 14:33:46 +0300 Subject: [PATCH 05/18] add airgapped scripts --- scripts/private-registry-utils/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/private-registry-utils/README.md b/scripts/private-registry-utils/README.md index eb57de50..52f09558 100644 --- a/scripts/private-registry-utils/README.md +++ b/scripts/private-registry-utils/README.md @@ -2,14 +2,14 @@ Utilities to assist with image mirroring to private registries ## How it works? -1. The all calculated values are outputed using output-calculated-values.sh. The script contains a special template that handles image values. Specifically it derives tags for images that don't have explicit tags sepcified from the subchart appverstion. +1. All calculated values are outputed using output-calculated-values.sh. The script contains a special template that handles image values. Specifically it derives tags for images that don't have explicit tags sepcified from the subchart appVersion. 2. Those values are then filtered using the helper script yaml-filter.py to filter only the values that contain images. 3. image-values-utils.py then uses the output of the previous steps and can generate: 1. A list of all images 2. Values files with and without tags including a custom registry for each image. 3. A csv file with source and target image names (can help with image mirroring). -## Execution +## Usage 1. Build the image with buildcontext being the root of the repo `docker build -f scripts/private-registry-utils/Dockerfile -t .` For example: `docker build -f scripts/private-registry-utils/Dockerfile -t gitops-runtime-priv-reg .` 2. Execute with: `docker run -v :/output -it ` for example: `docker run -v /tmp/output:/output -it gitops-runtime-priv-reg myregisry.example.com` 3. See the generated files in local output folder From 35a7ca63beca31c5b26489dcc8340043755c0340 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Mon, 29 May 2023 14:48:28 +0300 Subject: [PATCH 06/18] adjust installer image --- installer-image/Dockerfile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/installer-image/Dockerfile b/installer-image/Dockerfile index f08a922c..2383e54f 100644 --- a/installer-image/Dockerfile +++ b/installer-image/Dockerfile @@ -1,10 +1,9 @@ FROM --platform=$BUILDPLATFORM debian:bullseye-slim -RUN apt-get update -y && apt-get install curl -y +RUN apt-get update -y && apt-get install wget -y ARG CF_CLI_VERSION=v0.1.25 ARG KUBECTL_VERSION=v1.26.0 -ARG ARGOCD_VERSION=v2.4.15 ARG TARGETARCH RUN echo "${TARGETARCH}" -RUN curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/${CF_CLI_VERSION}/cf-linux-${TARGETARCH}.tar.gz | tar zx && mv ./cf-linux-${TARGETARCH} /usr/local/bin/cf -RUN curl -LO https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl && chmod +x kubectl && mv ./kubectl /usr/local/bin/kubectl -RUN curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/${ARGOCD_VERSION}/argocd-linux-${TARGETARCH} && chmod +x /usr/local/bin/argocd \ No newline at end of file +RUN wget https://github.com/codefresh-io/cli-v2/releases/download/${CF_CLI_VERSION}/cf-linux-${TARGETARCH}.tar.gz && tar -xf cf-linux-${TARGETARCH}.tar.gz && mv ./cf-linux-${TARGETARCH} /usr/local/bin/cf +RUN wget https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl && chmod +x kubectl && mv ./kubectl /usr/local/bin/kubectl +USER 1000 \ No newline at end of file From 28a1fbdcaefd3446a724782c2ef47f5b966848e2 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Mon, 29 May 2023 17:14:00 +0300 Subject: [PATCH 07/18] blah --- charts/gitops-runtime/Chart.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/charts/gitops-runtime/Chart.yaml b/charts/gitops-runtime/Chart.yaml index ce12596a..ece2847e 100644 --- a/charts/gitops-runtime/Chart.yaml +++ b/charts/gitops-runtime/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 appVersion: 0.1.29 description: A Helm chart for Codefresh gitops runtime -name: gitops-runtime -version: 0.2.6-alpha +name: gitops-runtime-sandbox +version: 0.2.21-alpha home: https://github.com/codefresh-io/gitops-runtime-helm icon: https://avatars1.githubusercontent.com/u/11412079?v=3 keywords: @@ -16,9 +16,7 @@ annotations: artifacthub.io/prerelease: "true" artifacthub.io/changes: | - kind: changed - description: updated `argo-cd` to `v2.6.0-cap-CR-18430-del-app` (fix application/git-source deletion) - - kind: fixed - description: Fix delete runtime hook when using custom CA + description: Add private registry utils dependencies: - name: argo-cd repository: https://codefresh-io.github.io/argo-helm From 44e2d918ac6c60128cf6f7d17680880535d99176 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Mon, 29 May 2023 17:28:03 +0300 Subject: [PATCH 08/18] revert accidental change --- charts/gitops-runtime/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitops-runtime/Chart.yaml b/charts/gitops-runtime/Chart.yaml index ece2847e..54d194cc 100644 --- a/charts/gitops-runtime/Chart.yaml +++ b/charts/gitops-runtime/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: 0.1.29 description: A Helm chart for Codefresh gitops runtime name: gitops-runtime-sandbox -version: 0.2.21-alpha +version: 0.2.6-alpha home: https://github.com/codefresh-io/gitops-runtime-helm icon: https://avatars1.githubusercontent.com/u/11412079?v=3 keywords: From 8b2c90e3658e4c3a37daa6f1a4b4a46bf1fa97c5 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Mon, 29 May 2023 17:28:14 +0300 Subject: [PATCH 09/18] revert accidental change --- charts/gitops-runtime/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitops-runtime/Chart.yaml b/charts/gitops-runtime/Chart.yaml index 54d194cc..6bab5174 100644 --- a/charts/gitops-runtime/Chart.yaml +++ b/charts/gitops-runtime/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 appVersion: 0.1.29 description: A Helm chart for Codefresh gitops runtime -name: gitops-runtime-sandbox +name: gitops-runtime version: 0.2.6-alpha home: https://github.com/codefresh-io/gitops-runtime-helm icon: https://avatars1.githubusercontent.com/u/11412079?v=3 From c1b1d8b415e83335888c38dc99b09c6bd532cf66 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Mon, 29 May 2023 18:56:26 +0300 Subject: [PATCH 10/18] bring back curl --- installer-image/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer-image/Dockerfile b/installer-image/Dockerfile index 2383e54f..4751cc5e 100644 --- a/installer-image/Dockerfile +++ b/installer-image/Dockerfile @@ -1,5 +1,5 @@ FROM --platform=$BUILDPLATFORM debian:bullseye-slim -RUN apt-get update -y && apt-get install wget -y +RUN apt-get update -y && apt-get install curl wget -y ARG CF_CLI_VERSION=v0.1.25 ARG KUBECTL_VERSION=v1.26.0 ARG TARGETARCH From 37f7f726d65ec3250206032149e288b69fc640bb Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Tue, 30 May 2023 08:55:10 +0300 Subject: [PATCH 11/18] add instructions for private registry utils in the readme --- charts/gitops-runtime/README.md | 41 +++++------ charts/gitops-runtime/README.md.gotmpl | 28 +++++++ scripts/helper-scripts/replace-registry.py | 85 ---------------------- scripts/helper-scripts/yaml-filter.py | 46 ------------ 4 files changed, 48 insertions(+), 152 deletions(-) create mode 100644 charts/gitops-runtime/README.md.gotmpl delete mode 100644 scripts/helper-scripts/replace-registry.py delete mode 100755 scripts/helper-scripts/yaml-filter.py diff --git a/charts/gitops-runtime/README.md b/charts/gitops-runtime/README.md index 8c57e8e7..4d188a79 100644 --- a/charts/gitops-runtime/README.md +++ b/charts/gitops-runtime/README.md @@ -1,27 +1,29 @@ -# gitops-runtime - +## Codefresh gitops runtime Helm chart ![Version: 0.2.6-alpha](https://img.shields.io/badge/Version-0.2.6--alpha-informational?style=flat-square) ![AppVersion: 0.1.29](https://img.shields.io/badge/AppVersion-0.1.29-informational?style=flat-square) -A Helm chart for Codefresh gitops runtime - -**Homepage:** +## Codefresh official documentation: +Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/ -## Maintainers +## Using with private registries +As the chart is comprised of multiple components and images - some belonging to dependency charts with varying values schemas making overriding all values containing images rather difficult, +we have created a utility to help with that. The utility will create values files with the correct structure with the private registry included. +You can then provide those when installing the chart to override all images. +The utility will also create other files with data that will help you identify and correctly mirror all the images. -| Name | Email | Url | -| ---- | ------ | --- | -| codefresh | | | +### Usage +The utility is packaged in a container image. Below are instructions on executing the utility using Docker: -## Requirements +``` +docker run -v :/output quay.io/codefresh/gitops-runtime-private-registry-utils:0.2.6-alpha +``` +output_dir - is a local directory where the utility will output files.
+local_registry - is your local registry where you want to mirror the images to -| Repository | Name | Version | -|------------|------|---------| -| https://bitnami-labs.github.io/sealed-secrets/ | sealed-secrets | 2.7.3 | -| https://chartmuseum.codefresh.io/codefresh-tunnel-client | tunnel-client(codefresh-tunnel-client) | 0.1.12 | -| https://codefresh-io.github.io/argo-helm | argo-cd | 5.29.2-cap-CR-18430 | -| https://codefresh-io.github.io/argo-helm | argo-events | 2.0.5-1-cf-init | -| https://codefresh-io.github.io/argo-helm | argo-rollouts | 2.22.1-1-cap-sw | -| https://codefresh-io.github.io/argo-helm | argo-workflows | 0.22.9-1-CR-17426 | +The utility will output 4 files into the folder: +1. `image-list.txt` - is the list of all images used in this version of the chart. Those are the images that you need to mirror. +2. `image-mirror.csv` - is a csv file with 2 fields - source_image and target_image. source_image is the image with the original registry and target_image is the image with the private registry. Can be used as an input file for a mirroring script. +3. `values-images-no-tags.yaml` - a values file with all image values with the private registry **excluding tags**. If provided through --values to helm install/upgrade command - it will override all images to use the private registry. +4. `values-images-with-tags.yaml` - The same as 3 but with tags **included**. ## Values @@ -184,6 +186,3 @@ A Helm chart for Codefresh gitops runtime | tunnel-client | object | `{"enabled":true,"libraryMode":true,"tunnelServer":{"host":"register-tunnels.cf-cd.com","subdomainHost":"tunnels.cf-cd.com"}}` | Tunnel based runtime. Not supported for on-prem platform. In on-prem use ingress based runtimes. | | tunnel-client.enabled | bool | `true` | Will only be used if global.runtime.ingress.enabled = false | | tunnel-client.libraryMode | bool | `true` | Do not change this value! Breaks chart logic | - ----------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.9.1](https://github.com/norwoodj/helm-docs/releases/v1.9.1) diff --git a/charts/gitops-runtime/README.md.gotmpl b/charts/gitops-runtime/README.md.gotmpl new file mode 100644 index 00000000..e29705f1 --- /dev/null +++ b/charts/gitops-runtime/README.md.gotmpl @@ -0,0 +1,28 @@ +## Codefresh gitops runtime Helm chart +{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} + +## Codefresh official documentation: +Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/ + +## Using with private registries +As the chart is comprised of multiple components and images - some belonging to dependency charts with varying values schemas making overriding all values containing images rather difficult, +we have created a utility to help with that. The utility will create values files with the correct structure with the private registry included. +You can then provide those when installing the chart to override all images. +The utility will also create other files with data that will help you identify and correctly mirror all the images. + +### Usage +The utility is packaged in a container image. Below are instructions on executing the utility using Docker: + +``` +docker run -v :/output quay.io/codefresh/gitops-runtime-private-registry-utils:{{ template "chart.version" . }} +``` +output_dir - is a local directory where the utility will output files.
+local_registry - is your local registry where you want to mirror the images to + +The utility will output 4 files into the folder: +1. `image-list.txt` - is the list of all images used in this version of the chart. Those are the images that you need to mirror. +2. `image-mirror.csv` - is a csv file with 2 fields - source_image and target_image. source_image is the image with the original registry and target_image is the image with the private registry. Can be used as an input file for a mirroring script. +3. `values-images-no-tags.yaml` - a values file with all image values with the private registry **excluding tags**. If provided through --values to helm install/upgrade command - it will override all images to use the private registry. +4. `values-images-with-tags.yaml` - The same as 3 but with tags **included**. + +{{ template "chart.valuesSection" . }} diff --git a/scripts/helper-scripts/replace-registry.py b/scripts/helper-scripts/replace-registry.py deleted file mode 100644 index 1402b4b0..00000000 --- a/scripts/helper-scripts/replace-registry.py +++ /dev/null @@ -1,85 +0,0 @@ -import yaml -import sys -import re -import csv - - - -def replace_registry_in_image(image_string, new_registry): - if '/' in image_string: - parts = image_string.split('/') - if len(parts) >= 2: - parts[0] = new_registry - return '/'.join(parts) - else: - return new_registry + '/' + image_string - -# Try to identify whether a string is a docker image -def is_docker_image(image_string): - pattern = r'^[a-zA-Z0-9/_-]+:[a-zA-Z0-9_.-]+$' - return bool(re.match(pattern, image_string)) - - -def recurse_replace_registry(currValue,new_registry): - if type(currValue) is dict: - for key in currValue.keys(): - if key == "registry": - currValue[key]=new_registry - elif key == "repository" and "registry" not in currValue: - currValue[key] = replace_registry_in_image(currValue[key],new_registry) - elif type(currValue[key]) is str: - if is_docker_image(currValue[key]): - currValue[key] = replace_registry_in_image(currValue[key],new_registry) - else: - recurse_replace_registry(currValue[key],new_registry) - elif type(currValue) is list: - for item in currValue: - recurse_replace_registry(item,new_registry) - -def recurse_get_source_target(currValue,new_registry,lstSourceTarget): - oldImage = "" - if type(currValue) is dict: - for key in currValue.keys(): - if key == "registry": - oldImage += currValue[key] + "/" - if key == "repository": - oldImage += currValue[key] - if key == "tag": - oldImage += ":" + currValue[key] - - elif type(currValue[key]) is str: - if is_docker_image(currValue[key]): - oldImage = currValue[key] - - recurse_get_source_target(currValue[key],new_registry,lstSourceTarget) - - if len(oldImage) > 0: - lstSourceTarget.append({"source_image": oldImage, "target_image": replace_registry_in_image(oldImage,new_registry)}) - - - elif type(currValue) is list: - for item in currValue: - recurse_get_source_target(item,new_registry,lstSourceTarget) - - -def main(yamlFilepath, newRegistry): - # Open yaml - with open(yamlFilepath, 'r') as stream: - try: - d=yaml.safe_load(stream) - except yaml.YAMLError as e: - print(e) - - lstSourceTarget = [] - recurse_get_source_target(d,newRegistry,lstSourceTarget) - print(yaml.dump(lstSourceTarget)) - #recurse_replace_registry(d,newRegistry) - #print(yaml.dump(d)) - - # - -if __name__ == "__main__": - if len(sys.argv) != 3: - raise SyntaxError("Wrong number of arguments. Usage: replace-registry.py ") - else: - main(sys.argv[1], sys.argv[2]) \ No newline at end of file From 9602fa5d5607176e349f658381bd65e37928e7e3 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Tue, 30 May 2023 08:55:33 +0300 Subject: [PATCH 12/18] add instructions for private registry utils in the readme --- charts/gitops-runtime/README.md.gotmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitops-runtime/README.md.gotmpl b/charts/gitops-runtime/README.md.gotmpl index e29705f1..d35292e6 100644 --- a/charts/gitops-runtime/README.md.gotmpl +++ b/charts/gitops-runtime/README.md.gotmpl @@ -1,4 +1,4 @@ -## Codefresh gitops runtime Helm chart +## Codefresh gitops runtime {{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} ## Codefresh official documentation: From ec58b253e4dd5394942ed7a33c7c73f8e4e3884d Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Tue, 30 May 2023 09:00:27 +0300 Subject: [PATCH 13/18] update changelog --- charts/gitops-runtime/Chart.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/charts/gitops-runtime/Chart.yaml b/charts/gitops-runtime/Chart.yaml index 6bab5174..9e361a7b 100644 --- a/charts/gitops-runtime/Chart.yaml +++ b/charts/gitops-runtime/Chart.yaml @@ -16,7 +16,9 @@ annotations: artifacthub.io/prerelease: "true" artifacthub.io/changes: | - kind: changed - description: Add private registry utils + description: Add private registry utililies + - kind: changed + description: Installer image for hooks now runs rootless dependencies: - name: argo-cd repository: https://codefresh-io.github.io/argo-helm From 8fe06610537f779adcd0001c06e12fdc08927875 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Tue, 30 May 2023 15:24:03 +0300 Subject: [PATCH 14/18] update readme --- charts/gitops-runtime/Chart.yaml | 2 +- charts/gitops-runtime/README.md | 12 ++++++------ charts/gitops-runtime/README.md.gotmpl | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/charts/gitops-runtime/Chart.yaml b/charts/gitops-runtime/Chart.yaml index 9e361a7b..425ba4c1 100644 --- a/charts/gitops-runtime/Chart.yaml +++ b/charts/gitops-runtime/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: 0.1.29 description: A Helm chart for Codefresh gitops runtime name: gitops-runtime -version: 0.2.6-alpha +version: 0.2.7-alpha home: https://github.com/codefresh-io/gitops-runtime-helm icon: https://avatars1.githubusercontent.com/u/11412079?v=3 keywords: diff --git a/charts/gitops-runtime/README.md b/charts/gitops-runtime/README.md index 4d188a79..8fc407df 100644 --- a/charts/gitops-runtime/README.md +++ b/charts/gitops-runtime/README.md @@ -1,20 +1,20 @@ -## Codefresh gitops runtime Helm chart -![Version: 0.2.6-alpha](https://img.shields.io/badge/Version-0.2.6--alpha-informational?style=flat-square) ![AppVersion: 0.1.29](https://img.shields.io/badge/AppVersion-0.1.29-informational?style=flat-square) +## Codefresh gitops runtime +![Version: 0.2.7-alpha](https://img.shields.io/badge/Version-0.2.7--alpha-informational?style=flat-square) ![AppVersion: 0.1.29](https://img.shields.io/badge/AppVersion-0.1.29-informational?style=flat-square) ## Codefresh official documentation: Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/ ## Using with private registries -As the chart is comprised of multiple components and images - some belonging to dependency charts with varying values schemas making overriding all values containing images rather difficult, -we have created a utility to help with that. The utility will create values files with the correct structure with the private registry included. -You can then provide those when installing the chart to override all images. +The gitops runtime is comprised of multiple subcharts and container images. Subcharts also vary in values structure, making it difficult to override image specific values to use private registries. +To assist with that issue we have created a helper utility. The utility will create values files in the correct structure, overriding the registry for each image. +You can then provide those values files when installing the chart to override all images. The utility will also create other files with data that will help you identify and correctly mirror all the images. ### Usage The utility is packaged in a container image. Below are instructions on executing the utility using Docker: ``` -docker run -v :/output quay.io/codefresh/gitops-runtime-private-registry-utils:0.2.6-alpha +docker run -v :/output quay.io/codefresh/gitops-runtime-private-registry-utils:0.2.7-alpha ``` output_dir - is a local directory where the utility will output files.
local_registry - is your local registry where you want to mirror the images to diff --git a/charts/gitops-runtime/README.md.gotmpl b/charts/gitops-runtime/README.md.gotmpl index d35292e6..f2c10c18 100644 --- a/charts/gitops-runtime/README.md.gotmpl +++ b/charts/gitops-runtime/README.md.gotmpl @@ -5,9 +5,9 @@ Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/ ## Using with private registries -As the chart is comprised of multiple components and images - some belonging to dependency charts with varying values schemas making overriding all values containing images rather difficult, -we have created a utility to help with that. The utility will create values files with the correct structure with the private registry included. -You can then provide those when installing the chart to override all images. +The gitops runtime is comprised of multiple subcharts and container images. Subcharts also vary in values structure, making it difficult to override image specific values to use private registries. +To assist with that issue we have created a helper utility. The utility will create values files in the correct structure, overriding the registry for each image. +You can then provide those values files when installing the chart to override all images. The utility will also create other files with data that will help you identify and correctly mirror all the images. ### Usage From e3059ed991f215de394ed633a9f6f65ae9142646 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Tue, 30 May 2023 15:48:18 +0300 Subject: [PATCH 15/18] adjust readme --- charts/gitops-runtime/README.md | 5 +++-- charts/gitops-runtime/README.md.gotmpl | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/charts/gitops-runtime/README.md b/charts/gitops-runtime/README.md index 8fc407df..f7ad5013 100644 --- a/charts/gitops-runtime/README.md +++ b/charts/gitops-runtime/README.md @@ -4,13 +4,14 @@ ## Codefresh official documentation: Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/ -## Using with private registries +## Using with private registries - Helper utility The gitops runtime is comprised of multiple subcharts and container images. Subcharts also vary in values structure, making it difficult to override image specific values to use private registries. To assist with that issue we have created a helper utility. The utility will create values files in the correct structure, overriding the registry for each image. You can then provide those values files when installing the chart to override all images. The utility will also create other files with data that will help you identify and correctly mirror all the images. -### Usage +#### Usage: + The utility is packaged in a container image. Below are instructions on executing the utility using Docker: ``` diff --git a/charts/gitops-runtime/README.md.gotmpl b/charts/gitops-runtime/README.md.gotmpl index f2c10c18..af57fc56 100644 --- a/charts/gitops-runtime/README.md.gotmpl +++ b/charts/gitops-runtime/README.md.gotmpl @@ -4,13 +4,14 @@ ## Codefresh official documentation: Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/ -## Using with private registries +## Using with private registries - Helper utility The gitops runtime is comprised of multiple subcharts and container images. Subcharts also vary in values structure, making it difficult to override image specific values to use private registries. To assist with that issue we have created a helper utility. The utility will create values files in the correct structure, overriding the registry for each image. You can then provide those values files when installing the chart to override all images. The utility will also create other files with data that will help you identify and correctly mirror all the images. -### Usage +#### Usage + The utility is packaged in a container image. Below are instructions on executing the utility using Docker: ``` From cfd4a990f8d0bf0b042cc3a69fdb3de284a4d13a Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Tue, 30 May 2023 15:49:24 +0300 Subject: [PATCH 16/18] adjust readme --- charts/gitops-runtime/README.md | 6 +++--- charts/gitops-runtime/README.md.gotmpl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/charts/gitops-runtime/README.md b/charts/gitops-runtime/README.md index f7ad5013..94d60aae 100644 --- a/charts/gitops-runtime/README.md +++ b/charts/gitops-runtime/README.md @@ -10,15 +10,15 @@ To assist with that issue we have created a helper utility. The utility will cre You can then provide those values files when installing the chart to override all images. The utility will also create other files with data that will help you identify and correctly mirror all the images. -#### Usage: +#### Usage The utility is packaged in a container image. Below are instructions on executing the utility using Docker: ``` docker run -v :/output quay.io/codefresh/gitops-runtime-private-registry-utils:0.2.7-alpha ``` -output_dir - is a local directory where the utility will output files.
-local_registry - is your local registry where you want to mirror the images to +`output_dir` - is a local directory where the utility will output files.
+`local_registry` - is your local registry where you want to mirror the images to The utility will output 4 files into the folder: 1. `image-list.txt` - is the list of all images used in this version of the chart. Those are the images that you need to mirror. diff --git a/charts/gitops-runtime/README.md.gotmpl b/charts/gitops-runtime/README.md.gotmpl index af57fc56..670e2f8d 100644 --- a/charts/gitops-runtime/README.md.gotmpl +++ b/charts/gitops-runtime/README.md.gotmpl @@ -17,8 +17,8 @@ The utility is packaged in a container image. Below are instructions on executin ``` docker run -v :/output quay.io/codefresh/gitops-runtime-private-registry-utils:{{ template "chart.version" . }} ``` -output_dir - is a local directory where the utility will output files.
-local_registry - is your local registry where you want to mirror the images to +`output_dir` - is a local directory where the utility will output files.
+`local_registry` - is your local registry where you want to mirror the images to The utility will output 4 files into the folder: 1. `image-list.txt` - is the list of all images used in this version of the chart. Those are the images that you need to mirror. From 34ded584f044c72ba89075a36cb675e994cffde6 Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Tue, 30 May 2023 16:03:59 +0300 Subject: [PATCH 17/18] incorporate changes from Nima --- charts/gitops-runtime/README.md | 8 ++++---- charts/gitops-runtime/README.md.gotmpl | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/charts/gitops-runtime/README.md b/charts/gitops-runtime/README.md index 94d60aae..389b7c6a 100644 --- a/charts/gitops-runtime/README.md +++ b/charts/gitops-runtime/README.md @@ -5,10 +5,10 @@ Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/ ## Using with private registries - Helper utility -The gitops runtime is comprised of multiple subcharts and container images. Subcharts also vary in values structure, making it difficult to override image specific values to use private registries. -To assist with that issue we have created a helper utility. The utility will create values files in the correct structure, overriding the registry for each image. -You can then provide those values files when installing the chart to override all images. -The utility will also create other files with data that will help you identify and correctly mirror all the images. +The GitOps Runtime comprises multiple subcharts and container images. Subcharts also vary in values structure, making it difficult to override image specific values to use private registries. +We have created a helper utility to resolve this issue: +- The utility create values files in the correct structure, overriding the registry for each image. When installing the chart, you can then provide those values files to override all images. +- The utility also creates other files with data to help you identify and correctly mirror all the images. #### Usage diff --git a/charts/gitops-runtime/README.md.gotmpl b/charts/gitops-runtime/README.md.gotmpl index 670e2f8d..71d07799 100644 --- a/charts/gitops-runtime/README.md.gotmpl +++ b/charts/gitops-runtime/README.md.gotmpl @@ -5,17 +5,17 @@ Prior to running the installation please see the official documentation at: https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation/ ## Using with private registries - Helper utility -The gitops runtime is comprised of multiple subcharts and container images. Subcharts also vary in values structure, making it difficult to override image specific values to use private registries. -To assist with that issue we have created a helper utility. The utility will create values files in the correct structure, overriding the registry for each image. -You can then provide those values files when installing the chart to override all images. -The utility will also create other files with data that will help you identify and correctly mirror all the images. +The GitOps Runtime comprises multiple subcharts and container images. Subcharts also vary in values structure, making it difficult to override image specific values to use private registries. +We have created a helper utility to resolve this issue: +- The utility create values files in the correct structure, overriding the registry for each image. When installing the chart, you can then provide those values files to override all images. +- The utility also creates other files with data to help you identify and correctly mirror all the images. #### Usage The utility is packaged in a container image. Below are instructions on executing the utility using Docker: ``` -docker run -v :/output quay.io/codefresh/gitops-runtime-private-registry-utils:{{ template "chart.version" . }} +docker run -v :/output quay.io/codefresh/gitops-runtime-private-registry-utils:0.2.7-alpha ``` `output_dir` - is a local directory where the utility will output files.
`local_registry` - is your local registry where you want to mirror the images to From be2dce1bc55cce98fedbff983d4d79eb37e0056d Mon Sep 17 00:00:00 2001 From: Ilia Medvedev Date: Tue, 30 May 2023 16:51:06 +0300 Subject: [PATCH 18/18] rootless fix --- installer-image/Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/installer-image/Dockerfile b/installer-image/Dockerfile index 4751cc5e..3b7a71eb 100644 --- a/installer-image/Dockerfile +++ b/installer-image/Dockerfile @@ -1,9 +1,8 @@ FROM --platform=$BUILDPLATFORM debian:bullseye-slim -RUN apt-get update -y && apt-get install curl wget -y +RUN apt-get update -y && apt-get install curl -y ARG CF_CLI_VERSION=v0.1.25 ARG KUBECTL_VERSION=v1.26.0 ARG TARGETARCH -RUN echo "${TARGETARCH}" -RUN wget https://github.com/codefresh-io/cli-v2/releases/download/${CF_CLI_VERSION}/cf-linux-${TARGETARCH}.tar.gz && tar -xf cf-linux-${TARGETARCH}.tar.gz && mv ./cf-linux-${TARGETARCH} /usr/local/bin/cf -RUN wget https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl && chmod +x kubectl && mv ./kubectl /usr/local/bin/kubectl +RUN curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/${CF_CLI_VERSION}/cf-linux-${TARGETARCH}.tar.gz | tar zx && mv ./cf-linux-${TARGETARCH} /usr/local/bin/cf +RUN curl -LO https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl && chmod +x kubectl && mv ./kubectl /usr/local/bin/kubectl USER 1000 \ No newline at end of file