Skip to content

Commit

Permalink
Changes to make the RP work
Browse files Browse the repository at this point in the history
Signed-off-by: Alba Hita Catala <[email protected]>
  • Loading branch information
ahitacat committed Jan 22, 2025
1 parent 55c3cbd commit 3f909ab
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 5 deletions.
4 changes: 3 additions & 1 deletion backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ backend:

run:
./aro-hcp-backend --location ${LOCATION} \
--clusters-service-url http://localhost:8000
--clusters-service-url http://localhost:8000 \
--cosmos-name ${DB_NAME} \
--cosmos-url ${DB_URL}
.PHONY: run

clean:
Expand Down
37 changes: 37 additions & 0 deletions demo/testCreateCluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

set -e

source env_vars
source "$(dirname "$0")"/common.sh



arm_x_ms_identity_url_header() {
# Requests directly against the frontend
# need to send a X-Ms-Identity-Url HTTP
# header, which simulates what ARM performs.
# By default we set a dummy value, which is
# enough in the environments where a real
# Managed Identities Data Plane does not
# exist like in the development or integration
# environments. The default can be overwritten
# by providing the environment variable
# ARM_X_MS_IDENTITY_URL when running the script.
: ${ARM_X_MS_IDENTITY_URL:="https://dummyhost.identity.azure.net"}
echo "X-Ms-Identity-Url: ${ARM_X_MS_IDENTITY_URL}"
}

main() {

SUBSCRIPTION_ID=$(az account show --query id -o tsv)
CLUSTER_FILE="cluster.json"


(arm_system_data_header; correlation_headers; arm_x_ms_identity_url_header) | curl -si -X PUT "localhost:8443/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${CUSTOMER_RG_NAME}/providers/Microsoft.RedHatOpenshift/hcpOpenShiftClusters/${CLUSTER_NAME}?api-version=2024-06-10-preview" \
--header @- \
--json @${CLUSTER_FILE}
}

# Call to the `main` function in the script
main "$@"
37 changes: 37 additions & 0 deletions demo/testUpdateCluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

set -e

source env_vars
source "$(dirname "$0")"/common.sh



arm_x_ms_identity_url_header() {
# Requests directly against the frontend
# need to send a X-Ms-Identity-Url HTTP
# header, which simulates what ARM performs.
# By default we set a dummy value, which is
# enough in the environments where a real
# Managed Identities Data Plane does not
# exist like in the development or integration
# environments. The default can be overwritten
# by providing the environment variable
# ARM_X_MS_IDENTITY_URL when running the script.
: ${ARM_X_MS_IDENTITY_URL:="https://dummyhost.identity.azure.net"}
echo "X-Ms-Identity-Url: ${ARM_X_MS_IDENTITY_URL}"
}

main() {

SUBSCRIPTION_ID=$(az account show --query id -o tsv)
CLUSTER_FILE="cluster.json"


(arm_system_data_header; correlation_headers; arm_x_ms_identity_url_header) | curl -si -X PATCH "localhost:8443/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${CUSTOMER_RG_NAME}/providers/Microsoft.RedHatOpenshift/hcpOpenShiftClusters/${CLUSTER_NAME}?api-version=2024-06-10-preview" \
--header @- \
--json @${CLUSTER_FILE}
}

# Call to the `main` function in the script
main "$@"
5 changes: 2 additions & 3 deletions frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ info:
run:
./aro-hcp-frontend --location ${LOCATION} \
--clusters-service-url http://localhost:8000 \
--cluster-service-provision-shard 1 \
--cluster-service-noop-provision \
--cluster-service-noop-deprovision
--cosmos-name ${DB_NAME} \
--cosmos-url ${DB_URL}

clean:
rm -f aro-hcp-frontend
Expand Down
2 changes: 1 addition & 1 deletion frontend/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewRootCmd() *cobra.Command {
rootCmd.Flags().StringVar(&opts.cosmosURL, "cosmos-url", os.Getenv("DB_URL"), "Cosmos database URL")
rootCmd.Flags().StringVar(&opts.location, "location", os.Getenv("LOCATION"), "Azure location")
rootCmd.Flags().IntVar(&opts.port, "port", 8443, "port to listen on")
rootCmd.Flags().IntVar(&opts.metricsPort, "metrics-port", 8081, "port to serve metrics on")
rootCmd.Flags().IntVar(&opts.metricsPort, "metrics-port", 8082, "port to serve metrics on")

rootCmd.Flags().StringVar(&opts.clustersServiceURL, "clusters-service-url", "https://api.openshift.com", "URL of the OCM API gateway.")
rootCmd.Flags().BoolVar(&opts.insecure, "insecure", false, "Skip validating TLS for clusters-service.")
Expand Down

0 comments on commit 3f909ab

Please sign in to comment.