INFRA-3755 | Saurabh | Adding new vertical and cluster details for NIAPL (#227)
* INFRA-3755 | Saurabh | Adding new vertical and cluster details for NIAPL * INFRA-3755 | Saurabh | go fmt in file
This commit is contained in:
committed by
GitHub
parent
8cad585689
commit
cc0e4335be
@@ -101,6 +101,9 @@ var defaultWorkspaceMap = map[string]map[string]string{
|
||||
"prod": "aps1-prod-navi-ktk",
|
||||
"uat": "aps1-uat-navi-ktk",
|
||||
},
|
||||
"navi-iapl": {
|
||||
"prod": "aps1-prod-navi-iapl",
|
||||
},
|
||||
}
|
||||
|
||||
var storageBackendBucketMap = map[string]map[string]string{
|
||||
@@ -206,6 +209,9 @@ var globalTagsMap = map[string]map[string]string{
|
||||
"ktk-uat": {
|
||||
"environment": "uat",
|
||||
},
|
||||
"navi-iapl-prod": {
|
||||
"environment": "prod",
|
||||
},
|
||||
}
|
||||
|
||||
var storageBackendAWSProfileMap = map[string]string{
|
||||
@@ -226,6 +232,7 @@ var ownerMap = map[string]string{
|
||||
"navi-saas": "saas",
|
||||
"navi-data-platform": "DataPlatform",
|
||||
"navi-ppl": "navi-ppl",
|
||||
"navi-iapl": "navi-iapl",
|
||||
"ktk": "ktk",
|
||||
}
|
||||
|
||||
@@ -239,5 +246,6 @@ var productMap = map[string]string{
|
||||
"navi-saas": "saas",
|
||||
"navi-data-platform": "DataPlatform",
|
||||
"navi-ppl": "navi-ppl",
|
||||
"navi-iapl": "navi-iapl",
|
||||
"ktk": "navi-ktk",
|
||||
}
|
||||
|
||||
2
main.go
2
main.go
@@ -113,7 +113,7 @@ func parseManifest(manifestPath string, tfActions *Actions) (*Manifest, error) {
|
||||
}
|
||||
|
||||
func setActions(templateOnly bool, plan bool, destroy bool, runAdditionalScripts bool) (*Actions, error) {
|
||||
log.Printf("Setting actions. \nTemplateOnly: %v, \nPlan: %v, \nDestroy: %v, \n" +
|
||||
log.Printf("Setting actions. \nTemplateOnly: %v, \nPlan: %v, \nDestroy: %v, \n"+
|
||||
"RunAdditionalScripts: %v\n", templateOnly, plan, destroy, runAdditionalScripts)
|
||||
var actions Actions
|
||||
actions.TemplateOnly = templateOnly
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
### NOTE: Teraform init and workspace selection is taken care of
|
||||
|
||||
### Stages:
|
||||
|
||||
1. preTerraformSetup()
|
||||
1. This function is used to execute custom scripts before terraform operations(if required)
|
||||
2. User can add custom scripts in user-scripts-before-terraform-setup.txt
|
||||
3. Function can be moved as per convenience and is optional.
|
||||
4. migration_required_for.json is where the output goes in this stage in the format {"a": true, "b": true} where a and b are the resource for which migration is required
|
||||
1. This function is used to execute custom scripts before terraform operations(if required)
|
||||
2. User can add custom scripts in user-scripts-before-terraform-setup.txt
|
||||
3. Function can be moved as per convenience and is optional.
|
||||
4. migration_required_for.json is where the output goes in this stage in the format {"a": true, "b": true} where a and b are the resource for which migration is required
|
||||
2. Manifests are fetched from deployment portal using xAuthToken and portal url
|
||||
3. postTerraformSetup()
|
||||
1. This function is used to execute custom scripts after terraform operations(if required)
|
||||
2. User can add custom scripts in user-scripts-after-terraform-setup.txt
|
||||
3. User can specify actions such as terraform import.
|
||||
1. This function is used to execute custom scripts after terraform operations(if required)
|
||||
2. User can add custom scripts in user-scripts-after-terraform-setup.txt
|
||||
3. User can specify actions such as terraform import.
|
||||
|
||||
### Caution:
|
||||
|
||||
### Caution:
|
||||
1. Currently tfStateUpdate() is written to work on database related operations in a more optimised manner. Modify and update the code as per requirement
|
||||
2. User can search for "# NOTE" in the code and find all the place where logic can be changed as per resource type and type of operation
|
||||
3. It is user's responsibility to update shell commands in user-scripts-before-terraform-setup.txt and user-scripts-after-terraform-setup.txt and provide the list of resources as specified in 1.4 format in migration_required_for.json file.
|
||||
|
||||
### Usage:
|
||||
### Usage:
|
||||
|
||||
```
|
||||
python driver.py -h
|
||||
Usage: python3 driver.py <vertical> <xAuthToken> <operateOnEnv> <resourceType>
|
||||
vertical(optional): default(lending), navi-pay, sa, gi, navi-ppl
|
||||
vertical(optional): default(lending), navi-pay, sa, gi, navi-ppl, navi-iapl
|
||||
resourceType: database, elasticCache, docdb, aws_access, s3_buckets, dynamodb, auroradb
|
||||
operateOnEnv: all, dev, prod, perf
|
||||
|
||||
@@ -36,15 +39,18 @@ $ python driver.py navi-pay kjf-adfkjf-12e all database
|
||||
|
||||
### Example use case:
|
||||
|
||||
preTerraformSetup()/user-scripts-before-terraform-setup.txt
|
||||
preTerraformSetup()/user-scripts-before-terraform-setup.txt
|
||||
|
||||
- was used to create cloudwatch alarms for the required RDS instances and update list of DBs to json file
|
||||
getListofAWSDBsRequiredForMigration() read the list of DBs for which migration is required from a json file
|
||||
getListofAWSDBsRequiredForMigration() read the list of DBs for which migration is required from a json file
|
||||
|
||||
driver.py
|
||||
|
||||
- gets list of manifests from deployment-portal-backend and iterates over them as per resource type and environment.
|
||||
- for each manifest, the environment variables are updated in the required keys. Ex: ${DATASOURCE_USERNAME} is updated with the username required to access DB
|
||||
- some of the variables like TEAM_NAME, DB_NAME, DB_REPLICA are set in env.json file and used in user-scripts-after-terraform-setup.txt
|
||||
- tfStateUpdate() is used to execute terraform init and terraform import for the required RDS instances
|
||||
|
||||
postTerraformSetup()/user-scripts-after-terraform-setup
|
||||
|
||||
- was used to execute terraform import for the required RDS instances
|
||||
|
||||
@@ -163,7 +163,7 @@ if __name__ == "__main__":
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] in ["help", "-h", "--help"]:
|
||||
print("Usage: python3 driver.py <vertical> <x_auth_token> <operate_on_env> <resource_type>")
|
||||
print("vertical(optional): default(lending), navi-pay, sa, gi, navi-ppl")
|
||||
print("vertical(optional): default(lending), navi-pay, sa, gi, navi-ppl, navi-iapl")
|
||||
print("resource_type: database, elasticCache, docdb, aws_access, s3_buckets, dynamodb, auroradb")
|
||||
print("operate_on_env: all, dev, prod, perf")
|
||||
sys.exit(0)
|
||||
|
||||
Reference in New Issue
Block a user