Skip to content

Commit

Permalink
chore: disabled health alert for test-dev
Browse files Browse the repository at this point in the history
Signed-off-by: ashutosh16 <[email protected]>
  • Loading branch information
ashutosh16 committed Oct 2, 2024
1 parent abf3ccf commit f933a3a
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 18 deletions.
66 changes: 51 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,41 @@ and install the configured UI extension. All configuration is provided
as environment variables as part of the init container. Find below the
list of all environment variables that can be configured:

| Env Var | Required? | Default | Description |
|------------------------|-------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| EXTENSION_ENABLED | No | true | If set to false will skip the installation. Noop |
| EXTENSION_URL | Yes | "" | Must be set to a valid URL where the UI extension can be downloaded from. <br>Argo CD API server needs to have network access to this URL. |
| EXTENSION_CHECKSUM_URL | No | "" | Can be set to the file containing the checksum to validate the downloaded<br>extension. Will skip the checksum validation if not provided.<br>Argo CD API server needs to have network access to this URL. |
| MAX_DOWNLOAD_SEC | No | 30 | Total time in seconds allowed to download the extension. |
| EXTENSION_VARS | No | "" | Define variables to be exported in `vars.json` within the extension folder. These variables serve as external configurations for the extension. <br/>The format should be `{key1=value1, key2=value2}`. |
| Env Var | Required? | Default | Description |
|--------------------------|-----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| EXTENSION_NAME | Yes | "" | Extension Name |
| EXTENSION_ENABLED | No | true | If set to false will skip the installation. Noop |
| EXTENSION_URL | Yes | "" | Must be set to a valid URL where the UI extension can be downloaded from. <br>Argo CD API server needs to have network access to this URL. |
| EXTENSION_VERSION | Yes | "" | The version of the extension to be installed. |
| EXTENSION_CHECKSUM_URL | No | "" | Can be set to the file containing the checksum to validate the downloaded<br>extension. Will skip the checksum validation if not provided.<br>Argo CD API server needs to have network access to this URL. |
| MAX_DOWNLOAD_SEC | No | 30 | Total time in seconds allowed to download the extension. |
| EXTENSION_VARS | No | "" | Specifies the variables to be exported in $EXTENSION_VARS_FILE_NAME in json format within the extension folder. These variables serve as external configurations for the extension. <br/>The format should be `{key1=value1, key2=value2}`. |
| EXTENSION_VARS_FILE_NAME | No | 'vars' | Specifies the file name where the variables will be exported. The default is 'vars', but you can provide your own file name, e.g., 'Metrics'. |
| EXTENSION_VARS_FILE_PATH | No | "" | Specifies the path where the variables will be exported. For example, you can use a path like '/tmp/extensions/resources/extension-{EXTENSION_VARS_FILE_NAME}.js'. |




```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-ephemeral-access-global-vars-cm
name: argocd-extension-cm
data:
extension.url: 'http://example.com/extension.tar.gz'
extension.version: 'v0.3.1'
extension.enabled: 'true'
extension.checksum_url: 'http://example.com/extension_checksums.txt'
extension.max_download_sec: '30'
extension.vars: |
{
"key1": "value1",
"key2": "value2"
}
{
"key1": "value1",
"key2": "value2"
}
extension.vars_file_name: 'vars'
extension.vars_file_path: '/tmp/extensions/resources/extension-<EXTENSION_VARS_FILE_NAME>.js'


```

```yaml
Expand All @@ -54,11 +64,37 @@ spec:
# https://quay.io/repository/argoprojlabs/argocd-extension-installer?tab=tags
image: docker.intuit.com/quay-rmt/argoprojlabs/argocd-extension-installer:v0.0.1@sha256:f50fa11a4592f3fcdd5a137dab8ed32067bb779a77a393f179e8a5d96abe1a80
env:
- name: EXTENSION_URL
- name: EXTENSION_NAME
valueFrom:
configMapKeyRef:
key: extension.url
name: argocd-extension-cm
key: extension.name
name: argocd-extension-cm
- name: EXTENSION_URL
valueFrom:
configMapKeyRef:
key: extension.url
name: argocd-extension-cm
- name: EXTENSION_VERSION
valueFrom:
configMapKeyRef:
key: extension.version
name: argocd-extension-cm
## Optional fields
- name: EXTENSION_VARS
valueFrom:
configMapKeyRef:
key: extension.vars
name: argocd-extension-cm
- name: EXTENSION_VARS_FILE_NAME
valueFrom:
configMapKeyRef:
key: extension.vars_file_name
name: argocd-extension-cm
- name: EXTENSION_VARS_FILE_PATH
valueFrom:
configMapKeyRef:
key: extension.vars_file_path
name: argocd-extension-cm
volumeMounts:
- name: extensions
mountPath: /tmp/extensions/
Expand Down
18 changes: 15 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ finalizer() {
}
trap finalizer EXIT


# will download the extension respecting the max download
# duration setting
download_extension() {
Expand Down Expand Up @@ -63,7 +64,15 @@ install_extension() {
mkdir -p /tmp/extensions/resources
fi
cp -Rf resources/* /tmp/extensions/resources/

if [ -n "$vars" ] && [ "$vars" != "null" ]; then
echo "Installing extension vars"
json_vars=$(printf '%s\n' "$vars" | jq -R . | jq -s .)
echo "Exporting extension vars to path $ext_vars_file_path/$ext_vars_file_name.json"
echo "$json_vars" > "$ext_vars_file_path/$ext_vars_file_name.json"
fi
echo "UI extension installed successfully"

}


Expand All @@ -85,14 +94,17 @@ fi
checksum_url="${EXTENSION_CHECKSUM_URL:-}"
download_max_sec="${MAX_DOWNLOAD_SEC:-30}"

vars="${VARS:-}"
echo "$vars" | jq '.' > /tmp/extensions/resources/$ext_filename/vars.json

ext_filename=$(basename -- "$ext_url")
download_dir=`mktemp -d -t extension-XXXXXX`
ext_file="$download_dir/$ext_filename"
if [ -f $ext_file ]; then
rm $ext_file
fi

vars=$(echo "$EXTENSION_VARS" | jq -c '.')
ext_vars_file_name="${EXTENSION_VARS_FILE_NAME:-}"
ext_vars_file_path="${EXTENSION_VARS_FILE_PATH:-}"


download_extension
install_extension

0 comments on commit f933a3a

Please sign in to comment.