aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/modeling/components
AgeCommit message (Expand)AuthorFilesLines
2022-04-22[MODELING] Update modeling/etsicatalog imagedengyh1-1/+1
2022-03-31[MODELING] Update modeling/etsicatalog imagedengyh1-1/+1
2021-12-07[GLOBAL] Migrate to helm v3efiacor3-40/+27
2021-11-16[MODELING] Use log templateMaciej Wereski5-25/+11
2021-10-15[COMMON] Bump ONAP versionSylvain Desbureaux2-7/+9
2021-10-11[MODELING] Update chart with service accountfarida azmy3-1/+10
2021-09-26[COMMON] Add and run pre-commit linters via toxguillaume.lambert1-2/+2
2021-08-31[MODELING] Update modeling/etsicatalog imagedyh1-1/+1
2021-03-24[DOC][COMMON] Prepare Honolulu releaseSylvain Desbureaux2-6/+6
2021-03-04[MODELING] Update modeling/etsicatalog imagedyh1-1/+1
2020-12-14[COMMON][MARIADB] Upgrade Mariadb DB galera versionSylvain Desbureaux1-7/+10
2020-11-30[COMMON][DOC] Bump version GuilinSylvain Desbureaux2-6/+6
2020-11-23[MODELING] Uses new tpls for repos / imagesSylvain Desbureaux13-0/+763
.highlight .nx { color: #a6e22e } /* Name.Other */ .highlight .py { color: #f8f8f2 } /* Name.Property */ .highlight .nt { color: #f92672 } /* Name.Tag */ .highlight .nv { color: #f8f8f2 } /* Name.Variable */ .highlight .ow { color: #f92672 } /* Operator.Word */ .highlight .w { color: #f8f8f2 } /* Text.Whitespace */ .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */ .highlight .mf { color: #ae81ff } /* Literal.Number.Float */ .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */ .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */ .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */ .highlight .sa { color: #e6db74 } /* Literal.String.Affix */ .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */ .highlight .sc { color: #e6db74 } /* Literal.String.Char */ .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */ .highlight .se { color: #ae81ff } /* Literal.String.Escape */ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail

source _functions.sh

base_url_clm=${base_url:-"http://10.10.10.6:31044/v2"}
base_url_ncm=${base_url:-"http://10.10.10.6:31983/v2"}
base_url_orchestrator=${base_url:-"http://10.10.10.6:30186/v2"}

# add the rsync controller entry
rsynccontrollername="rsync"
rsynccontrollerdata="$(cat<<EOF
{
  "metadata": {
    "name": "rsync",
    "description": "description of $rsynccontrollername controller",
    "userData1": "$rsynccontrollername user data 1",
    "userData2": "$rsynccontrollername user data 2"
  },
  "spec": {
    "host": "${rsynccontrollername}",
    "port": 9041 
  }
}
EOF
)"

# ncm data samples
clusterprovidername="cluster-provider-a"
clusterproviderdata="$(cat<<EOF
{
  "metadata": {
    "name": "$clusterprovidername",
    "description": "description of $clusterprovidername",
    "userData1": "$clusterprovidername user data 1",
    "userData2": "$clusterprovidername user data 2"
  }
}
EOF
)"

clustername="edge01"
clusterdata="$(cat<<EOF
{
  "metadata": {
    "name": "$clustername",
    "description": "description of $clustername",
    "userData1": "$clustername user data 1",
    "userData2": "$clustername user data 2"
  }
}
EOF
)"

# set $kubeconfigfile before running script to point to the desired config file
defaultkubeconfig="$(cat<<EOF
{
    "not a good kube config file"
}
EOF
)"
echo "$defaultkubeconfig" > /tmp/ncmkubeconfig

kubeconfigfile=${kubeconfigfile:-"/tmp/ncmkubeconfig"}

labelname="LabelA"
labeldata="$(cat<<EOF
{"label-name": "$labelname"}
EOF
)"

kvname="kva"
kvdata="$(cat<<EOF
{
  "metadata": {
    "name": "$kvname",
    "description": "this is key value $kvname",
    "userData1": "cluster $kvname pair data",
    "userData2": "cluster $kvname pair data a"
  },
  "spec": {
      "kv" : [
          {"keyA": "value A"},
          {"keyB": "value B"},
          {"keyC": "value C"}
       ]
   }
}
EOF
)"

networkname="network-a"
networkdata="$(cat<<EOF
{
  "metadata": {
    "name": "$networkname",
    "description": "Description of $networkname",
    "userData1": "$networkname data part A",
    "userData2": "$networkname data part B"
  },
  "spec": {
      "cniType": "ovn4nfv",
      "ipv4Subnets": [
          {
              "subnet": "172.16.33.0/24",
              "name": "subnet3",
              "gateway":  "172.16.33.1/32",
              "excludeIps": "172.16.33.2 172.16.33.5..172.16.33.10"
          },
          {
              "subnet": "172.16.34.0/24",
              "name": "subnet4",
              "gateway":  "172.16.34.1/32",
              "excludeIps": "172.16.34.2 172.16.34.5..172.16.34.10"
          }
      ]
  }
}
EOF
)"

providernetworkname="providernetwork-a"
providernetworkdata="$(cat<<EOF
{
  "metadata": {
    "name": "$providernetworkname",
    "description": "Description of $providernetworkname",
    "userData1": "$providernetworkname data part A",
    "userData2": "$providernetworkname data part B"
  },
  "spec": {
      "cniType": "ovn4nfv",
      "ipv4Subnets": [
          {
              "subnet": "172.16.31.0/24",
              "name": "subnet1",
              "gateway":  "172.16.31.1/32",
              "excludeIps": "172.16.31.2 172.16.31.5..172.16.31.10"
          },
          {
              "subnet": "172.16.32.0/24",
              "name": "subnet2",
              "gateway":  "172.16.32.1/32",
              "excludeIps": "172.16.32.2 172.16.32.5..172.16.32.10"
          }
      ],
      "providerNetType": "VLAN",
      "vlan": {
          "vlanId": "100",
          "providerInterfaceName": "eth1",
          "logicalInterfaceName": "eth1.100",
          "vlanNodeSelector": "specific",
          "nodeLabelList": [
              "kubernetes.io/hostname=localhost",
              "kubernetes.io/name=localhost"
          ]
      }
  }
}
EOF
)"

function createOrchData {
    call_api -d "${rsynccontrollerdata}" "${base_url_orchestrator}/controllers"
}

function createNcmData {
    call_api -d "${clusterproviderdata}" "${base_url_clm}/cluster-providers"
    call_api -H "Content-Type: multipart/form-data" -F "metadata=$clusterdata" -F "file=@$kubeconfigfile" "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters"
    call_api -d "${labeldata}" "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/labels"
    call_api -d "${kvdata}" "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/kv-pairs"
    call_api -d "${providernetworkdata}" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/provider-networks"
    call_api -d "${networkdata}" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/networks"
}

# apply the network and providernetwork to an appcontext and instantiate with resource synchronizer (when implemented)
function applyNcmData {
    call_api -d "{ }" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/apply"
}

# deletes the appcontext (eventually will terminate from resource synchronizer when that funcationality is ready)
function terminateNcmData {
    call_api -d "{ }" "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/terminate"
}

function getOrchData {
    call_api_nox "${base_url_orchestrator}/controllers"
}

function getNcmData {
    call_api_nox "${base_url_clm}/cluster-providers/${clusterprovidername}"
    call_api_nox -H "Accept: application/json" "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}"
    call_api_nox "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters?label=${labelname}"
    call_api_nox "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/kv-pairs/${kvname}"
    call_api_nox "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/networks/${networkname}"
    call_api_nox "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/provider-networks/${providernetworkname}"

}

function deleteOrchData {
    call_api -X DELETE "${base_url_orchestrator}/controllers/${rsynccontrollername}" | jq .
}

function deleteNcmData {
    call_api -X DELETE "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/networks/${networkname}"
    call_api -X DELETE "${base_url_ncm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/provider-networks/${providernetworkname}"
    call_api -X DELETE "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/labels/${labelname}"
    call_api -X DELETE "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}/kv-pairs/${kvname}"
    call_api -X DELETE "${base_url_clm}/cluster-providers/${clusterprovidername}/clusters/${clustername}"
    call_api -X DELETE "${base_url_clm}/cluster-providers/${clusterprovidername}"
}

function usage {
    echo "Usage: $0  create|creatersync|apply|get|getrsync|terminate|delete|deletersync"
    exit
}

# Put in logic to select from a few choices:  create, get, delete
if [ "$#" -ne 1 ] ; then
    usage
fi

case "$1" in
    "creatersync" ) createOrchData ;;
    "create" ) createNcmData ;;
    "apply" ) applyNcmData ;;
    "terminate" ) terminateNcmData ;;
    "get" )    getNcmData ;;
    "getrsync" )    getOrchData ;;
    "delete" ) deleteNcmData ;;
    "deletersync" ) deleteOrchData ;;
    *) usage ;;
esac