Skip to content

Commit

Permalink
gcp sync gitub gitlab
Browse files Browse the repository at this point in the history
  • Loading branch information
chkp-rivkas committed Jan 4, 2024
1 parent 046d111 commit 3847dd0
Show file tree
Hide file tree
Showing 42 changed files with 1,426 additions and 1,353 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"defaultDeploymentType": "MULTI_VM",
"imageName": "check-point-r8110-gw-byol-mig-335-991001174-v20221113",
"imageName": "check-point-r8120-gw-byol-mig-631-991001475-v20231221",
"projectId": "checkpoint-public",
"templateName": "nonexistent_template",
"useSolutionPackage": "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
}

TEMPLATE_NAME = 'autoscale'
TEMPLATE_VERSION = '20230319'
TEMPLATE_VERSION = '20231221'

startup_script = '''
#cloud-config
runcmd:
- 'python3 /etc/cloud_config.py "generatePassword=\\"{generatePassword}\\"" "allowUploadDownload=\\"{allowUploadDownload}\\"" "templateName=\\"{templateName}\\"" "templateVersion=\\"{templateVersion}\\"" "mgmtNIC=\\"{mgmtNIC}\\"" "hasInternet=\\"{hasInternet}\\"" "config_url=\\"{config_url}\\"" "config_path=\\"{config_path}\\"" "installationType=\\"{installationType}\\"" "enableMonitoring=\\"{enableMonitoring}\\"" "shell=\\"{shell}\\"" "computed_sic_key=\\"{computed_sic_key}\\"" "sicKey=\\"{sicKey}\\"" "managementGUIClientNetwork=\\"{managementGUIClientNetwork}\\"" "primary_cluster_address_name=\\"{primary_cluster_address_name}\\"" "secondary_cluster_address_name=\\"{secondary_cluster_address_name}\\"" "managementNetwork=\\"{managementNetwork}\\"" "numAdditionalNICs=\\"{numAdditionalNICs}\\"" "smart1CloudToken=\\"{smart1CloudToken}\\"" "name=\\"{name}\\"" "zone=\\"{zoneConfig}\\"" "region=\\"{region}\\""'
- 'python3 /etc/cloud_config.py "generatePassword=\\"{generatePassword}\\"" "allowUploadDownload=\\"{allowUploadDownload}\\"" "templateName=\\"{templateName}\\"" "templateVersion=\\"{templateVersion}\\"" "mgmtNIC=\\"{mgmtNIC}\\"" "hasInternet=\\"{hasInternet}\\"" "config_url=\\"{config_url}\\"" "config_path=\\"{config_path}\\"" "installationType=\\"{installationType}\\"" "enableMonitoring=\\"{enableMonitoring}\\"" "shell=\\"{shell}\\"" "computed_sic_key=\\"{computed_sic_key}\\"" "sicKey=\\"{sicKey}\\"" "managementGUIClientNetwork=\\"{managementGUIClientNetwork}\\"" "primary_cluster_address_name=\\"{primary_cluster_address_name}\\"" "secondary_cluster_address_name=\\"{secondary_cluster_address_name}\\"" "managementNetwork=\\"{managementNetwork}\\"" "numAdditionalNICs=\\"{numAdditionalNICs}\\"" "smart1CloudToken=\\"{smart1CloudToken}\\"" "name=\\"{name}\\"" "zone=\\"{zoneConfig}\\"" "region=\\"{region}\\"" "osVersion=\\"{osVersion}\\"" "MaintenanceModePassword=\\"{maintenanceMode}\\""'
'''


Expand Down Expand Up @@ -101,7 +101,7 @@ def create_instance_template(context,
name,
nics,
depends_on=None,
gw_version=VERSIONS['R81.10-GW']):
gw_version=VERSIONS['R81.20-GW']):
if 'gw' in gw_version:
license_name = "{}-{}".format(LICENSE, LICENCE_TYPE)
else:
Expand Down Expand Up @@ -203,7 +203,16 @@ def create_instance_template(context,
'value': context.properties['instanceSSHKey']
}
)
return instance_template
passwd = ''
if context.properties['generatePassword']:
passwd = password.GeneratePassword(12, False)
metadata['items'].append(
{
'key': 'adminPasswordSourceMetadata',
'value': passwd
}
)
return instance_template, passwd


def GenerateAutscaledGroup(context, name,
Expand Down Expand Up @@ -302,12 +311,16 @@ def generate_config(context):
prop['gatewayExternalIP'] = (prop['mgmtNIC'] ==
'Ephemeral Public IP (eth0)')
version_chosen = prop['autoscalingVersion'].split(' ')[0] + "-GW"
prop['osVersion'] = prop['autoscalingVersion'].split(' ')[0].replace(
".", "")
nics = create_nics(context)
gw_template = create_instance_template(context,
prop['deployment'],
nics,
depends_on=prop['gw_dependencies'],
gw_version=VERSIONS[version_chosen])
gw_template, passwd = create_instance_template(context,
prop['deployment'],
nics,
depends_on=prop[
'gw_dependencies'],
gw_version=VERSIONS[
version_chosen])
prop['resources'] += [gw_template]
prop['igm_dependencies'] = [gw_template['name']]
igm = GenerateAutscaledGroup(context,
Expand Down Expand Up @@ -360,5 +373,9 @@ def generate_config(context):
'name': 'maxInstancesInt',
'value': str(int(prop['maxInstances']))
},
{
'name': 'password',
'value': passwd
}
]
return common.MakeResource(prop['resources'], prop['outputs'])
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ required:
- networkDefinedByRoutes
- shell
- enableMonitoring
- generatePassword

properties:
zone:
Expand Down Expand Up @@ -166,7 +167,7 @@ properties:
diskTypeProperty: diskType
autoscalingVersion:
type: string
default: R81.10 Autoscaling
default: R81.20 Autoscaling
enum:
- R80.40 Autoscaling
- R81 Autoscaling
Expand All @@ -189,6 +190,13 @@ properties:
allowUploadDownload:
type: boolean
default: True
generatePassword:
type: boolean
default: False
maintenanceMode:
type: string
pattern: ^([a-z0-9A-Z.]{12,300}|)$
default: ''
shell:
type: string
default: /etc/cli.sh
Expand All @@ -202,4 +210,6 @@ outputs:
deployment:
type: string
project:
type: string
password:
type: string
Loading

0 comments on commit 3847dd0

Please sign in to comment.