SIENTIAPDE-1017
Update liveness and readiness probes, enhance Redis connection, and refine OPC tag data structure
This commit is contained in:
@@ -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/
|
# 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:
|
livenessProbe:
|
||||||
tcpSocket:
|
exec:
|
||||||
port: 4840
|
command:
|
||||||
initialDelaySeconds: 150
|
- sh
|
||||||
periodSeconds: 15
|
- -c
|
||||||
|
- pgrep -f "ingestor.app"
|
||||||
|
initialDelaySeconds: 20
|
||||||
|
periodSeconds: 30
|
||||||
|
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
tcpSocket:
|
exec:
|
||||||
port: 4840
|
command:
|
||||||
initialDelaySeconds: 120
|
- sh
|
||||||
periodSeconds: 10
|
- -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/
|
# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
|
||||||
autoscaling:
|
autoscaling:
|
||||||
@@ -114,25 +121,35 @@ service:
|
|||||||
env:
|
env:
|
||||||
# Entrypoint variables
|
# Entrypoint variables
|
||||||
- name: GITHUB_REPO_URL
|
- 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
|
- name: GITHUB_BRANCH
|
||||||
value: SIENTIAPDE-988-criar-ingestor-opc
|
value: "SIENTIAPDE-1017-criar-helm-generico-para-os-modulos-do-sientia"
|
||||||
- name: PYTHON_APP
|
- name: PYTHON_APP
|
||||||
value: ingestor.app
|
value: "ingestor.app"
|
||||||
|
|
||||||
# Application variables
|
# Application variables
|
||||||
- name: KAFKA_SERVERS
|
- name: KAFKA_SERVERS
|
||||||
value: kafka.kafka.svc.cluster.local:9092
|
value: "kafka.kafka.svc.cluster.local:9092"
|
||||||
- name: REDIS_HOST
|
- name: REDIS_HOST
|
||||||
value: redis-master.redis.svc.cluster.local
|
value: "redis-master.redis.svc.cluster.local"
|
||||||
- name: REDIS_PORT
|
- name: REDIS_PORT
|
||||||
value: "6379"
|
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
|
- name: LEASE_TTL
|
||||||
value: 10
|
value: "10"
|
||||||
- name: HEARTBEAT_TTL
|
- name: HEARTBEAT_TTL
|
||||||
value: 20
|
value: "20"
|
||||||
- name: POLL_INTERVAL
|
- name: POLL_INTERVAL
|
||||||
value: 5
|
value: "5"
|
||||||
|
|
||||||
|
|
||||||
ssh:
|
ssh:
|
||||||
@@ -142,4 +159,4 @@ ssh:
|
|||||||
knownHostsPath: /mnt/known_hosts
|
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
|
# 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
|
||||||
@@ -55,6 +55,7 @@ class IngestorManager():
|
|||||||
manager.connect()
|
manager.connect()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to initialize OpcManager: {e}")
|
logger.error(f"Failed to initialize OpcManager: {e}")
|
||||||
|
traceback.print_exc()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return manager
|
return manager
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ redis_host = "localhost"
|
|||||||
redis_port = 6379
|
redis_port = 6379
|
||||||
|
|
||||||
# Connect to Redis
|
# 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
|
# Define the key pattern to target
|
||||||
pattern = "slot:opc_tags:*"
|
pattern = "slot:opc_tags:*"
|
||||||
@@ -24,7 +25,7 @@ new_data = {
|
|||||||
"slot:opc_tags:1": {
|
"slot:opc_tags:1": {
|
||||||
"server1": {
|
"server1": {
|
||||||
"name": "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",
|
"server_uri": "http://opcua-server.simulator",
|
||||||
"tags": {
|
"tags": {
|
||||||
'ns=2;i=2': {
|
'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'],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user