@Test public void shouldSetEnvVars() throws Exception { provisioner.provision(openShiftEnvironment, runtimeIdentity); verifyOcLoginEnvVarsPresence(con1EnvVars); verifyOcLoginEnvVarsPresence(con2EnvVars); verifyOcLoginEnvVarsPresence(con3EnvVars); verify(tenantDataProvider).getUserCheTenantData(eq(SUBJECT), eq("user")); }
@Override @Traced public void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { super.provision(osEnv, identity); Map<String, String> envVars = new HashMap<>(); try { Subject subject = EnvironmentContext.getCurrent().getSubject(); addTokenEnvVar(envVars, subject); addTenantEnvVars(envVars, subject); injectEnvVars(osEnv, envVars); } catch (InfrastructureException e) { LOG.error(e.getLocalizedMessage()); } osEnv .getRoutes() .forEach( (name, route) -> { Map<String, String> annotations = route.getMetadata().getAnnotations(); if (annotations.containsKey("org.eclipse.che.server.wsagent/http.path")) { annotations.put("haproxy.router.openshift.io/timeout", wsAgentRoutingTimeout); } }); }
RhCheInfraEnvironmentProvisioner extends OpenShiftEnvironmentProvisioner { @Override @Traced public void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { super.provision(osEnv, identity); Map<String, String> envVars = new HashMap<>(); try { Subject subject = EnvironmentContext.getCurrent().getSubject(); addTokenEnvVar(envVars, subject); addTenantEnvVars(envVars, subject); injectEnvVars(osEnv, envVars); } catch (InfrastructureException e) { LOG.error(e.getLocalizedMessage()); } osEnv .getRoutes() .forEach( (name, route) -> { Map<String, String> annotations = route.getMetadata().getAnnotations(); if (annotations.containsKey("org.eclipse.che.server.wsagent/http.path")) { annotations.put("haproxy.router.openshift.io/timeout", wsAgentRoutingTimeout); } }); } }
RhCheInfraEnvironmentProvisioner extends OpenShiftEnvironmentProvisioner { @Override @Traced public void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { super.provision(osEnv, identity); Map<String, String> envVars = new HashMap<>(); try { Subject subject = EnvironmentContext.getCurrent().getSubject(); addTokenEnvVar(envVars, subject); addTenantEnvVars(envVars, subject); injectEnvVars(osEnv, envVars); } catch (InfrastructureException e) { LOG.error(e.getLocalizedMessage()); } osEnv .getRoutes() .forEach( (name, route) -> { Map<String, String> annotations = route.getMetadata().getAnnotations(); if (annotations.containsKey("org.eclipse.che.server.wsagent/http.path")) { annotations.put("haproxy.router.openshift.io/timeout", wsAgentRoutingTimeout); } }); } @Inject  RhCheInfraEnvironmentProvisioner(
      @Named("che.infra.kubernetes.pvc.enabled") boolean pvcEnabled,
      OpenShiftUniqueNamesProvisioner uniqueNamesProvisioner,
      TlsProvisionerProvider<OpenShiftEnvironment> routeTlsProvisionerProvider,
      ServersConverter<OpenShiftEnvironment> openShiftServersConverter,
      EnvVarsConverter envVarsConverter,
      RestartPolicyRewriter restartPolicyRewriter,
      WorkspaceVolumesStrategy volumesStrategy,
      ContainerResourceProvisioner containerResourceProvisioner,
      LogsVolumeMachineProvisioner logsVolumeMachineProvisioner,
      OpenshiftUserTokenProvider openshiftUserTokenProvider,
      TenantDataProvider tenantDataProvider,
      PodTerminationGracePeriodProvisioner podTerminationGracePeriodProvisioner,
      ImagePullSecretProvisioner imagePullSecretProvisioner,
      ProxySettingsProvisioner proxySettingsProvisioner,
      NodeSelectorProvisioner nodeSelectorProvisioner,
      AsyncStorageProvisioner asyncStorageProvisioner,
      AsyncStoragePodInterceptor asyncStoragePodInterceptor,
      ServiceAccountProvisioner serviceAccountProvisioner,
      CertificateProvisioner certificateProvisioner,
      SshKeysProvisioner sshKeysProvisioner,
      GitConfigProvisioner gitConfigProvisioner,
      OpenShiftPreviewUrlExposer previewUrlEndpointsProvisioner,
      VcsSslCertificateProvisioner vcsSslCertificateProvisioner,
      @Named("che.infra.kubernetes.trust_certs") boolean trustCerts,
      @Named("che.fabric8.wsagent_routing_timeout") String wsAgentRoutingTimeout); }
RhCheInfraEnvironmentProvisioner extends OpenShiftEnvironmentProvisioner { @Override @Traced public void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { super.provision(osEnv, identity); Map<String, String> envVars = new HashMap<>(); try { Subject subject = EnvironmentContext.getCurrent().getSubject(); addTokenEnvVar(envVars, subject); addTenantEnvVars(envVars, subject); injectEnvVars(osEnv, envVars); } catch (InfrastructureException e) { LOG.error(e.getLocalizedMessage()); } osEnv .getRoutes() .forEach( (name, route) -> { Map<String, String> annotations = route.getMetadata().getAnnotations(); if (annotations.containsKey("org.eclipse.che.server.wsagent/http.path")) { annotations.put("haproxy.router.openshift.io/timeout", wsAgentRoutingTimeout); } }); } @Inject  RhCheInfraEnvironmentProvisioner(
      @Named("che.infra.kubernetes.pvc.enabled") boolean pvcEnabled,
      OpenShiftUniqueNamesProvisioner uniqueNamesProvisioner,
      TlsProvisionerProvider<OpenShiftEnvironment> routeTlsProvisionerProvider,
      ServersConverter<OpenShiftEnvironment> openShiftServersConverter,
      EnvVarsConverter envVarsConverter,
      RestartPolicyRewriter restartPolicyRewriter,
      WorkspaceVolumesStrategy volumesStrategy,
      ContainerResourceProvisioner containerResourceProvisioner,
      LogsVolumeMachineProvisioner logsVolumeMachineProvisioner,
      OpenshiftUserTokenProvider openshiftUserTokenProvider,
      TenantDataProvider tenantDataProvider,
      PodTerminationGracePeriodProvisioner podTerminationGracePeriodProvisioner,
      ImagePullSecretProvisioner imagePullSecretProvisioner,
      ProxySettingsProvisioner proxySettingsProvisioner,
      NodeSelectorProvisioner nodeSelectorProvisioner,
      AsyncStorageProvisioner asyncStorageProvisioner,
      AsyncStoragePodInterceptor asyncStoragePodInterceptor,
      ServiceAccountProvisioner serviceAccountProvisioner,
      CertificateProvisioner certificateProvisioner,
      SshKeysProvisioner sshKeysProvisioner,
      GitConfigProvisioner gitConfigProvisioner,
      OpenShiftPreviewUrlExposer previewUrlEndpointsProvisioner,
      VcsSslCertificateProvisioner vcsSslCertificateProvisioner,
      @Named("che.infra.kubernetes.trust_certs") boolean trustCerts,
      @Named("che.fabric8.wsagent_routing_timeout") String wsAgentRoutingTimeout); @Override @Traced void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity); }
RhCheInfraEnvironmentProvisioner extends OpenShiftEnvironmentProvisioner { @Override @Traced public void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { super.provision(osEnv, identity); Map<String, String> envVars = new HashMap<>(); try { Subject subject = EnvironmentContext.getCurrent().getSubject(); addTokenEnvVar(envVars, subject); addTenantEnvVars(envVars, subject); injectEnvVars(osEnv, envVars); } catch (InfrastructureException e) { LOG.error(e.getLocalizedMessage()); } osEnv .getRoutes() .forEach( (name, route) -> { Map<String, String> annotations = route.getMetadata().getAnnotations(); if (annotations.containsKey("org.eclipse.che.server.wsagent/http.path")) { annotations.put("haproxy.router.openshift.io/timeout", wsAgentRoutingTimeout); } }); } @Inject  RhCheInfraEnvironmentProvisioner(
      @Named("che.infra.kubernetes.pvc.enabled") boolean pvcEnabled,
      OpenShiftUniqueNamesProvisioner uniqueNamesProvisioner,
      TlsProvisionerProvider<OpenShiftEnvironment> routeTlsProvisionerProvider,
      ServersConverter<OpenShiftEnvironment> openShiftServersConverter,
      EnvVarsConverter envVarsConverter,
      RestartPolicyRewriter restartPolicyRewriter,
      WorkspaceVolumesStrategy volumesStrategy,
      ContainerResourceProvisioner containerResourceProvisioner,
      LogsVolumeMachineProvisioner logsVolumeMachineProvisioner,
      OpenshiftUserTokenProvider openshiftUserTokenProvider,
      TenantDataProvider tenantDataProvider,
      PodTerminationGracePeriodProvisioner podTerminationGracePeriodProvisioner,
      ImagePullSecretProvisioner imagePullSecretProvisioner,
      ProxySettingsProvisioner proxySettingsProvisioner,
      NodeSelectorProvisioner nodeSelectorProvisioner,
      AsyncStorageProvisioner asyncStorageProvisioner,
      AsyncStoragePodInterceptor asyncStoragePodInterceptor,
      ServiceAccountProvisioner serviceAccountProvisioner,
      CertificateProvisioner certificateProvisioner,
      SshKeysProvisioner sshKeysProvisioner,
      GitConfigProvisioner gitConfigProvisioner,
      OpenShiftPreviewUrlExposer previewUrlEndpointsProvisioner,
      VcsSslCertificateProvisioner vcsSslCertificateProvisioner,
      @Named("che.infra.kubernetes.trust_certs") boolean trustCerts,
      @Named("che.fabric8.wsagent_routing_timeout") String wsAgentRoutingTimeout); @Override @Traced void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity); static final String TOKEN_VAR; static final String CLUSTER_VAR; static final String PROJECT_VAR; static final String TRUST_CERTS_VAR; }