Skip to content

Commit

Permalink
fix: remove registry auth information for desktop app launching
Browse files Browse the repository at this point in the history
  • Loading branch information
at88mph committed Oct 23, 2024
1 parent 79f5c8e commit 1162efb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ HOST=(HOST)

# Callback token
TOKEN="${DESKTOP_SESSION_APP_TOKEN}"
REGISTRY_AUTH="${DESKTOP_SESSION_APP_REGISTRY_AUTH}"
CURL_APP_SESSION_HEADERS="--header \"x-auth-token-skaha: ${TOKEN}\" --header \"x-skaha-registry-auth: ${REGISTRY_AUTH}\""
CURL_APP_SESSION_HEADERS="--header \"x-auth-token-skaha: ${TOKEN}\""

handle_error() {
echo "$1"
Expand Down
2 changes: 0 additions & 2 deletions deployment/helm/skaha/skaha-config/launch-desktop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ spec:
value: "v0"
- name: DESKTOP_SESSION_APP_TOKEN
value: "${software.desktop.app.token}"
- name: DESKTOP_SESSION_APP_REGISTRY_AUTH
value: "${software.desktop.app.registry-auth}"
securityContext:
privileged: false
allowPrivilegeEscalation: false
Expand Down
15 changes: 4 additions & 11 deletions skaha/src/main/java/org/opencadc/skaha/session/PostAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,12 @@ public class PostAction extends SessionAction {
public static final String HEADLESS_PRIORITY = "headless.priority";
public static final String HEADLESS_IMAGE_BUNDLE = "headless.image.bundle";
public static final String DEFAULT_SOFTWARE_IMAGESECRET_VALUE = "notused";

// k8s rejects label size > 63. Since k8s appends a maximum of six characters
// to a job name to form a pod name, we limit the job name length to 57 characters.
private static final int MAX_JOB_NAME_LENGTH = 57;
private static final String CREATE_USER_BASE_COMMAND = "/usr/local/bin/add-user";
private static final String DESKTOP_SESSION_APP_TOKEN = "software.desktop.app.token";
private static final String DESKTOP_SESSION_REGISTRY_AUTH = "software.desktop.app.registry-auth";
private static final String POSIX_MAPPER_URI = "POSIX_MAPPER_URI";
private static final String SKAHA_TLD = "SKAHA_TLD";

private static final Logger log = Logger.getLogger(PostAction.class);
Expand Down Expand Up @@ -547,8 +546,6 @@ public void createSession(String type, String image, String name, Integer cores,
String cmd, String args, List<String> envs)
throws Exception {

String jobName = K8SUtil.getJobName(sessionID, type, posixPrincipal.username);

String supplementalGroups = getSupplementalGroupsList();
log.debug("supplementalGroups are " + supplementalGroups);

Expand Down Expand Up @@ -590,16 +587,16 @@ public void createSession(String type, String image, String name, Integer cores,
final String headlessImageBundle = getHeadlessImageBundle(image, cmd, args, envs);

final String imageRegistrySecretName;
final ImageRegistryAuth userRegistryAuth;
// In the absence of the existence of a public image, assume Private. The validateImage() step above will have caught a non-existent Image already.
if (getPublicImage(image) == null) {
userRegistryAuth = getRegistryAuth(getRegistryHost(image));
final ImageRegistryAuth userRegistryAuth = getRegistryAuth(getRegistryHost(image));
imageRegistrySecretName = createRegistryImageSecret(userRegistryAuth);
} else {
userRegistryAuth = null;
imageRegistrySecretName = PostAction.DEFAULT_SOFTWARE_IMAGESECRET_VALUE;
}

String jobName = K8SUtil.getJobName(sessionID, type, posixPrincipal.username);

SessionJobBuilder sessionJobBuilder = SessionJobBuilder.fromPath(Paths.get(jobLaunchPath))
.withGPUEnabled(this.gpuEnabled)
.withGPUCount(gpus)
Expand All @@ -620,10 +617,6 @@ public void createSession(String type, String image, String name, Integer cores,
.withParameter(PostAction.SOFTWARE_REQUESTS_RAM, ram.toString() + "Gi")
.withParameter(PostAction.SOFTWARE_LIMITS_CORES, cores.toString())
.withParameter(PostAction.SOFTWARE_LIMITS_RAM, ram + "Gi")
.withParameter(PostAction.POSIX_MAPPER_URI,
this.posixMapperConfiguration.getBaseURL() == null
? this.posixMapperConfiguration.getResourceID().toString()
: this.posixMapperConfiguration.getBaseURL().toExternalForm())
.withParameter(PostAction.SKAHA_TLD, this.skahaTld);

if (StringUtil.hasText(supplementalGroups)) {
Expand Down

0 comments on commit 1162efb

Please sign in to comment.