confignode

package
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCacheDir = "/root/crm_cache"
	// Platform services
	ServiceTypeCRM                = "crmserver"
	ServiceTypeShepherd           = "shepherd"
	ServiceTypeCloudletPrometheus = intprocess.PrometheusContainer
	K8sMasterNodeCount            = 1
	K8sWorkerNodeCount            = 2
	CRMRedisImage                 = "docker.io/bitnami/redis"
	CRMRedisVersion               = "6.2.6-debian-10-r103"
)
View Source
const CloudletNameHeader = "cloudlet-name"
View Source
const CloudletOrgHeader = "cloudlet-org"

Variables

View Source
var ConfigureNodeScript = `#!/bin/bash
set -e
echo $( date ) Running configure node
cd $( dirname $0 )
wgetargs=(-nv "--header=` + CloudletNameHeader + `: {{ .Key.CloudletKey.Name }}" "--header=` + CloudletOrgHeader + `: {{ .Key.CloudletKey.Organization }}" "--header=Authorization: {{ .BasicAuth }}")
echo "Checking ansible.tar.gz checksum"
wget "${wgetargs[@]}" -O ansible.tar.gz.md5 {{ .AnsiblePublicAddr }}/confignode/ansible.tar.gz.md5
cat ansible.tar.gz.md5
download=true
run_ansible=false
if [[ -f "ansible.tar.gz" ]]; then
    echo "Checking md5 for ansible.tar.gz"
    if md5sum -c ansible.tar.gz.md5; then
        echo "ansible.tar.gz md5 matches, skipping download"
        download=false
    else
        echo "ansible.tar.gz md5 mismatch, will download"
    fi
else
    echo "No local ansible.tar.gz, will download"
fi
if [[ $download == true ]]; then
    echo "Downloading ansible.tar.gz"
    wget "${wgetargs[@]}" -O ansible.tar.gz {{ .AnsiblePublicAddr }}/confignode/ansible.tar.gz
    echo "Clean up old directory"
    rm -Rf ./ansible
    echo "Expanding ansible archive"
    tar -xpf ansible.tar.gz
    run_update=true
fi
echo "Checking vars.yaml checksum"
wget "${wgetargs[@]}" -O vars.yaml.md5 {{ .AnsiblePublicAddr }}/confignode/vars.yaml.md5
cat vars.yaml.md5
download=true
if [[ -f "vars.yaml" ]]; then
    echo "Checking md5 for vars.yaml"
    if md5sum -c vars.yaml.md5; then
        echo "vars.yaml md5 matches, skipping download"
        download=false
    else
        echo "vars.yaml md5 mismatch, will download"
    fi
else
    echo "No local vars.yaml, will download"
fi
if [[ $download == true ]]; then
    echo "Downloading vars.yaml"
    wget "${wgetargs[@]}" -O vars.yaml {{ .AnsiblePublicAddr }}/confignode/vars.yaml
    run_update=true
    cp vars.yaml ansible/vars.yml
    cat ansible/vars.yml
fi
if [[ ! -f ansible_run_ok ]]; then
    echo "Ansible has not succeeded, will run"
    run_update=true
fi
if [[ ${run_update} == true ]]; then
    echo "Running update"
    if [[ -z "${ANSIBLE_PLAYBOOK_BIN}" ]]; then
        ANSIBLE_PLAYBOOK_BIN=/usr/local/bin/ansible-playbook
        if [[ ! -f "${ANSIBLE_PLAYBOOK_BIN}" ]]; then
            ANSIBLE_PLAYBOOK_BIN=/usr/bin/ansible-playbook
        fi
    fi
    if ${ANSIBLE_PLAYBOOK_BIN} -e @ansible/vars.yml ./ansible/playbook.yml -v; then
        touch ansible_run_ok
    else
        rm -f ansible_run_ok
        exit 1
    fi
else
    echo "No update needed"
fi
`
View Source
var ValidDockerArgs = map[string]string{
	"label":   "dict",
	"publish": "list",
	"volume":  "list",
}

Functions

func GetCloudletAttributes

func GetCloudletAttributes(ctx context.Context, cl *edgeproto.Cloudlet, pfConfig *edgeproto.PlatformConfig, registryAuth *cloudcommon.RegistryAuth) (map[string]interface{}, error)

func GetDockerArgs

func GetDockerArgs(cmdArgs []string) map[string]interface{}

Types

type ConfigureNodeVars

type ConfigureNodeVars struct {
	Key                 edgeproto.CloudletNodeKey
	NodeType            cloudcommon.NodeType
	NodeRole            cloudcommon.NodeRole
	OwnerKey            objstore.ObjKey
	Password            string
	BasicAuth           string // for script only
	AnsiblePublicAddr   string
	ConfigureNodeScript string
}

func (*ConfigureNodeVars) GenScript

func (s *ConfigureNodeVars) GenScript() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL