From 1d82a89eb1058b39c98dbf3788bb31a52aaf2b9f Mon Sep 17 00:00:00 2001 From: Sam Lucidi Date: Thu, 20 Jun 2024 10:36:54 -0400 Subject: [PATCH 1/3] Add Discovery addons and tasks Signed-off-by: Sam Lucidi --- .github/workflows/create-release.yml | 2 + ...nveyor-operator.clusterserviceversion.yaml | 4 + helm/templates/deployment.yaml | 2 + helm/values.yaml | 1 + roles/tackle/defaults/main.yml | 18 +++ 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 ++++++++++++++++++ 9 files changed, 197 insertions(+) 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 cf54699..8abeefa 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/manifests/konveyor-operator.clusterserviceversion.yaml b/bundle/manifests/konveyor-operator.clusterserviceversion.yaml index fd259a3..50224d4 100644 --- a/bundle/manifests/konveyor-operator.clusterserviceversion.yaml +++ b/bundle/manifests/konveyor-operator.clusterserviceversion.yaml @@ -214,6 +214,8 @@ spec: value: quay.io/konveyor/generic-external-provider:latest - name: RELATED_IMAGE_PROVIDER_JAVA value: quay.io/konveyor/java-external-provider:latest + - name: RELATED_IMAGE_ADDON_LANGUAGE_DISCOVERY + value: quay.io/konveyor/tackle2-addon-discovery:latest image: quay.io/konveyor/tackle2-operator:latest imagePullPolicy: Always livenessProbe: @@ -408,4 +410,6 @@ spec: name: provider-generic - image: quay.io/konveyor/java-external-provider:latest name: provider-java + - image: quay.io/konveyor/tackle2-addon-discovery:latest + name: addon-language-discovery version: 99.0.0 diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 870a09b..4c226ac 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -55,6 +55,8 @@ spec: value: {{ .Values.images.provider_generic }} - name: RELATED_IMAGE_PROVIDER_JAVA value: {{ .Values.images.provider_java }} + - name: RELATED_IMAGE_ADDON_LANGUAGE_DISCOVERY + value: {{ .Values.images.addon_language_discovery }} name: tackle-operator image: {{ .Values.images.operator }} imagePullPolicy: Always diff --git a/helm/values.yaml b/helm/values.yaml index 4deba69..547fd85 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -22,3 +22,4 @@ images: 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 + addon_language_discovery: quay.io/konveyor/tackle2-addon-discovery:latest \ No newline at end of file diff --git a/roles/tackle/defaults/main.yml b/roles/tackle/defaults/main.yml index c14ae95..1003fc2 100644 --- a/roles/tackle/defaults/main.yml +++ b/roles/tackle/defaults/main.yml @@ -180,6 +180,24 @@ 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_LANGUAGE_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 }}" + 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 bb5093a..a4a2ccb 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 53c635f..900ce1b 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 0000000..0d585e8 --- /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 0000000..9c64a66 --- /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"] From f4d2b9c905a9f2f260b1327ae95faa12720f48e5 Mon Sep 17 00:00:00 2001 From: Sam Lucidi Date: Fri, 21 Jun 2024 09:52:12 -0400 Subject: [PATCH 2/3] Fix conflicting values for discovery addon Signed-off-by: Sam Lucidi --- bundle.Dockerfile | 2 +- .../manifests/konveyor-operator.clusterserviceversion.yaml | 6 +----- helm/templates/deployment.yaml | 2 -- helm/values.yaml | 3 +-- roles/tackle/defaults/main.yml | 2 +- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/bundle.Dockerfile b/bundle.Dockerfile index 6b547c8..dfc17cd 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 50224d4..cd265b7 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. @@ -214,8 +214,6 @@ spec: value: quay.io/konveyor/generic-external-provider:latest - name: RELATED_IMAGE_PROVIDER_JAVA value: quay.io/konveyor/java-external-provider:latest - - name: RELATED_IMAGE_ADDON_LANGUAGE_DISCOVERY - value: quay.io/konveyor/tackle2-addon-discovery:latest image: quay.io/konveyor/tackle2-operator:latest imagePullPolicy: Always livenessProbe: @@ -410,6 +408,4 @@ spec: name: provider-generic - image: quay.io/konveyor/java-external-provider:latest name: provider-java - - image: quay.io/konveyor/tackle2-addon-discovery:latest - name: addon-language-discovery version: 99.0.0 diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 4c226ac..870a09b 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -55,8 +55,6 @@ spec: value: {{ .Values.images.provider_generic }} - name: RELATED_IMAGE_PROVIDER_JAVA value: {{ .Values.images.provider_java }} - - name: RELATED_IMAGE_ADDON_LANGUAGE_DISCOVERY - value: {{ .Values.images.addon_language_discovery }} name: tackle-operator image: {{ .Values.images.operator }} imagePullPolicy: Always diff --git a/helm/values.yaml b/helm/values.yaml index 547fd85..e467406 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -21,5 +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 - addon_language_discovery: quay.io/konveyor/tackle2-addon-discovery:latest \ No newline at end of file + 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 1003fc2..e61a52b 100644 --- a/roles/tackle/defaults/main.yml +++ b/roles/tackle/defaults/main.yml @@ -180,7 +180,7 @@ 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_LANGUAGE_DISCOVERY') }}" +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 }}" From 762d9d8a7a4e2c4583e2cfb06834f0999140da8c Mon Sep 17 00:00:00 2001 From: Sam Lucidi Date: Fri, 21 Jun 2024 11:24:23 -0400 Subject: [PATCH 3/3] Explicitly set discovery to enabled Signed-off-by: Sam Lucidi --- roles/tackle/defaults/main.yml | 3 +++ roles/tackle/templates/deployment-hub.yml.j2 | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/roles/tackle/defaults/main.yml b/roles/tackle/defaults/main.yml index e61a52b..e827666 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 @@ -197,6 +198,8 @@ 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" diff --git a/roles/tackle/templates/deployment-hub.yml.j2 b/roles/tackle/templates/deployment-hub.yml.j2 index 0907747..c0c1222 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 }}