Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
prachirp committed Jul 8, 2020
1 parent 884615c commit c25d76e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 20 deletions.
21 changes: 15 additions & 6 deletions docs/guides/producer/functions/ts/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using an existing Hello World package.</p>
<ul>
<li>Install <a href="https://nodejs.org/en/download/">node</a></li>
<li>Install <a href="https://docs.docker.com/v17.09/engine/installation/">docker</a></li>
<li>Install <a href="../../../../installation/">kpt</a> and add it to $PATH</li>
<li>Install <a href="../../../../../installation/">kpt</a> and add it to $PATH</li>
</ul>
<h3 id="hello-world-package">Hello World Package</h3>
<ol>
Expand All @@ -51,7 +51,7 @@ using an existing Hello World package.</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-sh" data-lang="sh">npm run watch
</code></pre></div></li>
<li>
<p>Run the <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/label_namespace.ts"><code>label_namespace</code></a> function:</p>
<p>Run the <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/label_namespace.ts"><code>label_namespace</code></a> transformer function:</p>


<pre class="language-markup">
Expand Down Expand Up @@ -119,15 +119,24 @@ in the <code>example-configs</code> directory:</p>
</code></pre></div></li>
<li>
<p>Try modifying the function in <code>src/label_namespace.ts</code> to perform other operations
on <code>example-configs</code>, then repeat step 4. You can also explore other functions such as <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/suggest_psp.ts">suggest-psp</a> or <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/validate_rolebinding.ts">validate-rolebinding</a>.</p>
<p>The function should implement the <code>KptFunc</code> interface <a href="https://googlecontainertools.github.io/kpt-functions-sdk/api/interfaces/_types_.kptfunc.html">documented here</a>.</p>
and rerun the function on <code>example-configs</code> to see the changes.</p>
</li>
<li>
<p>Explore validation functions like <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/validate_rolebinding.ts">validate-rolebinding</a>. Instead of transforming configuration,
this function searches RoleBindings and returns a results field containing details about invalid
subject names.</p>
</li>
<li>
<p>Explore generator functions like <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/expand_team_cr.ts">expand-team-cr</a>. This function generates a per-environment
Namespace and RoleBinding object for each custom resource (CR) of type Team.</p>
</li>
</ol>
<p>Config functions should implement the <code>KptFunc</code> interface <a href="https://googlecontainertools.github.io/kpt-functions-sdk/api/interfaces/_types_.kptfunc.html">documented here</a>.</p>
<h2 id="next-steps">Next Steps</h2>
<ul>
<li>Take a look at <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/tree/master/ts/demo-functions/src">these example functions</a> to better understand how to use the typescript SDK.</li>
<li>Read the complete <a href="develop/">Typescript Developer Guide</a>.</li>
<li>Learn how to <a href="../../../consumer/function/">run functions</a>.</li>
<li>Read the complete <a href="../develop/">Typescript Developer Guide</a>.</li>
<li>Learn how to <a href="../../../../consumer/function/">run functions</a>.</li>
</ul>

</description>
Expand Down
21 changes: 15 additions & 6 deletions docs/guides/producer/functions/ts/quickstart/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ <h4 id="setting-up-your-local-environment">Setting Up Your Local Environment</h4
<ul>
<li>Install <a href="https://nodejs.org/en/download/">node</a></li>
<li>Install <a href="https://docs.docker.com/v17.09/engine/installation/">docker</a></li>
<li>Install <a href="../../../../installation/">kpt</a> and add it to $PATH</li>
<li>Install <a href="../../../../../installation/">kpt</a> and add it to $PATH</li>
</ul>
<h3 id="hello-world-package">Hello World Package</h3>
<ol>
Expand All @@ -1020,7 +1020,7 @@ <h3 id="hello-world-package">Hello World Package</h3>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-sh" data-lang="sh">npm run watch
</code></pre></div></li>
<li>
<p>Run the <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/label_namespace.ts"><code>label_namespace</code></a> function:</p>
<p>Run the <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/label_namespace.ts"><code>label_namespace</code></a> transformer function:</p>


<pre class="language-markup">
Expand Down Expand Up @@ -1088,15 +1088,24 @@ <h3 id="hello-world-package">Hello World Package</h3>
</code></pre></div></li>
<li>
<p>Try modifying the function in <code>src/label_namespace.ts</code> to perform other operations
on <code>example-configs</code>, then repeat step 4. You can also explore other functions such as <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/suggest_psp.ts">suggest-psp</a> or <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/validate_rolebinding.ts">validate-rolebinding</a>.</p>
<p>The function should implement the <code>KptFunc</code> interface <a href="https://googlecontainertools.github.io/kpt-functions-sdk/api/interfaces/_types_.kptfunc.html">documented here</a>.</p>
and rerun the function on <code>example-configs</code> to see the changes.</p>
</li>
<li>
<p>Explore validation functions like <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/validate_rolebinding.ts">validate-rolebinding</a>. Instead of transforming configuration,
this function searches RoleBindings and returns a results field containing details about invalid
subject names.</p>
</li>
<li>
<p>Explore generator functions like <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/expand_team_cr.ts">expand-team-cr</a>. This function generates a per-environment
Namespace and RoleBinding object for each custom resource (CR) of type Team.</p>
</li>
</ol>
<p>Config functions should implement the <code>KptFunc</code> interface <a href="https://googlecontainertools.github.io/kpt-functions-sdk/api/interfaces/_types_.kptfunc.html">documented here</a>.</p>
<h2 id="next-steps">Next Steps</h2>
<ul>
<li>Take a look at <a href="https://github.com/GoogleContainerTools/kpt-functions-sdk/tree/master/ts/demo-functions/src">these example functions</a> to better understand how to use the typescript SDK.</li>
<li>Read the complete <a href="develop/">Typescript Developer Guide</a>.</li>
<li>Learn how to <a href="../../../consumer/function/">run functions</a>.</li>
<li>Read the complete <a href="../develop/">Typescript Developer Guide</a>.</li>
<li>Learn how to <a href="../../../../consumer/function/">run functions</a>.</li>
</ul>

<div class="section-index">
Expand Down
23 changes: 15 additions & 8 deletions site/content/en/guides/producer/functions/ts/quickstart/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Currently supported platforms: amd64 Linux/Mac
npm run watch
```

1. Run the [`label_namespace`][label-namespace] function:
1. Run the [`label_namespace`][label-namespace] transformer function:

{{< code type="ts" >}}
{{< readfile file="static/ts/label_namespace.ts" >}}
Expand All @@ -71,10 +71,17 @@ Currently supported platforms: amd64 Linux/Mac
git diff $CONFIGS
```

2. Try modifying the function in `src/label_namespace.ts` to perform other operations
on `example-configs`, then repeat step 4. You can also explore other functions such as [suggest-psp] or [validate-rolebinding].
1. Try modifying the function in `src/label_namespace.ts` to perform other operations
and rerun the function on `example-configs` to see the changes.

The function should implement the `KptFunc` interface [documented here][api-kptfunc].
1. Explore validation functions like [validate-rolebinding]. Instead of transforming configuration,
this function searches RoleBindings and returns a results field containing details about invalid
subject names.

1. Explore generator functions like [expand-team-cr]. This function generates a per-environment
Namespace and RoleBinding object for each custom resource (CR) of type Team.

Config functions should implement the `KptFunc` interface [documented here][api-kptfunc].

## Next Steps

Expand All @@ -84,11 +91,11 @@ Currently supported platforms: amd64 Linux/Mac

[download-node]: https://nodejs.org/en/download/
[install-docker]: https://docs.docker.com/v17.09/engine/installation/
[download-kpt]: ../../../../installation/
[download-kpt]: ../../../../../installation/
[demo-funcs]: https://github.com/GoogleContainerTools/kpt-functions-sdk/tree/master/ts/demo-functions/src
[api-kptfunc]: https://googlecontainertools.github.io/kpt-functions-sdk/api/interfaces/_types_.kptfunc.html
[Typescript Developer Guide]: develop/
[run functions]: ../../../consumer/function/
[Typescript Developer Guide]: ../develop/
[run functions]: ../../../../consumer/function/
[label-namespace]: https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/label_namespace.ts
[suggest-psp]: https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/suggest_psp.ts
[expand-team-cr]: https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/expand_team_cr.ts
[validate-rolebinding]: https://github.com/GoogleContainerTools/kpt-functions-sdk/blob/master/ts/demo-functions/src/validate_rolebinding.ts

0 comments on commit c25d76e

Please sign in to comment.