-
install minikube https://kubernetes.io/docs/tasks/tools/install-minikube/
-
To run:
eval $(minikube docker-env)
docker build -t cloudefficiency .
kubectl create secret generic cloudefficiency-config --from-file=./report/config.json --from-file=./frontend/src/config.js
kubectl create secret generic cloudefficiency-aws-credentials --from-file=~/.aws
export BUCKET=mybucket
export DATA_BUCKET=mydatabucket
export AWS_PROFILE=myprofile
envsubst < cronjob.yaml | kubectl create -f -
kubectl create job --from=cronjob/cloudefficiency-cronjob cloudefficiency-job
or
docker build . -t cloudefficiency
docker run -it \
-v `pwd`'/frontend/src/config.js:/app/frontend/src/config.js' \
-v `pwd`'/report/config.json:/app/report/config.json' \
-v "$HOME/.aws/:/root/.aws/" \
-e "BUCKET=$BUCKET" \
-e "DATA_BUCKET=$DATA_BUCKET" \
-e "AWS_PROFILE=$AWS_PROFILE" \
cloudefficiency
Three stages to produce EC2 c-type instance cost/waste interactive reports. ldap data + instance data -> user hierarchy and instance data -> static html/js isomorphic React pages.
python3 -m report.allocate_efficiency
- gets ldap data for user hierarchy, and dl lists.
- gets rightsizing recommendations for instances from cloudability.
caches data to:
- ldap_entries.pickle
- dl_owners.pickle
- rightsizing_cache.json
- assigns cost and waste to each individual
- aggregate costs and wastes up reporting chain
outputs:
- allInstances.js jsonp file
- allUsers.js jsonp file
mv all*.js to frontend/src/
node ./dist/generate_files.js
cwd has ./output/*.html
./public/index.css
has styling
./public/bundle.js
has js and user/instance data
Frontend code is tested with Jest and Enzyme.
To run tests:
npm test
either insert console.log
statements, or you can debug using jest:
node --inspect-brk node_modules/.bin/jest --runInBand
and open chrome://inspect
in chrome
[more details](https://jestjs.io/docs/en/troubleshooting_
logo.svg
in frontend/public/logo.svg
config.js
in frontend/src/config.js
const awsmobile = {
'aws_app_analytics': 'enable',
'aws_mobile_analytics_app_id': <string>,
'aws_mobile_analytics_app_region': <string>,
'aws_project_id': <string>,
'aws_project_name': <string>,
'aws_project_region': <string>,
'aws_resource_name_prefix': <string>
}
const VPLIST = [<string>...]
const HELP_LINK = 'https://slack.com/app_redirect?channel=cloudefficiency';
const HELP_TEXT = 'slack channel';
export { awsmobile, VPLIST, HELP_TEXT, HELP_LINK };
config.json
in report/config.json
{
"ldap_url": <string>,
"ldap_port": <number>,
"ldap_basedn": <string>,
"ldap_binddn": <string>,
"ldap_bindpw": <string>,
"ldab_dl_basedn": <string>,
"ldap_dl_search_filter_template": <string>,
"ldap_search_filter": <string>,
"ldap_searchreq_attrlist": [<string>...],
"ldap_users_cache_file": <filename>,
"ldap_cache_time": <number>,
"cloudability_api_key": <string>,
"VP_LIST": [<string>...]
}
Root Render (document.referrer, page) { name: 'appRender' });
Analytics.updateEndpoint({ page: ..., referrer: ..., })
click CPE logo { name: 'click', attributes: { target: 'logo' }, });
click issues { name: 'click', attributes: { target: 'issues' }, });
click help { name: 'click', attributes: { target: 'help' }, });
click teammember { name: 'click', attributes: { target: 'teammember', targetUser: 'name' }, });
click manager { name: 'click', attributes: { target: 'manager', targetUser: 'name' }, });
click owner { name: 'click', attributes: { target: 'instanceOwner', targetUser: 'name', targetInstance: 'id' }, });
click ownerVp { name: 'click', attributes: { target: 'pwmerVP', targetUser: 'name', targetInstance: 'id' }, });
hover tooltip { name: 'tooltip', attributes: { target: 'leadership' | 'user' | 'id' | 'type' | 'suggest' | 'waste' | 'cost' | 'owner' | 'vpOwner' | 'attribution', 'moneyExplanation, }, }); { name: 'tooltip', attributes: { target: 'attribution', targetUser: 'name' }, });