catlog and helm added
This commit is contained in:
commit
66781fe793
128
catalog-info.yaml
Normal file
128
catalog-info.yaml
Normal file
@ -0,0 +1,128 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: schedulerservice
|
||||
title: Scheduler Service
|
||||
description: Job scheduling and execution service for managing scheduled tasks and job triggers
|
||||
annotations:
|
||||
backstage.io/kubernetes-id: "schedulerservice"
|
||||
backstage.io/techdocs-ref: dir:.
|
||||
github.com/project-slug: "onlinesales-ai/schedulerService"
|
||||
argocd/app-selector: backstage.io/kubernetes-id=schedulerservice
|
||||
argo-workflows.cnoe.io/label-selector: "service=schedulerservice"
|
||||
helm.cnoe.io/git-repo: "https://gitea.os-tf-qa.onlinesales.ai/gitea_admin/schedulerService-chart.git"
|
||||
helm.cnoe.io/git-ref: "main"
|
||||
helm.cnoe.io/chart-path: "helm/schedulerservice"
|
||||
helm.cnoe.io/values-file: "values-local.yaml"
|
||||
helm.cnoe.io/available-values-files: '["values.yaml", "values-local.yaml"]'
|
||||
helm.cnoe.io/dependencies: '{"mysql":{"namespace":"{namespace}","release":"schedulerservice-mysql","chart":"wso2/mysql","version":"1.6.9","parameters":{"mysqlDatabase":"os_scheduling_db"}}}'
|
||||
helm.cnoe.io/dependency-urls: '{}'
|
||||
tags:
|
||||
- java
|
||||
- kubernetes
|
||||
- scheduler
|
||||
- tomcat
|
||||
links:
|
||||
- url: https://github.com/onlinesales-ai/schedulerService
|
||||
title: GitHub Repository
|
||||
icon: github
|
||||
spec:
|
||||
type: service
|
||||
lifecycle: production
|
||||
owner: group:infrastructure
|
||||
system: job-management
|
||||
providesApis:
|
||||
- schedulerservice-api
|
||||
dependsOn:
|
||||
- resource:schedulerservice-db
|
||||
---
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: API
|
||||
metadata:
|
||||
name: schedulerservice-api
|
||||
title: Scheduler Service API
|
||||
description: REST API for job scheduling and management
|
||||
spec:
|
||||
type: openapi
|
||||
lifecycle: production
|
||||
owner: group:infrastructure
|
||||
system: job-management
|
||||
definition: |
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: Scheduler Service API
|
||||
version: 1.0.0
|
||||
description: Job scheduling and execution service API
|
||||
servers:
|
||||
- url: http://schedulerservice.cnoe.localtest.me/schedulerService
|
||||
description: Local development
|
||||
paths:
|
||||
/job:
|
||||
post:
|
||||
summary: Create a new job
|
||||
responses:
|
||||
'200':
|
||||
description: Job created successfully
|
||||
/jobTrigger:
|
||||
get:
|
||||
summary: Get job trigger status / Health check
|
||||
parameters:
|
||||
- name: jsonQuery
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: Job trigger status
|
||||
post:
|
||||
summary: Trigger job execution
|
||||
responses:
|
||||
'200':
|
||||
description: Job triggered
|
||||
/schedules:
|
||||
get:
|
||||
summary: List schedules
|
||||
responses:
|
||||
'200':
|
||||
description: List of schedules
|
||||
post:
|
||||
summary: Create schedule
|
||||
responses:
|
||||
'200':
|
||||
description: Schedule created
|
||||
/group:
|
||||
get:
|
||||
summary: List groups
|
||||
responses:
|
||||
'200':
|
||||
description: List of groups
|
||||
/jobStat:
|
||||
get:
|
||||
summary: Get job statistics
|
||||
responses:
|
||||
'200':
|
||||
description: Job statistics
|
||||
/jobDetail:
|
||||
get:
|
||||
summary: Get job details
|
||||
responses:
|
||||
'200':
|
||||
description: Job details
|
||||
/cluster:
|
||||
get:
|
||||
summary: Get cluster information
|
||||
responses:
|
||||
'200':
|
||||
description: Cluster info
|
||||
---
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Resource
|
||||
metadata:
|
||||
name: schedulerservice-db
|
||||
title: Scheduler Service Database
|
||||
description: MySQL database for scheduler service
|
||||
spec:
|
||||
type: database
|
||||
owner: group:infrastructure
|
||||
system: job-management
|
||||
109
docs/api-reference.md
Normal file
109
docs/api-reference.md
Normal file
@ -0,0 +1,109 @@
|
||||
# API Reference
|
||||
|
||||
## Base URL
|
||||
|
||||
- **Local**: `http://schedulerservice.cnoe.localtest.me/schedulerService/`
|
||||
- **Production**: `http://schedulerservice.{namespace}.svc.cluster.local/schedulerService/`
|
||||
|
||||
## Health Check
|
||||
|
||||
### GET /schedulerService/jobTrigger
|
||||
|
||||
Returns the health status of the service.
|
||||
|
||||
**Request:**
|
||||
```
|
||||
GET /schedulerService/jobTrigger?jsonQuery={"application":"nagios","jobName":"monitoring_scheduler_svc"}
|
||||
```
|
||||
|
||||
**URL Encoded:**
|
||||
```
|
||||
GET /schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D
|
||||
```
|
||||
|
||||
**Response (200 OK):**
|
||||
```json
|
||||
{
|
||||
"status": "success"
|
||||
}
|
||||
```
|
||||
|
||||
## Endpoints
|
||||
|
||||
### Job Management
|
||||
|
||||
#### POST /schedulerService/job
|
||||
|
||||
Create a new job.
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"jobName": "my-job",
|
||||
"application": "my-app",
|
||||
"command": "echo hello",
|
||||
"preemption": false
|
||||
}
|
||||
```
|
||||
|
||||
### Schedule Management
|
||||
|
||||
#### GET /schedulerService/schedules
|
||||
|
||||
List all schedules.
|
||||
|
||||
#### POST /schedulerService/schedules
|
||||
|
||||
Create a new schedule.
|
||||
|
||||
#### PUT /schedulerService/schedules
|
||||
|
||||
Update an existing schedule.
|
||||
|
||||
#### DELETE /schedulerService/schedules
|
||||
|
||||
Delete a schedule.
|
||||
|
||||
### Job Trigger
|
||||
|
||||
#### GET /schedulerService/jobTrigger
|
||||
|
||||
Get job trigger status.
|
||||
|
||||
#### POST /schedulerService/jobTrigger
|
||||
|
||||
Trigger a job execution.
|
||||
|
||||
### Statistics
|
||||
|
||||
#### GET /schedulerService/jobStat
|
||||
|
||||
Get job statistics.
|
||||
|
||||
### Job Details
|
||||
|
||||
#### GET /schedulerService/jobDetail
|
||||
|
||||
Get detailed information about a job.
|
||||
|
||||
### Group Management
|
||||
|
||||
#### GET /schedulerService/group
|
||||
|
||||
List groups.
|
||||
|
||||
#### POST /schedulerService/group
|
||||
|
||||
Create a group.
|
||||
|
||||
### Cluster Information
|
||||
|
||||
#### GET /schedulerService/cluster
|
||||
|
||||
Get cluster information.
|
||||
|
||||
### Command Prefix Mapping
|
||||
|
||||
#### GET /schedulerService/commandPrefixImageMapping
|
||||
|
||||
Get command prefix to container image mappings.
|
||||
81
docs/configuration.md
Normal file
81
docs/configuration.md
Normal file
@ -0,0 +1,81 @@
|
||||
# Configuration
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `APP_ENV` | Application environment | `local` |
|
||||
| `LOG_LEVEL` | Logging level | `INFO` |
|
||||
|
||||
## Configuration Files
|
||||
|
||||
Configuration files are mounted at `/etc/onlinesales/config/schedulerService/`.
|
||||
|
||||
### schedulerService.cfg
|
||||
|
||||
Main service configuration file.
|
||||
|
||||
```
|
||||
LOG_CONFIG_FILE=/etc/onlinesales/config/schedulerService/log.cfg
|
||||
DB_CONFIG_FILE=/etc/onlinesales/config/schedulerService/hibernate.cfg.xml
|
||||
```
|
||||
|
||||
### authConfig.cfg
|
||||
|
||||
Authentication configuration for ACL.
|
||||
|
||||
```json
|
||||
{
|
||||
"authEnable": false,
|
||||
"authServiceUrl": "http://hades-service/hades/authorize"
|
||||
}
|
||||
```
|
||||
|
||||
### hibernate.cfg.xml
|
||||
|
||||
Database connection configuration (injected via secrets).
|
||||
|
||||
```xml
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<!DOCTYPE hibernate-configuration PUBLIC
|
||||
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
|
||||
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
|
||||
|
||||
<hibernate-configuration>
|
||||
<session-factory>
|
||||
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
|
||||
<property name="connection.url">jdbc:mysql://HOST:PORT/os_scheduling_db</property>
|
||||
<property name="connection.username">USERNAME</property>
|
||||
<property name="connection.password">PASSWORD</property>
|
||||
<property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
||||
```
|
||||
|
||||
## Helm Values
|
||||
|
||||
### Production (values.yaml)
|
||||
|
||||
- Replicas: 2
|
||||
- Resource limits enabled
|
||||
- Autoscaling enabled
|
||||
- PDB enabled
|
||||
- MySQL subchart disabled (external DB)
|
||||
|
||||
### Local (values-local.yaml)
|
||||
|
||||
- Replicas: 1
|
||||
- No resource limits
|
||||
- Autoscaling disabled
|
||||
- Ingress enabled for local access
|
||||
- MySQL subchart enabled
|
||||
|
||||
## Database Configuration
|
||||
|
||||
| Parameter | Production | Local |
|
||||
|-----------|-----------|-------|
|
||||
| Host | External MySQL | `schedulerservice-mysql` |
|
||||
| Port | 3306 | 3306 |
|
||||
| Database | `os_scheduling_db` | `os_scheduling_db` |
|
||||
| User | (from secret) | `scheduler_user` |
|
||||
| Password | (from secret) | `localpassword` |
|
||||
75
docs/deployment.md
Normal file
75
docs/deployment.md
Normal file
@ -0,0 +1,75 @@
|
||||
# Deployment
|
||||
|
||||
## Helm Chart
|
||||
|
||||
The service is deployed using Helm charts located in `helm/schedulerservice/`.
|
||||
|
||||
## Values Files
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `values.yaml` | Production/default configuration |
|
||||
| `values-local.yaml` | Local Kind cluster development |
|
||||
|
||||
## Backstage Integration
|
||||
|
||||
This service is registered in Backstage with the following identifiers:
|
||||
|
||||
- **Kubernetes ID**: `schedulerservice`
|
||||
- **ArgoCD Selector**: `backstage.io/kubernetes-id=schedulerservice`
|
||||
|
||||
## Commands
|
||||
|
||||
### Lint Chart
|
||||
```bash
|
||||
helm lint helm/schedulerservice
|
||||
```
|
||||
|
||||
### Template Preview
|
||||
```bash
|
||||
helm template scheduler-service helm/schedulerservice -f helm/schedulerservice/values-local.yaml
|
||||
```
|
||||
|
||||
### Install
|
||||
```bash
|
||||
helm install scheduler-service helm/schedulerservice -f helm/schedulerservice/values-local.yaml -n scheduler --create-namespace
|
||||
```
|
||||
|
||||
### Upgrade
|
||||
```bash
|
||||
helm upgrade scheduler-service helm/schedulerservice -f helm/schedulerservice/values-local.yaml -n scheduler
|
||||
```
|
||||
|
||||
### Uninstall
|
||||
```bash
|
||||
helm uninstall scheduler-service -n scheduler
|
||||
```
|
||||
|
||||
## Kubernetes Resources
|
||||
|
||||
The Helm chart creates the following resources:
|
||||
|
||||
| Resource | Name |
|
||||
|----------|------|
|
||||
| Deployment | `schedulerservice` |
|
||||
| Service | `schedulerservice` |
|
||||
| ServiceAccount | `schedulerservice` |
|
||||
| ConfigMap | `schedulerservice-config` |
|
||||
| Ingress | `schedulerservice` |
|
||||
| HPA | `schedulerservice` (production only) |
|
||||
| PDB | `schedulerservice` (production only) |
|
||||
|
||||
## Health Checks
|
||||
|
||||
| Probe | Path | Initial Delay |
|
||||
|-------|------|---------------|
|
||||
| Liveness | `/schedulerService/jobTrigger?...` | 60s |
|
||||
| Readiness | `/schedulerService/jobTrigger?...` | 30s |
|
||||
| Startup | `/schedulerService/jobTrigger?...` | 30s |
|
||||
|
||||
## Secrets
|
||||
|
||||
The following secrets are required:
|
||||
|
||||
- `schedulerservice-db-secret`: Database credentials
|
||||
- `hibernate.cfg.xml`: Complete Hibernate configuration file
|
||||
63
docs/getting-started.md
Normal file
63
docs/getting-started.md
Normal file
@ -0,0 +1,63 @@
|
||||
# Getting Started
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes cluster (Kind for local development)
|
||||
- Helm 3.x
|
||||
- kubectl configured
|
||||
- MySQL database available
|
||||
|
||||
## Local Development
|
||||
|
||||
### 1. Clone the repository
|
||||
|
||||
```bash
|
||||
git clone https://gitea.os-tf-qa.onlinesales.ai/gitea_admin/schedulerService-chart.git
|
||||
cd schedulerService-chart
|
||||
```
|
||||
|
||||
### 2. Update Helm dependencies
|
||||
|
||||
```bash
|
||||
helm dependency update helm/schedulerservice
|
||||
```
|
||||
|
||||
### 3. Install with Helm (Local)
|
||||
|
||||
```bash
|
||||
helm install scheduler-service helm/schedulerservice \
|
||||
-f helm/schedulerservice/values-local.yaml \
|
||||
-n scheduler \
|
||||
--create-namespace
|
||||
```
|
||||
|
||||
### 4. Access the service
|
||||
|
||||
The service will be available at:
|
||||
- http://schedulerservice.cnoe.localtest.me/schedulerService/
|
||||
|
||||
### 5. Verify health
|
||||
|
||||
```bash
|
||||
curl "http://schedulerservice.cnoe.localtest.me/schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D"
|
||||
```
|
||||
|
||||
## Production Deployment
|
||||
|
||||
```bash
|
||||
helm install scheduler-service helm/schedulerservice \
|
||||
-f helm/schedulerservice/values.yaml \
|
||||
-n scheduler \
|
||||
--create-namespace
|
||||
```
|
||||
|
||||
## Database Setup
|
||||
|
||||
The service requires a MySQL database. The schema will be managed via Hibernate ORM.
|
||||
|
||||
### Local MySQL
|
||||
|
||||
When using `values-local.yaml`, a MySQL instance is deployed as a subchart with:
|
||||
- Database: `os_scheduling_db`
|
||||
- User: `scheduler_user`
|
||||
- Password: `localpassword`
|
||||
48
docs/index.md
Normal file
48
docs/index.md
Normal file
@ -0,0 +1,48 @@
|
||||
# Scheduler Service
|
||||
|
||||
Job scheduling and execution service for managing scheduled tasks and job triggers.
|
||||
|
||||
## Overview
|
||||
|
||||
This service is part of the **job-management** system. It provides REST APIs for creating, managing, and triggering scheduled jobs across the platform.
|
||||
|
||||
## Quick Links
|
||||
|
||||
- [Getting Started](getting-started.md)
|
||||
- [API Reference](api-reference.md)
|
||||
- [Configuration](configuration.md)
|
||||
- [Deployment](deployment.md)
|
||||
|
||||
## Service Information
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
| **Service Type** | Java (Tomcat) |
|
||||
| **Port** | 8080 |
|
||||
| **Health Endpoint** | `/schedulerService/jobTrigger?jsonQuery=...` |
|
||||
| **Owner** | group:infrastructure |
|
||||
| **Database** | MySQL (os_scheduling_db) |
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
[Client] --> [Ingress] --> [Scheduler Service] --> [MySQL Database]
|
||||
|
|
||||
+--> [External Services]
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
| Endpoint | Description |
|
||||
|----------|-------------|
|
||||
| `/schedulerService/job` | Job creation and management |
|
||||
| `/schedulerService/jobTrigger` | Job trigger status and execution |
|
||||
| `/schedulerService/schedules` | Schedule CRUD operations |
|
||||
| `/schedulerService/group` | Group management |
|
||||
| `/schedulerService/jobStat` | Job statistics |
|
||||
| `/schedulerService/jobDetail` | Job details |
|
||||
| `/schedulerService/cluster` | Cluster information |
|
||||
|
||||
## Dependencies
|
||||
|
||||
- **MySQL Database**: `os_scheduling_db` - Stores job configurations, schedules, and execution history
|
||||
6
helm/schedulerservice/Chart.lock
Normal file
6
helm/schedulerservice/Chart.lock
Normal file
@ -0,0 +1,6 @@
|
||||
dependencies:
|
||||
- name: mysql
|
||||
repository: https://helm.wso2.com
|
||||
version: 1.6.9
|
||||
digest: sha256:bdbd774f845f1f0f4b7346e75b80f6c2e244cf92cf9feacf3d4807f8e50f9bce
|
||||
generated: "2026-01-29T10:58:50.337803+05:30"
|
||||
23
helm/schedulerservice/Chart.yaml
Normal file
23
helm/schedulerservice/Chart.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
apiVersion: v2
|
||||
name: schedulerservice
|
||||
description: Helm chart for Scheduler Service - Job scheduling and execution service
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.0"
|
||||
keywords:
|
||||
- java
|
||||
- tomcat
|
||||
- scheduler
|
||||
- microservice
|
||||
- backstage
|
||||
maintainers:
|
||||
- name: infrastructure
|
||||
email: infrastructure@onlinesales.ai
|
||||
home: https://github.com/onlinesales-ai/schedulerService
|
||||
sources:
|
||||
- https://github.com/onlinesales-ai/schedulerService
|
||||
dependencies:
|
||||
- name: mysql
|
||||
version: 1.6.9
|
||||
repository: https://helm.wso2.com
|
||||
condition: mysql.enabled
|
||||
BIN
helm/schedulerservice/charts/mysql-1.6.9.tgz
Normal file
BIN
helm/schedulerservice/charts/mysql-1.6.9.tgz
Normal file
Binary file not shown.
18
helm/schedulerservice/templates/NOTES.txt
Normal file
18
helm/schedulerservice/templates/NOTES.txt
Normal file
@ -0,0 +1,18 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range $host := .Values.ingress.hosts }}
|
||||
{{- range .paths }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "schedulerservice.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:{{ .Values.service.targetPort }}
|
||||
{{- end }}
|
||||
|
||||
2. Backstage Kubernetes ID: {{ .Values.commonLabels | default dict | dig "backstage.io/kubernetes-id" "schedulerservice" }}
|
||||
|
||||
3. Health check endpoint:
|
||||
/schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D
|
||||
|
||||
4. Documentation available at TechDocs in Backstage after registering catalog-info.yaml
|
||||
63
helm/schedulerservice/templates/_helpers.tpl
Normal file
63
helm/schedulerservice/templates/_helpers.tpl
Normal file
@ -0,0 +1,63 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "schedulerservice.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
*/}}
|
||||
{{- define "schedulerservice.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "schedulerservice.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "schedulerservice.labels" -}}
|
||||
helm.sh/chart: {{ include "schedulerservice.chart" . }}
|
||||
{{ include "schedulerservice.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- with .Values.commonLabels }}
|
||||
{{ toYaml . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "schedulerservice.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "schedulerservice.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "schedulerservice.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "schedulerservice.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
13
helm/schedulerservice/templates/configmap.yaml
Normal file
13
helm/schedulerservice/templates/configmap.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
{{- if .Values.config.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "schedulerservice.fullname" . }}-config
|
||||
labels:
|
||||
{{- include "schedulerservice.labels" . | nindent 4 }}
|
||||
data:
|
||||
{{- range $key, $value := .Values.config.files }}
|
||||
{{ $key }}: |
|
||||
{{- $value | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
83
helm/schedulerservice/templates/deployment.yaml
Normal file
83
helm/schedulerservice/templates/deployment.yaml
Normal file
@ -0,0 +1,83 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "schedulerservice.fullname" . }}
|
||||
labels:
|
||||
{{- include "schedulerservice.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "schedulerservice.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "schedulerservice.labels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "schedulerservice.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.targetPort }}
|
||||
protocol: TCP
|
||||
{{- if .Values.livenessProbe }}
|
||||
livenessProbe:
|
||||
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.readinessProbe }}
|
||||
readinessProbe:
|
||||
{{- toYaml .Values.readinessProbe | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.startupProbe }}
|
||||
startupProbe:
|
||||
{{- toYaml .Values.startupProbe | nindent 12 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- if .Values.config.enabled }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: {{ .Values.config.mountPath }}
|
||||
{{- end }}
|
||||
{{- with .Values.env }}
|
||||
env:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.config.enabled }}
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "schedulerservice.fullname" . }}-config
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
32
helm/schedulerservice/templates/hpa.yaml
Normal file
32
helm/schedulerservice/templates/hpa.yaml
Normal file
@ -0,0 +1,32 @@
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "schedulerservice.fullname" . }}
|
||||
labels:
|
||||
{{- include "schedulerservice.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "schedulerservice.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
41
helm/schedulerservice/templates/ingress.yaml
Normal file
41
helm/schedulerservice/templates/ingress.yaml
Normal file
@ -0,0 +1,41 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "schedulerservice.fullname" . }}
|
||||
labels:
|
||||
{{- include "schedulerservice.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
pathType: {{ .pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "schedulerservice.fullname" $ }}
|
||||
port:
|
||||
number: {{ $.Values.service.port }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
18
helm/schedulerservice/templates/pdb.yaml
Normal file
18
helm/schedulerservice/templates/pdb.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
{{- if .Values.pdb.enabled }}
|
||||
apiVersion: policy/v1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ include "schedulerservice.fullname" . }}
|
||||
labels:
|
||||
{{- include "schedulerservice.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if .Values.pdb.minAvailable }}
|
||||
minAvailable: {{ .Values.pdb.minAvailable }}
|
||||
{{- end }}
|
||||
{{- if .Values.pdb.maxUnavailable }}
|
||||
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "schedulerservice.selectorLabels" . | nindent 6 }}
|
||||
{{- end }}
|
||||
19
helm/schedulerservice/templates/service.yaml
Normal file
19
helm/schedulerservice/templates/service.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "schedulerservice.fullname" . }}
|
||||
labels:
|
||||
{{- include "schedulerservice.labels" . | nindent 4 }}
|
||||
{{- with .Values.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: {{ .Values.service.targetPort }}
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "schedulerservice.selectorLabels" . | nindent 4 }}
|
||||
12
helm/schedulerservice/templates/serviceaccount.yaml
Normal file
12
helm/schedulerservice/templates/serviceaccount.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "schedulerservice.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "schedulerservice.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
128
helm/schedulerservice/values-local.yaml
Normal file
128
helm/schedulerservice/values-local.yaml
Normal file
@ -0,0 +1,128 @@
|
||||
# Local development configuration for Kind cluster
|
||||
replicaCount: 1
|
||||
|
||||
# CRITICAL: Same Backstage label for local discovery
|
||||
commonLabels:
|
||||
backstage.io/kubernetes-id: "schedulerservice"
|
||||
|
||||
image:
|
||||
repository: gcr.io/prj-onlinesales-stag-01/schedulerservice
|
||||
pullPolicy: IfNotPresent
|
||||
tag: "latest"
|
||||
|
||||
# Relaxed security for local development
|
||||
podSecurityContext:
|
||||
fsGroup: 1000
|
||||
runAsNonRoot: false
|
||||
runAsUser: 0
|
||||
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: false
|
||||
runAsNonRoot: false
|
||||
runAsUser: 0
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
targetPort: 8080
|
||||
|
||||
# Enable ingress for local access
|
||||
ingress:
|
||||
enabled: true
|
||||
className: "nginx"
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "false"
|
||||
hosts:
|
||||
- host: schedulerservice.cnoe.localtest.me
|
||||
paths:
|
||||
- path: /schedulerService
|
||||
pathType: Prefix
|
||||
|
||||
# No resource limits for local development
|
||||
resources: {}
|
||||
|
||||
# Relaxed probes for local development
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D
|
||||
port: http
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 30
|
||||
failureThreshold: 10
|
||||
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D
|
||||
port: http
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 30
|
||||
failureThreshold: 10
|
||||
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D
|
||||
port: http
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 30
|
||||
failureThreshold: 60
|
||||
|
||||
# Disable autoscaling and PDB for local
|
||||
autoscaling:
|
||||
enabled: false
|
||||
|
||||
pdb:
|
||||
enabled: false
|
||||
|
||||
nodeSelector: {}
|
||||
tolerations: []
|
||||
affinity: {}
|
||||
|
||||
# External service dependencies for local
|
||||
externalServices: {}
|
||||
|
||||
config:
|
||||
enabled: true
|
||||
mountPath: /etc/onlinesales/config/schedulerService
|
||||
files:
|
||||
schedulerService.cfg: |
|
||||
LOG_CONFIG_FILE=/etc/onlinesales/config/schedulerService/log.cfg
|
||||
DB_CONFIG_FILE=/etc/onlinesales/config/schedulerService/hibernate.cfg.xml
|
||||
authConfig.cfg: |
|
||||
{
|
||||
"authEnable": false,
|
||||
"authServiceUrl": "http://hades-service/hades/authorize"
|
||||
}
|
||||
log.cfg: |
|
||||
log4j.rootLogger=DEBUG, stdout
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
|
||||
env:
|
||||
- name: APP_ENV
|
||||
value: "local"
|
||||
- name: LOG_LEVEL
|
||||
value: "DEBUG"
|
||||
|
||||
# MySQL enabled for local development
|
||||
mysql:
|
||||
enabled: true
|
||||
image: "mysql"
|
||||
imageTag: "8.0"
|
||||
mysqlRootPassword: "rootpassword"
|
||||
mysqlUser: "scheduler_user"
|
||||
mysqlPassword: "localpassword"
|
||||
mysqlDatabase: "os_scheduling_db"
|
||||
fullnameOverride: "schedulerservice-mysql"
|
||||
persistence:
|
||||
enabled: false
|
||||
resources: {}
|
||||
podLabels:
|
||||
backstage.io/kubernetes-id: "schedulerservice"
|
||||
135
helm/schedulerservice/values.yaml
Normal file
135
helm/schedulerservice/values.yaml
Normal file
@ -0,0 +1,135 @@
|
||||
# Production/Default configuration for Scheduler Service
|
||||
replicaCount: 2
|
||||
|
||||
# CRITICAL: Backstage Kubernetes plugin discovery label
|
||||
commonLabels:
|
||||
backstage.io/kubernetes-id: "schedulerservice"
|
||||
|
||||
image:
|
||||
repository: gcr.io/prj-onlinesales-prod-01/schedulerservice
|
||||
pullPolicy: IfNotPresent
|
||||
tag: "latest"
|
||||
|
||||
imagePullSecrets: []
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
serviceAccount:
|
||||
create: true
|
||||
annotations: {}
|
||||
name: ""
|
||||
|
||||
podAnnotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
|
||||
podLabels: {}
|
||||
|
||||
podSecurityContext:
|
||||
fsGroup: 1000
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: false
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
targetPort: 8080
|
||||
annotations: {}
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: "nginx"
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "false"
|
||||
hosts:
|
||||
- host: schedulerservice.example.com
|
||||
paths:
|
||||
- path: /schedulerService
|
||||
pathType: Prefix
|
||||
tls: []
|
||||
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 1Gi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 512Mi
|
||||
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D
|
||||
port: http
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 30
|
||||
failureThreshold: 5
|
||||
successThreshold: 1
|
||||
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D
|
||||
port: http
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 30
|
||||
failureThreshold: 5
|
||||
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /schedulerService/jobTrigger?jsonQuery=%7B%22application%22%3A%22nagios%22%2C%22jobName%22%3A%22monitoring_scheduler_svc%22%7D
|
||||
port: http
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 30
|
||||
failureThreshold: 30
|
||||
|
||||
autoscaling:
|
||||
enabled: true
|
||||
minReplicas: 2
|
||||
maxReplicas: 10
|
||||
targetCPUUtilizationPercentage: 70
|
||||
targetMemoryUtilizationPercentage: 80
|
||||
|
||||
pdb:
|
||||
enabled: true
|
||||
minAvailable: 1
|
||||
|
||||
nodeSelector: {}
|
||||
tolerations: []
|
||||
affinity: {}
|
||||
|
||||
# External service dependencies
|
||||
externalServices: {}
|
||||
|
||||
config:
|
||||
enabled: true
|
||||
mountPath: /etc/onlinesales/config/schedulerService
|
||||
files:
|
||||
schedulerService.cfg: |
|
||||
LOG_CONFIG_FILE=/etc/onlinesales/config/schedulerService/log.cfg
|
||||
DB_CONFIG_FILE=/etc/onlinesales/config/schedulerService/hibernate.cfg.xml
|
||||
authConfig.cfg: |
|
||||
{
|
||||
"authEnable": false,
|
||||
"authServiceUrl": "http://hades-service/hades/authorize"
|
||||
}
|
||||
log.cfg: |
|
||||
log4j.rootLogger=INFO, stdout
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
|
||||
env: []
|
||||
|
||||
# MySQL disabled for production (use external DB)
|
||||
mysql:
|
||||
enabled: false
|
||||
22
mkdocs.yml
Normal file
22
mkdocs.yml
Normal file
@ -0,0 +1,22 @@
|
||||
site_name: 'Scheduler Service'
|
||||
site_description: 'Job scheduling and execution service for managing scheduled tasks and job triggers'
|
||||
|
||||
nav:
|
||||
- Home: index.md
|
||||
- Getting Started: getting-started.md
|
||||
- API Reference: api-reference.md
|
||||
- Configuration: configuration.md
|
||||
- Deployment: deployment.md
|
||||
|
||||
plugins:
|
||||
- techdocs-core
|
||||
|
||||
markdown_extensions:
|
||||
- admonition
|
||||
- codehilite
|
||||
- pymdownx.superfences
|
||||
- pymdownx.tabbed:
|
||||
alternate_style: true
|
||||
- pymdownx.details
|
||||
- toc:
|
||||
permalink: true
|
||||
Loading…
x
Reference in New Issue
Block a user