Skip to content

Commit

Permalink
WIP(osal.coredns): add example for coredns usage
Browse files Browse the repository at this point in the history
- create an example to use coredns module for adding dns records
- fix module errors
  • Loading branch information
mariobassem committed Feb 9, 2025
1 parent e929ce0 commit 86e3fdb
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 164 deletions.
20 changes: 20 additions & 0 deletions examples/osal/coredns/example.vsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run

import freeflowuniverse.herolib.installers.infra.coredns as coredns_installer
import freeflowuniverse.herolib.osal.coredns
import freeflowuniverse.herolib.core.playbook

// coredns_installer.delete()!
mut installer := coredns_installer.get()!
// coredns_installer.fix()!
installer.start()!

// TODO: create heroscript and run it to add dns records
mut script := '
dns.a_record
name: "a_rec1"
ip: "1.1.1.1"
'

mut plbook := playbook.new(text: script)!
coredns.play_dns(mut plbook)!
2 changes: 1 addition & 1 deletion lib/installers/infra/coredns/coredns_actions.v
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn stop_post() ! {

// checks if a certain version or above is installed
fn installed() !bool {
res := os.execute('${osal.profile_path_source_and()!} coredns version')
res := os.execute('/bin/bash -c "${osal.profile_path_source_and()!} coredns --version"')
if res.exit_code != 0 {
return false
}
Expand Down
4 changes: 4 additions & 0 deletions lib/osal/coredns/model.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
module coredns

import freeflowuniverse.herolib.core.redisclient

// Input parameter structs for each record type
@[params]
struct SRVRecord {
Expand Down
Loading

0 comments on commit 86e3fdb

Please sign in to comment.