Skip to content

Commit

Permalink
[RHCLOUD-28518] Init connector drawer module (RedHatInsights#2200)
Browse files Browse the repository at this point in the history
  • Loading branch information
g-duval authored Sep 26, 2023
1 parent 2a2a07e commit be863dc
Show file tree
Hide file tree
Showing 7 changed files with 439 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/platsec-connector-drawer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# The default values used in the docker build commands are the root
# directory '.' and the dockerfile name of 'Dockerfile'. If there is
# a need to change these do so in your local workflow template (this file) and
# change them there. HINT: Look at the bottom of this file.

# This workflow checks out code, builds an image, performs a container image
# vulnerability scan with Anchore's Grype tool, and generates an
# SBOM via Anchore's Syft tool

# For more information on Anchore's container image scanning tool Grype, see
# https://github.com/anchore/grype

# For more information about the Anchore SBOM tool, Syft, see
# https://github.com/anchore/syft

name: ConsoleDot Platform Security Scan (notifications-connector-drawer)

on:
push:
branches: [ "main", "master", "security-compliance" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main", "master", "security-compliance" ]

jobs:
PlatSec-Security-Workflow:
uses: RedHatInsights/platform-security-gh-workflow/.github/workflows/platsec-security-scan-reusable-workflow.yml@master
## The optional parameters below are used if you are using something other than the
## the defaults of root '.' for the path and 'Dockerfile' for the Dockerfile name.
## Additionally, if you have a Dockerfile you use as your BASE_IMG or you need to
## use '--build-arg', those can be define below as well.

with:
dockerfile_path: './docker'
dockerfile_name: 'Dockerfile.notifications-connector-drawer.jvm'
# base_image_build: true
# base_dockerfile_path: './test'
# base_dockerfile_name: 'Dockerfile.base'
# build_arg: '--build-arg BASE_IMAGE="localbuild/baseimage:latest"'
158 changes: 158 additions & 0 deletions .rhcicd/clowdapp-connector-drawer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: notifications-connector-drawer
objects:
- apiVersion: cloud.redhat.com/v1alpha1
kind: ClowdApp
metadata:
name: notifications-connector-drawer
spec:
envName: ${ENV_NAME}
kafkaTopics:
- topicName: platform.notifications.tocamel
partitions: 3
replicas: 3
- topicName: platform.notifications.fromcamel
partitions: 3
replicas: 3
deployments:
- name: service
minReplicas: ${{MIN_REPLICAS}}
webServices:
private:
enabled: true
podSpec:
image: ${IMAGE}:${IMAGE_TAG}
resources:
requests:
cpu: ${CPU_REQUEST}
memory: ${MEMORY_REQUEST}
limits:
cpu: ${CPU_LIMIT}
memory: ${MEMORY_LIMIT}
readinessProbe:
httpGet:
path: /q/health/ready
port: ${{QUARKUS_HTTP_PORT}}
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 5
livenessProbe:
httpGet:
path: /q/health/live
port: ${{QUARKUS_HTTP_PORT}}
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 5
env:
- name: ENV_NAME
value: ${ENV_NAME}
- name: NOTIFICATIONS_CONNECTOR_KAFKA_INCOMING_MAX_POLL_INTERVAL_MS
value: ${KAFKA_MAX_POLL_INTERVAL_MS}
- name: NOTIFICATIONS_CONNECTOR_KAFKA_INCOMING_MAX_POLL_RECORDS
value: ${KAFKA_MAX_POLL_RECORDS}
- name: NOTIFICATIONS_CONNECTOR_KAFKA_INCOMING_POLL_ON_ERROR
value: ${KAFKA_POLL_ON_ERROR}
- name: NOTIFICATIONS_CONNECTOR_SEDA_CONCURRENT_CONSUMERS
value: ${NOTIFICATIONS_CONNECTOR_SEDA_CONCURRENT_CONSUMERS}
- name: NOTIFICATIONS_CONNECTOR_SEDA_QUEUE_SIZE
value: ${NOTIFICATIONS_CONNECTOR_SEDA_QUEUE_SIZE}
- name: QUARKUS_HTTP_PORT
value: ${QUARKUS_HTTP_PORT}
- name: QUARKUS_LOG_CATEGORY__COM_REDHAT_CLOUD_NOTIFICATIONS__LEVEL
value: ${NOTIFICATIONS_LOG_LEVEL}
- name: QUARKUS_LOG_CATEGORY__ORG_APACHE_KAFKA_CLIENTS__LEVEL
value: ${KAFKA_CLIENT_LOG_LEVEL}
- name: QUARKUS_LOG_CLOUDWATCH_API_CALL_TIMEOUT
value: ${QUARKUS_LOG_CLOUDWATCH_API_CALL_TIMEOUT}
- name: QUARKUS_LOG_CLOUDWATCH_BATCH_PERIOD
value: ${QUARKUS_LOG_CLOUDWATCH_BATCH_PERIOD}
- name: QUARKUS_LOG_CLOUDWATCH_BATCH_SIZE
value: ${QUARKUS_LOG_CLOUDWATCH_BATCH_SIZE}
- name: QUARKUS_LOG_CLOUDWATCH_ENABLED
value: ${QUARKUS_LOG_CLOUDWATCH_ENABLED}
- name: QUARKUS_LOG_CLOUDWATCH_LOG_STREAM_NAME
value: ${HOSTNAME}
- name: QUARKUS_LOG_CLOUDWATCH_MAX_QUEUE_SIZE
value: ${QUARKUS_LOG_CLOUDWATCH_MAX_QUEUE_SIZE}
- name: QUARKUS_LOG_CLOUDWATCH_SERVICE_ENVIRONMENT
value: ${ENV_NAME}
- name: QUARKUS_LOG_SENTRY
value: ${SENTRY_ENABLED}
- name: QUARKUS_LOG_SENTRY_DSN
value: ${SENTRY_DSN}${ENV_NAME}
- name: QUARKUS_LOG_SENTRY_ENVIRONMENT
value: ${ENV_NAME}
parameters:
- name: CPU_LIMIT
description: CPU limit
value: 200m
- name: CPU_REQUEST
description: CPU request
value: 100m
- name: ENV_NAME
description: ClowdEnvironment name (ephemeral, stage, prod)
required: true
- name: IMAGE
description: Image URL
value: quay.io/cloudservices/notifications-connector-drawer
- name: IMAGE_TAG
value: latest
- name: KAFKA_CLIENT_LOG_LEVEL
description: Log level of the Kafka client library
value: WARN
- name: KAFKA_MAX_POLL_INTERVAL_MS
description: Maximum delay in milliseconds between two calls of poll(). Defaults to 300000 (5 minutes).
value: "300000"
- name: KAFKA_MAX_POLL_RECORDS
description: Maximum number of records returned in a single call of poll(). Defaults to 500.
value: "500"
- name: KAFKA_POLL_ON_ERROR
description: What to do if kafka threw an exception while polling for new messages. See https://camel.apache.org/components/latest/kafka-component.html for more details.
value: RECONNECT
- name: MEMORY_LIMIT
description: Memory limit
value: 500Mi
- name: MEMORY_REQUEST
description: Memory request
value: 250Mi
- name: MIN_REPLICAS
value: "3"
- name: NOTIFICATIONS_CONNECTOR_SEDA_CONCURRENT_CONSUMERS
description: Number of concurrent threads processing exchanges with SEDA
value: "20"
- name: NOTIFICATIONS_CONNECTOR_SEDA_QUEUE_SIZE
description: Maximum capacity of the SEDA queue
value: "20"
- name: NOTIFICATIONS_LOG_LEVEL
description: Log level of Notifications
value: INFO
- name: QUARKUS_HTTP_PORT
description: Quarkus HTTP server port, defaulting to the default Clowder private port
value: "9000"
- name: QUARKUS_LOG_CLOUDWATCH_API_CALL_TIMEOUT
description: Amount of time to allow the CloudWatch client to complete the execution of an API call expressed with the ISO-8601 duration format PnDTnHnMn.nS.
value: PT30S
- name: QUARKUS_LOG_CLOUDWATCH_BATCH_PERIOD
description: Period between two batch executions. Defaults to 5s.
value: 5s
- name: QUARKUS_LOG_CLOUDWATCH_BATCH_SIZE
description: Number of log events sent to CloudWatch per batch. Defaults to 10,000 which is the maximum number of log events per batch allowed by CloudWatch.
value: "10000"
- name: QUARKUS_LOG_CLOUDWATCH_ENABLED
value: "false"
- name: QUARKUS_LOG_CLOUDWATCH_MAX_QUEUE_SIZE
description: Optional maximum size of the log events queue. If this is not set, the queue will have a capacity of Integer#MAX_VALUE.
value: "100000"
- name: SENTRY_DSN
description: The DSN to push data to Sentry — i.e. https://public_key@host/project_id?environment=
- name: SENTRY_ENABLED
value: "false"
150 changes: 150 additions & 0 deletions connector-drawer/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<artifactId>notifications-connector-drawer</artifactId>

<parent>
<groupId>com.redhat.cloud.notifications</groupId>
<artifactId>notifications-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<profiles>

<!--
When Maven compiles a project with the "-Dmaven.test.skip" option, the tests compilation and execution are skipped
but Maven still resolves the dependencies from the "test" scope and fails if these dependencies cannot be found.
This is considered a Maven bug by many users and even though it was reported as such several years ago, it's never
been fixed. The following profile works around that limitation and makes the compilation successful when tests are
skipped even if the listed test dependencies are not available.
-->
<profile>
<id>resolve-test-jars-if-tests-are-not-skipped</id>
<activation>
<property>
<name>maven.test.skip</name>
<value>!true</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.redhat.cloud.notifications</groupId>
<artifactId>notifications-common</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.redhat.cloud.notifications</groupId>
<artifactId>notifications-connector-common</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</profile>

</profiles>

<dependencies>

<!-- Scope: compile -->

<!-- Notifications module -->
<dependency>
<groupId>com.redhat.cloud.notifications</groupId>
<artifactId>notifications-connector-common</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Camel -->
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bean</artifactId>
</dependency>

<!-- Scope: test -->
<!-- Some test dependencies are declared in the "profiles" section of this POM. -->

<!-- Camel -->
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>

<!-- MockServer -->
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-netty-no-dependencies</artifactId>
<version>${mockserver-netty-no-dependencies.version}</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<plugins>

<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemPropertyVariables>
</configuration>
</plugin>

<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<version>6.0.0</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<includeOnlyProperties>
<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
</includeOnlyProperties>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
</configuration>
</plugin>

</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.redhat.cloud.notifications.connector.drawer;

import com.redhat.cloud.notifications.connector.CloudEventDataExtractor;
import io.vertx.core.json.JsonObject;
import jakarta.enterprise.context.ApplicationScoped;
import org.apache.camel.Exchange;

@ApplicationScoped
public class DrawerCloudEventDataExtractor extends CloudEventDataExtractor {

@Override
public void extract(Exchange exchange, JsonObject cloudEventData) {

}
}
Loading

0 comments on commit be863dc

Please sign in to comment.