Search in sources :

Example 56 with NamespaceResolutionContext

use of org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext in project devspaces-images by redhat-developer.

the class OpenShiftProjectFactory method getOrCreate.

public OpenShiftProject getOrCreate(RuntimeIdentity identity) throws InfrastructureException {
    OpenShiftProject osProject = get(identity);
    var subject = EnvironmentContext.getCurrent().getSubject();
    NamespaceResolutionContext resolutionCtx = new NamespaceResolutionContext(identity.getWorkspaceId(), subject.getUserId(), subject.getUserName());
    Map<String, String> namespaceAnnotationsEvaluated = evaluateAnnotationPlaceholders(resolutionCtx);
    osProject.prepare(canCreateNamespace(identity), initWithCheServerSa && !isNullOrEmpty(oAuthIdentityProvider), labelNamespaces ? namespaceLabels : emptyMap(), annotateNamespaces ? namespaceAnnotationsEvaluated : emptyMap());
    configureNamespace(resolutionCtx, osProject.getName());
    return osProject;
}
Also used : NamespaceResolutionContext(org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext)

Aggregations

NamespaceResolutionContext (org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext)56 Test (org.testng.annotations.Test)30 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)16 KubernetesServer (io.fabric8.kubernetes.client.server.mock.KubernetesServer)14 BeforeMethod (org.testng.annotations.BeforeMethod)14 HashMap (java.util.HashMap)8 KubernetesNamespaceMetaImpl (org.eclipse.che.workspace.infrastructure.kubernetes.api.server.impls.KubernetesNamespaceMetaImpl)8 WorkspaceImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl)6 InfrastructureException (org.eclipse.che.api.workspace.server.spi.InfrastructureException)6 KubernetesNamespaceMeta (org.eclipse.che.workspace.infrastructure.kubernetes.api.shared.KubernetesNamespaceMeta)6 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)4 RuntimeIdentity (org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity)4 UserImpl (org.eclipse.che.api.user.server.model.impl.UserImpl)4 RuntimeIdentityImpl (org.eclipse.che.api.workspace.server.model.impl.RuntimeIdentityImpl)4 DevfileImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl)4 SubjectImpl (org.eclipse.che.commons.subject.SubjectImpl)4 NamespaceConfigurator (org.eclipse.che.workspace.infrastructure.kubernetes.namespace.configurator.NamespaceConfigurator)4 Namespace (io.fabric8.kubernetes.api.model.Namespace)2 NamespaceBuilder (io.fabric8.kubernetes.api.model.NamespaceBuilder)2 Project (io.fabric8.openshift.api.model.Project)2