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

Added the tenants: ecoeng_01, ecoeng_02, ecoeng_03 #672

Merged
merged 3 commits into from
Jan 10, 2024

Conversation

athiruma
Copy link
Collaborator

Type of change

Note: Fill x in []

  • bug
  • enhancement
  • documentation
  • dependencies

Description

Adding the managed tenants.

For security reasons, all pull requests need to be approved first before running any automated CI

@athiruma athiruma added documentation Improvements or additions to documentation ok-to-test PR ok to test labels Sep 18, 2023
@athiruma athiruma requested a review from ebattat September 18, 2023 12:52
@athiruma athiruma self-assigned this Sep 18, 2023
@ebattat ebattat changed the title Added the tenanats: ecoeng, mikhail Added the tenants: ecoeng, mikhail Sep 20, 2023
ebattat
ebattat approved these changes Sep 20, 2023
@athiruma athiruma changed the title Added the tenants: ecoeng, mikhail Added the tenants: ecoeng_01, ecoeng_02 Sep 26, 2023
Copy link
Collaborator

@ebattat ebattat left a comment

Choose a reason for hiding this comment

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

@athiruma Please fix the folder name from mikhail_02 to ecoeng_02

@athiruma
Copy link
Collaborator Author

@athiruma Please fix the folder name from mikhail_02 to ecoeng_02

done

@ebattat
Copy link
Collaborator

ebattat commented Oct 4, 2023

@athiruma, did Michail review it ?

@athiruma
Copy link
Collaborator Author

athiruma commented Oct 4, 2023

@athiruma, did Michail review it ?

no. Yet to review.

@athiruma
Copy link
Collaborator Author

athiruma commented Oct 4, 2023

@redmikhail ptal 👋

@athiruma athiruma force-pushed the add_tenants branch 2 times, most recently from bd18f65 to 07d0d72 Compare December 5, 2023 10:09
@redmikhail
Copy link

@athiruma LGTM

@ebattat ebattat changed the title Added the tenants: ecoeng_01, ecoeng_02 Added the tenants: ecoeng_01, ecoeng_02, ecoeng_03 Dec 14, 2023
sh '''if [[ "$(podman images -q quay.io/ebattat/cloud-governance 2> /dev/null)" != "" ]]; then podman rmi -f $(podman images -q quay.io/ebattat/cloud-governance 2> /dev/null); fi'''
}
}
stage('Run Tagging Cluster & Non-Cluster') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you sure it tagging stage ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is an tagging job.

sh '''if [[ "$(podman images -q quay.io/ebattat/cloud-governance 2> /dev/null)" != "" ]]; then podman rmi -f $(podman images -q quay.io/ebattat/cloud-governance 2> /dev/null); fi'''
}
}
stage('Run Policies the Cost Policies') {
Copy link
Collaborator

@ebattat ebattat Dec 14, 2023

Choose a reason for hiding this comment

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

Run Cost Policies - fix it in all places

}
}
}
stage('Run Policies the Daily polices') {
Copy link
Collaborator

@ebattat ebattat Dec 14, 2023

Choose a reason for hiding this comment

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

Run Daily Policies - fix it in all places

@@ -0,0 +1,80 @@
account = ['industry-partners', 'special-projects', 'edgeinfra', 'specialprojects-qe', 'ecoeng-sap', 'sysdeseng', 'verticals-ui']
Copy link
Collaborator

Choose a reason for hiding this comment

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

ecoeng_03 instead of ecoeng_3

string(credentialsId: "${account[i]}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account[i]}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account[i]}"
sh 'python3 jenkins/poc/haim/common/run_cost_policies.py'
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Is this path properly ?, if not pls fix it for all 3 groups

string(credentialsId: "${account[i]}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account[i]}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account[i]}"
sh 'python3 jenkins/poc/haim/common/run_policies.py'
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Is this path properly ?
  2. I think that we should pass argument:
    Configure in jenkinsfile:
    policies_in_action = ['ebs_unattached', 'ip_unattached', 'zombie_snapshots', 'unused_nat_gateway', 's3_inactive', 'empty_roles']

python3 jenkins/poc/haim/common/run_policies.py "$policies_in_action"

Please fix it in all 3 groups: ecoeng01/02/03

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is no need to pass to the file, we can access it by os.environ variable.

Copy link
Collaborator

@ebattat ebattat left a comment

Choose a reason for hiding this comment

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

You should move all action policies list in jenkinsfile and pass it as argument ?


exclude_policies = ['cost_explorer', 'optimize_resources_report', 'monthly_report', 'cost_over_usage',
'skipped_resources', 'cost_explorer_payer_billings', 'cost_billing_reports', 'spot_savings_analysis']
available_policies = get_custodian_policies(exclude_policies=exclude_policies)
Copy link
Collaborator

Choose a reason for hiding this comment

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

get_custodian_policies ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sry, it is get policies. Get all policies with excluding the cost policies.

contact2 = "[email protected]"
// By default, all policies are running in dry_run="yes" mode and the whole list can be found in run_policies.py
// POLICIES_IN_ACTION: Policies that run in the dry_run="no" mode
POLICIES_IN_ACTION = ["ebs_unattached", "ip_unattached", "zombie_snapshots", "unused_nat_gateway", "s3_inactive", "empty_roles"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the policy list in action

string(credentialsId: "${account[i]}-aws-secret-key-id", variable: 'secret_key'),
string(credentialsId: "${account[i]}-s3-bucket", variable: 's3_bucket')]) {
env.account_name = "${account[i]}"
sh 'python3 jenkins/tenant/aws/common/run_policies.py'
Copy link
Collaborator

@ebattat ebattat Dec 20, 2023

Choose a reason for hiding this comment

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

You should pass the policies here
Can we use the following variable:
available_policies = list of all our policies [Should be env variable] => should configured in cg variables.
active_policies = list of active policies per Jenkinsfile and it should pass from Jenkinsfile as following
python3 jenkins/tenant/aws/common/run_policies.py "active_policies"

if that works, pls fix it for all the groups

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the way of passing by arguments, it is always better to expose it environment and consume it in the file.
I don't agree with the available policies here. The policies should be changed. Thats the reason I added it inside the python dynamically. Coming to active_polices, I added the ENV variable POLICIES_IN_ACTION, describes which are in action.

Copy link
Collaborator

@ebattat ebattat left a comment

Choose a reason for hiding this comment

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

/LGTM
Lets wait to Haim to approve it also

@athiruma athiruma force-pushed the add_tenants branch 2 times, most recently from a07a68e to 2f26fc9 Compare January 3, 2024 12:21
@redmikhail
Copy link

LGTM

@ebattat ebattat merged commit 87b2f06 into redhat-performance:main Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation ok-to-test PR ok to test
Projects
Development

Successfully merging this pull request may close these issues.

3 participants