diff --git a/demo/dockerfiles/demo-theia-monitor-vscode/Dockerfile b/demo/dockerfiles/demo-theia-monitor-vscode/Dockerfile index 838bac4d..2b3fb29a 100644 --- a/demo/dockerfiles/demo-theia-monitor-vscode/Dockerfile +++ b/demo/dockerfiles/demo-theia-monitor-vscode/Dockerfile @@ -1,3 +1,10 @@ +FROM node:18-bullseye-slim as build-stage + +# Copy and unzip the vsix file +RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/* +COPY theiacloud-monitor-0.11.0-next.vsix /tmp/theiacloud-monitor.vsix +RUN mkdir /tmp/extracted && unzip /tmp/theiacloud-monitor.vsix -d /tmp/extracted + FROM theiacloud/theia-cloud-demo:0.11.0-next as production-stage -COPY --chown=theia:theia theiacloud-monitor-0.11.0-next.vsix /home/theia/plugins \ No newline at end of file +COPY --chown=theia:theia --from=build-stage /tmp/extracted /home/theia/plugins \ No newline at end of file diff --git a/demo/dockerfiles/demo-theia-monitor-vscode/theiacloud-monitor-0.11.0-next.vsix b/demo/dockerfiles/demo-theia-monitor-vscode/theiacloud-monitor-0.11.0-next.vsix index a13ec713..51c36dfc 100644 Binary files a/demo/dockerfiles/demo-theia-monitor-vscode/theiacloud-monitor-0.11.0-next.vsix and b/demo/dockerfiles/demo-theia-monitor-vscode/theiacloud-monitor-0.11.0-next.vsix differ diff --git a/documentation/Architecture.md b/documentation/Architecture.md index eff85f75..11662d36 100644 --- a/documentation/Architecture.md +++ b/documentation/Architecture.md @@ -8,7 +8,7 @@ The Theia Cloud Operator listens for changes to custom resources inside the clus The Java operator is created via a dependency injection module. We provide a library (`org.eclipse.theia.cloud.operator`), as well as a default implementation (`org.eclipse.theia.cloud.defaultoperator`) for the operator. -The library can be used to create a operator customized to your use cases. +The library can be used to create an operator customized to your use cases. The default implementation is a production-ready operator that handles most use cases on most cloud providers out of the box and is used in our demos. If customization is needed, it also serves as an example of how to utilize the operator library. diff --git a/java/operator/org.eclipse.theia.cloud.defaultoperator/src/main/java/org/eclipse/theia/cloud/defaultoperator/DefaultTheiaCloudOperatorLauncher.java b/java/operator/org.eclipse.theia.cloud.defaultoperator/src/main/java/org/eclipse/theia/cloud/defaultoperator/DefaultTheiaCloudOperatorLauncher.java index b125d35e..7ff7e3ce 100644 --- a/java/operator/org.eclipse.theia.cloud.defaultoperator/src/main/java/org/eclipse/theia/cloud/defaultoperator/DefaultTheiaCloudOperatorLauncher.java +++ b/java/operator/org.eclipse.theia.cloud.defaultoperator/src/main/java/org/eclipse/theia/cloud/defaultoperator/DefaultTheiaCloudOperatorLauncher.java @@ -23,8 +23,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.eclipse.theia.cloud.operator.TheiaCloudOperator; -import org.eclipse.theia.cloud.operator.AbstractTheiaCloudOperatorLauncher; import org.eclipse.theia.cloud.operator.TheiaCloudOperatorArguments; +import org.eclipse.theia.cloud.operator.TheiaCloudOperatorLauncher; import org.eclipse.theia.cloud.operator.di.AbstractTheiaCloudOperatorModule; import com.google.inject.Guice; @@ -41,7 +41,7 @@ import io.fabric8.kubernetes.client.extended.leaderelection.resourcelock.LeaseLock; import picocli.CommandLine; -public class DefaultTheiaCloudOperatorLauncher extends AbstractTheiaCloudOperatorLauncher { +public class DefaultTheiaCloudOperatorLauncher implements TheiaCloudOperatorLauncher { private static final Logger LOGGER = LogManager.getLogger(DefaultTheiaCloudOperatorLauncher.class); @@ -87,7 +87,8 @@ public void runMain(String[] args) throws InterruptedException { .withLock(new LeaseLock(leaseLockNamespace, LEASE_LOCK_NAME, lockIdentity))// .withLeaderCallbacks(new LeaderCallbacks(DefaultTheiaCloudOperatorLauncher.this::onStartLeading, - DefaultTheiaCloudOperatorLauncher.this::onStopLeading, DefaultTheiaCloudOperatorLauncher.this::onNewLeader))// + DefaultTheiaCloudOperatorLauncher.this::onStopLeading, + DefaultTheiaCloudOperatorLauncher.this::onNewLeader))// .build(); LeaderElector leaderElector = k8sClient.leaderElector().withConfig(leaderElectionConfig).build(); leaderElector.run(); @@ -122,7 +123,7 @@ protected void startOperatorAsLeader(TheiaCloudOperatorArguments arguments) { } @Override - protected TheiaCloudOperatorArguments createArguments(String[] args) { + public TheiaCloudOperatorArguments createArguments(String[] args) { TheiaCloudOperatorArguments arguments = new TheiaCloudOperatorArguments(); CommandLine commandLine = new CommandLine(arguments).setTrimQuotes(true); commandLine.parseArgs(args); @@ -131,7 +132,7 @@ protected TheiaCloudOperatorArguments createArguments(String[] args) { } @Override - protected AbstractTheiaCloudOperatorModule createModule(TheiaCloudOperatorArguments arguments) { + public AbstractTheiaCloudOperatorModule createModule(TheiaCloudOperatorArguments arguments) { return new DefaultTheiaCloudOperatorModule(arguments); } diff --git a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/AbstractTheiaCloudOperatorLauncher.java b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/TheiaCloudOperatorLauncher.java similarity index 81% rename from java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/AbstractTheiaCloudOperatorLauncher.java rename to java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/TheiaCloudOperatorLauncher.java index 1fb02f89..9983f232 100644 --- a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/AbstractTheiaCloudOperatorLauncher.java +++ b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/TheiaCloudOperatorLauncher.java @@ -18,12 +18,12 @@ import org.eclipse.theia.cloud.operator.di.AbstractTheiaCloudOperatorModule; -public abstract class AbstractTheiaCloudOperatorLauncher { +public interface TheiaCloudOperatorLauncher { public abstract void runMain(String[] args) throws InterruptedException; - protected abstract TheiaCloudOperatorArguments createArguments(String[] args); + public abstract TheiaCloudOperatorArguments createArguments(String[] args); - protected abstract AbstractTheiaCloudOperatorModule createModule(TheiaCloudOperatorArguments arguments); + public abstract AbstractTheiaCloudOperatorModule createModule(TheiaCloudOperatorArguments arguments); }