Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

viya-single-container running on K8S cluster cannot apply a new SAS license without rebuild #60

Open
splmie opened this issue Sep 7, 2021 · 1 comment

Comments

@splmie
Copy link

splmie commented Sep 7, 2021

I've built SAS Viya 3.5 single container using your framework build.sh and SAS_Viya_deployment_data.zip including SAS license A. Containers created from the image run inside kubernetes cluster. After I added SETINIT_TEXT variable into kubernetes Config Map contained SAS license B and changed the manifest starting Viya containers I expected new Viya containers will start with SAS license B. Unfortunetly this functionality is not working for the image as described in doc https://go.documentation.sas.com/doc/en/dplyml0phy0dkr/3.5/n0qu54bw8k60fqn1rpevg0qnx0q0.htm
New Viya containers still have applied SAS license A in CAS and Foundation. The only change is inside Viya container we have SETINIT_TEXT env variable with license B.

After few tests I found I can change the SAS license only for pre-build single Viya container image downloaded from ses.sas.download docker repository. In example:
ses.sas.download/va-125-x64_redhat_linux_7-docker/sas-viya-programming:3.5.11-20210528.1622225215043

@splmie
Copy link
Author

splmie commented Sep 24, 2021

I found the solution by myself.

  1. Create kubernetes config map with spre.SETINIT_TEXT variable
  2. Put the content of your new SAS license into spre.SETINIT_TEXT.
  spre.SETINIT_TEXT: |
    PROC SETINIT RELEASE='V03';
    SITEINFO NAME='XXXXXXXX'
    SITE=123456789 OSNAME='LIN X64' RECREATE WARN=34 GRACE=62
    [..]
    SAVE; RUN;
  1. Inside the SPRE container set environment variable SETINIT_TEXT and initialize it with value of spre.SETINIT_TEXT from kubernetes config map.

TIP: you have to modify the manifest starting your SPRE container by putting this section

    spec:
      containers:
      - env:
        - name: SETINIT_TEXT
          valueFrom:
            configMapKeyRef:
              key: spre.SETINIT_TEXT
              name: spre-config
  1. entrypoint for the SPRE image need to be modified by putting that code before CAS starts
   echo;echo "===== [INFO] : Checking SAS license =====";

      if [ ! -z "${SETINIT_TEXT}" ]; then
          export SASLICENSEFILE="license.sas"
          export SASLICENSEDIR="/sasinside"
          echo;echo "===== [INFO] : Found new SAS license! =====";echo;
          echo;echo "${SETINIT_TEXT}";echo;
          echo;echo "===== [INFO] : Applying new SAS license =====";echo;
          echo "${SETINIT_TEXT}" > ${SASLICENSEDIR}/${SASLICENSEFILE}
          # Applying license to SAS Foundation
          sudo su -s "/bin/sh" -c "/opt/sas/spre/home/SASFoundation/utilities/bin/apply_license ${SASLICENSEDIR}/${SASLICENSEFILE}" sas
          # Applying license to CAS
          sudo su -s "/bin/sh" -c "ln -sf ${SASLICENSEDIR}/${SASLICENSEFILE} /opt/sas/viya/config/etc/cas/default/sas_license.txt" sas
      else
          echo;echo "===== [INFO] : No changes, skipping  =====";echo;
      fi

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant