diff --git a/.github/workflows/component-service-profile-kotlin.yml b/.github/workflows/component-service-profile-kotlin.yml index aad93eb..cb6d205 100644 --- a/.github/workflows/component-service-profile-kotlin.yml +++ b/.github/workflows/component-service-profile-kotlin.yml @@ -24,6 +24,11 @@ on: default: 'service-profile.yml' type: string description: 'File name for the service profile in the `templates` directory' + service-profile-name: + required: false + type: string + default: '' + description: 'ServiceProfile metadata.name (..svc.cluster.local). Set when the Kubernetes Service is not named -; empty keeps that default.' openapi-max-workers: required: false type: string @@ -112,6 +117,8 @@ jobs: fi - name: Generate service profile shell: bash + env: + SERVICE_PROFILE_NAME: ${{ inputs.service-profile-name }} run: | # Find the generated spec YML_FILE=$(find . -type f -name '*.yml' \ @@ -138,6 +145,10 @@ jobs: {"condition": {"method": "HEAD"}, "name": "HEAD [Default]"}, {"condition": {"method": "OPTIONS"}, "name": "OPTIONS [Default]"} ]' > service-profile.yml + + if [ -n "$SERVICE_PROFILE_NAME" ]; then + yq -i '.metadata.name = strenv(SERVICE_PROFILE_NAME)' service-profile.yml + fi - name: Check out manifest repository uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 with: @@ -146,6 +157,8 @@ jobs: token: ${{ secrets.MANIFEST_REPO_PAT }} - name: Update or create manifest file shell: bash + env: + SERVICE_PROFILE_NAME: ${{ inputs.service-profile-name }} run: | TEMPLATES_PATH="./manifests/apps/${{ inputs.service-identifier }}/${{ inputs.stage }}/app/templates" @@ -155,6 +168,9 @@ jobs: # Only update the routes part of the service profile if it already exists if [[ -f "$SERVICE_PROFILE_FILE" ]]; then yq -i '.spec.routes = load("service-profile.yml").spec.routes' $SERVICE_PROFILE_FILE + if [ -n "$SERVICE_PROFILE_NAME" ]; then + yq -i '.metadata.name = strenv(SERVICE_PROFILE_NAME)' $SERVICE_PROFILE_FILE + fi else cp service-profile.yml $SERVICE_PROFILE_FILE fi diff --git a/.github/workflows/deploy-kotlin-v2.yml b/.github/workflows/deploy-kotlin-v2.yml index c1f1912..1285118 100644 --- a/.github/workflows/deploy-kotlin-v2.yml +++ b/.github/workflows/deploy-kotlin-v2.yml @@ -124,6 +124,11 @@ on: type: boolean default: true description: 'Use generated openapi spec to generate linkerd service profile and update the service helm chart' + service-profile-name: + required: false + type: string + default: '' + description: 'ServiceProfile metadata.name (..svc.cluster.local). Set when the Kubernetes Service is not named -; empty keeps that default.' openapi-max-workers: required: false type: string @@ -323,6 +328,7 @@ jobs: gradle-module: ${{ inputs.gradle-module }} java-version: ${{ inputs.java-version }} openapi-max-workers: ${{ inputs.openapi-max-workers }} + service-profile-name: ${{ inputs.service-profile-name }} use-arc-runners: ${{ (inputs.use-arc-runners && github.event.repository.private) }} secrets: GHL_USERNAME: ${{ secrets.GHL_USERNAME }} diff --git a/.github/workflows/deploy-kotlin.yml b/.github/workflows/deploy-kotlin.yml index 18538f5..11da69e 100644 --- a/.github/workflows/deploy-kotlin.yml +++ b/.github/workflows/deploy-kotlin.yml @@ -124,6 +124,11 @@ on: type: boolean default: true description: 'Use generated openapi spec to generate linkerd service profile and update the service helm chart' + service-profile-name: + required: false + type: string + default: '' + description: 'ServiceProfile metadata.name (..svc.cluster.local). Set when the Kubernetes Service is not named -; empty keeps that default.' openapi-max-workers: required: false type: string @@ -308,6 +313,7 @@ jobs: gradle-module: ${{ inputs.gradle-module }} java-version: ${{ inputs.java-version }} openapi-max-workers: ${{ inputs.openapi-max-workers }} + service-profile-name: ${{ inputs.service-profile-name }} use-arc-runners: ${{ (inputs.use-arc-runners && github.event.repository.private) }} secrets: GHL_USERNAME: ${{ secrets.GHL_USERNAME }} diff --git a/docs/workflow-guide.md b/docs/workflow-guide.md index 477ab03..30be6ca 100644 --- a/docs/workflow-guide.md +++ b/docs/workflow-guide.md @@ -569,6 +569,7 @@ jobs: | `ecr-repository-name` | No | - | Override ECR repository name | | `run-tests` | No | true | Run tests before deployment | | `update-service-profile` | No | true | Generate linkerd service profile from OpenAPI spec | +| `service-profile-name` | No | `{service-identifier}-{stage}.{service-identifier}-{stage}.svc.cluster.local` | ServiceProfile name; set when the Service is named differently | | `helm-values-path` | No | `helm/{service-identifier}/{stage}/app` | Path to helm values directory in service repo | | `repository-name` | No | `service-{service-identifier}` | Service repository name override | | `argocd-server` | No | - | ArgoCD server URL (e.g., argocd.monta.app) |