You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2024/02/27 19:02:31 UTC
(camel-karavan) branch main updated (33c870c5 -> 1a2e462d)
This is an automated email from the ASF dual-hosted git repository.
marat pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
from 33c870c5 Fix
new 774f0d6f security-authorize-web-endpoints-reference
new 5679b161 Fix
new 1a2e462d Fix
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/camel/karavan/service/GitService.java | 6 +--
.../camel/karavan/service/KaravanCacheService.java | 6 +--
.../camel/karavan/service/KaravanService.java | 45 +++++++---------------
.../camel/karavan/service/ProjectService.java | 15 ++------
.../src/main/resources/application.properties | 2 +-
.../src/main/webui/src/api/ProjectService.ts | 2 -
.../webui/src/project/files/CreateFileModal.tsx | 2 +-
karavan-core/src/core/api/VariableUtil.ts | 3 +-
8 files changed, 23 insertions(+), 58 deletions(-)
(camel-karavan) 01/03: security-authorize-web-endpoints-reference
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
commit 774f0d6f00339cc51a046f888bc40ae33f57822f
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Tue Feb 27 12:58:22 2024 -0500
security-authorize-web-endpoints-reference
---
karavan-app/src/main/resources/application.properties | 2 +-
karavan-app/src/main/webui/src/project/files/CreateFileModal.tsx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/karavan-app/src/main/resources/application.properties b/karavan-app/src/main/resources/application.properties
index 939778f5..a694040d 100644
--- a/karavan-app/src/main/resources/application.properties
+++ b/karavan-app/src/main/resources/application.properties
@@ -69,7 +69,7 @@ karavan.container-image.registry-password=
quarkus.http.auth.permission.authenticated.paths=/api/*
quarkus.http.auth.permission.authenticated.policy=authenticated
-quarkus.http.auth.permission.public.paths=/public/*,/static/*,/*.map,/*.css,/*.js,/*.png,/*.html,/*.woff2,/*.ico,/robots.txt
+quarkus.http.auth.permission.public.paths=/public/*,/static/*,/robots.txt,/favicon.ico
quarkus.http.auth.permission.public.policy=permit
quarkus.http.auth.permission.public.methods=GET,HEAD,POST
diff --git a/karavan-app/src/main/webui/src/project/files/CreateFileModal.tsx b/karavan-app/src/main/webui/src/project/files/CreateFileModal.tsx
index cd2538fe..61af5453 100644
--- a/karavan-app/src/main/webui/src/project/files/CreateFileModal.tsx
+++ b/karavan-app/src/main/webui/src/project/files/CreateFileModal.tsx
@@ -182,7 +182,7 @@ export function CreateFileModal(props: Props) {
function getFullFileName(name: string, type?: string) {
let extension = ProjectFileTypes.filter(value => value.name === type)[0]?.extension;
extension = extension === '*' ? '' : '.' + extension;
- const filename = (extension !== 'java')
+ const filename = (extension !== '.java')
? fileNameCheck(name)
: CamelUi.javaNameFromTitle(name);
return filename + (isKamelet ? '-' + kameletType : '') + extension;
(camel-karavan) 02/03: Fix
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
commit 5679b161f7b96049c8dab494310a194a9cac6437
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Tue Feb 27 13:12:25 2024 -0500
Fix
---
.../apache/camel/karavan/service/GitService.java | 6 +--
.../camel/karavan/service/KaravanCacheService.java | 6 +--
.../camel/karavan/service/KaravanService.java | 45 +++++++---------------
.../camel/karavan/service/ProjectService.java | 15 ++------
.../src/main/webui/src/api/ProjectService.ts | 2 -
5 files changed, 19 insertions(+), 55 deletions(-)
diff --git a/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java b/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
index 14da6248..7a4ce07e 100644
--- a/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
+++ b/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
@@ -24,11 +24,7 @@ import io.smallrye.mutiny.tuples.Tuple2;
import io.vertx.core.Vertx;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
-import org.apache.camel.karavan.model.GitConfig;
-import org.apache.camel.karavan.model.GitRepo;
-import org.apache.camel.karavan.model.GitRepoFile;
-import org.apache.camel.karavan.model.Project;
-import org.apache.camel.karavan.model.ProjectFile;
+import org.apache.camel.karavan.model.*;
import org.eclipse.jgit.api.*;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidRemoteException;
diff --git a/karavan-app/src/main/java/org/apache/camel/karavan/service/KaravanCacheService.java b/karavan-app/src/main/java/org/apache/camel/karavan/service/KaravanCacheService.java
index ce2b178b..1c87bd59 100644
--- a/karavan-app/src/main/java/org/apache/camel/karavan/service/KaravanCacheService.java
+++ b/karavan-app/src/main/java/org/apache/camel/karavan/service/KaravanCacheService.java
@@ -24,7 +24,6 @@ import com.hazelcast.map.IMap;
import com.hazelcast.query.Predicate;
import com.hazelcast.query.Predicates;
import io.quarkus.runtime.ShutdownEvent;
-import io.quarkus.vertx.ConsumeEvent;
import jakarta.enterprise.event.Observes;
import jakarta.enterprise.inject.Default;
import jakarta.inject.Singleton;
@@ -42,8 +41,6 @@ import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
-import static org.apache.camel.karavan.service.KaravanService.START_SERVICES;
-
@Default
@Singleton
public class KaravanCacheService {
@@ -62,8 +59,7 @@ public class KaravanCacheService {
public static final String DEFAULT_ENVIRONMENT = "dev";
- @ConsumeEvent(value = START_SERVICES)
- void start(String data) {
+ void start() {
LOGGER.info("KaravanCacheService is starting");
Config config = new ClasspathYamlConfig("hazelcast.yaml");
hz = Hazelcast.getOrCreateHazelcastInstance(config);
diff --git a/karavan-app/src/main/java/org/apache/camel/karavan/service/KaravanService.java b/karavan-app/src/main/java/org/apache/camel/karavan/service/KaravanService.java
index 353c1b53..3bef1afd 100644
--- a/karavan-app/src/main/java/org/apache/camel/karavan/service/KaravanService.java
+++ b/karavan-app/src/main/java/org/apache/camel/karavan/service/KaravanService.java
@@ -20,7 +20,6 @@ import io.quarkus.runtime.Quarkus;
import io.quarkus.runtime.ShutdownEvent;
import io.quarkus.runtime.Startup;
import io.quarkus.runtime.StartupEvent;
-import io.quarkus.vertx.ConsumeEvent;
import io.vertx.core.eventbus.EventBus;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
@@ -53,9 +52,10 @@ public class KaravanService implements HealthCheck {
@Inject
ProjectService projectService;
- public static final String START_KUBERNETES_SERVICES = "START_KUBERNETES_LISTENERS";
- public static final String START_INTERNAL_DOCKER_SERVICES = "START_INTERNAL_DOCKER_SERVICES";
- public static final String START_SERVICES = "START_SERVICES";
+ @Inject
+ KaravanCacheService karavanCacheService;
+
+ public static final String KARAVAN_STARTED = "KARAVAN_STARTED";
@Override
public HealthCheckResponse call() {
@@ -63,44 +63,27 @@ public class KaravanService implements HealthCheck {
}
void onStart(@Observes StartupEvent ev) throws Exception {
- if (!ConfigService.inKubernetes()) {
- eventBus.publish(START_INTERNAL_DOCKER_SERVICES, null);
- } else {
- eventBus.publish(START_KUBERNETES_SERVICES, null);
- }
- eventBus.publish(START_SERVICES, null);
- }
-
- @ConsumeEvent(value = START_INTERNAL_DOCKER_SERVICES, blocking = true)
- void startInternalDockerServices(String data) throws Exception {
- LOGGER.info("Starting Karavan in Docker");
- if (!dockerService.checkDocker()){
+ if (!ConfigService.inKubernetes() && !dockerService.checkDocker()){
Quarkus.asyncExit();
- } else {
- dockerService.startListeners();
}
- }
-
- @ConsumeEvent(value = START_KUBERNETES_SERVICES, blocking = true)
- void startKubernetesServices(String data) throws Exception {
- LOGGER.info("Starting Karavan in Kubernetes");
- kubernetesService.startInformers(null);
- }
-
- @ConsumeEvent(value = START_SERVICES, blocking = true)
- void startServices(String data) throws Exception {
LOGGER.info("Starting Karavan services");
+ karavanCacheService.start();
projectService.tryStart();
+ eventBus.publish(KARAVAN_STARTED, null);
+ if (!ConfigService.inKubernetes()) {
+ dockerService.startListeners();
+ } else {
+ kubernetesService.startInformers(null);
+ }
}
void onStop(@Observes ShutdownEvent ev) throws IOException {
- LOGGER.info("Stop Listeners");
+ LOGGER.info("Stopping Listeners");
if (ConfigService.inKubernetes()) {
kubernetesService.stopInformers();
} else {
dockerService.stopListeners();
}
- LOGGER.info("Stop Karavan");
+ LOGGER.info("Karavan stopped");
}
-
}
diff --git a/karavan-app/src/main/java/org/apache/camel/karavan/service/ProjectService.java b/karavan-app/src/main/java/org/apache/camel/karavan/service/ProjectService.java
index 00d1f5be..bc966850 100644
--- a/karavan-app/src/main/java/org/apache/camel/karavan/service/ProjectService.java
+++ b/karavan-app/src/main/java/org/apache/camel/karavan/service/ProjectService.java
@@ -23,23 +23,17 @@ import io.vertx.mutiny.core.eventbus.EventBus;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Default;
import jakarta.inject.Inject;
-import org.apache.camel.karavan.model.ContainerStatus;
-import org.apache.camel.karavan.model.GroupedKey;
-import org.apache.camel.karavan.model.Project;
-import org.apache.camel.karavan.model.ProjectFile;
import org.apache.camel.karavan.code.CodeService;
import org.apache.camel.karavan.code.DockerComposeConverter;
-import org.apache.camel.karavan.model.DockerComposeService;
import org.apache.camel.karavan.docker.DockerForKaravan;
-import org.apache.camel.karavan.model.GitRepo;
import org.apache.camel.karavan.kubernetes.KubernetesService;
+import org.apache.camel.karavan.model.*;
import org.apache.camel.karavan.shared.Constants;
import org.apache.camel.karavan.shared.Property;
import org.apache.camel.karavan.validation.project.ProjectModifyValidator;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.microprofile.config.inject.ConfigProperty;
-import org.eclipse.microprofile.faulttolerance.Retry;
import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Readiness;
@@ -50,8 +44,8 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
-import static org.apache.camel.karavan.service.KaravanCacheService.DEFAULT_ENVIRONMENT;
import static org.apache.camel.karavan.code.CodeService.*;
+import static org.apache.camel.karavan.service.KaravanCacheService.DEFAULT_ENVIRONMENT;
import static org.apache.camel.karavan.shared.Constants.NOTIFICATION_EVENT_COMMIT;
@Default
@@ -272,13 +266,10 @@ public class ProjectService implements HealthCheck {
return codeService.getProjectPort(projectId);
}
- @Retry(maxRetries = 20, delay = 3000)
public void tryStart() throws Exception {
- boolean cache = karavanCacheService.isReady();
boolean git = gitService.checkGit();
- LOGGER.info("Starting Project service: cache is " + (cache ? "ready" : "not ready"));
LOGGER.info("Starting Project service: git is " + (git ? "ready" : "not ready"));
- if (karavanCacheService.isReady() && gitService.checkGit()) {
+ if (gitService.checkGit()) {
if (karavanCacheService.getProjects().isEmpty()) {
importAllProjects();
}
diff --git a/karavan-app/src/main/webui/src/api/ProjectService.ts b/karavan-app/src/main/webui/src/api/ProjectService.ts
index 670da152..38b19e07 100644
--- a/karavan-app/src/main/webui/src/api/ProjectService.ts
+++ b/karavan-app/src/main/webui/src/api/ProjectService.ts
@@ -116,7 +116,6 @@ export class ProjectService {
public static pullProject(projectId: string) {
useProjectStore.setState({isPulling: true})
KaravanApi.pull(projectId, res => {
- console.log(res);
if (res.status === 200 || res.status === 201) {
useProjectStore.setState({isPulling: false})
ProjectService.refreshProject(projectId);
@@ -136,7 +135,6 @@ export class ProjectService {
})
KaravanApi.getFiles("kamelets", (files: ProjectFile[]) => {
- console.log(files)
files.map(f => f.name.replace('.kamelet.yaml', ''))
.forEach(name => KameletApi.saveCustomKameletName(name))
});
(camel-karavan) 03/03: Fix
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
commit 1a2e462d574e17a2df85ec489c05c0bd97a53999
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Tue Feb 27 14:01:43 2024 -0500
Fix
---
karavan-core/src/core/api/VariableUtil.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/karavan-core/src/core/api/VariableUtil.ts b/karavan-core/src/core/api/VariableUtil.ts
index 88e9e93a..8887dd67 100644
--- a/karavan-core/src/core/api/VariableUtil.ts
+++ b/karavan-core/src/core/api/VariableUtil.ts
@@ -35,7 +35,8 @@ export class VariableUtil {
}
static findVariables = (files: IntegrationFile[]): string[] => {
- const integrations = files.map(file => CamelDefinitionYaml.yamlToIntegration(file.name, file.code));
+ const integrations = files.filter(file => file.name?.endsWith(".camel.yaml"))
+ .map(file => CamelDefinitionYaml.yamlToIntegration(file.name, file.code));
return VariableUtil.findVariablesInIntegrations(integrations);
};