Skip to content

Commit

Permalink
feat(guides): fix connectivity in observability namespace (#2088)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcin Skalski <[email protected]>
  • Loading branch information
Automaat authored Nov 20, 2024
1 parent 5b07503 commit e4dafe4
Show file tree
Hide file tree
Showing 7 changed files with 212 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ def initialize(tag_name, markup, options)
"metadata" => {
"name" => node["name"],
"namespace" => context[:namespace],
"labels" => {
**(node["labels"] || node["mesh"] ? { "labels" => {
**(node["labels"] || {}),
"kuma.io/mesh" => node["mesh"]
}
**(node["mesh"] ? { "kuma.io/mesh" => node["mesh"] } : {})
}} : {})
},
"spec" => node["spec"]
}
Expand Down
91 changes: 91 additions & 0 deletions spec/fixtures/hostnamegenerator-labels.golden.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<link rel="stylesheet" href="http://localhost:8000/dist/vite/assets/application.css" />
<script src="http://localhost:8000/dist/vite/assets/application.js" crossorigin="anonymous" type="module"></script>



<div class="tabs-component" data-tab-use-url-fragment="false">
<ul role="tablist" class="tabs-component-tabs">

<li class="tabs-component-tab is-active" role="presentation">
<a
aria-controls="Kubernetes"
aria-selected="true"
href="#Kubernetes"
class="tabs-component-tab-a"
role="tab"
data-slug="Kubernetes"
>
Kubernetes
</a>
</li>

<li class="tabs-component-tab " role="presentation">
<a
aria-controls="Universal"
aria-selected="false"
href="#Universal"
class="tabs-component-tab-a"
role="tab"
data-slug="Universal"
>
Universal
</a>
</li>

</ul>

<div class="tabs-component-panels">

<section
aria-hidden="false"
class="tabs-component-panel "
id="Kubernetes"
role="tabpanel"
data-panel="Kubernetes"
>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">apiVersion</span><span class="pi">:</span> <span class="s">kuma.io/v1alpha1</span>
<span class="na">kind</span><span class="pi">:</span> <span class="s">HostnameGenerator</span>
<span class="na">metadata</span><span class="pi">:</span>
<span class="na">name</span><span class="pi">:</span> <span class="s">synced-universal-mesh-service</span>
<span class="na">namespace</span><span class="pi">:</span> <span class="s">kuma-demo</span>
<span class="na">labels</span><span class="pi">:</span>
<span class="na">test</span><span class="pi">:</span> <span class="s">label</span>
<span class="na">spec</span><span class="pi">:</span>
<span class="na">selector</span><span class="pi">:</span>
<span class="na">meshService</span><span class="pi">:</span>
<span class="na">matchLabels</span><span class="pi">:</span>
<span class="na">kuma.io/origin</span><span class="pi">:</span> <span class="s">global</span>
<span class="na">kuma.io/env</span><span class="pi">:</span> <span class="s">universal</span>
<span class="na">template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">.DisplayName</span><span class="nv"> </span><span class="s">}}.svc.{{</span><span class="nv"> </span><span class="s">.Zone</span><span class="nv"> </span><span class="s">}}.mesh.local"</span>
</code></pre></div></div>


</section>

<section
aria-hidden="true"
class="tabs-component-panel hidden"
id="Universal"
role="tabpanel"
data-panel="Universal"
>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">type</span><span class="pi">:</span> <span class="s">HostnameGenerator</span>
<span class="na">name</span><span class="pi">:</span> <span class="s">synced-universal-mesh-service</span>
<span class="na">labels</span><span class="pi">:</span>
<span class="na">test</span><span class="pi">:</span> <span class="s">label</span>
<span class="na">spec</span><span class="pi">:</span>
<span class="na">selector</span><span class="pi">:</span>
<span class="na">meshService</span><span class="pi">:</span>
<span class="na">matchLabels</span><span class="pi">:</span>
<span class="na">kuma.io/origin</span><span class="pi">:</span> <span class="s">global</span>
<span class="na">kuma.io/env</span><span class="pi">:</span> <span class="s">universal</span>
<span class="na">template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">.DisplayName</span><span class="nv"> </span><span class="s">}}.svc.{{</span><span class="nv"> </span><span class="s">.Zone</span><span class="nv"> </span><span class="s">}}.mesh.local"</span>
</code></pre></div></div>


</section>

</div>
</div>
11 changes: 11 additions & 0 deletions spec/fixtures/hostnamegenerator-labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type: HostnameGenerator
name: synced-universal-mesh-service
labels:
test: label
spec:
selector:
meshService:
matchLabels:
kuma.io/origin: global
kuma.io/env: universal
template: "{% raw %}{{ .DisplayName }}.svc.{{ .Zone }}.mesh.local{% endraw %}"
87 changes: 87 additions & 0 deletions spec/fixtures/hostnamegenerator.golden.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<link rel="stylesheet" href="http://localhost:8000/dist/vite/assets/application.css" />
<script src="http://localhost:8000/dist/vite/assets/application.js" crossorigin="anonymous" type="module"></script>



<div class="tabs-component" data-tab-use-url-fragment="false">
<ul role="tablist" class="tabs-component-tabs">

<li class="tabs-component-tab is-active" role="presentation">
<a
aria-controls="Kubernetes"
aria-selected="true"
href="#Kubernetes"
class="tabs-component-tab-a"
role="tab"
data-slug="Kubernetes"
>
Kubernetes
</a>
</li>

<li class="tabs-component-tab " role="presentation">
<a
aria-controls="Universal"
aria-selected="false"
href="#Universal"
class="tabs-component-tab-a"
role="tab"
data-slug="Universal"
>
Universal
</a>
</li>

</ul>

<div class="tabs-component-panels">

<section
aria-hidden="false"
class="tabs-component-panel "
id="Kubernetes"
role="tabpanel"
data-panel="Kubernetes"
>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">apiVersion</span><span class="pi">:</span> <span class="s">kuma.io/v1alpha1</span>
<span class="na">kind</span><span class="pi">:</span> <span class="s">HostnameGenerator</span>
<span class="na">metadata</span><span class="pi">:</span>
<span class="na">name</span><span class="pi">:</span> <span class="s">synced-universal-mesh-service</span>
<span class="na">namespace</span><span class="pi">:</span> <span class="s">kuma-demo</span>
<span class="na">spec</span><span class="pi">:</span>
<span class="na">selector</span><span class="pi">:</span>
<span class="na">meshService</span><span class="pi">:</span>
<span class="na">matchLabels</span><span class="pi">:</span>
<span class="na">kuma.io/origin</span><span class="pi">:</span> <span class="s">global</span>
<span class="na">kuma.io/env</span><span class="pi">:</span> <span class="s">universal</span>
<span class="na">template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">.DisplayName</span><span class="nv"> </span><span class="s">}}.svc.{{</span><span class="nv"> </span><span class="s">.Zone</span><span class="nv"> </span><span class="s">}}.mesh.local"</span>
</code></pre></div></div>


</section>

<section
aria-hidden="true"
class="tabs-component-panel hidden"
id="Universal"
role="tabpanel"
data-panel="Universal"
>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">type</span><span class="pi">:</span> <span class="s">HostnameGenerator</span>
<span class="na">name</span><span class="pi">:</span> <span class="s">synced-universal-mesh-service</span>
<span class="na">spec</span><span class="pi">:</span>
<span class="na">selector</span><span class="pi">:</span>
<span class="na">meshService</span><span class="pi">:</span>
<span class="na">matchLabels</span><span class="pi">:</span>
<span class="na">kuma.io/origin</span><span class="pi">:</span> <span class="s">global</span>
<span class="na">kuma.io/env</span><span class="pi">:</span> <span class="s">universal</span>
<span class="na">template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">.DisplayName</span><span class="nv"> </span><span class="s">}}.svc.{{</span><span class="nv"> </span><span class="s">.Zone</span><span class="nv"> </span><span class="s">}}.mesh.local"</span>
</code></pre></div></div>


</section>

</div>
</div>
9 changes: 9 additions & 0 deletions spec/fixtures/hostnamegenerator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type: HostnameGenerator
name: synced-universal-mesh-service
spec:
selector:
meshService:
matchLabels:
kuma.io/origin: global
kuma.io/env: universal
template: "{% raw %}{{ .DisplayName }}.svc.{{ .Zone }}.mesh.local{% endraw %}"
2 changes: 1 addition & 1 deletion spec/fixtures/mhr-port_edition.golden.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,4 @@
</section>

</div>
</div>
</div>
10 changes: 10 additions & 0 deletions spec/kuma_plugins/liquid/tags/policy_yaml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@
tag_options: 'use_meshservice=true',
page: { 'release' => '2.10.x', 'edition' => 'kuma', 'label' => 'dev' }
},
{
input_file: 'spec/fixtures/hostnamegenerator.yaml',
golden_file: 'spec/fixtures/hostnamegenerator.golden.html',
tag_options: nil
},
{
input_file: 'spec/fixtures/hostnamegenerator-labels.yaml',
golden_file: 'spec/fixtures/hostnamegenerator-labels.golden.html',
tag_options: nil
},
]

test_cases.each do |test_case|
Expand Down

0 comments on commit e4dafe4

Please sign in to comment.