forked from Azure-Samples/cargotracker-liberty-aks
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor ACR variable names for consistency and clarity.
- Loading branch information
1 parent
b7701e4
commit 32251aa
Showing
10 changed files
with
245 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: package-helm-chart | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'charts/**' | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
package-helm-chart: | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set environment variables | ||
id: set-variables | ||
run: | | ||
echo "REPOSITORY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" | ||
echo "VERSION=$(yq -r .version ./charts/cargotracker-liberty-aks/Chart.yaml)" >> "$GITHUB_OUTPUT" | ||
- name: Env variable output | ||
id: test-variables | ||
run: | | ||
echo ${{ steps.set-variables.outputs.REPOSITORY }} | ||
echo ${{ steps.set-variables.outputs.VERSION }} | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- name: Package and push helm chart | ||
run: | | ||
helm package ./charts/cargotracker-liberty-aks --version ${{ steps.set-variables.outputs.VERSION }} | ||
helm push ./cargotracker-liberty-aks-chart-${{ steps.set-variables.outputs.VERSION }}.tgz oci://${{ steps.set-variables.outputs.REPOSITORY }}/charts | ||
publish-helm-chart: | ||
permissions: | ||
id-token: write | ||
packages: write | ||
contents: write | ||
actions: read | ||
deployments: read | ||
pull-requests: read | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Publish Helm chart to GitHub Pages | ||
uses: stefanprodan/helm-gh-pages@0ad2bb377311d61ac04ad9eb6f252fb68e207260 # v1.7.0 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
linting: off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
az extension add --upgrade -n application-insights |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: app-insight-secret | ||
namespace: "{{ .Values.namespace }}" | ||
type: Opaque | ||
stringData: | ||
connection.string: "{{ .Values.appInsightConnectionString }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: db-secret-sql | ||
namespace: "{{ .Values.namespace }}" | ||
type: Opaque | ||
stringData: | ||
db.server.name: "{{ .Values.db.ServerName }}" | ||
db.port.number: "{{ .Values.db.PortNumber }}" | ||
db.name: "{{ .Values.db.Name }}" | ||
db.user: "{{ .Values.db.User }}" | ||
db.password: "{{ .Values.db.Password }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
targetScope = 'subscription' | ||
|
||
@minLength(1) | ||
@maxLength(64) | ||
@description('Name of the environment that can be used as part of naming resource convention') | ||
param environmentName string | ||
|
||
@minLength(1) | ||
@description('Primary location for all resources') | ||
param location string | ||
|
||
@description('The base URL for artifacts') | ||
param _artifactsLocation string = 'https://raw.githubusercontent.com/WASdev/azure.liberty.aks/048e776e9efe2ffed8368812e198c1007ba94b2c/src/main/' | ||
|
||
@description('Whether to create a new AKS cluster') | ||
param createCluster bool = true | ||
|
||
@description('The VM size for AKS nodes') | ||
param vmSize string = 'Standard_DS2_v2' | ||
|
||
@description('The minimum node count for AKS cluster') | ||
param minCount int = 1 | ||
|
||
@description('The maximum node count for AKS cluster') | ||
param maxCount int = 5 | ||
|
||
@description('Whether to create Azure Container Registry') | ||
param createACR bool = true | ||
|
||
@description('Whether to deploy the application') | ||
param deployApplication bool = false | ||
|
||
@description('Whether to enable Application Gateway Ingress') | ||
param enableAppGWIngress bool = true | ||
|
||
@description('The certificate option for Application Gateway') | ||
param appGatewayCertificateOption string = 'generateCert' | ||
|
||
@description('Whether to enable cookie-based affinity') | ||
param enableCookieBasedAffinity bool = true | ||
|
||
@description('Server administrator login name') | ||
@secure() | ||
param administratorLogin string = 'azureroot' | ||
|
||
@description('Server administrator password') | ||
@secure() | ||
param administratorLoginPassword string | ||
|
||
// Tags that should be applied to all resources. | ||
// | ||
// Note that 'azd-service-name' tags should be applied separately to service host resources. | ||
// Example usage: | ||
// tags: union(tags, { 'azd-service-name': <service name in azure.yaml> }) | ||
var tags = { | ||
'azd-env-name': environmentName | ||
} | ||
|
||
var abbrs = loadJsonContent('./abbreviations.json') | ||
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location)) | ||
var suffix = take(resourceToken, 6) | ||
|
||
resource rg 'Microsoft.Resources/resourceGroups@2022-09-01' = { | ||
name: 'rg-${environmentName}-${take(resourceToken, 6)}' | ||
location: location | ||
tags: tags | ||
} | ||
|
||
module openLibertyOnAks './azure.liberty.aks/mainTemplate.bicep' = { | ||
name: 'openliberty-on-aks' | ||
params: { | ||
_artifactsLocation: _artifactsLocation | ||
location: location | ||
createCluster: createCluster | ||
vmSize: vmSize | ||
minCount: minCount | ||
maxCount: maxCount | ||
createACR: createACR | ||
deployApplication: deployApplication | ||
enableAppGWIngress: enableAppGWIngress | ||
appGatewayCertificateOption: appGatewayCertificateOption | ||
enableCookieBasedAffinity: enableCookieBasedAffinity | ||
} | ||
scope: rg | ||
} | ||
|
||
module monitoring './shared/monitoring.bicep' = { | ||
name: 'monitoring' | ||
params: { | ||
location: location | ||
tags: tags | ||
logAnalyticsName: '${abbrs.operationalInsightsWorkspaces}${resourceToken}' | ||
applicationInsightsName: '${abbrs.insightsComponents}${resourceToken}' | ||
} | ||
scope: rg | ||
} | ||
|
||
output ACR_PASSWORD string = openLibertyOnAks.outputs.acrPassword | ||
output ACR_SERVER string = openLibertyOnAks.outputs.acrServerName | ||
output ACR_USER_NAME string = openLibertyOnAks.outputs.acrUsername | ||
output AZURE_AKS_CLUSTER_NAME string = openLibertyOnAks.outputs.clusterName | ||
output AZURE_REGISTRY_NAME string = openLibertyOnAks.outputs.acrServerName | ||
output AZURE_RESOURCE_GROUP string = rg.name | ||
output DB_NAME string = 'liberty-db-${suffix}' | ||
output DB_RESOURCE_NAME string = 'liberty-server-${suffix}' | ||
output DB_USER_NAME string = administratorLogin | ||
output DB_USER_PASSWORD string = administratorLoginPassword | ||
output LOCATION string = location | ||
output RESOURCE_GROUP_NAME string = rg.name | ||
output WORKSPACE_ID string = monitoring.outputs.logAnalyticsWorkspaceId | ||
output APP_INSIGHTS_CONNECTION_STRING string = monitoring.outputs.appInsightsConnectionString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
param logAnalyticsName string | ||
param applicationInsightsName string | ||
param location string = resourceGroup().location | ||
param tags object = {} | ||
|
||
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2021-12-01-preview' = { | ||
name: logAnalyticsName | ||
location: location | ||
tags: tags | ||
properties: any({ | ||
retentionInDays: 30 | ||
features: { | ||
searchVersion: 1 | ||
} | ||
sku: { | ||
name: 'PerGB2018' | ||
} | ||
}) | ||
} | ||
|
||
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = { | ||
name: applicationInsightsName | ||
location: location | ||
tags: tags | ||
kind: 'web' | ||
properties: { | ||
Application_Type: 'web' | ||
WorkspaceResourceId: logAnalytics.id | ||
} | ||
} | ||
|
||
output applicationInsightsName string = applicationInsights.name | ||
output logAnalyticsWorkspaceId string = logAnalytics.id | ||
output logAnalyticsWorkspaceName string = logAnalytics.name | ||
output appInsightsConnectionString string = applicationInsights.properties.ConnectionString |