Skip to content

Commit

Permalink
Fix support for custom domain name.
Browse files Browse the repository at this point in the history
In particular, the new optional parameter 'CustomDomain' is added to the PCUI stack to specify the custom domain name.
  • Loading branch information
gmarciani committed Oct 1, 2024
1 parent f3454dd commit 63bc480
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 10 deletions.
2 changes: 2 additions & 0 deletions infrastructure/environments/demo-cfn-create-args.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Parameters:
# ParameterValue: arn:aws:iam::xxxxxxxxxx:policy/xxxxxxxxxx
# - ParameterKey: IAMRoleAndPolicyPrefix
# ParameterValue: xxxxxxxxxx
# - ParameterKey: CustomDomain
# ParameterValue: xxxxxxxxxx
Capabilities:
- CAPABILITY_AUTO_EXPAND
- CAPABILITY_NAMED_IAM
Expand Down
2 changes: 2 additions & 0 deletions infrastructure/environments/demo-cfn-update-args.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Parameters:
UsePreviousValue: true
- ParameterKey: IAMRoleAndPolicyPrefix
UsePreviousValue: true
- ParameterKey: CustomDomain
UsePreviousValue: true
Capabilities:
- CAPABILITY_AUTO_EXPAND
- CAPABILITY_NAMED_IAM
Expand Down
49 changes: 39 additions & 10 deletions infrastructure/parallelcluster-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ Parameters:
Description: 'Prefix applied to the name of every IAM role and policy (max length: 10). [ParallelCluster >= 3.8.0]'
Default: ''
MaxLength: 10
CustomDomain:
Type: String
Description: (Optional) Custom domain name. If omitted, the default domain name will be used.
Default: ''
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
Expand Down Expand Up @@ -100,6 +104,10 @@ Metadata:
- IAMRoleAndPolicyPrefix
- PermissionsBoundaryPolicy
- PermissionsBoundaryPolicyPCAPI
- Label:
default: (Optional) Custom Domain
Parameters:
- CustomDomain
- Label:
default: (Debugging only) Infrastructure S3 Bucket
Parameters:
Expand Down Expand Up @@ -144,11 +152,13 @@ Conditions:
UsePermissionBoundary: !Not [!Equals [!Ref PermissionsBoundaryPolicy, '']]
UsePermissionBoundaryPCAPI: !Not [!Equals [!Ref PermissionsBoundaryPolicyPCAPI, '']]
UseIAMRoleAndPolicyPrefix: !Not [!Equals [!Ref IAMRoleAndPolicyPrefix, '']]
UseCustomDomain: !Not [!Equals [!Ref CustomDomain, '']]

Mappings:
ParallelClusterUI:
Constants:
Version: 2024.07.1 # format YYYY.MM.REVISION
CustomDomainBasePath: pcui

Resources:

Expand Down Expand Up @@ -219,13 +229,22 @@ Resources:
Variables:
API_BASE_URL: !GetAtt [ ParallelClusterApi, Outputs.ParallelClusterApiInvokeUrl ]
API_VERSION: !Ref Version
SITE_URL: !Sub
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/pcui
- Api: !Ref ApiGatewayRestApi
SITE_URL: !If
- UseCustomDomain
- !Sub
- https://${CustomDomain}/${CustomDomainBasePath}
- { CustomDomainBasePath: !FindInMap [ ParallelClusterUI, Constants, CustomDomainBasePath ] }
- !Sub
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/${Stage}
- { Api: !Ref ApiGatewayRestApi, Stage: !Ref ApiGatewayRestStage }
AUTH_PATH: !If [ UseExistingCognito, !Ref UserPoolAuthDomain, !GetAtt [ Cognito, Outputs.UserPoolAuthDomain ]]
SECRET_ID: !GetAtt UserPoolClientSecret.SecretName
AUDIENCE: !Ref CognitoAppClient
OIDC_PROVIDER: 'Cognito'
API_GATEWAY_BASE_PATH: !If
- UseCustomDomain
- !FindInMap [ ParallelClusterUI, Constants, CustomDomainBasePath ]
- !Ref AWS::NoValue
FunctionName: !Sub
- ParallelClusterUIFun-${StackIdSuffix}
- { StackIdSuffix: !Select [2, !Split ['/', !Ref 'AWS::StackId']] }
Expand Down Expand Up @@ -351,7 +370,7 @@ Resources:
Format: '{ "requestId":"$context.requestId", "ip": "$context.identity.sourceIp", "requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod","path":"$context.path", "status":"$context.status","protocol":"$context.protocol", "responseLength":"$context.responseLength" }'
RestApiId: !Ref ApiGatewayRestApi
DeploymentId: !Ref ApiGatewayDeployment
StageName: pcui
StageName: !If [ UseCustomDomain, prod, pcui ]
MethodSettings:
- ResourcePath: '/*'
HttpMethod: '*'
Expand All @@ -371,9 +390,14 @@ Resources:
ExplicitAuthFlows:
- ALLOW_REFRESH_TOKEN_AUTH
CallbackURLs:
- !Sub
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/pcui/login
- Api: !Ref ApiGatewayRestApi
- !If
- UseCustomDomain
- !Sub
- https://${CustomDomain}/${CustomDomainBasePath}/login
- { CustomDomainBasePath: !FindInMap [ ParallelClusterUI, Constants, CustomDomainBasePath ] }
- !Sub
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/${Stage}/login
- { Api: !Ref ApiGatewayRestApi, Stage: !Ref ApiGatewayRestStage }
SupportedIdentityProviders:
- COGNITO
UserPoolId: !If [ UseExistingCognito, !Ref UserPoolId, !GetAtt [ Cognito, Outputs.UserPoolId ]]
Expand Down Expand Up @@ -1011,9 +1035,14 @@ Outputs:
Description: 'Url to reach the ParallelCluster UI Site.'
Export:
Name: !Sub ${AWS::StackName}-ParallelClusterUISite
Value: !Sub
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/pcui
- Api: !Ref ApiGatewayRestApi
Value: !If
- UseCustomDomain
- !Sub
- https://${CustomDomain}/${CustomDomainBasePath}
- { CustomDomainBasePath: !FindInMap [ ParallelClusterUI, Constants, CustomDomainBasePath ] }
- !Sub
- https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/${Stage}
- { Api: !Ref ApiGatewayRestApi, Stage: !Ref ApiGatewayRestStage }
AppClientId:
Description: The id of the Cognito app client
Value: !Ref CognitoAppClient
Expand Down

0 comments on commit 63bc480

Please sign in to comment.