Skip to content

[patch] Rename Facilities MREF AES Keystore Secret for gitops - #2597

Open
AditIBM931 wants to merge 19 commits into
masterfrom
mascore-16222
Open

AditIBM931 wants to merge 19 commits into
masterfrom
mascore-16222

Conversation

@AditIBM931

@AditIBM931 AditIBM931 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Fix: Rename Facilities MREF AES Keystore Secret

Problem

The CLI stored the MREF keystore password in AWS SM under manage-mref-keystore-password and set facilities_vault_secret_name to the same value. However, since vaultSecret.secretName was never set in the FacilitiesWorkspace CR, Facilities ignored the CLI-managed secret and created its own K8s secret (main-facilities-vs--sn) with an independently generated password.

This meant all MAS instances for a given customer (ICN) used different MREF passwords, defeating the purpose of the customer-level shared secret and causing backflow issues when moving data between environments.

Jira issue: https://jsw.ibm.com/browse/MASCORE-16222

Solution

Rename the secret to match the name Facilities natively uses ({workspace_id}-facilities-vs--sn) so ArgoCD injects the CLI-managed password directly into the secret Facilities already reads — without requiring any Workspace CR update.

The secret JSON key is also updated from password to pwd to match what the Facilities operator expects.

Changes

image/cli/mascli/functions/gitops_suite_app_config

  • FACILITIES_VAULT_SECRET_NAME default: manage-mref-keystore-password${MAS_WORKSPACE_ID}-facilities-vs--sn
  • FACILITIES_AWS_SECRET_NAME introduced to separate the AWS SM secret name from the K8s secret name for use in validation
  • manage_customer_mref_password() call updated to pass MAS_WORKSPACE_ID as new 5th argument
  • Validation updated to use FACILITIES_AWS_SECRET_NAME with fallback to FACILITIES_VAULT_SECRET_NAME for user-provided secrets
  • Secret key in validation changed from passwordpwd
  • Log message updated to reflect new secret path

image/cli/mascli/functions/gitops_utilsmanage_customer_mref_password()

  • New MAS_WORKSPACE_ID parameter added as 5th argument (SECRETS_KEY_SEPERATOR shifted to 6th)

  • AWS secret name renamed: manage-mref-keystore-password{MAS_WORKSPACE_ID}-facilities-vs--sn

  • Secret JSON key changed from passwordpwd (read and write)

  • added a fallback to ensure existing environments preserve their current password across the rename.:

    Tier Checks Action
    1 {workspace_id}-facilities-vs--sn (new secret) Use directly
    2 manage-mref-keystore-password (customer-level) Migrate to new name
    3 {account}/{cluster}/{instance}/facilities/manage-mref-keystore-password (instance-level) Migrate to new name
    4 Nothing found Generate new 32-char alphanumeric password

image/cli/mascli/templates/gitops/appset-configs/cluster/instance/masapp/ibm-mas-masapp-config.yaml.j2

  • AVP secret reference key changed from #password#pwd so ArgoCD resolves the correct key from AWS SM when creating the K8s secret

Testing

successful run of the pipeline and creation of {MAS_WORKSPACE_ID}-facilities-vs--sn: https://cloud.ibm.com/devops/pipelines/tekton/39587f23-e891-42a3-ad41-da50d48e6693/runs/682bb488-0d04-4e1b-9161-cfec266d42c5?env_id=ibm:yp:us-south

Screenshot 2026-09-18 at 10 14 18 AM

verification of the secrets:

image

Additional Changes

FACILITIES_LIBERTY_EXTENSIONS_SECRET path restored to instance-level

Liberty extensions XML is an instance-specific server configuration and must be stored per-instance, not shared across all instances of a customer and was thus restored back to instance-level.

Restored liberty secret name validation

The only allowed format is: {workspace_id}-facilities-lexml--sn If a user sets a non-standard liberty secret name in the FacilitiesWorkspace CR, the pipeline will fail with a clear error message. It also fails if the liberty secret is missing.

@AditIBM931
AditIBM931 requested a review from a team as a code owner September 18, 2026 04:48

@mnivedithaa mnivedithaa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FACILITIES_LIBERTY_EXTENSIONS_SECRET should be updated to original instance level secret

@AditIBM931

AditIBM931 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

re-ran pipeline successfully: https://cloud.ibm.com/devops/pipelines/tekton/39587f23-e891-42a3-ad41-da50d48e6693/runs/4f79c191-1e67-4295-a12d-207a83261aea?env_id=ibm:yp:us-south

tested with a temporary aws secret: test-liberty-secret, no problems with the new format for FACILITIES_LIBERTY_EXTENSIONS_SECRET

image

@mnivedithaa mnivedithaa changed the title Fix: Rename Facilities MREF AES Keystore Secret [patch] Rename Facilities MREF AES Keystore Secret Sep 18, 2026
@AditIBM931

Copy link
Copy Markdown
Contributor Author

Removed legacy secrets fallback, but restored libertyExtensionXML secret name validation enforcing. Relevant pipeline: https://cloud.ibm.com/devops/pipelines/tekton/39587f23-e891-42a3-ad41-da50d48e6693/runs/fc160451-ee7c-4046-bcbd-b81f02d5978b?env_id=ibm:yp:us-south

@whitfiea whitfiea changed the title [patch] Rename Facilities MREF AES Keystore Secret [patch] Rename Facilities MREF AES Keystore Secret for gitops Sep 21, 2026
# Set customer-level secret path (without trailing separator)
export FACILITIES_VAULT_SECRET="ibm-customer${SECRETS_KEY_SEPERATOR}${ICN}${SECRETS_KEY_SEPERATOR}facilities"
export FACILITIES_LIBERTY_EXTENSIONS_SECRET="ibm-customer${SECRETS_KEY_SEPERATOR}${ICN}${SECRETS_KEY_SEPERATOR}facilities"
export FACILITIES_LIBERTY_EXTENSIONS_SECRET="${ACCOUNT_ID}${SECRETS_KEY_SEPERATOR}${CLUSTER_ID}${SECRETS_KEY_SEPERATOR}${MAS_INSTANCE_ID}${SECRETS_KEY_SEPERATOR}facilities"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was the FACILITIES_LIBERTY_EXTENSIONS_SECRET changed? it isn't mentioned in the issue or PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main-facilities-lexml--sn was restored to instance level due to issues in the Gitops pipeline, therefore FACILITIES_LIBERTY_EXTENSIONS_SECRET also needed to be restored to instance level for correct pathing in AWS


# Get user-provided secret name from app spec (if any)
USER_PROVIDED_VAULT_SECRET=$(yq eval '.mas_appws_spec.settings.vaultSecret.secretName // ""' ${MAS_APPWS_SPEC_YAML_RESOLVED})
USER_PROVIDED_LIBERTY_SECRET=$(yq eval '.mas_appws_spec.settings.libertyExtensionXML.secretName // ""' ${MAS_APPWS_SPEC_YAML_RESOLVED})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are not using the provided liberty secret name?

@AditIBM931 AditIBM931 Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the liberty secret name is taken directly from CR and validated against the format main-facilities-lexml--sn

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main-facilities-lexml--sn was originally an instance level secret and these changes caused an issue in the Gitops pipeline, so it was reverted

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following is the slack thread is where the Gitops issue was reported, it might help put things better into context: https://ibm-mas.slack.com/archives/C0161LRJWDU/p1788890475858589

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants