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

Initial version of the manual creation of templates in the project #43

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rkd-rafay
Copy link
Contributor

Initial version of the manual creation of templates in the project


# console url
BASE_URL="https://console.stage.rafay.dev"
API_KEY="ra2.aca8acd81c49fa393364ab744574a6d5386ec7f6.46166dc1e95bc8c12670999c93d02d4285bd02b33f1a317a8d737701810dd7b7"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this API KEY.

Pass as environment variable or take is as input.

#"terraform/vcluster/101-caas"
#"terraform/vmware/101-caas-vmware"
#"terraform/waas/101-waas"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we planning to import these templates as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

},
"spec": {
"repositoryType": "GitRepository",
"endpoint": "https://github.com/RafaySystems/rafay-ai-templates",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct endpoint?

#!/bin/bash

# console url
BASE_URL="https://console.stage.rafay.dev"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass as environment variable or take is as input.

# POST request for HUB apis
function make_get_request_new {
local endpoint="$1"
curl -s -X GET -H "Accept */*" -H "X-API-KEY: ${API_KEY}" "${BASE_URL}/${endpoint}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do some error handling for all the API requests to make it easier to debug in case of failure?

yq -o=json $PWD/$folder/setup/templates/$fName.yaml.spec > $PWD/$folder/setup/templates/$fName.json

#echo "Creating configcontext"
#jq --arg repo_name "$REPO_NAME" '(.spec.repositoryOptions.name |= $repo_name) | del(.spec.agents, .spec.contexts)' $PWD/$folder/setup/templates/$fName.json > $PWD/$folder/setup/templates/$fName.json1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleanup


yq -o=json $PWD/$folder/setup/templates/$fName.yaml.spec > $PWD/$folder/setup/templates/$fName.json

#echo "Creating resource"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these commented lines.


yq -o=json $PWD/$folder/setup/templates/$fName.yaml.spec > $PWD/$folder/setup/templates/$fName.json

#echo "Creating environment template"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these commented lines.

printf -- "\033[32m Info: Rafay spec file for %s - SUCCESS \033[0m\n" "$i";
fi

yq -o=json $PWD/$folder/setup/templates/$fName.yaml.spec > $PWD/$folder/setup/templates/$fName.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script requires few external tools, Can we add something like this here as well?
https://github.com/hardik-rafay/envmgr/blob/main/terraform/aws/101-caas-ecs/setup/setup.sh#L9

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


# console url
BASE_URL="https://console.stage.rafay.dev"
API_KEY="<APIKEY>"
Copy link

@swami-rafay swami-rafay Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the utility is purely dependent on the APIKey being given , would'nt it be better to get a confirmation from user who is running this, saying here is the org that templates will be boostrapped and on confirmation continue ?

Copy link
Contributor Author

@rkd-rafay rkd-rafay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added values.yaml to pass the values

#"terraform/vcluster/101-caas"
#"terraform/vmware/101-caas-vmware"
#"terraform/waas/101-waas"
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

printf -- "\033[32m Info: Rafay spec file for %s - SUCCESS \033[0m\n" "$i";
fi

yq -o=json $PWD/$folder/setup/templates/$fName.yaml.spec > $PWD/$folder/setup/templates/$fName.json
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants