Skip to content

Commit

Permalink
Tracking Pull Request to merge release-1.16.0 to master (#420) - spri…
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanfandevops authored Dec 18, 2020
1 parent a02f5b6 commit c7df3ac
Show file tree
Hide file tree
Showing 58 changed files with 1,333 additions and 293 deletions.
6 changes: 3 additions & 3 deletions .pipeline-v3/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const phases = {
ssoName:'dev.oidc.gov.bc.ca', phase: 'dev' , changeId:`${changeId}`, suffix: `-dev-${changeId}`,
instance: `${name}-dev-${changeId}` , version:`${version}-${changeId}`, tag:`dev-${version}-${changeId}`,
host: `zeva-dev-${changeId}.${ocpName}.gov.bc.ca`, djangoDebug: 'True', logoutHost: 'logontest.gov.bc.ca',
frontendCpuRequest: '100m', frontendCpuLimit: '700m', frontendMemoryRequest: '300M', frontendMemoryLimit: '4G', frontendReplicas: 1,
frontendCpuRequest: '100m', frontendCpuLimit: '700m', frontendMemoryRequest: '300M', frontendMemoryLimit: '4G', frontendReplicas: 1, creditTransferEnabled: 'true',
backendCpuRequest: '300m', backendCpuLimit: '600m', backendMemoryRequest: '1G', backendMemoryLimit: '2G', backendHealthCheckDelay: 30, backendHost: `zeva-backend-dev-${changeId}.${ocpName}.gov.bc.ca`, backendReplicas: 1,
minioCpuRequest: '100m', minioCpuLimit: '200m', minioMemoryRequest: '200M', minioMemoryLimit: '500M', minioPvcSize: '1G',
schemaspyCpuRequest: '50m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
Expand All @@ -26,7 +26,7 @@ const phases = {
ssoName:'test.oidc.gov.bc.ca', phase: 'test' , changeId:`${changeId}`, suffix: `-test`,
instance: `${name}-test`, version:`${version}`, tag:`test-${version}`,
host: `zeva-test.${ocpName}.gov.bc.ca`, djangoDebug: 'False', logoutHost: 'logontest.gov.bc.ca',
frontendCpuRequest: '300m', frontendCpuLimit: '600m', frontendMemoryRequest: '500M', frontendMemoryLimit: '1G', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5,
frontendCpuRequest: '300m', frontendCpuLimit: '600m', frontendMemoryRequest: '500M', frontendMemoryLimit: '1G', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5, creditTransferEnabled: 'true',
backendCpuRequest: '100m', backendCpuLimit: '500m', backendMemoryRequest: '500M', backendMemoryLimit: '2G', backendHealthCheckDelay: 30, backendReplicas: 1, backendMinReplicas: 2, backendMaxReplicas: 5, backendHost: `zeva-backend-test.${ocpName}.gov.bc.ca`,
minioCpuRequest: '100m', minioCpuLimit: '300m', minioMemoryRequest: '500M', minioMemoryLimit: '700M', minioPvcSize: '5G',
schemaspyCpuRequest: '20m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
Expand All @@ -37,7 +37,7 @@ const phases = {
ssoName:'oidc.gov.bc.ca', phase: 'prod' , changeId:`${changeId}`, suffix: `-prod`,
instance: `${name}-prod`, version:`${version}`, tag:`prod-${version}`,
host: `zeroemissionvehicles.${ocpName}.gov.bc.ca`, djangoDebug: 'False', logoutHost: 'logon7.gov.bc.ca',
frontendCpuRequest: '300m', frontendCpuLimit: '600m', frontendMemoryRequest: '1G', frontendMemoryLimit: '2G', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5,
frontendCpuRequest: '300m', frontendCpuLimit: '600m', frontendMemoryRequest: '1G', frontendMemoryLimit: '2G', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5, creditTransferEnabled: 'false',
backendCpuRequest: '200m', backendCpuLimit: '700m', backendMemoryRequest: '1G', backendMemoryLimit: '2G', backendHealthCheckDelay: 30, backendReplicas: 1, backendMinReplicas: 2, backendMaxReplicas: 5, backendHost: `zeva-backend-prod.${ocpName}.gov.bc.ca`,
minioCpuRequest: '100m', minioCpuLimit: '300m', minioMemoryRequest: '500M', minioMemoryLimit: '700M', minioPvcSize: '10G',
schemaspyCpuRequest: '50m', schemaspyCpuLimit: '400m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
Expand Down
5 changes: 3 additions & 2 deletions .pipeline-v3/lib/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports = settings => {
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/patroni/deployment-prereq.yaml`, {
'param': {
'NAME': 'patroni',
'SUFFIX': phases[phase].suffix
'SUFFIX': phases[phase].suffix
}
}))
//deploy Patroni
Expand Down Expand Up @@ -118,7 +118,8 @@ module.exports = settings => {
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/frontend/frontend-configmap.yaml`, {
'param': {
'NAME': phases[phase].name,
'SUFFIX': phases[phase].suffix
'SUFFIX': phases[phase].suffix,
'CREDIT_TRANSFER_ENABLED': phases[phase].creditTransferEnabled
}
}))

Expand Down
14 changes: 7 additions & 7 deletions .pipeline/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const phases = {
ssoName:'dev.oidc.gov.bc.ca', phase: 'dev' , changeId:`${changeId}`, suffix: `-dev-${changeId}`,
instance: `${name}-dev-${changeId}` , version:`${version}-${changeId}`, tag:`dev-${version}-${changeId}`,
host: `zeva-dev-${changeId}.${ocpName}.gov.bc.ca`, djangoDebug: 'True', logoutHostName: 'logontest.gov.bc.ca',
frontendCpuRequest: '100m', frontendCpuLimit: '700m', frontendMemoryRequest: '300M', frontendMemoryLimit: '4G', frontendReplicas: 1,
frontendCpuRequest: '100m', frontendCpuLimit: '700m', frontendMemoryRequest: '300M', frontendMemoryLimit: '4G', frontendReplicas: 1, creditTransferEnabled: 'true',
backendCpuRequest: '300m', backendCpuLimit: '600m', backendMemoryRequest: '1G', backendMemoryLimit: '2G', backendHealthCheckDelay: 30, backendHost: `zeva-backend-dev-${changeId}.${ocpName}.gov.bc.ca`, backendReplicas: 1,
minioCpuRequest: '100m', minioCpuLimit: '200m', minioMemoryRequest: '200M', minioMemoryLimit: '500M', minioPvcSize: '1G',
schemaspyCpuRequest: '50m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
Expand All @@ -26,23 +26,23 @@ const phases = {
ssoName:'test.oidc.gov.bc.ca', phase: 'test' , changeId:`${changeId}`, suffix: `-test`,
instance: `${name}-test`, version:`${version}`, tag:`test-${version}`,
host: `zeva-test.${ocpName}.gov.bc.ca`, djangoDebug: 'False', logoutHostName: 'logontest.gov.bc.ca',
frontendCpuRequest: '300m', frontendCpuLimit: '600m', frontendMemoryRequest: '500M', frontendMemoryLimit: '1G', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5,
frontendCpuRequest: '300m', frontendCpuLimit: '600m', frontendMemoryRequest: '500M', frontendMemoryLimit: '1G', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5, creditTransferEnabled: 'true',
backendCpuRequest: '100m', backendCpuLimit: '500m', backendMemoryRequest: '500M', backendMemoryLimit: '2G', backendHealthCheckDelay: 30, backendReplicas: 1, backendMinReplicas: 2, backendMaxReplicas: 5, backendHost: `zeva-backend-test.${ocpName}.gov.bc.ca`,
minioCpuRequest: '100m', minioCpuLimit: '300m', minioMemoryRequest: '500M', minioMemoryLimit: '700M', minioPvcSize: '5G',
minioCpuRequest: '100m', minioCpuLimit: '300m', minioMemoryRequest: '500M', minioMemoryLimit: '700M', minioPvcSize: '3G',
schemaspyCpuRequest: '20m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
rabbitmqCpuRequest: '250m', rabbitmqCpuLimit: '700m', rabbitmqMemoryRequest: '500M', rabbitmqMemoryLimit: '700M', rabbitmqPvcSize: '1G', rabbitmqReplica: 2, rabbitmqPostStartSleep: 120, storageClass: 'netapp-block-standard',
patroniCpuRequest: '500m', patroniCpuLimit: '1000m', patroniMemoryRequest: '500M', patroniMemoryLimit: '1G', patroniPvcSize: '5G', patroniReplica: 2, storageClass: 'netapp-block-standard', ocpName: `${ocpName}`},
patroniCpuRequest: '500m', patroniCpuLimit: '1000m', patroniMemoryRequest: '500M', patroniMemoryLimit: '1G', patroniPvcSize: '10G', patroniReplica: 2, storageClass: 'netapp-block-standard', ocpName: `${ocpName}`},

prod: {namespace:'e52f12-prod', name: `${name}`, ssoSuffix:'',
ssoName:'oidc.gov.bc.ca', phase: 'prod' , changeId:`${changeId}`, suffix: `-prod`,
instance: `${name}-prod`, version:`${version}`, tag:`prod-${version}`,
host: 'zeroemissionvehicles.gov.bc.ca', djangoDebug: 'False', logoutHostName: 'logon7.gov.bc.ca',
frontendCpuRequest: '300m', frontendCpuLimit: '600m', frontendMemoryRequest: '1G', frontendMemoryLimit: '2G', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5,
frontendCpuRequest: '300m', frontendCpuLimit: '600m', frontendMemoryRequest: '1G', frontendMemoryLimit: '2G', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5, creditTransferEnabled: 'false',
backendCpuRequest: '200m', backendCpuLimit: '700m', backendMemoryRequest: '1G', backendMemoryLimit: '2G', backendHealthCheckDelay: 30, backendReplicas: 1, backendMinReplicas: 2, backendMaxReplicas: 5, backendHost: `zeva-backend-prod.${ocpName}.gov.bc.ca`,
minioCpuRequest: '100m', minioCpuLimit: '300m', minioMemoryRequest: '500M', minioMemoryLimit: '700M', minioPvcSize: '10G',
minioCpuRequest: '100m', minioCpuLimit: '300m', minioMemoryRequest: '500M', minioMemoryLimit: '700M', minioPvcSize: '3G',
schemaspyCpuRequest: '50m', schemaspyCpuLimit: '400m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
rabbitmqCpuRequest: '250m', rabbitmqCpuLimit: '700m', rabbitmqMemoryRequest: '500M', rabbitmqMemoryLimit: '1G', rabbitmqPvcSize: '5G', rabbitmqReplica: 2, rabbitmqPostStartSleep: 120, storageClass: 'netapp-block-standard',
patroniCpuRequest: '500m', patroniCpuLimit: '1000m', patroniMemoryRequest: '1G', patroniMemoryLimit: '2G', patroniPvcSize: '30G', patroniReplica: 3, storageClass: 'netapp-block-standard', ocpName: `${ocpName}`},
patroniCpuRequest: '500m', patroniCpuLimit: '1000m', patroniMemoryRequest: '1G', patroniMemoryLimit: '2G', patroniPvcSize: '25G', patroniReplica: 3, storageClass: 'netapp-block-standard', ocpName: `${ocpName}`}

};

Expand Down
3 changes: 2 additions & 1 deletion .pipeline/lib/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ module.exports = settings => {
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/frontend/frontend-configmap.yaml`, {
'param': {
'NAME': phases[phase].name,
'SUFFIX': phases[phase].suffix
'SUFFIX': phases[phase].suffix,
'CREDIT_TRANSFER_ENABLED': phases[phase].creditTransferEnabled
}
}))

Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pipeline {
beforeInput true
}
input {
message "Should we continue with deployment to PROD?"
message "Should we continue with deployment to PROD? This is Prod!. Make sure you have made a database backup and verified no clients are using the system."
ok "Yes!"
}
steps {
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile-v3
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pipeline {
beforeInput true
}
input {
message "Should we continue with deployment to PROD?"
message "Should we continue with deployment to PROD? This is Prod!. Make sure you have made a database backup and verified no clients are using the system."
ok "Yes!"
}
steps {
Expand Down
10 changes: 0 additions & 10 deletions backend/api/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ def check_external_services():
logger.error(_error)
raise RuntimeError('Keycloak connection failed')

if EMAIL['ENABLED']:
logger.info('Email sending enabled. Checking connection')

try:
with smtplib.SMTP(host=EMAIL['SMTP_SERVER_HOST'],
port=EMAIL['SMTP_SERVER_PORT']) as server:
server.noop()
except Exception as error:
logger.error(error)
raise RuntimeError('SMTP Connection failed')


def post_migration_callback(sender, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from django.db import transaction

from api.management.data_script import OperationalDataScript
from api.models.permission import Permission
from api.models.role import Role
from api.models.role_permission import RolePermission


class UpdateRolesPermissions(OperationalDataScript):
"""
Adds the Roles and Permissions
"""
is_revertable = False
comment = 'Adds the view credit transfers permissions for ZEV users and ' \
'signing authorities.'

def check_run_preconditions(self):
return True

def update_zeva_user(self):
permissions_to_be_added = [
'VIEW_CREDIT_TRANSFERS',
]

role = Role.objects.get(
role_code="ZEVA User"
)

for permission_code in permissions_to_be_added:
permission = Permission.objects.get(permission_code=permission_code)
RolePermission.objects.get_or_create(
permission=permission,
role=role
)

def update_signing_authority(self):
permissions_to_be_added = [
'VIEW_CREDIT_TRANSFERS',
]

role = Role.objects.get(
role_code="Signing Authority"
)

for permission_code in permissions_to_be_added:
permission = Permission.objects.get(permission_code=permission_code)
RolePermission.objects.get_or_create(
permission=permission,
role=role
)

@transaction.atomic
def run(self):
self.update_zeva_user()
self.update_signing_authority()

print('Updated Permissions')


script_class = UpdateRolesPermissions
45 changes: 45 additions & 0 deletions backend/api/fixtures/operational/0016_update_roles_permissions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from django.db import transaction

from api.management.data_script import OperationalDataScript
from api.models.permission import Permission
from api.models.role import Role
from api.models.role_permission import RolePermission
from api.authorities import REQUIRED_AUTHORITIES


class UpdateRolesPermissions(OperationalDataScript):
"""
Adds the Roles and Permissions
"""
is_revertable = False
comment = 'Updates the permissions for the roles so that they make more ' \
'sense with application.'

def check_run_preconditions(self):
return True

def update_analyst(self):

role = Role.objects.get(
role_code="Engineer/Analyst"
)

permissions_to_be_added = [
'VIEW_USERS',
]

for permission_code in permissions_to_be_added:
permission = Permission.objects.get(permission_code=permission_code)
RolePermission.objects.get_or_create(
permission=permission,
role=role
)

@transaction.atomic
def run(self):
self.update_analyst()

print('Updated Permissions')


script_class = UpdateRolesPermissions
1 change: 1 addition & 0 deletions backend/api/models/credit_transfer_statuses.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ class CreditTransferStatuses(Enum):
RECOMMEND_APPROVAL = 'RECOMMEND_APPROVAL'
RECOMMEND_REJECTION = 'RECOMMEND_REJECTION'
VALIDATED = 'VALIDATED'
RESCINDED = 'RESCINDED'
REJECTED = 'REJECTED'
DELETED = 'DELETED'
Loading

0 comments on commit c7df3ac

Please sign in to comment.