public Task desired()

in karavan-web/karavan-operator/src/main/java/org/apache/camel/karavan/operator/resource/KaravanTektonTask.java [64:101]


    public Task desired(Karavan karavan, Context<Karavan> context) {
        String image = ConfigProvider.getConfig().getValue("karavan.build-image", String.class);
        String version = ConfigProvider.getConfig().getValue("karavan.version", String.class);
        String script = getScript(karavan);

        return new TaskBuilder()
                .withNewMetadata()
                .withName(getName())
                .withNamespace(karavan.getMetadata().getNamespace())
                .withLabels(Utils.getLabels(getName(), Map.of()))
                .endMetadata()
                .withNewSpec()
                .withParams(new ParamSpecBuilder().withName("project").withType("string").withDescription("ProjectId").build())
                .withSteps(
                        new StepBuilder().withName("karavan-build-deploy")
                                .withScript(script)
                                .withImage(image + ":" + version)
                                .withEnv(
                                        new EnvVarBuilder().withName("GIT_REPOSITORY").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("git-repository").and().build()).build(),
                                        new EnvVarBuilder().withName("GIT_USERNAME").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("git-username").and().build()).build(),
                                        new EnvVarBuilder().withName("GIT_PASSWORD").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("git-password").and().build()).build(),
                                        new EnvVarBuilder().withName("GIT_BRANCH").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("git-branch").and().build()).build(),
                                        new EnvVarBuilder().withName("IMAGE_REGISTRY").withValueFrom(
                                                new EnvVarSourceBuilder().withNewSecretKeyRef().withName("karavan").withKey("image-registry").withOptional(true).and().build()).build()
                                )
                                .build()
                )
                .withWorkspaces(
                        new WorkspaceDeclaration("Maven Cache", "/root/.m2", Constants.PVC_M2_CACHE, false, false),
                        new WorkspaceDeclaration("JBang Cache", "/jbang/.jbang/cache", Constants.PVC_JBANG_CACHE, false, false)
                )
                .endSpec()
                .build();
    }