helm chart added

This commit is contained in:
Vaibhav Pathak 2026-01-05 11:55:00 +05:30
commit 36648be466
35 changed files with 21774 additions and 0 deletions

414
CLAUDE.md Normal file
View File

@ -0,0 +1,414 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This repository contains a Helm chart for deploying the Property Settings Service V2 on Kubernetes. The chart name is `property-settings-svc-v2-chart` and follows standard Helm chart structure and conventions.
**Application Details:**
- Java/Tomcat-based service
- Docker Image: `localhost:5001/prj-onlinesales-prod-01/os-docker-images/onlinesales/prod/services/java/propertysettingssvcv2:1752740345878`
- Service Port: 8080
- Context Path: `/propertySettingsSvcV2`
- Database: MySQL 5.7 (bundled or external)
- Source Code: `/Volumes/Os/onlinesales/infrastructure/apps/propertySettingsSvcV2/release_kubernetes_2.0`
## Helm Chart Commands
### Update dependencies (required before first install)
```bash
cd ./property-settings-svc-v2-chart
helm dependency update
cd ..
```
### Install the chart
```bash
helm install <release-name> ./property-settings-svc-v2-chart
```
### Install with custom values
```bash
helm install <release-name> ./property-settings-svc-v2-chart -f custom-values.yaml
```
### Upgrade an existing release
```bash
helm upgrade <release-name> ./property-settings-svc-v2-chart
```
### Dry run to preview rendered templates
```bash
helm install <release-name> ./property-settings-svc-v2-chart --dry-run --debug
```
### Lint the chart
```bash
helm lint ./property-settings-svc-v2-chart
```
### Package the chart
```bash
helm package ./property-settings-svc-v2-chart
```
### Uninstall a release
```bash
helm uninstall <release-name>
```
### Template rendering (output YAML without deploying)
```bash
helm template <release-name> ./property-settings-svc-v2-chart
```
## Architecture
### Chart Structure
```
property-settings-svc-v2-chart/
├── Chart.yaml # Chart metadata with MySQL dependency
├── values.yaml # Default configuration values
├── sql/ # SQL migration scripts (5 files)
│ ├── 000_create_property_settings_db.sql # Creates database
│ ├── 001_properties_table.sql # Creates tables & triggers
│ ├── 002_populate_properties_table.sql # V1→V2 migration (unused)
│ ├── 003_alter_column_property_value.sql # Alters column type
│ └── 004_property_settings_db_v2.sql # Complete dump with data (79KB)
├── charts/ # Dependent charts (MySQL)
│ └── mysql-*.tgz # WSO2 MySQL chart
└── templates/
├── _helpers.tpl # Template helpers and named templates
├── _db-helpers.tpl # Database connection helpers
├── deployment.yaml # Main application deployment
├── service.yaml # Kubernetes service (ClusterIP on port 8080)
├── serviceaccount.yaml # Service account configuration
├── configmap.yaml # Application configuration files
├── configmap-sql-migrations.yaml # ConfigMap with SQL files (auto-loaded)
├── job-dbinit.yaml # Database initialization Job (Helm hook)
├── secret.yaml # Database configuration (Hibernate with dynamic DB config)
├── ingress.yaml # Optional Ingress resource
├── httproute.yaml # Optional Gateway API HTTPRoute
├── hpa.yaml # Horizontal Pod Autoscaler (enabled by default)
└── tests/
└── test-connection.yaml
```
### Key Template Helpers
The `_helpers.tpl` file defines reusable template functions:
- `property-settings-svc-v2-chart.name` - Chart name with override support
- `property-settings-svc-v2-chart.fullname` - Fully qualified app name (max 63 chars)
- `property-settings-svc-v2-chart.chart` - Chart name and version label
- `property-settings-svc-v2-chart.labels` - Common labels for all resources
- `property-settings-svc-v2-chart.selectorLabels` - Labels for selecting pods
- `property-settings-svc-v2-chart.serviceAccountName` - Service account name resolution
### Routing Options
The chart supports two routing mechanisms (both disabled by default):
1. **Traditional Ingress** (`ingress.enabled: false`) - Standard Kubernetes Ingress using networking.k8s.io/v1
2. **Gateway API HTTPRoute** (`httpRoute.enabled: false`) - Modern Gateway API routing with advanced traffic management
### Default Configuration
- **Image**: `localhost:5001/prj-onlinesales-prod-01/os-docker-images/onlinesales/prod/services/java/propertysettingssvcv2:1752740345878`
- **Service Type**: ClusterIP on port 8080
- **Replicas**: 3 (minimum when autoscaling is enabled)
- **Probes**: HTTP health checks on `/propertySettingsSvcV2/properties` endpoint with specific query parameters
- **Autoscaling**: Enabled by default (3-10 replicas, CPU target 200%, Memory target 80%)
- **Resources**: CPU request 500m, Memory request 512Mi
- **Configuration Volumes**:
- ConfigMap mounted at `/etc/onlinesales/config/propertySettingsSvcV2`
- Secret mounted at `/etc/onlinesales/db`
## Working with Templates
When modifying templates, remember:
- All resource names use the `property-settings-svc-v2-chart.fullname` helper
- Labels should use the `property-settings-svc-v2-chart.labels` helper for consistency
- Container port in deployment.yaml references `service.port` from values
- The deployment uses conditional logic for autoscaling (`.Values.autoscaling.enabled`)
- HTTPRoute template includes advanced features like filters and header manipulation
## MySQL Database Configuration
The chart includes MySQL as an optional dependency using the WSO2 MySQL Helm chart (version 1.6.9).
### Bundled MySQL (Default)
By default, the chart deploys MySQL alongside the application:
- **Version**: MySQL 5.7.30
- **Database Name**: `property_settings_db_v2`
- **Username**: `propertysettings`
- **Password**: `changeme` (should be changed for production)
- **Persistence**: 8Gi storage (configurable)
- **Initialization**: Automatically creates database schema and tables
To deploy with bundled MySQL:
```bash
helm install property-settings-v2 ./property-settings-svc-v2-chart
```
### External MySQL
To use an external MySQL database, disable the bundled MySQL and configure connection details:
```yaml
# values.yaml or custom-values.yaml
mysql:
enabled: false
externalDatabase:
host: "your-mysql-host.example.com"
port: 3306
database: "property_settings_db_v2"
username: "propertysettings"
password: "your-secure-password"
```
Deploy with external MySQL:
```bash
helm install property-settings-v2 ./property-settings-svc-v2-chart \
--set mysql.enabled=false \
--set externalDatabase.host=your-mysql-host.example.com \
--set externalDatabase.password=your-secure-password
```
**Important**: When using external MySQL, ensure the database schema is initialized manually using the SQL scripts from `sql/` directory.
### Database Schema and Initialization
The chart uses a **Helm Job with ConfigMap approach** for database initialization (same pattern as hades-service):
#### How It Works
1. **SQL Files in `sql/` Directory**: All SQL migration scripts are stored as separate files
2. **Auto-Loading via ConfigMap**: The `configmap-sql-migrations.yaml` template uses `.Files.Glob "sql/**.sql"` to automatically load all SQL files
3. **Execution via Helm Job**: The `job-dbinit.yaml` runs as a post-install/post-upgrade hook that:
- Waits for MySQL to be ready
- Executes SQL files in alphabetical order (000, 001, 002, etc.)
- Provides detailed logging and error handling
- Fails if any migration fails
**Advantages of this approach:**
- ✅ No need to embed SQL in values.yaml
- ✅ SQL files remain separate and version-controlled
- ✅ Automatic file discovery - just add/remove files in `sql/` directory
- ✅ Clean execution logs with success/failure reporting
- ✅ Runs automatically on install and upgrade
#### Available SQL Files
The `sql/` directory contains 5 files:
1. **000_create_property_settings_db.sql** - Creates the database
2. **001_properties_table.sql** - Creates properties table with triggers
3. **002_populate_properties_table.sql** - V1→V2 migration (commented out, not used)
4. **003_alter_column_property_value.sql** - Alters property_value column to TEXT
5. **004_property_settings_db_v2.sql** (79KB) - Complete database dump with staging data
#### OPTION 1: Clean Installation (Default)
For production deployments with an empty database:
**Files to keep active:**
- 000, 001, 003 (002 is commented out)
**To configure:**
```bash
# Rename or remove the complete dump file
mv sql/004_property_settings_db_v2.sql sql/004_property_settings_db_v2.sql.bak
```
**Result:**
- Empty `properties` table with proper schema
- Triggers for automatic timestamp tracking
- TEXT column type for property_value
- Ready for production use
#### OPTION 2: Complete Database Dump (With Seed Data)
For development/testing with sample data from staging:
**File to keep active:**
- 004 only
**To configure:**
```bash
# Rename the incremental files and keep only the dump
cd sql/
mv 000_create_property_settings_db.sql 000_create_property_settings_db.sql.bak
mv 001_properties_table.sql 001_properties_table.sql.bak
mv 002_populate_properties_table.sql 002_populate_properties_table.sql.bak
mv 003_alter_column_property_value.sql 003_alter_column_property_value.sql.bak
# Keep 004_property_settings_db_v2.sql active
```
**Result:**
- Complete database with real staging data
- 4 Agency records (TVING staging, TVING QA, etc.)
- 24+ Client records with configurations
- Moloco account details, payment modes
- Schema_info table with migration tracking
**⚠️ WARNING**: Do NOT use both options together. The dump file (004) drops and recreates tables, conflicting with incremental files (000-003).
#### Schema Details
**Table**: `properties`
- **Primary Key**: (entity_type, entity_value, property_type)
- **Columns**: entity_type (VARCHAR 200), entity_value (VARCHAR 200), property_type (VARCHAR 200), property_value (TEXT), is_active (BOOLEAN), creation_date (DATETIME), last_update (DATETIME), last_updated_by (VARCHAR 150)
- **Triggers**: Automatic timestamp and user tracking on INSERT/UPDATE
- **Character Set**: UTF-8
- **Engine**: InnoDB
#### Controlling Database Initialization
To disable automatic database initialization:
```yaml
# values.yaml
dbInit:
enabled: false
```
This is useful when:
- Using an external database with existing schema
- Managing schema separately
- Running in environments where Jobs/Hooks are restricted
### Hibernate Configuration
The Hibernate configuration in `secret.yaml` is dynamically generated based on MySQL settings:
- Uses `_db-helpers.tpl` to determine connection details
- Automatically configures JDBC URL, username, and password
- Supports both internal and external MySQL seamlessly
### Database Service Name Convention
When using bundled MySQL, the service is named `<release-name>-mysql`:
- Example: With release name `prop`, MySQL service is `prop-mysql`
- The database initialization Job and Hibernate config automatically use the correct service name
- Connection string format: `jdbc:mysql://<release-name>-mysql:3306/property_settings_db_v2`
## Configuration Management
### ConfigMap (configmap.yaml)
The chart creates a ConfigMap containing application configuration files:
- `propertySettingsService.cfg` - Main service configuration (prod/test environments)
- `log.cfg` - Logging configuration
- `prodRestAccessor.cfg` - Production REST accessor settings
- `testRestAccessor.cfg` - Test REST accessor settings
- `authConfig.cfg` - Authentication configuration
- `statsLogging.cfg` - Statistics logging configuration
**Important**: These files contain placeholder content and must be updated with actual configuration before deployment.
### Secret (secret.yaml)
The chart creates a Secret for sensitive database configuration:
- `propertySettingsV2.hbm.xml` - Hibernate mapping file for database access
**Important**: This file contains placeholder XML and must be updated with actual database mapping before deployment.
### Health Check Configuration
The service uses a comprehensive health check endpoint:
```
/propertySettingsSvcV2/properties?jsonQuery={encoded-json}
```
This endpoint validates:
- Service availability
- Database connectivity
- Property retrieval functionality
The query is URL-encoded and checks for BUSINESS_SEGMENT_SET properties for AGENCY entity type.
## Values Configuration
Key values.yaml sections (already configured):
- `image.repository` and `image.tag` - Set to Property Settings V2 image
- `service.port` - Set to 8080 (Tomcat default)
- `replicaCount` - Set to 3 replicas
- `resources` - CPU: 500m, Memory: 512Mi
- `autoscaling` - Enabled (3-10 replicas, CPU: 200%, Memory: 80%)
- `livenessProbe` and `readinessProbe` - Configured for Property Settings endpoint
Optional values to configure:
- `ingress` or `httpRoute` - Enable one for external access
- `nodeSelector`, `tolerations`, `affinity` - For pod scheduling preferences
## Deployment Workflow
1. **Update Chart Dependencies** (Required before first deployment):
```bash
cd ./property-settings-svc-v2-chart
helm dependency update
cd ..
```
2. **Update Configuration Files** (Required before first deployment):
```bash
# Edit the ConfigMap template with actual configuration
vim ./property-settings-svc-v2-chart/templates/configmap.yaml
# Update MySQL credentials (if needed)
vim ./property-settings-svc-v2-chart/values.yaml
# Change mysql.mysqlRootPassword and mysql.mysqlPassword
```
3. **Validate the Chart**:
```bash
helm lint ./property-settings-svc-v2-chart
helm template test ./property-settings-svc-v2-chart --debug
```
4. **Deploy to Kubernetes** (with bundled MySQL):
```bash
helm install property-settings-v2 ./property-settings-svc-v2-chart \
--set mysql.mysqlRootPassword=your-root-password \
--set mysql.mysqlPassword=your-user-password
```
5. **Deploy to Kubernetes** (with external MySQL):
```bash
helm install property-settings-v2 ./property-settings-svc-v2-chart \
--set mysql.enabled=false \
--set externalDatabase.host=your-mysql-host \
--set externalDatabase.password=your-password
```
6. **Verify Deployment**:
```bash
# Check all pods (application + MySQL if enabled)
kubectl get pods -l app.kubernetes.io/instance=property-settings-v2
# Check application logs
kubectl logs -l app.kubernetes.io/name=property-settings-svc-v2-chart
# Check MySQL logs (if bundled)
kubectl logs -l app.kubernetes.io/name=mysql
# Verify database connection
kubectl exec -it <property-settings-pod> -- sh
# Test connection to MySQL
```
## Important Notes
- The chart uses modern Kubernetes API versions (apps/v1, networking.k8s.io/v1)
- Service account is created by default with API credentials auto-mounted
- **MySQL dependency must be updated** - Run `helm dependency update` before first deployment
- **Database passwords should be changed** - Default passwords are insecure and meant for development only
- **Configuration files must be updated before deployment** - The ConfigMap contains placeholder content
- The deployment automatically mounts configuration volumes - no need to modify deployment.yaml for config changes
- The Hibernate configuration is dynamically generated based on MySQL settings (internal or external)
- **Database initialization uses Helm Job** - SQL files are auto-loaded from `sql/` directory and executed via a post-install/post-upgrade hook
- When enabling HTTPRoute, ensure Gateway API CRDs are installed in the cluster
- The image registry (localhost:5001) suggests a local registry - ensure it's accessible from your cluster
- For external MySQL, the database schema must be initialized manually using scripts in `sql/` directory
## MySQL Dependency Details
**Chart**: WSO2 MySQL (version 1.6.9)
**Repository**: https://helm.wso2.com
**Condition**: `mysql.enabled`
The MySQL chart is conditionally deployed based on the `mysql.enabled` value. When enabled, it creates:
- MySQL StatefulSet
- PersistentVolumeClaim for data storage
- Service for database access
- ConfigMap for initialization scripts

105
catalog-info.yaml Normal file
View File

@ -0,0 +1,105 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: propertysettings-v2-service
title: PropertySettings V2 Service
description: Property Settings and Configuration Management Service providing centralized application configuration, environment-specific properties, and dynamic settings management
annotations:
backstage.io/techdocs-ref: dir:.
github.com/project-slug: yourorg/propertysettings-v2-service
# Argo Workflows annotation for environment provisioning
argo-workflows.cnoe.io/label-selector: "service=propertysettings-v2-service"
# ArgoCD annotations
argocd/app-name: propertysettings-v2-service
# Kubernetes annotations - Using kubernetes-id with commonLabels
backstage.io/kubernetes-id: propertysettings-v2-service
# Helm chart annotations for environment provisioning
helm.cnoe.io/git-repo: https://gitea.cnoe.localtest.me:8443/giteaAdmin/propertysettings-v2-chart.git
helm.cnoe.io/chart-path: propertySettings-V2
helm.cnoe.io/values-file: values-dev.yaml
helm.cnoe.io/available-values-files: '["values.yaml", "values-dev.yaml", "values-local.yaml"]'
helm.cnoe.io/dependencies: '{}'
tags:
- configuration
- settings
- properties
- java
links:
- url: https://wiki.company.com/propertysettings-v2
title: Documentation
icon: docs
- url: https://grafana.company.com/d/propertysettings-v2
title: Grafana Dashboard
icon: dashboard
spec:
type: service
lifecycle: experimental
owner: user1
dependsOn: []
providesApis:
- propertysettings-v2-api
consumesApis: []
---
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: propertysettings-v2-api
title: PropertySettings V2 API
description: REST API for property and configuration management operations
tags:
- rest
- configuration
links:
- url: https://api-docs.company.com/propertysettings-v2
title: API Documentation
spec:
type: openapi
lifecycle: experimental
owner: user1
definition: |
openapi: 3.0.0
info:
title: PropertySettings V2 API
version: 2.0.0
description: Property Settings and Configuration Management Service
paths:
/properties:
get:
summary: List properties
description: Get list of all properties
operationId: listProperties
tags:
- Properties
post:
summary: Create property
description: Create a new property
operationId: createProperty
tags:
- Properties
/properties/{id}:
get:
summary: Get property
description: Get a specific property by ID
operationId: getProperty
tags:
- Properties
put:
summary: Update property
description: Update an existing property
operationId: updateProperty
tags:
- Properties
delete:
summary: Delete property
description: Delete a property
operationId: deleteProperty
tags:
- Properties
/health:
get:
summary: Health check
description: Service health check endpoint
operationId: healthCheck
tags:
- Monitoring

4
mkdocs.yml Normal file
View File

@ -0,0 +1,4 @@
site_name: PropertySettings V2 Service
docs_dir: docs
plugins:
- techdocs-core

View File

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,6 @@
dependencies:
- name: mysql
repository: https://helm.wso2.com
version: 1.6.9
digest: sha256:bdbd774f845f1f0f4b7346e75b80f6c2e244cf92cf9feacf3d4807f8e50f9bce
generated: "2025-12-09T14:10:52.064234+05:30"

View File

@ -0,0 +1,30 @@
apiVersion: v2
name: property-settings-svc-v2-chart
description: A Helm chart for Property Settings Service V2 on Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
dependencies:
- name: mysql
version: "1.6.9"
repository: "https://helm.wso2.com"
condition: mysql.enabled

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
create database if not exists property_settings_db_v2;

View File

@ -0,0 +1,30 @@
use property_settings_db_v2;
create table properties
(
entity_type VARCHAR(200) NOT NULL,
entity_value VARCHAR(200) NOT NULL,
property_type VARCHAR(200) NOT NULL,
property_value BLOB NOT NULL,
is_active BOOLEAN NOT NULL DEFAULT 1,
PRIMARY KEY (entity_type, entity_value, property_type)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
ALTER TABLE properties ADD COLUMN creation_date DATETIME;
ALTER TABLE properties ADD COLUMN last_update DATETIME;
ALTER TABLE properties ADD COLUMN last_updated_by VARCHAR(150);
delimiter //
CREATE TRIGGER properties_insert_trigger BEFORE INSERT ON properties
FOR EACH ROW BEGIN
SET NEW.creation_date=NOW();
SET NEW.last_updated_by=USER();
SET NEW.last_update=NOW();
END;//
CREATE TRIGGER properties_update_trigger BEFORE UPDATE ON properties
FOR EACH ROW
BEGIN
SET NEW.last_updated_by=USER();
SET NEW.last_update = NOW();
END;//
delimiter ;

View File

@ -0,0 +1,19 @@
#use property_settings_db_v2;
#INSERT INTO properties
#(
# entity_type,
# entity_value,
# property_type,
# property_value,
# is_active
#)
#SELECT
# e.name as entity_type,
# CONCAT(prop.client_id, "_", prop.entity_id) AS entity_value,
# p.name AS property_type,
# prop.property_value,
# prop.is_active
#FROM propertiesV1 prop,
# property_types p, entity_types e
#WHERE
# prop.property_type_id = p.id AND prop.entity_type_id = e.id;

View File

@ -0,0 +1,3 @@
use property_settings_db_v2;
ALTER TABLE `properties` CHANGE COLUMN `property_value` `property_value` text NOT NULL;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,35 @@
1. Get the application URL by running these commands:
{{- if .Values.httpRoute.enabled }}
{{- if .Values.httpRoute.hostnames }}
export APP_HOSTNAME={{ .Values.httpRoute.hostnames | first }}
{{- else }}
export APP_HOSTNAME=$(kubectl get --namespace {{(first .Values.httpRoute.parentRefs).namespace | default .Release.Namespace }} gateway/{{ (first .Values.httpRoute.parentRefs).name }} -o jsonpath="{.spec.listeners[0].hostname}")
{{- end }}
{{- if and .Values.httpRoute.rules (first .Values.httpRoute.rules).matches (first (first .Values.httpRoute.rules).matches).path.value }}
echo "Visit http://$APP_HOSTNAME{{ (first (first .Values.httpRoute.rules).matches).path.value }} to use your application"
NOTE: Your HTTPRoute depends on the listener configuration of your gateway and your HTTPRoute rules.
The rules can be set for path, method, header and query parameters.
You can check the gateway configuration with 'kubectl get --namespace {{(first .Values.httpRoute.parentRefs).namespace | default .Release.Namespace }} gateway/{{ (first .Values.httpRoute.parentRefs).name }} -o yaml'
{{- end }}
{{- else 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 "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "property-settings-svc-v2-chart.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "property-settings-svc-v2-chart.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "property-settings-svc-v2-chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "property-settings-svc-v2-chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}

View File

@ -0,0 +1,61 @@
{{/*
Database host
*/}}
{{- define "property-settings-svc-v2-chart.databaseHost" -}}
{{- if .Values.mysql.enabled -}}
{{- printf "%s-mysql" .Release.Name -}}
{{- else -}}
{{- .Values.externalDatabase.host -}}
{{- end -}}
{{- end -}}
{{/*
Database port
*/}}
{{- define "property-settings-svc-v2-chart.databasePort" -}}
{{- if .Values.mysql.enabled -}}
3306
{{- else -}}
{{- .Values.externalDatabase.port -}}
{{- end -}}
{{- end -}}
{{/*
Database name
*/}}
{{- define "property-settings-svc-v2-chart.databaseName" -}}
{{- if .Values.mysql.enabled -}}
{{- .Values.mysql.mysqlDatabase -}}
{{- else -}}
{{- .Values.externalDatabase.database -}}
{{- end -}}
{{- end -}}
{{/*
Database username
*/}}
{{- define "property-settings-svc-v2-chart.databaseUsername" -}}
{{- if .Values.mysql.enabled -}}
{{- .Values.mysql.mysqlUser -}}
{{- else -}}
{{- .Values.externalDatabase.username -}}
{{- end -}}
{{- end -}}
{{/*
Database password
*/}}
{{- define "property-settings-svc-v2-chart.databasePassword" -}}
{{- if .Values.mysql.enabled -}}
{{- .Values.mysql.mysqlPassword -}}
{{- else -}}
{{- .Values.externalDatabase.password -}}
{{- end -}}
{{- end -}}
{{/*
Database JDBC URL
*/}}
{{- define "property-settings-svc-v2-chart.databaseJdbcUrl" -}}
{{- printf "jdbc:mysql://%s:%s/%s?useUnicode=true&amp;characterEncoding=UTF-8&amp;autoReconnect=true&amp;" (include "property-settings-svc-v2-chart.databaseHost" .) (include "property-settings-svc-v2-chart.databasePort" .) (include "property-settings-svc-v2-chart.databaseName" .) -}}
{{- end -}}

View File

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "property-settings-svc-v2-chart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "property-settings-svc-v2-chart.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 "property-settings-svc-v2-chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "property-settings-svc-v2-chart.labels" -}}
helm.sh/chart: {{ include "property-settings-svc-v2-chart.chart" . }}
{{ include "property-settings-svc-v2-chart.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "property-settings-svc-v2-chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "property-settings-svc-v2-chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "property-settings-svc-v2-chart.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "property-settings-svc-v2-chart.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,13 @@
{{- if .Values.dbInit.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "property-settings-svc-v2-chart.fullname" . }}-sql-migrations
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 4 }}
app.kubernetes.io/component: dbinit
binaryData:
{{- range $path, $_ := .Files.Glob "sql/004_property_settings_db*.sql" }}
{{ base $path }}: {{ $.Files.Get $path | b64enc | quote }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,88 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "property-settings-svc-v2-chart.fullname" . }}-config
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 4 }}
data:
propertySettingsService.cfg: |
{
prod: {
log_config: "{{ .Values.config.propertySettingsService.prod.logConfig }}",
property_settings_db_hibernate_config: "{{ .Values.config.propertySettingsService.prod.hibernateConfig }}",
rest_accessor_config_file: "{{ .Values.config.propertySettingsService.prod.restAccessorConfig }}",
},
test: {
log_config: "{{ .Values.config.propertySettingsService.test.logConfig }}",
property_settings_db_hibernate_config: "{{ .Values.config.propertySettingsService.test.hibernateConfig }}",
rest_accessor_config_file: "{{ .Values.config.propertySettingsService.test.restAccessorConfig }}",
}
}
log.cfg: |
{{ .Values.config.log | indent 4 }}
prodRestAccessor.cfg: |
{
"post_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "post",
"response": "com.sokrati.propertySettingsSvcObjectsV2.PostPropertiesResponse"
},
"get_all_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "get",
"response": "com.sokrati.propertySettingsSvcObjectsV2.GetPropertiesResponse"
},
"get_best_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "get",
"response": "com.sokrati.propertySettingsSvcObjectsV2.GetPropertiesResponse"
},
"fetch_context":
{
{{- if .Values.traefik.enabled }}
"url": "{{ .Values.traefik.hadesUrl }}/hadesV2/context",
{{- else }}
"url": "http://hades.hades.svc.cluster.local:8080/hadesV2/context",
{{- end }}
"type": "get",
"response": "com.sokrati.hadesObjects.ContextResponse"
}
}
testRestAccessor.cfg: |
{
"post_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "post",
"response": "com.sokrati.propertySettingsSvcObjectsV2.PostPropertiesResponse"
},
"get_all_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "get",
"response": "com.sokrati.propertySettingsSvcObjectsV2.GetPropertiesResponse"
},
"get_best_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "get",
"response": "com.sokrati.propertySettingsSvcObjectsV2.GetPropertiesResponse"
},
"fetch_context":
{
{{- if .Values.traefik.enabled }}
"url": "{{ .Values.traefik.hadesUrl }}/hadesV2/context",
{{- else }}
"url": "http://hades.hades.svc.cluster.local:8080/hadesV2/context",
{{- end }}
"type": "get",
"response": "com.sokrati.hadesObjects.ContextResponse"
}
}
authConfig.cfg: |
{{ .Values.config.auth | indent 4 }}
statsLogging.cfg: |
{{ .Values.config.statsLogging | indent 4 }}

View File

@ -0,0 +1,93 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "property-settings-svc-v2-chart.fullname" . }}
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "property-settings-svc-v2-chart.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "property-settings-svc-v2-chart.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: APP_ENV
value: {{ .Values.appEnv | default "test" }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/onlinesales/config/propertySettingsSvcV2
readOnly: true
- name: db-config
mountPath: /etc/onlinesales/db
readOnly: true
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ include "property-settings-svc-v2-chart.fullname" . }}-config
- name: db-config
secret:
secretName: {{ include "property-settings-svc-v2-chart.fullname" . }}-db-config
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- 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 }}

View File

@ -0,0 +1,32 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "property-settings-svc-v2-chart.fullname" . }}
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "property-settings-svc-v2-chart.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 }}

View File

@ -0,0 +1,38 @@
{{- if .Values.httpRoute.enabled -}}
{{- $fullName := include "property-settings-svc-v2-chart.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ $fullName }}
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 4 }}
{{- with .Values.httpRoute.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
parentRefs:
{{- with .Values.httpRoute.parentRefs }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.httpRoute.hostnames }}
hostnames:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
{{- range .Values.httpRoute.rules }}
{{- with .matches }}
- matches:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .filters }}
filters:
{{- toYaml . | nindent 8 }}
{{- end }}
backendRefs:
- name: {{ $fullName }}
port: {{ $svcPort }}
weight: 1
{{- end }}
{{- end }}

View File

@ -0,0 +1,43 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "property-settings-svc-v2-chart.fullname" . }}
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.ingress.className }}
ingressClassName: {{ . }}
{{- 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 }}
{{- with .pathType }}
pathType: {{ . }}
{{- end }}
backend:
service:
name: {{ include "property-settings-svc-v2-chart.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,130 @@
{{- if .Values.dbInit.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "property-settings-svc-v2-chart.fullname" . }}-dbinit
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 4 }}
app.kubernetes.io/component: dbinit
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation
spec:
backoffLimit: 5
ttlSecondsAfterFinished: 300
template:
metadata:
labels:
app.kubernetes.io/component: dbinit
{{- include "property-settings-svc-v2-chart.selectorLabels" . | nindent 8 }}
spec:
restartPolicy: OnFailure
initContainers:
# Wait for MySQL to be ready
- name: wait-for-db
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting for database to be ready..."
until nc -z {{ include "property-settings-svc-v2-chart.databaseHost" . }} {{ include "property-settings-svc-v2-chart.databasePort" . }}; do
echo "Database is unavailable - sleeping"
sleep 2
done
echo "Database is up!"
sleep 10
containers:
- name: dbinit
image: mysql:8.0
env:
- name: MYSQL_HOST
value: {{ include "property-settings-svc-v2-chart.databaseHost" . | quote }}
- name: MYSQL_PORT
value: {{ include "property-settings-svc-v2-chart.databasePort" . | quote }}
- name: MYSQL_DATABASE
value: {{ include "property-settings-svc-v2-chart.databaseName" . | quote }}
- name: MYSQL_USER
value: {{ include "property-settings-svc-v2-chart.databaseUsername" . | quote }}
- name: MYSQL_PWD
value: {{ include "property-settings-svc-v2-chart.databasePassword" . | quote }}
command:
- /bin/bash
- -c
- |
set -ex
echo "========================================="
echo "Property Settings Database Migration"
echo "========================================="
echo "Host: ${MYSQL_HOST}:${MYSQL_PORT}"
echo "Database: ${MYSQL_DATABASE}"
echo "User: ${MYSQL_USER}"
echo "========================================="
# Test connection
echo "Testing database connection..."
if ! mysql -h"${MYSQL_HOST}" -P"${MYSQL_PORT}" -u"${MYSQL_USER}" -e "SELECT 1" 2>/dev/null; then
echo "ERROR: Cannot connect to database"
exit 1
fi
echo "✓ Database connection successful"
echo ""
# Apply migrations in order
TOTAL=0
SUCCESS=0
FAILED=0
for sql_file in /migrations/*.sql; do
if [ ! -f "$sql_file" ]; then
continue
fi
filename=$(basename "$sql_file")
TOTAL=$((TOTAL + 1))
echo -n "Applying $filename... "
if mysql -h"${MYSQL_HOST}" -P"${MYSQL_PORT}" -u"root" < "$sql_file" 2>/tmp/migration_error.log; then
echo "✓ SUCCESS"
SUCCESS=$((SUCCESS + 1))
else
echo "✗ FAILED"
echo "Error details:"
cat /tmp/migration_error.log
FAILED=$((FAILED + 1))
# Stop on first error
echo ""
echo "========================================="
echo "Migration failed at: $filename"
echo "========================================="
exit 1
fi
done
echo ""
echo "========================================="
echo "Migration Summary:"
echo " Total: $TOTAL"
echo " Success: $SUCCESS"
echo " Failed: $FAILED"
echo "========================================="
if [ $FAILED -eq 0 ]; then
echo "✓ All migrations completed successfully!"
exit 0
else
echo "✗ Some migrations failed"
exit 1
fi
volumeMounts:
- name: sql-migrations
mountPath: /migrations
volumes:
- name: sql-migrations
configMap:
name: {{ include "property-settings-svc-v2-chart.fullname" . }}-sql-migrations
{{- end }}

View File

@ -0,0 +1,44 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "property-settings-svc-v2-chart.fullname" . }}-db-config
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 4 }}
type: Opaque
stringData:
propertySettingsV2.hbm.xml: |
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="connection.url">{{ include "property-settings-svc-v2-chart.databaseJdbcUrl" . }}</property>
<property name="connection.username">{{ include "property-settings-svc-v2-chart.databaseUsername" . }}</property>
<property name="connection.password">{{ include "property-settings-svc-v2-chart.databasePassword" . }}</property>
<property name="connection.pool_size">1</property>
<property name="dialect">dblib.CustomMySQL8DialectUtf8mb4</property>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.cache.use_second_level_cache">false</property>
<property name="show_sql">false</property>
<property name="use_keying_service">false</property>
<property name="use_credential_store">false</property>
<!-- Transaction isolation 2 = READ_COMMITTED -->
<property name="connection.isolation">2</property>
<property name="connection.autocommit">true</property>
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF-8</property>
<!-- configuration pool via c3p0-->
<property name="c3p0.acquire_increment">10</property>
<property name="c3p0.max_size">30</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">3605</property> <!-- seconds -->
<property name="c3p0.testConnectionOnCheckin">true</property>
<property name="hibernate.c3p0.idle_test_period">30</property>
<property name="hibernate.c3p0.preferredTestQuery">select 1;</property>
<property name="hibernate.globally_quoted_identifiers">true</property>
</session-factory>
</hibernate-configuration>

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "property-settings-svc-v2-chart.fullname" . }}
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "property-settings-svc-v2-chart.selectorLabels" . | nindent 4 }}

View File

@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "property-settings-svc-v2-chart.serviceAccountName" . }}
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "property-settings-svc-v2-chart.fullname" . }}-test-connection"
labels:
{{- include "property-settings-svc-v2-chart.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "property-settings-svc-v2-chart.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never

View File

@ -0,0 +1,347 @@
# Default values for property-settings-svc-v2-chart.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
replicaCount: 1
# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
image:
repository: localhost:5001/prj-onlinesales-prod-01/os-docker-images/onlinesales/prod/services/java/propertysettingssvcv2
# This sets the pull policy for images.
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "1752740345878"
# This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
imagePullSecrets: []
# This is to override the chart name.
nameOverride: "property-settings"
fullnameOverride: ""
# This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/
serviceAccount:
# Specifies whether a service account should be created.
create: true
# Automatically mount a ServiceAccount's API credentials?
automount: true
# Annotations to add to the service account.
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template.
name: ""
# This is for setting Kubernetes Annotations to a Pod.
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
podAnnotations: {}
# This is for setting Kubernetes Labels to a Pod.
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
podLabels: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/
service:
# This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
type: ClusterIP
# This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports
port: 8080
# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
# -- Expose the service via gateway-api HTTPRoute
# Requires Gateway API resources and suitable controller installed within the cluster
# (see: https://gateway-api.sigs.k8s.io/guides/)
httpRoute:
# HTTPRoute enabled.
enabled: false
# HTTPRoute annotations.
annotations: {}
# Which Gateways this Route is attached to.
parentRefs:
- name: gateway
sectionName: http
# namespace: default
# Hostnames matching HTTP header.
hostnames:
- chart-example.local
# List of rules and filters applied.
rules:
- matches:
- path:
type: PathPrefix
value: /headers
# filters:
# - type: RequestHeaderModifier
# requestHeaderModifier:
# set:
# - name: My-Overwrite-Header
# value: this-is-the-only-value
# remove:
# - User-Agent
# - matches:
# - path:
# type: PathPrefix
# value: /echo
# headers:
# - name: version
# value: v2
resources:
requests:
cpu: 500m
memory: 512Mi
# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
livenessProbe:
httpGet:
path: /propertySettingsSvcV2/properties?jsonQuery=%7B%22requestType%22%3A%22GetAllProperties%22%2C%22isActive%22%3A%22true%22%2C%22propertyTypeFilter%22%3A%5B%22BUSINESS_SEGMENT_SET%22%5D%2C%22isBestProperty%22%3Afalse%2C%22entityDetails%22%3A%5B%7B%22entityType%22%3A%22AGENCY%22%2C%22entityValue%22%3A%22424_1%22%7D%5D%2C%22application%22%3A%22nagios%22%7D
port: http
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet:
path: /propertySettingsSvcV2/properties?jsonQuery=%7B%22requestType%22%3A%22GetAllProperties%22%2C%22isActive%22%3A%22true%22%2C%22propertyTypeFilter%22%3A%5B%22BUSINESS_SEGMENT_SET%22%5D%2C%22isBestProperty%22%3Afalse%2C%22entityDetails%22%3A%5B%7B%22entityType%22%3A%22AGENCY%22%2C%22entityValue%22%3A%22424_1%22%7D%5D%2C%22application%22%3A%22nagios%22%7D
port: http
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 10
targetCPUUtilizationPercentage: 200
targetMemoryUtilizationPercentage: 80
# Traefik Ingress Configuration (for test setup with IP header injection)
# Enable this to route traffic through Traefik with custom IP header injection
traefik:
# Enable Traefik routing for Hades calls
enabled: false
# Service-specific IP address for X-Client-IP header
clientIP: "10.0.0.1"
# Base URL for routing to Hades via Traefik (path-based routing - no DNS config needed)
hadesUrl: "http://traefik.traefik.svc.cluster.local/property-hades"
# Middleware reference (must exist in cluster)
middleware:
name: "property-settings-caller-headers"
namespace: "traefik"
# Additional volumes on the output Deployment definition.
volumes: []
# The deployment will automatically add config and db-config volumes
# - config volume mounts ConfigMap with application configuration files
# - db-config volume mounts Secret with Hibernate mapping
# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# The deployment automatically mounts:
# - /etc/onlinesales/config/propertySettingsSvcV2 (from config ConfigMap)
# - /etc/onlinesales/db (from db-config Secret)
nodeSelector: {}
tolerations: []
affinity: {}
# MySQL Database Configuration
# Set mysql.enabled to true to deploy MySQL as part of this chart
# Set mysql.enabled to false to use an external MySQL database
mysql:
enabled: true
image: "mysql"
imageTag: "8.0.33"
imagePullPolicy: IfNotPresent
mysqlRootPassword: "changeme"
mysqlUser: "propertysettings"
mysqlPassword: "changeme"
mysqlDatabase: "property_settings_db_v2"
persistence:
enabled: true
size: 8Gi
storageClass: ""
resources:
requests:
cpu: 250m
memory: 256Mi
configurationFiles:
mysql.cnf: |-
[mysqld]
default_authentication_plugin=mysql_native_password
character-set-server=utf8
collation-server=utf8_general_ci
sql_mode=NO_ENGINE_SUBSTITUTION
max_allowed_packet=16M
# Database initialization
# Automatically runs all SQL migration files from sql/ directory in alphabetical order
# SQL files are loaded via ConfigMap and executed by a Helm Job (post-install/post-upgrade hook)
# To use a specific set of files, manage them in the sql/ directory:
# - For clean installation: Use 000-003 files (004 can be removed or renamed)
# - For complete dump with data: Use only 004 file (rename others to .bak or remove)
dbInit:
enabled: true
# External MySQL Configuration (used when mysql.enabled=false)
externalDatabase:
host: "mysql.example.com"
port: 3306
database: "property_settings_db_v2"
username: "propertysettings"
password: "changeme"
# Application Configuration Files
# These values are used to generate the ConfigMap mounted at /etc/onlinesales/config/propertySettingsSvcV2
appEnv:
test
config:
# Main service configuration
propertySettingsService:
prod:
logConfig: "/etc/onlinesales/config/propertySettingsSvcV2/log.cfg"
hibernateConfig: "/etc/onlinesales/db/propertySettingsV2.hbm.xml"
restAccessorConfig: "/etc/onlinesales/config/propertySettingsSvcV2/prodRestAccessor.cfg"
test:
logConfig: "/etc/onlinesales/config/propertySettingsSvcV2/log.cfg"
hibernateConfig: "/etc/onlinesales/db/propertySettingsV2.hbm.xml"
restAccessorConfig: "/etc/onlinesales/config/propertySettingsSvcV2/testRestAccessor.cfg"
# Logging configuration
log: |
log4j.rootLogger=DEBUG, root
log4j.logger.OS=DEBUG, root
log4j.logger.org.hibernate=DEBUG, root
log4j.appender.root=org.apache.log4j.ConsoleAppender
log4j.appender.root.layout=org.apache.log4j.PatternLayout
log4j.appender.root.layout.ConversionPattern=<%d> %5p [%t](%c) [%X{request_id}] - %m%n
log4j.additivity.OS=false
log4j.logger.SOKRATI_METRICS=OFF, A3
log4j.appender.A3=org.apache.log4j.ConsoleAppender
log4j.appender.A3.layout=org.apache.log4j.PatternLayout
log4j.appender.A3.layout.ConversionPattern=<%d> %5p [%t](%c) - %m%n
log4j.additivity.SOKRATI_METRICS=false
# Production REST accessor configuration
prodRestAccessor: |
{
"post_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "post",
"response": "com.sokrati.propertySettingsSvcObjectsV2.PostPropertiesResponse"
},
"get_all_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "get",
"response": "com.sokrati.propertySettingsSvcObjectsV2.GetPropertiesResponse"
},
"get_best_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "get",
"response": "com.sokrati.propertySettingsSvcObjectsV2.GetPropertiesResponse"
},
"fetch_context":
{
"url": "http://hades.hades.svc.cluster.local:8080/hadesV2/context",
"type": "get",
"response": "com.sokrati.hadesObjects.ContextResponse"
}
}
# Test REST accessor configuration
testRestAccessor: |
{
"post_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "post",
"response": "com.sokrati.propertySettingsSvcObjectsV2.PostPropertiesResponse"
},
"get_all_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "get",
"response": "com.sokrati.propertySettingsSvcObjectsV2.GetPropertiesResponse"
},
"get_best_properties":
{
"url": "http://prop-property-settings:8080/propertySettingsSvcV2/properties",
"type": "get",
"response": "com.sokrati.propertySettingsSvcObjectsV2.GetPropertiesResponse"
},
"fetch_context":
{
"url": "http://hades.hades.svc.cluster.local:8080/hadesV2/context",
"type": "get",
"response": "com.sokrati.hadesObjects.ContextResponse"
}
}
# Authentication configuration
auth: |
{
prod: {
hades_auth_url : "http://hades.hades.svc.cluster.local:8080/hadesV2/authorize",
auth_enable : true
},
test: {
hades_auth_url : "http://hades.hades.svc.cluster.local:8080/hadesV2/authorize",
auth_enable : true
}
}
# Statistics logging configuration
statsLogging: |
{
test: {
metric_name_prefix: "",
statsd_host: "localhost",
statsd_port: "8125",
logging_enabled: "true",
},
prod: {
metric_name_prefix: "",
statsd_host: "localhost",
statsd_port: "8125",
logging_enabled: "true",
}
}

View File

@ -0,0 +1,23 @@
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: property-to-hades
namespace: hades
labels:
target: "hades"
caller: "property-settings"
spec:
entryPoints:
- web
routes:
- match: PathPrefix(`/property-hades`)
kind: Rule
services:
- name: hades
namespace: hades
port: 8080
middlewares:
- name: property-settings-caller-headers
namespace: hades
- name: strip-property-prefix
namespace: hades

View File

@ -0,0 +1,21 @@
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: serviceb-to-hades
namespace: traefik
labels:
target: "hades"
caller: "serviceb"
spec:
entryPoints:
- web
routes:
- match: Host(`serviceb-hades.local`)
kind: Rule
services:
- name: hades
namespace: hades
port: 8080
middlewares:
- name: serviceb-caller-headers
namespace: traefik

View File

@ -0,0 +1,14 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: property-settings-caller-headers
namespace: traefik
labels:
purpose: "hades-ip-injection"
caller: "property-settings"
spec:
headers:
customRequestHeaders:
X-Client-IP: "10.0.0.1"
X-Original-IP: "10.0.0.1"
X-Forwarded-For: "10.0.0.1"

View File

@ -0,0 +1,14 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: serviceb-caller-headers
namespace: traefik
labels:
purpose: "hades-ip-injection"
caller: "serviceb"
spec:
headers:
customRequestHeaders:
X-Client-IP: "10.0.0.2"
X-Original-IP: "10.0.0.2"
X-Forwarded-For: "10.0.0.2"

View File

@ -0,0 +1,9 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: strip-property-prefix
namespace: traefik
spec:
stripPrefix:
prefixes:
- /property-hades

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: traefik-service-ips
namespace: traefik
labels:
app: traefik
component: config
data:
# Service name to IP address mappings (for documentation)
property-settings-svc: "10.0.0.1"
serviceb-svc: "10.0.0.2"
# Add new services here:
# servicec-svc: "10.0.0.3"