Integrate Customizations From Malcolm-Helm As Options In Vanilla Malcolm (part 2)
Introduction
In our previous discussion, we explored the idea of integrating customizations from the Malcolm-Helm chart into vanilla Malcolm. This would enable us to remove the customizations from Malcolm-Helm, making the chart more resilient to changes as new versions of Malcolm are released. In this article, we will delve deeper into the identified use cases and examine how we can handle them natively in Malcolm.
Custom Handling of Write Indexes and ILM Stuff
The first use case we identified is the custom handling of write indexes and ILM (Information Lifecycle Management) stuff. This is handled through the logstash_override.yml
file in Malcolm-Helm, which overrides the 99_opensearch_output.conf
and malcolm_template.json
files in vanilla Malcolm. The purpose of this customization is to provide a specific solution for a particular user's use case.
However, we are unsure if there is a way to make this more generic, as it is quite specific to this user's requirements. One possible solution is to introduce a flag in the chart that allows users to turn these overrides on or off. This would enable users to choose whether they want to use the custom handling or stick with the default behavior.
Code Snippet
# logstash_override.yml
output.elasticsearch:
hosts: ["localhost:9200"]
index: "my_index"
# 99_opensearch_output.conf
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "my_index"
}
}
# malcolm_template.json
{
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
}
}
Customizing Different ILM Parameters for Zeek vs. Suricata
The second use case we identified is the customization of different ILM parameters for Zeek vs. Suricata. This is handled through the _helpers.tpl
file in Malcolm-Helm, which customizes the malcolm_template.json
file in vanilla Malcolm. The purpose of this customization is to provide different ILM parameters for different data sources.
However, we are unsure what the best thing to do here is, as malcolm_template.json
is not broken out by data source (Zeek, Suricata) like it would have to be for this. One possible solution is to introduce a flag in the chart that allows users to choose which ILM parameters to use for each data source.
Code Snippet
# _helpers.tpl
{{- define "ilm.zeek" }}
{
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
}
}
{{- end }}
{{- define "ilm.suricata" }}
{
"index": {
"number_of_shards": 2,
"number_of_replicas": 1
}
}
{{- end }}
# malcolm_template.json
{
"ilm": {
"zeek": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
}
},
"suricata": {
"index": {
"number_of_shards": 2,
"number_of_replicas": 1
}
}
}
}
Creating Necessary Empty Directories
The third use case we identified is the creation of necessary empty directories. This is handled through the malcolm_configmaps.yaml
file in Malcolm-Helm, which creates empty directories in vanilla Malcolm. The purpose of this customization is to ensure that necessary directories exist.
However, we think that we could handle this in each service's dirinit
container with PUSER_MKDIR
instead of having these empty-directory configmaps. This would simplify the chart and make it more resilient to changes.
Code Snippet
# malcolm_configmaps.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: malcolm-config
data:
empty-dir: ""
# 11-suricata.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: suricata
spec:
selector:
matchLabels:
app: suricata
template:
metadata:
labels:
app: suricata
spec:
containers:
- name: suricata
image: docker.io/suricata/suricata:latest
command: ["suricata", "-c", "/etc/suricata/suricata.yaml"]
volumeMounts:
- name: suricata-config
mountPath: /etc/suricata
- name: empty-dir
mountPath: /var/log/suricata
initContainers:
- name: dirinit
image: busybox:latest
command: ["mkdir", "-p", "/var/log/suricata"]
volumeMounts:
- name: empty-dir
mountPath: /var/log/suricata
Conclusion
In this article, we have explored the use cases of customizing Malcolm-Helm and integrating them into vanilla Malcolm. We have identified three use cases: custom handling of write indexes and ILM stuff, customizing different ILM parameters for Zeek vs. Suricata, and creating necessary empty directories. We have also proposed solutions for each use case, including introducing flags in the chart and simplifying the chart by using PUSER_MKDIR
in each service's dirinit
container.
By integrating these customizations into vanilla Malcolm, we can make the chart more resilient to changes and simplify the chart. This will enable users to choose which customizations they want to use and make it easier to manage the chart.
Introduction
In our previous articles, we explored the idea of integrating customizations from the Malcolm-Helm chart into vanilla Malcolm. We identified three use cases: custom handling of write indexes and ILM stuff, customizing different ILM parameters for Zeek vs. Suricata, and creating necessary empty directories. In this article, we will answer some frequently asked questions (FAQs) about integrating customizations from Malcolm-Helm into vanilla Malcolm.
Q: What are the benefits of integrating customizations from Malcolm-Helm into vanilla Malcolm?
A: The benefits of integrating customizations from Malcolm-Helm into vanilla Malcolm include:
- Simplifying the chart by removing customizations
- Making the chart more resilient to changes
- Enabling users to choose which customizations they want to use
- Simplifying the management of the chart
Q: How do I integrate customizations from Malcolm-Helm into vanilla Malcolm?
A: To integrate customizations from Malcolm-Helm into vanilla Malcolm, you can follow these steps:
- Identify the customizations you want to integrate
- Create a new file or modify an existing file in vanilla Malcolm to include the customization
- Update the
values.yaml
file to include the new customization - Test the customization to ensure it works as expected
Q: What are some common issues I may encounter when integrating customizations from Malcolm-Helm into vanilla Malcolm?
A: Some common issues you may encounter when integrating customizations from Malcolm-Helm into vanilla Malcolm include:
- Conflicts between customizations
- Incompatibilities between customizations and vanilla Malcolm
- Difficulty in testing and debugging customizations
Q: How do I troubleshoot issues with customizations in vanilla Malcolm?
A: To troubleshoot issues with customizations in vanilla Malcolm, you can follow these steps:
- Check the logs for errors or warnings
- Review the customization code for errors or inconsistencies
- Test the customization in isolation to identify the issue
- Consult the documentation or seek help from the community if necessary
Q: Can I customize the integration of customizations from Malcolm-Helm into vanilla Malcolm?
A: Yes, you can customize the integration of customizations from Malcolm-Helm into vanilla Malcolm by:
- Creating a new file or modifying an existing file in vanilla Malcolm to include the customization
- Updating the
values.yaml
file to include the new customization - Testing the customization to ensure it works as expected
Q: How do I contribute to the integration of customizations from Malcolm-Helm into vanilla Malcolm?
A: To contribute to the integration of customizations from Malcolm-Helm into vanilla Malcolm, you can:
- Submit a pull request with your customization
- Participate in the community discussion to provide feedback and suggestions
- Help test and debug customizations to ensure they work as expected
Q: What are some best practices for integrating customizations from Malcolm-Helm into vanilla Malcolm?
A: Some best practices for integrating customizations from Malcolm-Helm into vanilla Malcolm include:
- Testing customizations thoroughly before integrating them into vanilla Malcolm
- Documenting customizations clearly and concisely
- Consulting the documentation or seeking help from the community if necessary
- Participating the community discussion to provide feedback and suggestions
Conclusion
In this article, we have answered some frequently asked questions (FAQs) about integrating customizations from Malcolm-Helm into vanilla Malcolm. We have covered topics such as the benefits of integration, how to integrate customizations, common issues, troubleshooting, customization, contribution, and best practices. By following these guidelines, you can successfully integrate customizations from Malcolm-Helm into vanilla Malcolm and simplify the management of your chart.