SIENTIAPDE-1017

Update liveness and readiness probes, enhance Redis connection, and refine OPC tag data structure
This commit is contained in:
vitor-aignosi
2025-04-25 16:57:55 -03:00
parent 9eb483ee92
commit 8674a710af
3 changed files with 38 additions and 43 deletions

View File

@@ -66,16 +66,23 @@ resources: {}
# 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:
tcpSocket:
port: 4840
initialDelaySeconds: 150
periodSeconds: 15
exec:
command:
- sh
- -c
- pgrep -f "ingestor.app"
initialDelaySeconds: 20
periodSeconds: 30
readinessProbe:
tcpSocket:
port: 4840
initialDelaySeconds: 120
periodSeconds: 10
exec:
command:
- sh
- -c
- pgrep -f "ingestor.app"
initialDelaySeconds: 10
periodSeconds: 15
# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
autoscaling:
@@ -114,25 +121,35 @@ service:
env:
# Entrypoint variables
- name: GITHUB_REPO_URL
value: git@github.com:Aignosi/sientia-dataops-opc-ingestor.git
value: "git@github.com:Aignosi/sientia-dataops-opc-ingestor.git"
- name: GITHUB_BRANCH
value: SIENTIAPDE-988-criar-ingestor-opc
value: "SIENTIAPDE-1017-criar-helm-generico-para-os-modulos-do-sientia"
- name: PYTHON_APP
value: ingestor.app
value: "ingestor.app"
# Application variables
- name: KAFKA_SERVERS
value: kafka.kafka.svc.cluster.local:9092
value: "kafka.kafka.svc.cluster.local:9092"
- name: REDIS_HOST
value: redis-master.redis.svc.cluster.local
value: "redis-master.redis.svc.cluster.local"
- name: REDIS_PORT
value: "6379"
- name: REDIS_USERNAME
valueFrom:
secretKeyRef:
name: redis
key: redis-username
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis
key: redis-password
- name: LEASE_TTL
value: 10
value: "10"
- name: HEARTBEAT_TTL
value: 20
value: "20"
- name: POLL_INTERVAL
value: 5
value: "5"
ssh:
@@ -142,4 +159,4 @@ ssh:
knownHostsPath: /mnt/known_hosts
# kubectl create secret docker-registry docker-hub-secret --namespace sientia-opc --docker-server=http://aignosi.azurecr.io --docker-username=aignosi --docker-password=5I5zpQ6sRaHqX1hD3dr+2mo647yO3FRc359/wu6gsP+ACRDRz5mp
# helm upgrade --install sientia-dataops-opc-simulator ./sientia-module -n sientia-opc --create-namespace
# helm upgrade --install sientia-dataops-opc-ingestor ./helm -n sientia-opc --create-namespace

View File

@@ -55,6 +55,7 @@ class IngestorManager():
manager.connect()
except Exception as e:
logger.error(f"Failed to initialize OpcManager: {e}")
traceback.print_exc()
return None
return manager

View File

@@ -7,7 +7,8 @@ redis_host = "localhost"
redis_port = 6379
# Connect to Redis
r = redis.Redis(host=redis_host, port=redis_port, decode_responses=True)
r = redis.Redis(host=redis_host, port=redis_port,
decode_responses=True, username='default', password='bdnZOpcyiL')
# Define the key pattern to target
pattern = "slot:opc_tags:*"
@@ -24,7 +25,7 @@ new_data = {
"slot:opc_tags:1": {
"server1": {
"name": "server1",
"url": "opc.tcp://simulator:4840",
"url": "opc.tcp://sientia-opc-simulator-service.sientia-opc.svc.cluster.local:4840",
"server_uri": "http://opcua-server.simulator",
"tags": {
'ns=2;i=2': {
@@ -44,30 +45,6 @@ new_data = {
},
}
}
},
"slot:opc_tags:2": {
"server2": {
"name": "server2",
"url": "opc.tcp://simulator:4840",
"server_uri": "http://opcua-server.simulator",
"tags": {
'ns=2;i=2': {
'tag_name': 'Counter',
'frequency': 1000,
'topics': ['opcua2', 'counter'],
},
'ns=2;i=3': {
'tag_name': 'Rollout',
'frequency': 1000,
"topics": ['opcua2', 'rollout'],
},
'ns=2;i=4': {
'tag_name': 'Square',
'frequency': 1000,
"topics": ['opcua2'],
},
}
}
}
}