AGH3 Component: Report Generator
Relevant source files
The following files were used as context for generating this wiki page:The Report Generator is a microservice within the ArgusHack3 (AGH3) platform, responsible for handling reporting functionalities. It is deployed as a containerized application within a Kubernetes cluster using the agh3 Helm chart. This component is designed to be enabled or disabled based on deployment needs and interacts with other core services, such as the captain module, to perform its functions.
The component is defined as the report module within the Helm chart. It is deployed as a standard Kubernetes Deployment and exposed internally via a Service. Its configuration, including the container image, version, and environment variables, is managed through the values.yaml file of the agh3 chart.
Architecture and Deployment
The Report Generator's presence in a deployment is controlled by the report.enabled flag in the values.yaml file. When enabled, the Helm chart creates a Kubernetes Deployment to manage the Report Generator pod(s) and a Service to expose it to other components within the cluster.
Sources: charts/agh3/templates/report/report-deployment.yml:1, charts/agh3/templates/report/report-service.yml:1, charts/agh3/values.yaml:701-702
The following diagram illustrates the Kubernetes objects created for the Report Generator.
This diagram shows the relationship between the Deployment, ReplicaSet, Pod, and Service for the report component.
Sources: charts/agh3/templates/report/report-deployment.yml, charts/agh3/templates/report/report-service.yml
Deployment Specification
The report component is defined as a Deployment resource. Key aspects of its specification include:
- A selector matching pods with the label
app: report. - A pod template that defines the container image, environment variables, and ports.
- The container exposes port 80 for web traffic.
Sources: charts/agh3/templates/report/report-deployment.yml:5-29
# Source: charts/agh3/templates/report/report-deployment.yml:2-29
apiVersion: apps/v1
kind: Deployment
metadata:
name: report
spec:
selector:
matchLabels:
app: report
template:
metadata:
labels:
app: report
spec:
containers:
- name: report
image: {{ include "report.image" . }}
env:
# ... environment variables
ports:
- name: web
containerPort: 80
imagePullPolicy: {{ .Values.report.image.pullPolicy }}
restartPolicy: Always
Configuration
Configuration for the Report Generator is managed under the report key in the values.yaml file.
Sources: charts/agh3/values.yaml:700-714, charts/agh3/README.md:434-445
| Parameter | Description | Default Value |
|---|---|---|
report.enabled | Enables or disables the deployment of the Report module. | true |
report.image.repository | The container image repository for the Report module. | leukocyte-lab/argushack3/report |
report.image.tag | The container image tag. | v1.2.6 |
report.image.pullPolicy | The image pull policy. | IfNotPresent |
report.image.pullSecrets | Secrets for pulling the container image from a private registry. | [] |
report.extraEnv | A dictionary of additional environment variables to inject into the container. | {} |
Sources: charts/agh3/values.yaml:701-714, charts/agh3/README.md:434-445
Default values.yaml Configuration
# Source: charts/agh3/values.yaml:700-714
report:
## @param report.enabled Enable Report module
##
enabled: true
## @param report.image.repository Report image repository
## @param report.image.tag Report image tag (immutable tags are recommended)
## @param report.image.pullPolicy Report image pull policy
## @param report.image.pullSecrets Specify docker-registry secret names as an array
##
image:
repository: leukocyte-lab/argushack3/report
tag: v1.2.6
pullPolicy: IfNotPresent
pullSecrets: []
## @param report.extraEnv UI additional environment variables
##
extraEnv: {}
Networking and Service Interaction
The Report Generator is exposed within the Kubernetes cluster via a Service named report. This service makes the report pod accessible to other services on port 80.
Sources: charts/agh3/templates/report/report-service.yml:1-10
Service Specification
# Source: charts/agh3/templates/report/report-service.yml:2-10
apiVersion: v1
kind: Service
metadata:
name: report
spec:
selector:
app: report
ports:
- port: 80
targetPort: web
Interaction with captain
The captain component is configured to communicate with the Report Generator. When both captain and report are enabled, the captain deployment receives an environment variable REPORT_URL pointing to the report service.
The REPORT_URL is constructed as http://report.$(NAMESPACE).svc.cluster.local:80.
Sources: charts/agh3/templates/captain/captain-deployment.yml:143-145
The following diagram shows the communication flow from captain to report.
This diagram shows how the captain service uses the REPORT_URL to communicate with the report service.
Sources: charts/agh3/templates/captain/captain-deployment.yml:143-145, charts/agh3/templates/report/report-service.yml:8-9
Environment Variables
The report container is configured with a set of environment variables to facilitate its operation and integration with other services.
| Variable | Description | Source |
|---|---|---|
NAMESPACE | The Kubernetes namespace where the pod is running. Derived from the pod's metadata. | fieldRef: metadata.namespace |
API_ENDPOINT | The internal cluster address of the captain service. This is only set if .Values.captain.enabled is true. | captain.$(NAMESPACE).svc.cluster.local:8080 |
extraEnv | Placeholder for any additional environment variables defined in values.yaml. | .Values.report.extraEnv |
Sources: charts/agh3/templates/report/report-deployment.yml:19-27
Historical Context: AGH2 vs AGH3
In the predecessor chart, agh2, the report generation functionality was not a standalone component. Instead, its container image was defined as a shared utility image under shared.images.reportGenerator.
Sources: charts/agh2/values.yaml:454
# Source: charts/agh2/values.yaml:446-454
shared:
# ...
images:
poster: leukocyte-lab/argushack2/worker/poster:v2.0.0
cronjob: leukocyte-lab/argushack2/worker/cronjob:v1.0.0
reportInit: leukocyte-lab/argushack2/worker/report-init:v0.0.8
reportGenerator: leukocyte-lab/argushack2/worker/report-generator:v0.0.7
reportTemplate: leukocyte-lab/argushack2/attack-report-template:v0.0.8
In AGH3, this has been refactored into a dedicated report microservice with its own deployment, service, and configuration block, indicating a shift towards a more decoupled microservices architecture.
Sources: charts/agh3/values.yaml:700-714
Conclusion
The AGH3 Report Generator is a self-contained microservice responsible for reporting tasks. It is deployed and managed via the agh3 Helm chart, exposing an internal HTTP endpoint for other services like captain. Its configuration is flexible, allowing it to be enabled or disabled and customized with different container images and environment variables. The evolution from a shared image in AGH2 to a dedicated service in AGH3 highlights the architectural progression of the ArgusHack platform.