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

[COST-5368] POC - Glue #5250

Draft
wants to merge 64 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
1c241be
switch to glue
maskarb Aug 5, 2024
f737e00
poc file
maskarb Aug 6, 2024
228a224
add glue catalog
maskarb Aug 6, 2024
a9e28de
idk somethin
maskarb Aug 8, 2024
6e56c42
hive migration script
maskarb Aug 15, 2024
d0a98bc
some cleanup
maskarb Aug 15, 2024
2cb2979
some cleanup
maskarb Aug 15, 2024
0516869
Merge branch 'main' into glue2
maskarb Aug 15, 2024
47b526f
Merge branch 'main' into glue2
maskarb Sep 16, 2024
3ae3fb3
Merge branch 'main' into glue2
maskarb Oct 4, 2024
e54db9c
adding local config + glue clean make command
lcouzens Oct 11, 2024
56967fb
add migration script
maskarb Oct 14, 2024
972c4ce
remove polars
maskarb Oct 14, 2024
19458a0
Merge branch 'main' into glue2
maskarb Oct 16, 2024
1fa0aad
Merge branch 'main' into glue2
maskarb Oct 16, 2024
f7b57da
Merge branch 'main' into glue2
maskarb Oct 21, 2024
e585b8a
some updates
maskarb Oct 21, 2024
c8ba1ec
add suffix to sources org-id
maskarb Oct 22, 2024
8ca5972
fix test
maskarb Oct 22, 2024
a3b55ec
add env variable to docker compose
maskarb Oct 23, 2024
7c94ab9
attempt glue testing
maskarb Oct 25, 2024
176fd0e
change trino refs
maskarb Oct 25, 2024
bdc9d9e
whatever trino hash this is...
maskarb Oct 25, 2024
1a8cea3
add org-id-suffix
maskarb Oct 25, 2024
32875e5
try pointing to glue
maskarb Oct 25, 2024
dd52bba
pass profile name to session
maskarb Oct 25, 2024
169572e
undo pipfile
maskarb Dec 9, 2024
5653d45
Merge branch 'main' into glue2
maskarb Dec 9, 2024
d8bc7a3
reconfig config
maskarb Dec 11, 2024
1104e4d
clowdapp
maskarb Dec 11, 2024
71bf6e8
add suffix in sources flow
maskarb Dec 11, 2024
c7c0905
regex replace special characters with _
maskarb Dec 12, 2024
e169bcb
add org suffix to enabled_tags masu endpoint
maskarb Dec 12, 2024
aee0114
add the params
maskarb Dec 12, 2024
7ad09b5
lint
maskarb Dec 12, 2024
8d0d36a
Merge branch 'main' into glue2
maskarb Dec 16, 2024
c0214b5
changes for dev rds
maskarb Dec 17, 2024
444cd62
Merge branch 'main' into glue2
maskarb Jan 6, 2025
05e4192
Merge branch 'main' into glue2
maskarb Jan 8, 2025
1f009f9
move trino ref
maskarb Jan 8, 2025
97c88fe
remove koku-aws secret
maskarb Jan 8, 2025
216cb3d
fix bucket name
maskarb Jan 8, 2025
28c13de
fix bucket names
maskarb Jan 9, 2025
7b3a983
Merge branch 'main' into glue2
maskarb Jan 10, 2025
4744325
set hcs specific variables
maskarb Jan 10, 2025
b5c19a9
Merge branch 'main' into glue2
maskarb Jan 12, 2025
645301d
undo bucket changes for now
maskarb Jan 12, 2025
44820d5
add schema suffix to yet another masu endpoint
maskarb Jan 12, 2025
54cb190
change suffix to SCHEMA_SUFFIX
maskarb Jan 13, 2025
64972a9
simplify
maskarb Jan 13, 2025
42eda15
simplify
maskarb Jan 13, 2025
3aab9b4
simplify
maskarb Jan 13, 2025
c6da3e0
add back import
maskarb Jan 13, 2025
0cbcdda
Merge branch 'main' into glue2
maskarb Jan 13, 2025
f702c4d
remove temp stuff
maskarb Jan 13, 2025
a5a55b6
fix tests
maskarb Jan 13, 2025
5f4fec3
update cleanup script
maskarb Jan 14, 2025
b56a2ca
Merge branch 'main' into glue2
maskarb Jan 14, 2025
f72c314
Merge branch 'main' into glue2
maskarb Jan 15, 2025
573c9cb
add trino schema prefix to clowdapp
maskarb Jan 15, 2025
718f6f7
add schema prefix and s3a_or_s3
maskarb Jan 15, 2025
55c641c
update trino
maskarb Jan 16, 2025
94b14ab
test trino
maskarb Jan 16, 2025
32679b1
make clowdapp
maskarb Jan 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ TAG_ENABLED_LIMIT=200 # Set the max amount of tags per account
DELAYED_TASK_TIME=30 # Set the seconds before a delayed summary task should expire
DELAYED_TASK_POLLING_MINUTES=5 # Set the time before the delayed task kick off.

ENABLE_S3_ARCHIVING=True
S3_BUCKET_NAME=koku-bucket
S3_BUCKET_PATH=data
S3_ENDPOINT=http://koku-minio:9000
S3_ACCESS_KEY=kokuminioaccess
S3_SECRET=kokuminiosecret
SKIP_MINIO_DATA_DELETION=False

# AWS
Expand Down Expand Up @@ -66,7 +60,6 @@ INSIGHTS_KAFKA_PORT=29092
KEEPDB=True
PROMETHEUS_PUSHGATEWAY="pushgateway:9091"
AUTO_DATA_INGEST=True
DEVELOPMENT_IDENTITY='{"identity": {"account_number": "10001", "org_id": "1234567", "type": "User", "user": {"username": "user_dev", "email": "[email protected]", "is_org_admin": "True", "access": {}}},"entitlements": {"cost_management": {"is_entitled": "True"}}}'
CACHED_VIEWS_DISABLED=False
ACCOUNT_ENHANCED_METRICS=False
ENHANCED_ORG_ADMIN=True
Expand All @@ -76,3 +69,22 @@ QE_SCHEMA=""

# USER_ID= # Set to the value returned by id -u
# GROUP_ID= # Set to the value returned by id -g

# Minio
# S3_BUCKET_NAME=koku-bucket
# S3_ENDPOINT=http://koku-minio:9000
# S3_ACCESS_KEY=kokuminioaccess
# S3_SECRET=kokuminiosecret

DEVELOPMENT_IDENTITY='{"identity": {"account_number": "10001", "org_id": "1234567", "type": "User", "user": {"username": "user_dev", "email": "[email protected]", "is_org_admin": "True", "access": {}}},"entitlements": {"cost_management": {"is_entitled": "True"}}}'

# Glue
SCHEMA_SUFFIX=""

AWS_CATALOG_ID=589173575009
S3_ENDPOINT=https://s3.us-east-1.amazonaws.com

S3_BUCKET_NAME=CHANGEME
S3_ACCESS_KEY=CHANGEME
S3_SECRET=CHANGEME
S3_REGION=us-east-1
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pipeline {

IQE_PLUGINS="cost_management"
BUILD_URL="https://ci.ext.devshift.net/job/koku-pipeline-pr-check-main/${BUILD_NUMBER}/"
IQE_ENV_VARS="JOB_NAME=koku-ci-jenkins,BUILD_NUMBER=${BUILD_NUMBER},BUILD_URL=${BUILD_URL}"
IQE_ENV_VARS="JOB_NAME=koku-ci-jenkins,BUILD_NUMBER=${BUILD_NUMBER},BUILD_URL=${BUILD_URL},SCHEMA_SUFFIX=_${IMAGE_TAG}"
IQE_PARALLEL_ENABLED="false"

GITHUB_API_ROOT='https://api.github.com/repos/project-koku/koku'
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ help:
@echo " requirements generate Pipfile.lock"
@echo " clowdapp generates a new clowdapp.yaml"
@echo " delete-db delete local directory $(TOPDIR)/dev/containers/postgresql/data"
@echo " delete-glue-data delete s3 files + database created in AWS/glue"
@echo " delete-test-db delete the django test db"
@echo " reset-db-statistics clear the pg_stat_statements statistics"
@echo " run-migrations run migrations against database"
Expand Down Expand Up @@ -216,6 +217,9 @@ make-migrations:
delete-db:
@$(PREFIX) rm -rf $(TOPDIR)/dev/containers/postgresql/data/

delete-glue-data:
@$(PYTHON) $(SCRIPTDIR)/clean_glue.py $(schema)

delete-test-db:
@PGPASSWORD=$$DATABASE_PASSWORD psql -h $$POSTGRES_SQL_SERVICE_HOST \
-p $$POSTGRES_SQL_SERVICE_PORT \
Expand Down Expand Up @@ -338,7 +342,10 @@ docker-up-no-build: docker-up-db
# basic dev environment targets
docker-up-min: docker-build docker-up-min-no-build

docker-up-min-no-build: docker-host-dir-setup docker-up-db
# docker-up-min-no-build: docker-host-dir-setup docker-up-db
# $(DOCKER_COMPOSE) up -d --scale koku-worker=$(scale) redis koku-server masu-server koku-worker trino hive-metastore

docker-up-min-no-build: docker-host-dir-setup
$(DOCKER_COMPOSE) up -d --scale koku-worker=$(scale) redis koku-server masu-server koku-worker trino hive-metastore

# basic dev environment targets
Expand Down
31 changes: 19 additions & 12 deletions ci/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,37 +94,44 @@ function run_smoke_tests_stage() {
source ${CICD_ROOT}/_common_deploy_logic.sh
export NAMESPACE=$(bonfire namespace reserve --duration ${RESERVATION_TIMEOUT})

oc get secret/koku-aws -o json -n ephemeral-base | jq -r '.data' > aws-creds.json
oc get secret/koku-gcp -o json -n ephemeral-base | jq -r '.data' > gcp-creds.json
oc get secret/koku-oci -o json -n ephemeral-base | jq -r '.data' > oci-creds.json
oc get secret koku-aws -o yaml -n ephemeral-base | grep -v '^\s*namespace:\s' | oc apply --namespace=${NAMESPACE} -f -
oc get secret koku-gcp -o yaml -n ephemeral-base | grep -v '^\s*namespace:\s' | oc apply --namespace=${NAMESPACE} -f -
oc get secret koku-oci -o yaml -n ephemeral-base | grep -v '^\s*namespace:\s' | oc apply --namespace=${NAMESPACE} -f -

AWS_CREDENTIALS_EPH=$(jq -r '."aws-credentials"' < aws-creds.json)
GCP_CREDENTIALS_EPH=$(jq -r '."gcp-credentials"' < gcp-creds.json)
OCI_CREDENTIALS_EPH=$(jq -r '."oci-credentials"' < oci-creds.json)
OCI_CONFIG_EPH=$(jq -r '."oci-config"' < oci-creds.json)
# oc get secret/koku-aws -o json -n ephemeral-base | jq -r '.data' > aws-creds.json
# oc get secret/koku-gcp -o json -n ephemeral-base | jq -r '.data' > gcp-creds.json
# oc get secret/koku-oci -o json -n ephemeral-base | jq -r '.data' > oci-creds.json

# AWS_CREDENTIALS_EPH=$(jq -r '."aws-credentials"' < aws-creds.json)
# GCP_CREDENTIALS_EPH=$(jq -r '."gcp-credentials"' < gcp-creds.json)
# OCI_CREDENTIALS_EPH=$(jq -r '."oci-credentials"' < oci-creds.json)
# OCI_CONFIG_EPH=$(jq -r '."oci-config"' < oci-creds.json)

bonfire deploy \
${APP_NAME} \
--ref-env insights-production \
--set-template-ref ${APP_NAME}/${COMPONENT_NAME}=${ghprbActualCommit} \
--set-template-ref trino=9d20acdd35ec5049745b8575eff4eb262ba40424 \
--set-image-tag ${IMAGE}=${IMAGE_TAG} \
--namespace ${NAMESPACE} \
${COMPONENTS_ARG} \
${COMPONENTS_RESOURCES_ARG} \
--optional-deps-method hybrid \
--set-parameter rbac/MIN_REPLICAS=1 \
--set-parameter koku/AWS_CREDENTIALS_EPH=${AWS_CREDENTIALS_EPH} \
--set-parameter koku/GCP_CREDENTIALS_EPH=${GCP_CREDENTIALS_EPH} \
--set-parameter koku/OCI_CREDENTIALS_EPH=${OCI_CREDENTIALS_EPH} \
--set-parameter koku/OCI_CONFIG_EPH=${OCI_CONFIG_EPH} \
--set-parameter koku/DBM_IMAGE=${IMAGE} \
--set-parameter koku/DBM_IMAGE_TAG=${IMAGE_TAG} \
--set-parameter koku/DBM_INVOCATION=${DBM_INVOCATION} \
--set-parameter koku/IMAGE=${IMAGE} \
--set-parameter koku/SCHEMA_SUFFIX=_${IMAGE_TAG} \
--set-parameter trino/IMAGE=quay.io/redhat-user-workloads/cost-mgmt-dev-tenant/ubi-trino \
--set-parameter trino/IMAGE_TAG=pr-153-9d20acd \
--set-parameter trino/HIVE_PROPERTIES_FILE=glue.properties \
--set-parameter trino/GLUE_PROPERTIES_FILE=hive.properties \
--no-single-replicas \
--source=appsre \
--timeout 600


echo "Running E2E tests with IQE:"
echo "IQE_MARKER_EXPRESSION: '$IQE_MARKER_EXPRESSION'"
echo "IQE_FILTER_EXPRESSION: '$IQE_FILTER_EXPRESSION'"
Expand Down Expand Up @@ -183,7 +190,7 @@ function wait_for_image() {

local count=0
local max=60 # Try for up to 30 minutes
until podman image search --limit 500 --list-tags "${IMAGE}" | grep -q "${IMAGE_TAG}"; do
until [[ $(curl -k -XGET "https://quay.io/api/v1/repository/redhat-user-workloads/cost-mgmt-dev-tenant/koku/tag?specificTag=${IMAGE_TAG}" -Ls | jq '.tags | length') -gt 0 ]]; do
echo "${count}: Checking for image ${IMAGE}:${IMAGE_TAG}..."
sleep 30
((count+=1))
Expand Down
Loading
Loading