From 1b17156b63f0b65ba8b591649b9cabc3514b4a3f Mon Sep 17 00:00:00 2001 From: Samuel Lucidi Date: Fri, 21 Jun 2024 11:47:55 -0400 Subject: [PATCH] :sparkles: Add Discovery addons and tasks (#341) See also: https://github.com/konveyor/tackle2-addon-analyzer/pull/99 https://github.com/konveyor/tackle2-hub/pull/671 --------- Signed-off-by: Sam Lucidi --- .github/workflows/create-release.yml | 2 + bundle.Dockerfile | 2 +- ...nveyor-operator.clusterserviceversion.yaml | 2 +- helm/values.yaml | 2 +- roles/tackle/defaults/main.yml | 21 +++ roles/tackle/tasks/main.yml | 10 ++ .../customresource-addon-analyzer.yml.j2 | 1 + ...omresource-addon-language-discovery.yml.j2 | 35 +++++ ...customresource-addon-tech-discovery.yml.j2 | 124 ++++++++++++++++++ roles/tackle/templates/deployment-hub.yml.j2 | 7 + 10 files changed, 203 insertions(+), 3 deletions(-) create mode 100644 roles/tackle/templates/customresource-addon-language-discovery.yml.j2 create mode 100644 roles/tackle/templates/customresource-addon-tech-discovery.yml.j2 diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index cf5469965d9..8abeefaf19e 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -143,6 +143,8 @@ jobs: image: konveyor/tackle-keycloak-init - repo: konveyor/kantra image: konveyor/kantra + - repo: konveyor/tackle2-addon-discovery + image: konveyor/tackle2-addon-discovery fail-fast: true steps: - uses: konveyor/release-tools/create-release@main diff --git a/bundle.Dockerfile b/bundle.Dockerfile index 6b547c85bf3..dfc17cd0432 100644 --- a/bundle.Dockerfile +++ b/bundle.Dockerfile @@ -7,7 +7,7 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/ LABEL operators.operatorframework.io.bundle.package.v1=konveyor-operator LABEL operators.operatorframework.io.bundle.channels.v1=development LABEL operators.operatorframework.io.bundle.channel.default.v1=development -LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.34.2 +LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.28.1 LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 LABEL operators.operatorframework.io.metrics.project_layout=ansible.sdk.operatorframework.io/v1 diff --git a/bundle/manifests/konveyor-operator.clusterserviceversion.yaml b/bundle/manifests/konveyor-operator.clusterserviceversion.yaml index fd259a3af27..cd265b7ccbb 100644 --- a/bundle/manifests/konveyor-operator.clusterserviceversion.yaml +++ b/bundle/manifests/konveyor-operator.clusterserviceversion.yaml @@ -20,7 +20,7 @@ metadata: categories: Modernization & Migration certified: "false" containerImage: quay.io/konveyor/tackle2-operator:latest - createdAt: "2024-06-21T13:13:06Z" + createdAt: "2024-06-21T13:51:01Z" description: Konveyor is an open-source application modernization platform that helps organizations safely and predictably modernize applications to Kubernetes at scale. diff --git a/helm/values.yaml b/helm/values.yaml index 4deba697f82..e4674063d80 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -21,4 +21,4 @@ images: addon_analyzer: quay.io/konveyor/tackle2-addon-analyzer:latest addon_discovery: quay.io/konveyor/tackle2-addon-discovery:latest provider_generic: quay.io/konveyor/generic-external-provider:latest - provider_java: quay.io/konveyor/java-external-provider:latest + provider_java: quay.io/konveyor/java-external-provider:latest \ No newline at end of file diff --git a/roles/tackle/defaults/main.yml b/roles/tackle/defaults/main.yml index c14ae9530be..e82766660e7 100644 --- a/roles/tackle/defaults/main.yml +++ b/roles/tackle/defaults/main.yml @@ -10,6 +10,7 @@ feature_auth_required: "{{ false if app_profile == 'konveyor' else true }}" feature_auth_type: keycloak feature_isolate_namespace: true feature_analysis_archiver: true +feature_discovery: true # Environment openshift_cluster: false @@ -180,6 +181,26 @@ provider_java_image_fqin: "{{ lookup('env', 'RELATED_IMAGE_PROVIDER_JAVA') }}" provider_java_name: "java" provider_java_service_name: "{{ app_name }}-{{ provider_java_name }}-{{ analyzer_component_name }}" +language_discovery_fqin: "{{ lookup('env', 'RELATED_IMAGE_ADDON_DISCOVERY') }}" +language_discovery_name: "language-discovery" +language_discovery_component_name: "addon" +language_discovery_service_name: "{{ app_name }}-{{ language_discovery_name }}-{{ language_discovery_component_name }}" +language_discovery_container_limits_cpu: "500m" +language_discovery_container_limits_memory: "512Mi" +language_discovery_container_requests_cpu: "500m" +language_discovery_container_requests_memory: "512Mi" + +tech_discovery_fqin: "{{ analyzer_fqin }}" +tech_discovery_name: "tech-discovery" +tech_discovery_component_name: "addon" +tech_discovery_service_name: "{{ app_name }}-{{ tech_discovery_name }}-{{ tech_discovery_component_name }}" +tech_discovery_container_limits_cpu: "{{ analyzer_container_limits_cpu }}" +tech_discovery_container_limits_memory: "{{ analyzer_container_limits_memory }}" +tech_discovery_container_requests_cpu: "{{ analyzer_container_requests_cpu }}" +tech_discovery_container_requests_memory: "{{ analyzer_container_requests_memory }}" +tech_discovery_provider_java_name: "discovery-java" +tech_discovery_provider_generic_name: "discovery-generic" + cache_name: "cache" cache_data_volume_size: "100Gi" cache_data_volume_name: "{{ app_name }}-{{ cache_name }}-data" diff --git a/roles/tackle/tasks/main.yml b/roles/tackle/tasks/main.yml index bb5093ad506..a4a2ccb379e 100644 --- a/roles/tackle/tasks/main.yml +++ b/roles/tackle/tasks/main.yml @@ -463,6 +463,16 @@ state: present definition: "{{ lookup('template', 'customresource-addon-analyzer.yml.j2') }}" +- name: "Create Language Discovery Addon CR" + k8s: + state: present + definition: "{{ lookup('template', 'customresource-addon-language-discovery.yml.j2') }}" + +- name: "Create Tech Discovery Addon CR" + k8s: + state: present + definition: "{{ lookup('template', 'customresource-addon-tech-discovery.yml.j2') }}" + - name: "Create Network Policy" k8s: state: present diff --git a/roles/tackle/templates/customresource-addon-analyzer.yml.j2 b/roles/tackle/templates/customresource-addon-analyzer.yml.j2 index 53c635f33d5..900ce1b8604 100644 --- a/roles/tackle/templates/customresource-addon-analyzer.yml.j2 +++ b/roles/tackle/templates/customresource-addon-analyzer.yml.j2 @@ -110,3 +110,4 @@ metadata: name: {{ analyzer_name }} spec: priority: 10 + dependencies: [ {{ language_discovery_name }} ] diff --git a/roles/tackle/templates/customresource-addon-language-discovery.yml.j2 b/roles/tackle/templates/customresource-addon-language-discovery.yml.j2 new file mode 100644 index 00000000000..0d585e893a6 --- /dev/null +++ b/roles/tackle/templates/customresource-addon-language-discovery.yml.j2 @@ -0,0 +1,35 @@ +--- +kind: Addon +apiVersion: tackle.konveyor.io/v1alpha2 +metadata: + name: {{ language_discovery_name }} + namespace: {{ app_namespace }} + labels: + app.kubernetes.io/name: {{ language_discovery_service_name }} + app.kubernetes.io/component: {{ language_discovery_component_name }} + app.kubernetes.io/part-of: {{ app_name }} +spec: + task: {{ language_discovery_name }} + container: + name: {{ language_discovery_component_name }} + image: {{ language_discovery_fqin }} + imagePullPolicy: {{ image_pull_policy }} + resources: + limits: + cpu: {{ language_discovery_container_limits_cpu }} + memory: {{ language_discovery_container_limits_memory }} + requests: + cpu: {{ language_discovery_container_requests_cpu }} + memory: {{ language_discovery_container_requests_memory }} +--- +kind: Task +apiVersion: tackle.konveyor.io/v1alpha2 +metadata: + namespace: {{ app_namespace }} + name: {{ language_discovery_name }} + labels: + konveyor.io/discovery: "language" +spec: + priority: 10 + data: + source: language-discovery \ No newline at end of file diff --git a/roles/tackle/templates/customresource-addon-tech-discovery.yml.j2 b/roles/tackle/templates/customresource-addon-tech-discovery.yml.j2 new file mode 100644 index 00000000000..9c64a6674e0 --- /dev/null +++ b/roles/tackle/templates/customresource-addon-tech-discovery.yml.j2 @@ -0,0 +1,124 @@ +--- +kind: Addon +apiVersion: tackle.konveyor.io/v1alpha2 +metadata: + name: {{ tech_discovery_name }} + namespace: {{ app_namespace }} + labels: + app.kubernetes.io/name: {{ tech_discovery_service_name }} + app.kubernetes.io/component: {{ tech_discovery_component_name }} + app.kubernetes.io/part-of: {{ app_name }} +spec: + task: {{ tech_discovery_name }} + container: + name: {{ tech_discovery_component_name }} + image: {{ tech_discovery_fqin }} + imagePullPolicy: {{ image_pull_policy }} + resources: + limits: + cpu: {{ tech_discovery_container_limits_cpu }} + memory: {{ tech_discovery_container_limits_memory }} + requests: + cpu: {{ tech_discovery_container_requests_cpu }} + memory: {{ tech_discovery_container_requests_memory }} +--- +kind: Extension +apiVersion: tackle.konveyor.io/v1alpha2 +metadata: + name: {{ tech_discovery_provider_java_name }} + namespace: {{ app_namespace }} + labels: + app.kubernetes.io/name: {{ provider_java_service_name }} + app.kubernetes.io/component: {{ provider_java_component_name }} + app.kubernetes.io/part-of: {{ app_name }} +spec: + addon: {{ tech_discovery_name }} + selector: tag:Language=Java || !tag:Language + container: + name: {{ provider_java_name }} + image: {{ provider_java_image_fqin }} + imagePullPolicy: {{ image_pull_policy }} + args: + - --port + - $(PORT) + env: + - name: PORT + value: ${seq:8000} + resources: + limits: + cpu: {{ provider_java_container_limits_cpu }} + memory: {{ provider_java_container_limits_memory }} + requests: + cpu: {{ provider_java_container_requests_cpu }} + memory: {{ provider_java_container_requests_memory }} + metadata: + resources: + - selector: identity:kind=maven + fields: + - name: settings + path: /shared/creds/maven/settings.xml + key: maven.settings.path + provider: + name: {{ provider_java_name }} + address: localhost:$(PORT) + initConfig: + - providerSpecificConfig: + bundles: /jdtls/java-analyzer-bundle/java-analyzer-bundle.core/target/java-analyzer-bundle.core-1.0.0-SNAPSHOT.jar + depOpenSourceLabelsFile: /usr/local/etc/maven.default.index + lspServerPath: /jdtls/bin/jdtls + mavenSettingsFile: $(maven.settings.path) +--- +kind: Extension +apiVersion: tackle.konveyor.io/v1alpha2 +metadata: + name: {{ tech_discovery_provider_generic_name }} + namespace: {{ app_namespace }} + labels: + app.kubernetes.io/name: {{ provider_generic_service_name }} + app.kubernetes.io/component: {{ provider_generic_component_name }} + app.kubernetes.io/part-of: {{ app_name }} +spec: + addon: {{ tech_discovery_name }} + selector: tag:Language=Golang || tag:Language=Python + container: + name: {{ provider_generic_name }} + image: {{ provider_generic_image_fqin }} + imagePullPolicy: {{ image_pull_policy }} + args: + - --port + - $(PORT) + env: + - name: PORT + value: ${seq:8000} + resources: + limits: + cpu: {{ provider_generic_container_limits_cpu }} + memory: {{ provider_generic_container_limits_memory }} + requests: + cpu: {{ provider_generic_container_requests_cpu }} + memory: {{ provider_generic_container_requests_memory }} + metadata: + provider: + name: {{ provider_generic_name }} + address: localhost:$(PORT) + initConfig: +--- +kind: Task +apiVersion: tackle.konveyor.io/v1alpha2 +metadata: + namespace: {{ app_namespace }} + name: {{ tech_discovery_name }} + labels: + konveyor.io/discovery: "technology" +spec: + priority: 10 + dependencies: [ {{ language_discovery_name }} ] + data: + mode: + discovery: true + tagger: + enabled: true + source: tech-discovery + rules: + labels: + included: ["discovery"] diff --git a/roles/tackle/templates/deployment-hub.yml.j2 b/roles/tackle/templates/deployment-hub.yml.j2 index 09077471a9e..c0c1222191b 100644 --- a/roles/tackle/templates/deployment-hub.yml.j2 +++ b/roles/tackle/templates/deployment-hub.yml.j2 @@ -184,6 +184,13 @@ spec: {% else %} - name: ANALYSIS_ARCHIVER_ENABLED value: "false" +{% endif %} +{% if feature_discovery|bool %} + - name: DISCOVERY_ENABLED + value: "true" +{% else %} + - name: DISCOVERY_ENABLED + value: "false" {% endif %} ports: - containerPort: {{ hub_port }}