50 lines
32 KiB
HTML
50 lines
32 KiB
HTML
<!doctype html>
|
||
<html lang="en" dir="ltr" class="docs-wrapper docs-doc-page docs-version-0.6 plugin-docs plugin-id-default docs-doc-id-gitrepo-content">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="generator" content="Docusaurus v2.3.1">
|
||
<title data-rh="true">Git Repository Contents | Fleet</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://fleet.rancher.io/0.6/gitrepo-content"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="0.6"><meta data-rh="true" name="docusaurus_tag" content="docs-default-0.6"><meta data-rh="true" name="docsearch:version" content="0.6"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-0.6"><meta data-rh="true" property="og:title" content="Git Repository Contents | Fleet"><meta data-rh="true" name="description" content="Fleet will create bundles from a git repository. This happens either explicitly by specifying paths, or when a fleet.yaml is found."><meta data-rh="true" property="og:description" content="Fleet will create bundles from a git repository. This happens either explicitly by specifying paths, or when a fleet.yaml is found."><link data-rh="true" rel="icon" href="/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://fleet.rancher.io/0.6/gitrepo-content"><link data-rh="true" rel="alternate" href="https://fleet.rancher.io/0.6/gitrepo-content" hreflang="en"><link data-rh="true" rel="alternate" href="https://fleet.rancher.io/0.6/gitrepo-content" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://5YEVIM7OXD-dsn.algolia.net" crossorigin="anonymous"><link rel="search" type="application/opensearchdescription+xml" title="Fleet" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.3cf96da7.css">
|
||
<link rel="preload" href="/assets/js/runtime~main.3681bad0.js" as="script">
|
||
<link rel="preload" href="/assets/js/main.5f6cde4b.js" as="script">
|
||
</head>
|
||
<body class="navigation-with-keyboard">
|
||
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
|
||
<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/logo.svg" alt="logo" class="themedImage_ToTc themedImage--light_HNdA"><img src="/img/logo.svg" alt="logo" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Fleet</b></a></div><div class="navbar__items navbar__items--right"><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a class="navbar__link" aria-haspopup="true" aria-expanded="false" role="button" href="/0.6">0.6</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/gitrepo-content">Next 🚧</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/0.6/gitrepo-content">0.6</a></li><li><a class="dropdown__link" href="/0.5">0.5</a></li><li><a class="dropdown__link" href="/0.4">0.4</a></li></ul></div><a aria-current="page" class="navbar__item navbar__link navbar__docs navbar__link--active" href="/0.6">Docs</a><a href="https://github.com/rancher/fleet" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link navbar__github btn btn-secondary icon-github">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://rancher-users.slack.com/channels/fleet" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link header-slack-link" aria-label="Slack Channel"></a><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/0.6">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="true" href="/0.6/quickstart">Tutorials</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/quickstart">Quick Start</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/tut-deployment">Creating a Deployment</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/uninstall">Uninstall</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/0.6/architecture">Explanations</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/architecture">Architecture</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/concepts">Core Concepts</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/ref-bundle-stages">Bundle Lifecycle</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/0.6/gitrepo-content">Git Repository Contents</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/namespaces">Namespaces</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/ref-resources">Custom Resources</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="true" href="/0.6/installation">How-tos for Operators</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/installation">Installation Details</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/cluster-registration">Register Downstream Clusters</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/cluster-group">Create Cluster Groups</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/multi-user">Setup Multi User</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="true" href="/0.6/gitrepo-add">How-tos for Users</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/gitrepo-add">Create a GitRepo Resource</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/gitrepo-targets">Mapping to Downstream Clusters</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/bundle-diffs">Generating Diffs to Ignore Modified GitRepos</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/webhook">Using Webhooks Instead of Polling</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/imagescan">Using Image Scan to Update Container Image References</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="true" href="/0.6/cli/fleet-agent">Reference</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/0.6/cli/fleet-agent">CLI</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/cluster-bundles-state">Cluster and Bundle State</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/ref-registration">Cluster Registration Internals</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/ref-configuration">Configuration</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/ref-crds">Custom Resources Spec</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/ref-fleet-yaml">fleet.yaml</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/0.6/ref-gitrepo">GitRepo Resource</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/0.6/troubleshooting">Troubleshooting</a></li></ul></nav></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Explanations</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Git Repository Contents</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 0.6</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><h1>Git Repository Contents</h1><p>Fleet will create bundles from a git repository. This happens either explicitly by specifying paths, or when a <code>fleet.yaml</code> is found.</p><p>Each bundle is created from paths in a GitRepo and modified further by reading the discovered <code>fleet.yaml</code> file.
|
||
Bundle lifecycles are tracked between releases by the helm releaseName field added to each bundle. If the releaseName is not
|
||
specified within fleet.yaml it is generated from <code>GitRepo.name + path</code>. Long names are truncated and a <code>-<hash></code> prefix is added.</p><p><strong>The git repository has no explicitly required structure.</strong> It is important
|
||
to realize the scanned resources will be saved as a resource in Kubernetes so
|
||
you want to make sure the directories you are scanning in git do not contain
|
||
arbitrarily large resources. Right now there is a limitation that the resources
|
||
deployed must <strong>gzip to less than 1MB</strong>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="proper-namespace">Proper Namespace<a href="#proper-namespace" class="hash-link" aria-label="Direct link to Proper Namespace" title="Direct link to Proper Namespace"></a></h2><p>Git repos are added to the Fleet manager using the <code>GitRepo</code> custom resource type. The <code>GitRepo</code> type is namespaced. By default, Rancher will create two Fleet workspaces: <strong>fleet-default</strong> and <strong>fleet-local</strong>.</p><ul><li><code>Fleet-default</code> will contain all the downstream clusters that are already registered through Rancher.</li><li><code>Fleet-local</code> will contain the local cluster by default.</li></ul><p>Users can create new workspaces and move clusters across workspaces. An example of a special case might be including the local cluster in the <code>GitRepo</code> payload for config maps and secrets (no active deployments or payloads).</p><div class="theme-admonition theme-admonition-warning alert alert--danger admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"></path></svg></span>Local Cluster</div><div class="admonitionContent_S0QG"><p>While it's possible to move clusters out of either workspace, we recommend that you keep the local cluster in <code>fleet-local</code>.</p></div></div><p>If you are using Fleet in a <a href="/0.6/concepts">single cluster</a> style, the namespace will always be <strong>fleet-local</strong>. Check <a href="https://fleet.rancher.io/namespaces/#fleet-local" target="_blank" rel="noopener noreferrer">here</a> for more on the <code>fleet-local</code> namespace.</p><p>For a <a href="/0.6/concepts">multi-cluster</a> style, please ensure you use the correct repo that will map to the right target clusters.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="how-repos-are-scanned">How repos are scanned<a href="#how-repos-are-scanned" class="hash-link" aria-label="Direct link to How repos are scanned" title="Direct link to How repos are scanned"></a></h2><p>Multiple paths can be defined for a <code>GitRepo</code> and each path is scanned independently.
|
||
Internally each scanned path will become a <a href="/0.6/concepts">bundle</a> that Fleet will manage,
|
||
deploy, and monitor independently.</p><p>The following files are looked for to determine the how the resources will be deployed.</p><table><thead><tr><th>File</th><th>Location</th><th>Meaning</th></tr></thead><tbody><tr><td><strong>Chart.yaml</strong>:</td><td>/ relative to <code>path</code> or custom path from <code>fleet.yaml</code></td><td>The resources will be deployed as a Helm chart. Refer to the <code>fleet.yaml</code> for more options.</td></tr><tr><td><strong>kustomization.yaml</strong>:</td><td>/ relative to <code>path</code> or custom path from <code>fleet.yaml</code></td><td>The resources will be deployed using Kustomize. Refer to the <code>fleet.yaml</code> for more options.</td></tr><tr><td><strong>fleet.yaml</strong></td><td>Any subpath</td><td>If any fleet.yaml is found a new <a href="/0.6/concepts">bundle</a> will be defined. This allows mixing charts, kustomize, and raw YAML in the same repo</td></tr><tr><td><strong> *.yaml </strong></td><td>Any subpath</td><td>If a <code>Chart.yaml</code> or <code>kustomization.yaml</code> is not found then any <code>.yaml</code> or <code>.yml</code> file will be assumed to be a Kubernetes resource and will be deployed.</td></tr><tr><td><strong>overlays/{name}</strong></td><td>/ relative to <code>path</code></td><td>When deploying using raw YAML (not Kustomize or Helm) <code>overlays</code> is a special directory for customizations.</td></tr></tbody></table><h2 class="anchor anchorWithStickyNavbar_LWe7" id="fleetyaml"><code>fleet.yaml</code><a href="#fleetyaml" class="hash-link" aria-label="Direct link to fleetyaml" title="Direct link to fleetyaml"></a></h2><p>The <code>fleet.yaml</code> is an optional file that can be included in the git repository to change the behavior of how
|
||
the resources are deployed and customized. The <code>fleet.yaml</code> is always at the root relative to the <code>path</code> of the <code>GitRepo</code>
|
||
and if a subdirectory is found with a <code>fleet.yaml</code> a new <a href="/0.6/concepts">bundle</a> is defined that will then be
|
||
configured differently from the parent bundle.</p><div class="theme-admonition theme-admonition-caution alert alert--warning admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg></span>caution</div><div class="admonitionContent_S0QG"><p><strong>Helm chart dependencies</strong>:
|
||
It is up to the user to fulfill the dependency list for the Helm charts. As such, you must manually run <code>helm dependencies update $chart</code> OR run <code>helm dependencies build $chart</code> prior to install. See the <a href="https://rancher.com/docs/rancher/v2.6/en/deploy-across-clusters/fleet/#helm-chart-dependencies" target="_blank" rel="noopener noreferrer">Fleet docs</a> in Rancher for more information.</p></div></div><p>The available fields are documented in the <a href="/0.6/ref-fleet-yaml">fleet.yaml reference</a></p><p>For a private Helm repo, users can reference a secret from the git repo resource.
|
||
See <a href="/0.6/gitrepo-add#using-private-helm-repositories">Using Private Helm Repositories</a> for more information.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="per-cluster-customization">Per Cluster Customization<a href="#per-cluster-customization" class="hash-link" aria-label="Direct link to Per Cluster Customization" title="Direct link to Per Cluster Customization"></a></h2><p>The <code>GitRepo</code> defines which clusters a git repository should be deployed to and the <code>fleet.yaml</code> in the repository
|
||
determines how the resources are customized per target.</p><p>All clusters and cluster groups in the same namespace as the <code>GitRepo</code> will be evaluated against all targets of that
|
||
<code>GitRepo</code>. The targets list is evaluated one by one and if there is a match the resource will be deployed to the cluster.
|
||
If no match is made against the target list on the <code>GitRepo</code> then the resources will not be deployed to that cluster.
|
||
Once a target cluster is matched the <code>fleet.yaml</code> from the git repository is then consulted for customizations. The
|
||
<code>targetCustomizations</code> in the <code>fleet.yaml</code> will be evaluated one by one and the first match will define how the
|
||
resource is to be configured. If no match is made the resources will be deployed with no additional customizations.</p><p>There are three approaches to matching clusters for both <code>GitRepo</code> <code>targets</code> and <code>fleet.yaml</code> <code>targetCustomizations</code>.
|
||
One can use cluster selectors, cluster group selectors, or an explicit cluster group name. All criteria is additive so
|
||
the final match is evaluated as "clusterSelector && clusterGroupSelector && clusterGroup". If any of the three have the
|
||
default value it is dropped from the criteria. The default value is either null or "". It is important to realize
|
||
that the value <code>{}</code> for a selector means "match everything."</p><div class="language-yaml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-yaml codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic"># Match everything</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token key atrule">clusterSelector</span><span class="token punctuation" style="color:rgb(199, 146, 234)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic"># Selector ignored</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token key atrule">clusterSelector</span><span class="token punctuation" style="color:rgb(199, 146, 234)">:</span><span class="token plain"> </span><span class="token null important">null</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="raw-yaml-resource-customization">Raw YAML Resource Customization<a href="#raw-yaml-resource-customization" class="hash-link" aria-label="Direct link to Raw YAML Resource Customization" title="Direct link to Raw YAML Resource Customization"></a></h2><p>When using Kustomize or Helm the <code>kustomization.yaml</code> or the <code>helm.values</code> will control how the resource are
|
||
customized per target cluster. If you are using raw YAML then the following simple mechanism is built-in and can
|
||
be used. The <code>overlays/</code> folder in the git repo is treated specially as folder containing folders that
|
||
can be selected to overlay on top per target cluster. The resource overlay content
|
||
uses a file name based approach. This is different from kustomize which uses a resource based approach. In kustomize
|
||
the resource Group, Kind, Version, Name, and Namespace identify resources and are then merged or patched. For Fleet
|
||
the overlay resources will override or patch content with a matching file name.</p><div class="language-shell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-shell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic"># Base files</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">deployment.yaml</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">svc.yaml</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic"># Overlay files</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic"># The following file will be added</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">overlays/custom/configmap.yaml</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic"># The following file will replace svc.yaml</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">overlays/custom/svc.yaml</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic"># The following file will patch deployment.yaml</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">overlays/custom/deployment_patch.yaml</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>A file named <code>foo</code> will replace a file called <code>foo</code> from the base resources or a previous overlay. In order to patch
|
||
the contents of a file the convention of adding <code>_patch.</code> (notice the trailing period) to the filename is used. The string <code>_patch.</code>
|
||
will be replaced with <code>.</code> from the file name and that will be used as the target. For example <code>deployment_patch.yaml</code>
|
||
will target <code>deployment.yaml</code>. The patch will be applied using JSON Merge, Strategic Merge Patch, or JSON Patch.
|
||
Which strategy is used is based on the file content. Even though JSON strategies are used, the files can be written
|
||
using YAML syntax.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cluster-and-bundle-state">Cluster and Bundle State<a href="#cluster-and-bundle-state" class="hash-link" aria-label="Direct link to Cluster and Bundle State" title="Direct link to Cluster and Bundle State"></a></h2><p>See <a href="/0.6/cluster-bundles-state">Cluster and Bundle state</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/rancher/fleet-docs/edit/main/versioned_docs/version-0.6/gitrepo-content.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-05-15T14:46:52.000Z">May 15, 2023</time></b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/0.6/ref-bundle-stages"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Bundle Lifecycle</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/0.6/namespaces"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Namespaces</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#proper-namespace" class="table-of-contents__link toc-highlight">Proper Namespace</a></li><li><a href="#how-repos-are-scanned" class="table-of-contents__link toc-highlight">How repos are scanned</a></li><li><a href="#fleetyaml" class="table-of-contents__link toc-highlight"><code>fleet.yaml</code></a></li><li><a href="#per-cluster-customization" class="table-of-contents__link toc-highlight">Per Cluster Customization</a></li><li><a href="#raw-yaml-resource-customization" class="table-of-contents__link toc-highlight">Raw YAML Resource Customization</a></li><li><a href="#cluster-and-bundle-state" class="table-of-contents__link toc-highlight">Cluster and Bundle State</a></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">Copyright © 2023 SUSE Rancher. All Rights Reserved.</div></div></div></footer></div>
|
||
<script src="/assets/js/runtime~main.3681bad0.js"></script>
|
||
<script src="/assets/js/main.5f6cde4b.js"></script>
|
||
</body>
|
||
</html> |