Skip to content

installers.infra.coredns #

coredns

coredns

To get started



import freeflowuniverse.herolib.lib.installers.infra.coredns as coredns_installer

heroscript:='
!!coredns.configure name:'test'
    config_path: '/etc/coredns/Corefile'
    dnszones_path: '/etc/coredns/zones'
    plugins: 'forward,cache'
    example: true

!!coredns.start name:'test' reset:1 
'

coredns_installer.play(heroscript=heroscript)!

//or we can call the default and do a start with reset
//mut installer:= coredns_installer.get()!
//installer.start(reset:true)!

example heroscript

!!coredns.configure
    name: 'custom'
    config_path: '/etc/coredns/Corefile'
    config_url: 'https://github.com/example/coredns-config'
    dnszones_path: '/etc/coredns/zones'
    dnszones_url: 'https://github.com/example/dns-zones'
    plugins: 'forward,cache'
    example: false

Constants #

const version = '1.12.0'

fn configure #

fn configure() !

fn delete #

fn delete(args_ ArgsGet) !

fn example_configure #

fn example_configure() !

fn exists #

fn exists(args_ ArgsGet) !bool

does the config exists?

fn fix #

fn fix() !

fn get #

fn get(args_ ArgsGet) !&CoreDNS

fn heroscript_dumps #

fn heroscript_dumps(obj CoreDNS) !string

///////////NORMALLY NO NEED TO TOUCH

fn heroscript_loads #

fn heroscript_loads(heroscript string) !CoreDNS

fn play #

fn play(args_ PlayArgs) !

fn set #

fn set(o CoreDNS) !

register the config for the future

fn switch #

fn switch(name string)

switch instance to be used for coredns

struct ArgsGet #

@[params]
struct ArgsGet {
pub mut:
	name string
}

///////FACTORY

struct CoreDNS #

@[heap]
struct CoreDNS {
pub mut:
	name          string = 'default'
	config_path   string
	config_url    string // path to Corefile through e.g. git url, will pull it if it is not local yet
	dnszones_path string // path to where all the dns zones are
	dnszones_url  string // path on git url pull if needed (is comma or \n separated list)
	plugins       string // list of plugins to build CoreDNS with (is comma or \n separated list)
	example       bool = true // if true we will install examples
}

THIS THE THE SOURCE OF THE INFORMATION OF THIS FILE, HERE WE HAVE THE CONFIG OBJECT CONFIGURED AND MODELLED

fn (CoreDNS) build #

fn (mut self CoreDNS) build() !

fn (CoreDNS) destroy #

fn (mut self CoreDNS) destroy() !

fn (CoreDNS) install #

fn (mut self CoreDNS) install(args InstallArgs) !

fn (CoreDNS) install_start #

fn (mut self CoreDNS) install_start(args InstallArgs) !

fn (CoreDNS) reload #

fn (mut self CoreDNS) reload() !

load from disk and make sure is properly intialized

fn (CoreDNS) restart #

fn (mut self CoreDNS) restart() !

fn (CoreDNS) running #

fn (mut self CoreDNS) running() !bool

fn (CoreDNS) start #

fn (mut self CoreDNS) start() !

fn (CoreDNS) stop #

fn (mut self CoreDNS) stop() !

struct DefaultConfigArgs #

@[params]
struct DefaultConfigArgs {
	instance string = 'default'
}

helpers

struct InstallArgs #

@[params]
struct InstallArgs {
pub mut:
	reset bool
}

struct PlayArgs #

@[params]
struct PlayArgs {
pub mut:
	heroscript string // if filled in then plbook will be made out of it
	plbook     ?playbook.PlayBook
	reset      bool
}