Deploying custom report views and report types
Each tiscale-worker
release can be configured with custom report views and report types. Report views are stored in the ConfigMap <release>-report-views.
Report types are stored in the ConfigMap <release>-report-types
. The ConfigMap value should be the file content, and the key should be the view file name.
ConfigMaps are not managed with helm, and they should be edited manually. Helm will not overwrite values on update or delete the ConfigMap on uninstall.
Large File Workers have their own report views and report types ConfigMaps, which must be updated separately.
Adding files to a ConfigMap
- Get the
tiscale-worker
helm release name:
helm ls | grep tiscale-worker
- Define the ConfigMap name, and verify it's correct by checking that the ConfigMap exists:
CM="<release>-report-views"
kubectl describe configmap ${CM}
For report types, change the value of CM
to <release>-report-types
.
- Prepare the files that should be added to the ConfigMap in a directory, e.g.
./my-files
. - Update ConfigMap:
FILES="./my-files"
kubectl patch configmap ${CM} -p "$(\
kubectl create configmap ${CM} \
--from-file=${FILES} \
--output yaml \
--dry-run=client \
)"
The kubectl create configmap
command creates the ConfigMap manifest containing files in ${FILES}
directory and writes it to stdout. Then, kubectl apply -f -
applies the data to the ConfigMap in the cluster, keeping its metadata (labels and annotations).
All files from the given directory will be added to the ConfigMap. Existing data fields that match files in the directory will be overwritten. Existing data fields that do not match any files in the directory will not be changed.
Due to the ConfigMap size limitation of 1MB, the combined size of provided files must be less than 1MB.
- Verify the ConfigMap contains the desired files:
kubectl describe configmap ${CM}
- Restart the
tiscale-worker
deployment, e.g.:
kubectl rollout restart deployment --selector=app.kubernetes.io/name=tiscale-worker
Verify that the Worker pods have restarted.
After the pods have restarted, the report views will be deployed to /usr/libexec/ts-report-views.d
and report types will be deployed to /usr/libexec/ts-report-types.d
.
Deleting files from a ConfigMap
- Verify ConfigMap content:
kubectl describe configmap ${CM}
This command outputs the current data stored in the ConfigMap.
- To delete, for example, the file
my-report-type.json
from the ConfigMap, run:
CM_PATH="/data/my-report-type.json"
kubectl patch configmap ${CM} --type=json -p='[{"op": "remove", "path": "'${CM_PATH}'"}]'
If the file stored in the ConfigMap is a binary file, the CM_PATH
prefix should be binaryData
instead of data
(e.g. /binaryData/my-report-type.json
).
Whether the file is stored in the data
or binaryData
section of the ConfigMap can be identified after running the command kubectl describe configmap ${CM}
.
- Restart tiscale-worker deployment, e.g.:
kubectl rollout restart deployment --selector=app.kubernetes.io/name=tiscale-worker
Verify that the worker pods have restarted.