<!-- Set this_pages_navbar  -->
{% comment %}
Here, we loop through site.data for the current view
to set two variables:
  1. this_pages_navbar - a object containing this page's navbar
  2. navbars - a list of this site's toplevel navbars sorted by navbar.order

The code is a little roundabout for a few reasons:
  - liquid doesn't provide a simple way to create an empty array,
  so we just split an empty string.
  - liquid stores the navbars (in site.data[version].navbars) as
  a list keyed by the filename. We don't really care about the filename
  here, so we just need the data field. But, liquid doesn't provide a
  simple way to 'iteritems', so we have to manually loop through and access
  the  2nd item.
  - liquid also has a bug where it truncates after first `.` of a directory
  name in _data (i.e. _data/v0.1 will be stored as data.v0). Until that
  bug's fixed, we store version data in _data/v0_1 and do a string replace
  to find the right data.
{% endcomment %}

{% assign current_page = page.path | replace_first: page.version,"" | split: "/" %}
{% assign current_page = current_page[1] | prepend: "/" %}

{% capture version %}{{ page.version | replace: ".","_" }}{% endcapture %}

{% assign unsorted_navbars = "" | split:"|" %}
{% for navbars_hashmap in site.data[version].navbars %}
  {% assign navbar = navbars_hashmap[1] %}
  {% assign unsorted_navbars = unsorted_navbars | push: navbar %}
  {% assign navbar_size = navbar.path | size %}
  {% if current_page == navbar.path %}
    {% assign this_pages_navbar = navbar %}
  {% endif %}
{% endfor %}
{% assign navbars = unsorted_navbars | sort:"order" %}


<!Doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- <link rel="canonical" href="https://www.projectcalico.org/docs{{page.url}}" /> -->
    <link rel="shortcut icon" type="image/png" href="{{site.baseurl}}/images/favicon.png">
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
    <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
    <link rel="stylesheet" href='https://fonts.googleapis.com/css?family=Roboto+Mono' type='text/css'>
    <link rel="stylesheet" href="{{site.baseurl}}/css/style.css"/>
    <link rel="stylesheet" href="{{site.baseurl}}/css/plugins/offcanvas.css"/>
    <link href="https://www.projectcalico.org/wp-content/themes/dante/css/font-awesome.min.css" rel="stylesheet">
    <script src="{{site.baseurl}}/js/jquery-2.2.0.min.js"></script>
    <script src="{{site.baseurl}}/js/bootstrap/bootstrap.min.js"></script>
    <script src="{{site.baseurl}}/js/script.js"></script>
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

      ga('create', 'UA-52125893-4', 'auto');
      ga('send', 'pageview');
    </script>
    <title>Calico - {{ page.title | json }}</title>
  </head>
  <body>
    <section>
      <nav id="toplevel-nav" class="navbar navbar-default navbar-static-top">
        <div class="container">
          <div class="navbar-header">
            <!-- Hamburger menu for mobile -->
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#tigera-navbar" aria-expanded="false" aria-controls="tigera-navbar">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <!-- Left brand image -->
            <a class="navbar-brand" href="https://projectcalico.org/">
              <img alt="Brand" src="{{site.baseurl}}/images/brand.png">
            </a>
          </div>
          <div id="tigera-navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
              <li><a href="https://projectcalico.org">Home</a></li>
              <li class="active"><a href="https://projectcalico.org/resources"><span>Resources</span></a>
                <ul>
                    <li><a href="{{site.baseurl}}/latest/getting-started/"><i class="fa fa-tachometer" aria-hidden="true"></i> &nbsp; Getting Started</a></li>
                    <li><a href="{{site.baseurl}}"><i class="fa fa-book" aria-hidden="true"></i> &nbsp; Documentation</a></li>
                    <!--<li><a href="https://www.projectcalico.org/tutorials"><i class="fa fa-file-code-o" aria-hidden="true"></i> &nbsp; Tutorials &amp; Examples</a></li>
                    <li><a href=""><i class="fa fa-paper-plane-o" aria-hidden="true"></i> &nbsp; Online Workshops</a></li>-->
                    <li><a href="https://www.projectcalico.org/videos"><i class="fa fa-video-camera" aria-hidden="true"></i> &nbsp; Videos &amp; Webinars</a></li>
                    <li><a href="{{site.baseurl}}/latest/releases/"><i class="fa fa-clock-o" aria-hidden="true"></i> &nbsp; Releases</a></li>
                    <!-- <li><a href="/mvp"><i class="fa fa-star" aria-hidden="true"></i> &nbsp; MVP Program</a></li> -->
                    <li><a href="https://www.projectcalico.org/blog"><i class="fa fa-bookmark" aria-hidden="true"></i> &nbsp; Blog</a></li>
                </ul>
              </li>
              <li><a href="https://www.projectcalico.org/community">Community</a>
                <ul>
                    <li><a href="https://slack.projectcalico.org/"><i class="fa fa-slack" aria-hidden="true"></i> &nbsp; Slack</a></li>
                    <!--<li><a href="https://stackoverflow.com/questions/tagged/project-calico" target="_blank"><i class="fa fa-stack-overflow" aria-hidden="true"></i> &nbsp; StackOverflow</a></li>-->
                    <li><a href="https://www.projectcalico.org/mvp"><i class="fa fa-star" aria-hidden="true"></i> &nbsp; MVP Program</a></li>
                    <li><a href="https://www.projectcalico.org/community#events"><i class="fa fa-calendar" aria-hidden="true"></i> &nbsp; Upcoming Events</a></li>
                    <li><a href="https://www.projectcalico.org/newsletters"><i class="fa fa-envelope-o" aria-hidden="true"></i> &nbsp; Newsletter</a></li>
                    <li><a href="https://github.com/projectcalico" target="_blank"><i class="fa fa-github" aria-hidden="true"></i> &nbsp; GitHub</a></li> 
                    <li><a href="https://www.projectcalico.org/jobs"><i class="fa fa-briefcase" aria-hidden="true"></i> &nbsp; Jobs</a></li>
                    <li><a href="https://www.projectcalico.org/blog"><i class="fa fa-bookmark" aria-hidden="true"></i> &nbsp; Blog</a></li>
                </ul>
              </li>
              <li><a href="https://www.projectcalico.org/mvp" style="font-weight: bold;">MVP</a></li>
              <li><a href="https://www.projectcalico.org/support">Support</a></li>
              <li class="hidden-xs"><a href="https://www.projectcalico.org/support">
                <img class="desktopImage" width="30" align="absmiddle" src="https://www.projectcalico.org/images/tigera_trans_sm.png" alt="Tigera"></a>
              </li>
            </ul>
            <form class="navbar-form visible-xs">
              <ul class="nav navbar-nav navbar-right">
                {% for navbar in navbars %}
                  <li {% if this_pages_navbar == navbar %} class="active"{% endif %}>
                    <a href="{{site.baseurl}}/{{page.version}}{{navbar.path}}">{{ navbar.bigheader }}</a>
                  </li>
                {% endfor %}
              </ul>
            </form>
            <ul class="visible-xs nav navbar-nav navbar-right">
             <li class="dropdown">
               <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Version ({% if page.version == 'master' %}nightly{% else %}{{page.version}}{% endif %})<span class="caret"></span></a>
               <ul class="dropdown-menu">
                 <li><a href="{{site.baseurl}}/v2.6/introduction">v2.6 (latest)</a></li>
                 <li><a href="{{site.baseurl}}/v2.5/introduction">v2.5</a></li>
                 <li><a href="{{site.baseurl}}/v2.4/introduction">v2.4</a></li>
                 <li><a href="{{site.baseurl}}/v2.3/introduction">v2.3</a></li>
                 <li><a href="{{site.baseurl}}/v2.2/introduction">v2.2</a></li>
                 <li><a href="{{site.baseurl}}/v2.1/introduction">v2.1</a></li>
                 <li><a href="{{site.baseurl}}/v2.0/introduction">v2.0</a></li>
                 <li><a href="{{site.baseurl}}/v1.6/introduction">v1.6</a></li>
                 <li><a href="{{site.baseurl}}/v1.5/introduction">v1.5</a></li>
                 <li><a href="{{site.baseurl}}/master/introduction">nightly</a></li>
                 <li role="separator" class="divider"></li>
               </ul>
             </li>
           </ul>
          </div>
        </div>
        <div id="navbar" class="navbar-inverse navbar-collapse collapse">
          <div class="container">
            <ul class="nav navbar-nav">
              {% for navbar in navbars %}
                <li{% if this_pages_navbar == navbar %} class="active"{% endif %}>
                  <a href="{{site.baseurl}}/{{page.version}}{{navbar.path}}"><span>{{ navbar.bigheader }}</span></a>
                </li>
              {% endfor %}
              <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Version ({% if page.version == 'master' %}nightly{% else %}{{page.version}}{% endif %})<span class="caret"></span></a>
                <ul class="dropdown-menu">
                   <li><a href="{{site.baseurl}}/v2.6/introduction">v2.5 (latest)</a></li>
                   <li><a href="{{site.baseurl}}/v2.5/introduction">v2.5</a></li>
                   <li><a href="{{site.baseurl}}/v2.4/introduction">v2.4</a></li>
                   <li><a href="{{site.baseurl}}/v2.3/introduction">v2.3</a></li>
                   <li><a href="{{site.baseurl}}/v2.2/introduction">v2.2</a></li>
                   <li><a href="{{site.baseurl}}/v2.1/introduction">v2.1</a></li>
                   <li><a href="{{site.baseurl}}/v2.0/introduction">v2.0</a></li>
                   <li><a href="{{site.baseurl}}/v1.6/introduction">v1.6</a></li>
                   <li><a href="{{site.baseurl}}/v1.5/introduction">v1.5</a></li>
                  <li role="separator" class="divider"></li>
                  <li><a href="{{site.baseurl}}/master/introduction">nightly</a></li>
                </ul>
              </li>
            </ul>
          </div>
          <div class="row">
            <div class="col-sm-0"></div>
          </div>
        </div>
      </nav>
      <div class="container">
        <div class="row row-offcanvas row-offcanvas-left">
          <p class="pull-left visible-xs">
            <button type="button" class="btn btn-primary btn-xs" data-toggle="offcanvas">Toggle nav</button>
          </p>
          <div class="col-xs-6 col-sm-4 col-md-3 sidebar-offcanvas">
            <div class="row">
              <script>
                (function() {
                  var cx = '015028447179048192876:xjzskk7awwe';
                  var gcse = document.createElement('script');
                  gcse.type = 'text/javascript';
                  gcse.async = true;
                  gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
                  var s = document.getElementsByTagName('script')[0];
                  s.parentNode.insertBefore(gcse, s);
                })();
              </script>
              <gcse:search></gcse:search>
            </div>
            <div id="sidebar">{% include sidebar.html sidebar=this_pages_navbar.toc prefix="nav" %}</div>
          </div>
          <div class="col-xs-12 col-sm-8 col-md-9">
            <div id="content-main">
              <!-- TOP DOCUMENTATION PAGE NAVBAR -->
              <div style="text-align: left; padding: 18px 0 9px 0; min-width: 500px; overflow-x: hidden;">
              
              <a href="https://github.com/projectcalico/calico/tree/master/{{page.path}}" style="color: #999; text-decoration: none; float: right;" target="_blank"><i class="fa fa-github" aria-hidden="true"></i> Edit this page</a></div>
              <!-- END TOP DOCUMENTATION PAGE NAVBAR -->
              {% include version_warning.html %}
              <h1>{{ page.title }}</h1>
              {{ content }}
              
              <!-- BOTTOM DOCUMENTATION PAGE NAVBAR -->
              <div style="margin-top: 60px; margin-bottom: 40px; padding-top: 20px; border-top: 1px solid #999; text-align: left; color: #999;">Rate this Page: <div class="rw-ui-container" style="margin-top: -5px;"></div> <a href="https://www.projectcalico.org/contact?type=docs&file={{page.path}}" style="margin-left: 30px; color: #999; text-decoration: none;" target="_blank"><i class="fa fa-envelope" aria-hidden="true"></i> Provide Feedback</a> <a href="https://www.projectcalico.org/community#slack" style="margin-left: 30px; color: #999; text-decoration: none;" target="_blank"><i class="fa fa-slack" aria-hidden="true"></i> Get Help via Slack</a> <a href="https://www.projectcalico.org/mvp" style="margin-left: 30px; color: #999; text-decoration: none;" target="_blank"><i class="fa fa-trophy" aria-hidden="true"></i> Ask our MVPs</a></div>
              <!-- END BOTTOM DOCUMENTATION PAGE NAVBAR -->
            </div>
          </div>
        </div>
      </div>
    </section>
    <!-- Start Visual Website Optimizer Asynchronous Code -->
    <script type='text/javascript'>
      var _vwo_code=(function(){
      var account_id=287573,
      settings_tolerance=2000,
      library_tolerance=2500,
      use_existing_jquery=false,
      /* DO NOT EDIT BELOW THIS LINE */
      f=false,d=document;return{use_existing_jquery:function(){return use_existing_jquery;},library_tolerance:function(){return library_tolerance;},finish:function(){if(!f){f=true;var a=d.getElementById('_vis_opt_path_hides');if(a)a.parentNode.removeChild(a);}},finished:function(){return f;},load:function(a){var b=d.createElement('script');b.src=a;b.type='text/javascript';b.innerText;b.onerror=function(){_vwo_code.finish();};d.getElementsByTagName('head')[0].appendChild(b);},init:function(){settings_timer=setTimeout('_vwo_code.finish()',settings_tolerance);var a=d.createElement('style'),b='body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}',h=d.getElementsByTagName('head')[0];a.setAttribute('id','_vis_opt_path_hides');a.setAttribute('type','text/css');if(a.styleSheet)a.styleSheet.cssText=b;else a.appendChild(d.createTextNode(b));h.appendChild(a);this.load('//dev.visualwebsiteoptimizer.com/j.php?a='+account_id+'&u='+encodeURIComponent(d.URL)+'&r='+Math.random());return settings_timer;}};}());_vwo_settings_timer=_vwo_code.init();
    </script>
    <!-- End Visual Website Optimizer Asynchronous Code -->
    <!-- DOCUMENTATION RATING ANALYTICS -->
   <script type="text/javascript">(function(d, t, e, m){
    // Async Rating-Widget initialization.
    window.RW_Async_Init = function(){
        RW.init({
            huid: "368439",
            uid: "33da22c0dff384767b5074aaf10ebc50",
            source: "website",
            options: {
                "advanced": {
					"font": {
						"color": "#999999"
					},
                    "layout": {
                        "align": {
                            "hor": "left"
                        }
                    },
                    "text": {
                        "rateThis": "Rate this"
                    }
                },
				"label": {
					"background": "#FFFFFF"
				},
				"reVote": true,
				"showInfo": false,
				/*"showTooltip": false,*/
				"hideRecommendations": false,
				"showReport": false,
				"showLoader": false,
                "style": "oxygen",
                "isDummy": false
            } 
        });
        RW.render();
    };
        // Append Rating-Widget JavaScript library.
    var rw, s = d.getElementsByTagName(e)[0], id = "rw-js",
        l = d.location, ck = "Y" + t.getFullYear() + 
        "M" + t.getMonth() + "D" + t.getDate(), p = l.protocol,
        f = ((l.search.indexOf("DBG=") > -1) ? "" : ".min"),
        a = ("https:" == p ? "secure." + m + "js/" : "js." + m);
    if (d.getElementById(id)) return;              
    rw = d.createElement(e);
    rw.id = id; rw.async = true; rw.type = "text/javascript";
    rw.src = p + "//" + a + "external" + f + ".js?ck=" + ck;
    s.parentNode.insertBefore(rw, s);
    }(document, new Date(), "script", "rating-widget.com/"));</script>
    <!-- END DOCUMENTATION RATING ANALYTICS -->
  </body>
</html>
