diff --git a/.drone.star b/.drone.star index 7bc520f..1b5619f 100644 --- a/.drone.star +++ b/.drone.star @@ -69,6 +69,17 @@ TEMPLATES = { "vs_code_root": "/opt/splunk", }, }, + "splunk_license_hacking": { + "splunk_license_hacking": { + "image": "cr.smcm.xyz/coder-images/splunk", + "splunk_versions": ["9.1", "9.2"], + "coder_user": "splunk", + "coder_user_home": "/opt/splunk/etc", + "coder_user_uid": "41812", + "coder_user_gid": "41812", + "vs_code_root": "/opt/splunk", + }, + }, } def main(ctx): diff --git a/splunk_license_hacking.tf.j2 b/splunk_license_hacking.tf.j2 new file mode 100644 index 0000000..a24784f --- /dev/null +++ b/splunk_license_hacking.tf.j2 @@ -0,0 +1,96 @@ +{% extends "splunk.tf.j2" %} + +{% block coder_apps %} +resource "coder_app" "splunk-lm" { + agent_id = coder_agent.main.id + display_name = "Splunk Web (LM)" + slug = "splunkweb-lm" + icon = "https://s3.mcmaster.io/images/Splunk.webp" + url = "http://localhost:8001/" + subdomain = true + share = "public" + + healthcheck { + url = "http://localhost:8001/en-US/config?autoload=1" + interval = 3 + threshold = 10 + } +} +{{ super() }} +{% endblock %} + +{% block kubernetes_pod_main_volume_mount %} + volume_mount { + mount_path = "/opt/splunk/etc" + name = "home" + sub_path = "dev" + read_only = false + } + + volume_mount { + mount_path = "/opt/splunk-lm" + name = "home" + sub_path = "lm" + read_only = false + } +{% endblock %} + +{% block kubernetes_pod_main_env %} + env { + name = "SPLUNK_LICENSE_MASTER_URL" + value = "https://localhost:8091" + } +{{ super() }} +{% endblock %} + +{% block additional_containers %} + container { + name = "lm" + image = "{{image}}" + command = ["sudo", "-E", "-u", "ansible", "/sbin/entrypoint.sh", "start"] + image_pull_policy = "{{ image_pull_policy }}" + + security_context { + run_as_user = "{{ coder_user_uid }}" + } + + env { + name = "SPLUNK_HTTP_PORT" + value = "8001" + } + env { + name = "SPLUNK_SVC_PORT" + value = "8091" + } + env { + name = "SPLUNK_ROLE" + value = "splunk_license_master" + } + env { + name = "SPLUNK_PASSWORD" + value = "Temp1234!" + } + env { + name = "SPLUNK_START_ARGS" + value = "--accept-license" + } + + resources { + requests = { + "cpu" = "250m" + "memory" = "512Mi" + } + limits = { + "cpu" = data.coder_parameter.cpu.value + "memory" = "${data.coder_parameter.memory.value}Gi" + } + } + + volume_mount { + mount_path = "/opt/splunk/etc" + name = "home" + sub_path = "lm" + read_only = false + } + } +{% endblock %} \ No newline at end of file