fix: add new label to user-profile secret
Signed-off-by: David Kwon <dakwon@redhat.com>pr-update-base-images-1644020482
parent
e9e38fd77b
commit
8e8624c1fb
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
||||
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
|
|
@ -14,6 +14,7 @@ package org.eclipse.che.workspace.infrastructure.kubernetes.namespace.configurat
|
|||
import static org.eclipse.che.workspace.infrastructure.kubernetes.Constants.DEV_WORKSPACE_MOUNT_AS_ANNOTATION;
|
||||
import static org.eclipse.che.workspace.infrastructure.kubernetes.Constants.DEV_WORKSPACE_MOUNT_LABEL;
|
||||
import static org.eclipse.che.workspace.infrastructure.kubernetes.Constants.DEV_WORKSPACE_MOUNT_PATH_ANNOTATION;
|
||||
import static org.eclipse.che.workspace.infrastructure.kubernetes.Constants.DEV_WORKSPACE_WATCH_SECRET_LABEL;
|
||||
|
||||
import io.fabric8.kubernetes.api.model.Secret;
|
||||
import io.fabric8.kubernetes.api.model.SecretBuilder;
|
||||
|
|
@ -90,6 +91,7 @@ public class UserProfileConfigurator implements NamespaceConfigurator {
|
|||
.withNewMetadata()
|
||||
.withName(USER_PROFILE_SECRET_NAME)
|
||||
.addToLabels(DEV_WORKSPACE_MOUNT_LABEL, "true")
|
||||
.addToLabels(DEV_WORKSPACE_WATCH_SECRET_LABEL, "true")
|
||||
.addToAnnotations(DEV_WORKSPACE_MOUNT_AS_ANNOTATION, "file")
|
||||
.addToAnnotations(DEV_WORKSPACE_MOUNT_PATH_ANNOTATION, USER_PROFILE_SECRET_MOUNT_PATH)
|
||||
.endMetadata()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
||||
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
|
|
@ -13,11 +13,13 @@ package org.eclipse.che.workspace.infrastructure.kubernetes.namespace.configurat
|
|||
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
import io.fabric8.kubernetes.api.model.Secret;
|
||||
import io.fabric8.kubernetes.client.server.mock.KubernetesServer;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.eclipse.che.api.core.NotFoundException;
|
||||
import org.eclipse.che.api.core.ServerException;
|
||||
import org.eclipse.che.api.user.server.UserManager;
|
||||
|
|
@ -75,6 +77,15 @@ public class UserProfileConfiguratorTest {
|
|||
kubernetesServer.getClient().secrets().inNamespace(USER_NAMESPACE).list().getItems();
|
||||
assertEquals(secrets.size(), 1);
|
||||
assertEquals(secrets.get(0).getMetadata().getName(), "user-profile");
|
||||
|
||||
Map<String, String> labels = secrets.get(0).getMetadata().getLabels();
|
||||
String expectedMountLabel = "controller.devfile.io/mount-to-devworkspace";
|
||||
assertTrue(labels.containsKey(expectedMountLabel));
|
||||
assertEquals(labels.get(expectedMountLabel), "true");
|
||||
|
||||
String expectedWatchLabel = "controller.devfile.io/watch-secret";
|
||||
assertTrue(labels.containsKey(expectedWatchLabel));
|
||||
assertEquals(labels.get(expectedWatchLabel), "true");
|
||||
}
|
||||
|
||||
@Test(
|
||||
|
|
|
|||
Loading…
Reference in New Issue