oracledb_exporter
oracledb_exporter copied to clipboard
Read tnsnames.ora in k8s deployment
I'm submitting a ...
- [X] bug report
- [ ] feature request
What is the current behavior?
A tnsnames.ora file is being created but the exporter is not picking the configuration and reading the file. When I ssh into the container, I see the variables TNS_ENTRY, TNS_ADMIN and DATA_SOURCE_NAME being created. Also the file /path/to/tns_admin/tnsnames.ora is created with same permission than the user running the exporter, which is appuser
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
I get the error:
level=error Errorpingingoracle:="address database: missing port in address"
deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: oracledb-exporter
spec:
replicas: 1
selector:
matchLabels:
app: oracledb-exporter
template:
metadata:
labels:
app: oracledb-exporter
spec:
containers:
- name: oracledb-exporter
image: eu.gcr.io/repo/oracledb_exporter:0.5.0
ports:
- containerPort: 9161
env:
- name: TNS_ENTRY
value: "database"
- name: TNS_ADMIN
value: "/path/to/tns_admin"
- name: DATA_SOURCE_NAME
value: "oracle://asdfgh:1234@database"
volumeMounts:
- name: mnt
mountPath: /path/to/tns_admin/tnsnames.ora
subPath: file-from-cfgmap
volumes:
- name: mnt
configMap:
name: oracledb-configmap
configmap.yaml:
apiVersion: v1
kind: ConfigMap
metadata:
name: oracledb-configmap
data:
file-from-cfgmap: |
database =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = odb01.example.com)(PORT = 11511))
(ADDRESS = (PROTOCOL = TCP)(HOST = odb02.example.com)(PORT = 11511))
)
(CONNECT_DATA =
(SERVICE_NAME = service_name)
)
)
What is the expected behavior?
To be able to read the file with the HA setup, since adding it in the connection string doesnt work
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
k8s deploy with version 0.5.0 using using a configmap and k8s secret Version: X.Y.Z
I'm having the same issue (local setup with docker and without k8s). Seems like after the switch to github.com/sijms/go-ora/v2
in #312 the usage of a tnsnames.ora
is no longer supported :persevere: