doc: added javadoc for NamespaceConfigurator classes
Signed-off-by: xbaran4 <pbaran@redhat.com>pull/117/head
parent
dece823292
commit
e96aa25fb5
|
|
@ -1,9 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2021 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/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Red Hat, Inc. - initial API and implementation
|
||||
*/
|
||||
package org.eclipse.che.workspace.infrastructure.kubernetes.namespace.configurator;
|
||||
|
||||
import io.fabric8.kubernetes.api.model.Secret;
|
||||
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
|
||||
import org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.NamespaceProvisioner;
|
||||
|
||||
/**
|
||||
* Configures user's namespace after provisioning in {@link NamespaceProvisioner} with whatever is
|
||||
* needed. Such as creating user profile and preferences {@link Secret} in user namespace.
|
||||
*
|
||||
* @author Pavol Baran
|
||||
*/
|
||||
public interface NamespaceConfigurator {
|
||||
|
||||
/**
|
||||
* Configures user's namespace after provisioning.
|
||||
*
|
||||
* @param namespaceResolutionContext users namespace context
|
||||
* @throws InfrastructureException when any error occurs
|
||||
*/
|
||||
public void configure(NamespaceResolutionContext namespaceResolutionContext)
|
||||
throws InfrastructureException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2021 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/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Red Hat, Inc. - initial API and implementation
|
||||
*/
|
||||
package org.eclipse.che.workspace.infrastructure.kubernetes.namespace.configurator;
|
||||
|
||||
import static org.eclipse.che.workspace.infrastructure.kubernetes.Constants.DEV_WORKSPACE_MOUNT_AS_ANNOTATION;
|
||||
|
|
@ -22,6 +33,12 @@ import org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext;
|
|||
import org.eclipse.che.workspace.infrastructure.kubernetes.KubernetesClientFactory;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.namespace.KubernetesNamespaceFactory;
|
||||
|
||||
/**
|
||||
* Creates {@link Secret} with user preferences. This serves as a way for DevWorkspaces to acquire
|
||||
* information about the user.
|
||||
*
|
||||
* @author Pavol Baran
|
||||
*/
|
||||
public class UserPreferencesConfigurator implements NamespaceConfigurator {
|
||||
private static final String USER_PREFERENCES_SECRET_NAME = "user-preferences";
|
||||
private static final String USER_PREFERENCES_SECRET_MOUNT_PATH = "/config/user/preferences";
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2021 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/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Red Hat, Inc. - initial API and implementation
|
||||
*/
|
||||
package org.eclipse.che.workspace.infrastructure.kubernetes.namespace.configurator;
|
||||
|
||||
import static org.eclipse.che.workspace.infrastructure.kubernetes.Constants.DEV_WORKSPACE_MOUNT_AS_ANNOTATION;
|
||||
|
|
@ -20,6 +31,12 @@ import org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext;
|
|||
import org.eclipse.che.workspace.infrastructure.kubernetes.KubernetesClientFactory;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.namespace.KubernetesNamespaceFactory;
|
||||
|
||||
/**
|
||||
* Creates {@link Secret} with user profile information such as his id, name and email. This serves
|
||||
* as a way for DevWorkspaces to acquire information about the user.
|
||||
*
|
||||
* @author Pavol Baran
|
||||
*/
|
||||
public class UserProfileConfigurator implements NamespaceConfigurator {
|
||||
private static final String USER_PROFILE_SECRET_NAME = "user-profile";
|
||||
private static final String USER_PROFILE_SECRET_MOUNT_PATH = "/config/user/profile";
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@
|
|||
*/
|
||||
package org.eclipse.che.workspace.infrastructure.kubernetes.provision;
|
||||
|
||||
|
||||
import io.fabric8.kubernetes.api.model.Secret;
|
||||
import io.fabric8.kubernetes.api.model.Namespace;
|
||||
import javax.inject.Inject;
|
||||
import org.eclipse.che.api.workspace.server.model.impl.RuntimeIdentityImpl;
|
||||
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
|
||||
|
|
@ -20,12 +19,13 @@ import org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext;
|
|||
import org.eclipse.che.workspace.infrastructure.kubernetes.api.shared.KubernetesNamespaceMeta;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.namespace.KubernetesNamespace;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.namespace.KubernetesNamespaceFactory;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.namespace.configurator.NamespaceConfigurator;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.namespace.configurator.UserPreferencesConfigurator;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.namespace.configurator.UserProfileConfigurator;
|
||||
|
||||
/**
|
||||
* On namespace provisioning, creates k8s {@link Secret} profile and preferences from information
|
||||
* about the User.
|
||||
* Provisions the k8s {@link Namespace}. After provisioning, configures the namespace through {@link
|
||||
* NamespaceConfigurator}.
|
||||
*
|
||||
* @author Pavol Baran
|
||||
*/
|
||||
|
|
@ -36,7 +36,9 @@ public class NamespaceProvisioner {
|
|||
|
||||
@Inject
|
||||
public NamespaceProvisioner(
|
||||
KubernetesNamespaceFactory namespaceFactory, UserProfileConfigurator userProfileConfigurator, UserPreferencesConfigurator userPreferencesConfigurator) {
|
||||
KubernetesNamespaceFactory namespaceFactory,
|
||||
UserProfileConfigurator userProfileConfigurator,
|
||||
UserPreferencesConfigurator userPreferencesConfigurator) {
|
||||
this.namespaceFactory = namespaceFactory;
|
||||
this.userProfileConfigurator = userProfileConfigurator;
|
||||
this.userPreferencesConfigurator = userPreferencesConfigurator;
|
||||
|
|
@ -63,11 +65,8 @@ public class NamespaceProvisioner {
|
|||
return namespaceMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates k8s user profile and user preferences k8s secrets. This serves as a way for
|
||||
* DevWorkspaces to acquire information about the user.
|
||||
*/
|
||||
private void configureNamespace(NamespaceResolutionContext namespaceResolutionContext) throws InfrastructureException {
|
||||
private void configureNamespace(NamespaceResolutionContext namespaceResolutionContext)
|
||||
throws InfrastructureException {
|
||||
userProfileConfigurator.configure(namespaceResolutionContext);
|
||||
userPreferencesConfigurator.configure(namespaceResolutionContext);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue