<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Operator SDK – Helm</title>
    <link>/docs/building-operators/helm/</link>
    <description>Recent content in Helm on Operator SDK</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    
	  <atom:link href="/docs/building-operators/helm/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Docs: Installation Guide</title>
      <link>/docs/building-operators/helm/installation/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/building-operators/helm/installation/</guid>
      <description>
        
        
        &lt;h2 id=&#34;install-operator-sdk&#34;&gt;Install &lt;code&gt;operator-sdk&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Follow the steps in the &lt;a href=&#34;/docs/installation/&#34;&gt;installation guide&lt;/a&gt; to learn how to install the &lt;code&gt;operator-sdk&lt;/code&gt; CLI tool.&lt;/p&gt;
&lt;h3 id=&#34;additional-prerequisites&#34;&gt;Additional Prerequisites&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.docker.com/install/&#34;&gt;docker&lt;/a&gt; version 17.03+.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://kubernetes.io/docs/tasks/tools/install-kubectl/&#34;&gt;kubectl&lt;/a&gt; and access to a Kubernetes cluster of a &lt;a href=&#34;/docs/overview#kubernetes-version-compatibility&#34;&gt;compatible version&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Quickstart for Helm-based Operators</title>
      <link>/docs/building-operators/helm/quickstart/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/building-operators/helm/quickstart/</guid>
      <description>
        
        
        &lt;p&gt;This guide walks through an example of building a simple nginx-operator powered by &lt;a href=&#34;https://helm.sh/docs/&#34;&gt;Helm&lt;/a&gt; using tools and libraries provided by the Operator SDK.&lt;/p&gt;
&lt;h2 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Go through the &lt;a href=&#34;/docs/building-operators/helm/installation&#34;&gt;installation guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Make sure your user is authorized with &lt;code&gt;cluster-admin&lt;/code&gt; permissions.&lt;/li&gt;
&lt;li&gt;An accessible image registry for various operator images (ex. &lt;a href=&#34;https://hub.docker.com/signup&#34;&gt;hub.docker.com&lt;/a&gt;,
&lt;a href=&#34;https://quay.io/&#34;&gt;quay.io&lt;/a&gt;) and be logged in to your command line environment.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;example.com&lt;/code&gt; is used as the registry Docker Hub namespace in these examples.
Replace it with another value if using a different registry or namespace.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/olm-integration/cli-overview#private-bundle-and-catalog-image-registries&#34;&gt;Authentication and certificates&lt;/a&gt; if the registry is private or uses a custom CA.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;steps&#34;&gt;Steps&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a project directory for your project and initialize the project:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;mkdir nginx-operator
&lt;span style=&#34;color:#204a87&#34;&gt;cd&lt;/span&gt; nginx-operator
operator-sdk init --domain example.com --plugins helm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol&gt;
&lt;li&gt;Create a simple nginx API using Helm&amp;rsquo;s built-in chart boilerplate (from &lt;code&gt;helm create&lt;/code&gt;):&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;operator-sdk create api --group demo --version v1alpha1 --kind Nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol&gt;
&lt;li&gt;Build and push your operator&amp;rsquo;s image:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;make docker-build docker-push &lt;span style=&#34;color:#000&#34;&gt;IMG&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;example.com/nginx-operator:v0.0.1&amp;#34;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;olm-deployment&#34;&gt;OLM deployment&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Install &lt;a href=&#34;/docs/olm-integration/tutorial-bundle/#enabling-olm&#34;&gt;OLM&lt;/a&gt;:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;operator-sdk olm install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol&gt;
&lt;li&gt;Bundle your operator, then build and push the bundle image (defaults to &lt;code&gt;example.com/nginx-operator-bundle:v0.0.1&lt;/code&gt;):&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;make bundle &lt;span style=&#34;color:#000&#34;&gt;IMG&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;example.com/nginx-operator:v0.0.1&amp;#34;&lt;/span&gt;
make bundle-build bundle-push &lt;span style=&#34;color:#000&#34;&gt;IMG&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;example.com/nginx-operator:v0.0.1&amp;#34;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol&gt;
&lt;li&gt;Run your bundle. If your bundle image is hosted in a registry that is private and/or
has a custom CA, these &lt;a href=&#34;/docs/olm-integration/cli-overview#private-bundle-and-catalog-image-registries&#34;&gt;configuration steps&lt;/a&gt; must be complete.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;operator-sdk run bundle example.com/nginx-operator-bundle:v0.0.1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol&gt;
&lt;li&gt;Create a sample Nginx custom resource:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;$ kubectl apply -f config/samples/demo_v1alpha1_nginx.yaml
nginx.demo.example.com/nginx-sample created
&lt;/code&gt;&lt;/pre&gt;&lt;ol&gt;
&lt;li&gt;Uninstall the operator:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;operator-sdk cleanup nginx-operator
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;direct-deployment&#34;&gt;Direct deployment&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Deploy your operator:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;make deploy &lt;span style=&#34;color:#000&#34;&gt;IMG&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;example.com/nginx-operator:v0.0.1&amp;#34;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol&gt;
&lt;li&gt;Create a sample Nginx custom resource:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;$ kubectl apply -f config/samples/demo_v1alpha1_nginx.yaml
nginx.demo.example.com/nginx-sample created
&lt;/code&gt;&lt;/pre&gt;&lt;ol&gt;
&lt;li&gt;Uninstall the operator:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;make undeploy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;next-steps&#34;&gt;Next Steps&lt;/h2&gt;
&lt;p&gt;Read the &lt;a href=&#34;/docs/building-operators/helm/tutorial/&#34;&gt;full tutorial&lt;/a&gt; for an in-depth walkthrough of building a Helm operator.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/building-operators/helm/migration/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/building-operators/helm/migration/</guid>
      <description>
        
        
        &lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;
&lt;p&gt;The motivations for the new layout are related to bringing more flexibility to users and part of the process to Integrating Kubebuilder and Operator SDK. Because of this integration you may be referred to the Kubebuilder documentation &lt;a href=&#34;https://book.kubebuilder.io/&#34;&gt;https://book.kubebuilder.io/&lt;/a&gt; for more information about certain topics. When using this document just remember to replace &lt;code&gt;$ kubebuilder &amp;lt;command&amp;gt;&lt;/code&gt; with &lt;code&gt;$ operator-sdk &amp;lt;command&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; It is recommended that you have your project upgraded to the latest SDK v1.y release version before following the steps in this guide to migrate to the new layout. However, the steps might work from previous versions as well. In this case, if you find an issue which is not covered here then check the previous &lt;a href=&#34;/docs/upgrading-sdk-version/&#34;&gt;Migration Guides&lt;/a&gt; which might help out.&lt;/p&gt;
&lt;h3 id=&#34;what-was-changed&#34;&gt;What was changed&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;deploy&lt;/code&gt; directory was replaced with the &lt;code&gt;config&lt;/code&gt; directory including a new layout of Kubernetes manifests files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CRD manifests in &lt;code&gt;deploy/crds/&lt;/code&gt; are now in &lt;code&gt;config/crd/bases&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;CR manifests in &lt;code&gt;deploy/crds/&lt;/code&gt; are now in &lt;code&gt;config/samples&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Controller manifest &lt;code&gt;deploy/operator.yaml&lt;/code&gt; is now in &lt;code&gt;config/manager/manager.yaml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;RBAC manifests in &lt;code&gt;deploy&lt;/code&gt; are now in &lt;code&gt;config/rbac/&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;build/Dockerfile&lt;/code&gt; is moved to &lt;code&gt;Dockerfile&lt;/code&gt; in the project root directory&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;what-is-new&#34;&gt;What is new&lt;/h3&gt;
&lt;p&gt;Scaffolded projects now use:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/kustomize&#34;&gt;kustomize&lt;/a&gt; to manage Kubernetes resources needed to deploy your operator&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;Makefile&lt;/code&gt; with helpful targets for build, test, and deployment, and to give you flexibility to tailor things to your project&amp;rsquo;s needs&lt;/li&gt;
&lt;li&gt;Updated metrics configuration using &lt;a href=&#34;https://github.com/brancz/kube-rbac-proxy&#34;&gt;kube-auth-proxy&lt;/a&gt;, a &lt;code&gt;--metrics-bind-address&lt;/code&gt; flag, and &lt;a href=&#34;https://github.com/kubernetes-sigs/kustomize&#34;&gt;kustomize&lt;/a&gt;-based deployment of a Kubernetes &lt;code&gt;Service&lt;/code&gt; and prometheus operator &lt;code&gt;ServiceMonitor&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Preliminary support for CLI plugins. For more info see the [plugins design document][plugins-phase1-design-doc]&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;PROJECT&lt;/code&gt; configuration file to store information about GVKs, plugins, and help the CLI make decisions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Generated files with the default API versions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;apiextensions/v1&lt;/code&gt; for generated CRDs (&lt;code&gt;apiextensions/v1beta1&lt;/code&gt; was deprecated in Kubernetes &lt;code&gt;1.16&lt;/code&gt; and will be removed in &lt;code&gt;1.22&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;admissionregistration.k8s.io/v1&lt;/code&gt; for webhooks (&lt;code&gt;admissionregistration.k8s.io/v1beta1&lt;/code&gt; was deprecated in Kubernetes &lt;code&gt;1.16&lt;/code&gt; and will be removed in &lt;code&gt;1.22&lt;/code&gt; )&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;how-to-migrate&#34;&gt;How to migrate&lt;/h2&gt;
&lt;p&gt;The easy migration path is to initialize a new project, re-recreate APIs, then copy pre-v1.0.0 configuration files into the new project.&lt;/p&gt;
&lt;h3 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Go through the &lt;a href=&#34;/docs/building-operators/helm/installation&#34;&gt;installation guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Make sure your user is authorized with &lt;code&gt;cluster-admin&lt;/code&gt; permissions.&lt;/li&gt;
&lt;li&gt;An accessible image registry for various operator images (ex. &lt;a href=&#34;https://hub.docker.com/signup&#34;&gt;hub.docker.com&lt;/a&gt;,
&lt;a href=&#34;https://quay.io/&#34;&gt;quay.io&lt;/a&gt;) and be logged in to your command line environment.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;example.com&lt;/code&gt; is used as the registry Docker Hub namespace in these examples.
Replace it with another value if using a different registry or namespace.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/olm-integration/cli-overview#private-bundle-and-catalog-image-registries&#34;&gt;Authentication and certificates&lt;/a&gt; if the registry is private or uses a custom CA.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;creating-a-new-project&#34;&gt;Creating a new project&lt;/h3&gt;
&lt;p&gt;In Kubebuilder-style projects, CRD groups are defined using two different flags
(&lt;code&gt;--group&lt;/code&gt; and &lt;code&gt;--domain&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;When we initialize a new project, we need to specify the domain that &lt;em&gt;all&lt;/em&gt; APIs in
our project will share, so before creating the new project, we need to determine which
domain we&amp;rsquo;re using for the APIs in our existing project.&lt;/p&gt;
&lt;p&gt;To determine the domain, look at the &lt;code&gt;spec.group&lt;/code&gt; field in your CRDs in the
&lt;code&gt;deploy/crds&lt;/code&gt; directory.&lt;/p&gt;
&lt;p&gt;The domain is everything after the first DNS segment. Using &lt;code&gt;demo.example.com&lt;/code&gt; as an
example, the &lt;code&gt;--domain&lt;/code&gt; would be &lt;code&gt;example.com&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s create a new project with the same domain (&lt;code&gt;example.com&lt;/code&gt;):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;mkdir nginx-operator
&lt;span style=&#34;color:#204a87&#34;&gt;cd&lt;/span&gt; nginx-operator
operator-sdk init --plugins&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;helm --domain&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;example.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now that we have our new project initialized, we need to re-create each of our APIs.
Using our API example from earlier (&lt;code&gt;demo.example.com&lt;/code&gt;), we&amp;rsquo;ll use &lt;code&gt;demo&lt;/code&gt; for the
&lt;code&gt;--group&lt;/code&gt; flag.&lt;/p&gt;
&lt;p&gt;For &lt;code&gt;--version&lt;/code&gt; and &lt;code&gt;--kind&lt;/code&gt;, we use &lt;code&gt;spec.versions[0].name&lt;/code&gt; and &lt;code&gt;spec.names.kind&lt;/code&gt;, respectively.&lt;/p&gt;
&lt;p&gt;For each API in the existing project, run:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;operator-sdk create api &lt;span style=&#34;color:#4e9a06&#34;&gt;\
&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&lt;/span&gt;    --group&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;demo &lt;span style=&#34;color:#4e9a06&#34;&gt;\
&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&lt;/span&gt;    --version&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&amp;lt;version&amp;gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;\
&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&lt;/span&gt;    --kind&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&amp;lt;Kind&amp;gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;\
&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&lt;/span&gt;    --helm-chart&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&amp;lt;path_to_existing_project&amp;gt;/helm-charts/&amp;lt;chart&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;migrating-your-custom-resource-samples&#34;&gt;Migrating your Custom Resource samples&lt;/h3&gt;
&lt;p&gt;Update the CR manifests in &lt;code&gt;config/samples&lt;/code&gt; with the values of the CRs in your existing project which are in &lt;code&gt;deploy/crds/&amp;lt;group&amp;gt;_&amp;lt;version&amp;gt;_&amp;lt;kind&amp;gt;_cr.yaml&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;migrating-watchesyaml&#34;&gt;Migrating &lt;code&gt;watches.yaml&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Check if you have custom options in the &lt;code&gt;watches.yaml&lt;/code&gt; file of your existing project. If so, update the new &lt;code&gt;watches.yaml&lt;/code&gt; file to match. In our example, it will look like:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Use the &amp;#39;create api&amp;#39; subcommand to add watches to this file.&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;- &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;group&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;example.com&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;version&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;v1alpha1&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;kind&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;Nginx&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;chart&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;helm-charts/nginx&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#+kubebuilder:scaffold:watch&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Do not remove the &lt;code&gt;+kubebuilder:scaffold:watch&lt;/code&gt; &lt;a href=&#34;https://book.kubebuilder.io/reference/markers.html?highlight=markers#marker-syntax&#34;&gt;marker&lt;/a&gt;. It allows the tool to update the watches file when new APIs are created.&lt;/p&gt;
&lt;h3 id=&#34;checking-rbac-permissions&#34;&gt;Checking RBAC Permissions&lt;/h3&gt;
&lt;p&gt;In your new project, roles are automatically generated in &lt;code&gt;config/rbac/role.yaml&lt;/code&gt;.
If you modified these permissions manually in &lt;code&gt;deploy/role.yaml&lt;/code&gt; in your existing
project, you need to re-apply them in &lt;code&gt;config/rbac/role.yaml&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;New projects are configured to watch all namespaces by default, so they need a &lt;code&gt;ClusterRole&lt;/code&gt; to have the necessary permissions. Ensure that &lt;code&gt;config/rbac/role.yaml&lt;/code&gt; remains a &lt;code&gt;ClusterRole&lt;/code&gt; if you want to retain the default behavior of the new project conventions.&lt;/p&gt;
&lt;!--
todo(camilamacedo86): Create an Ansible operator scope document.
https://github.com/operator-framework/operator-sdk/issues/3447
--&gt;
&lt;p&gt;The following rules were used in earlier versions of helm-operator to automatically create and manage services and servicemonitors for metrics collection. If your operator&amp;rsquo;s charts don&amp;rsquo;t require these rules, they can safely be left out of the new &lt;code&gt;config/rbac/role.yaml&lt;/code&gt; file:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;apiGroups&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- monitoring.coreos.com&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;resources&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- servicemonitors&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;verbs&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- get&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- create&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;apiGroups&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- apps&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;resourceNames&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- nginx-operator&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;resources&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- deployments/finalizers&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;verbs&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;- update&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h5 id=&#34;updating-your-serviceaccount&#34;&gt;Updating your ServiceAccount&lt;/h5&gt;
&lt;p&gt;New Helm projects come with a ServiceAccount &lt;code&gt;controller-manager&lt;/code&gt; in &lt;code&gt;config/rbac/service_account.yaml&lt;/code&gt;.
Your project&amp;rsquo;s RoleBinding and ClusterRoleBinding subjects, and Deployments &lt;code&gt;spec.template.spec.serviceAccountName&lt;/code&gt;
that reference a ServiceAccount already refer to this new name. When you run &lt;code&gt;make deploy&lt;/code&gt;,
your project&amp;rsquo;s name will be prepended to &lt;code&gt;controller-manager&lt;/code&gt;, making it unique within a namespace,
much like your old &lt;code&gt;deploy/service_account.yaml&lt;/code&gt;. If you wish to use the old ServiceAccount,
make sure to update all RBAC bindings and your manager Deployment.&lt;/p&gt;
&lt;h3 id=&#34;configuring-your-operator&#34;&gt;Configuring your Operator&lt;/h3&gt;
&lt;p&gt;If your existing project has customizations in &lt;code&gt;deploy/operator.yaml&lt;/code&gt;, they need to be ported to
&lt;code&gt;config/manager/manager.yaml&lt;/code&gt;. If you are passing custom arguments in your deployment, make sure to also update &lt;code&gt;config/default/auth_proxy_patch.yaml&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Note that the following environment variables are no longer used.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;OPERATOR_NAME&lt;/code&gt; is deprecated. It is used to define the name for a leader election config map. Operator authors should begin using &lt;code&gt;--leader-election-id&lt;/code&gt; instead.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;POD_NAME&lt;/code&gt; was used to enable a particular pod to hold the leader election lock when the Helm operator used the leader for life mechanism. Helm operator now uses controller-runtime&amp;rsquo;s leader with lease mechanism, and &lt;code&gt;POD_NAME&lt;/code&gt; is no longer necessary.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exporting-metrics&#34;&gt;Exporting metrics&lt;/h3&gt;
&lt;p&gt;If you are using metrics and would like to keep them exported you will need to configure
it in the &lt;code&gt;config/default/kustomization.yaml&lt;/code&gt;. Please see the &lt;a href=&#34;https://book.kubebuilder.io/reference/metrics.html?highlight=metr#metrics&#34;&gt;metrics&lt;/a&gt; doc to know how you can perform this setup.&lt;/p&gt;
&lt;p&gt;The default port used by the metric endpoint binds to was changed from &lt;code&gt;:8383&lt;/code&gt; to &lt;code&gt;:8080&lt;/code&gt;. To continue using port &lt;code&gt;8383&lt;/code&gt;, specify &lt;code&gt;--metrics-bind-address=:8383&lt;/code&gt; when you start the operator.&lt;/p&gt;
&lt;h3 id=&#34;verify-the-migration&#34;&gt;Verify the migration&lt;/h3&gt;
&lt;p&gt;The project can now be deployed on cluster by running the command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;make deploy &lt;span style=&#34;color:#000&#34;&gt;IMG&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;example.com/nginx-operator:v0.0.1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can troubleshoot your deployment by checking container logs:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;kubectl logs deployment.apps/nginx-operator-controller-manager -n nginx-operator-system -c manager
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For further steps regarding the deployment of the operator, creation of custom resources, and cleaning up of resources, see the &lt;a href=&#34;/docs/building-operators/helm/tutorial/#run-the-operator&#34;&gt;tutorial&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Helm Operator Tutorial</title>
      <link>/docs/building-operators/helm/tutorial/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/building-operators/helm/tutorial/</guid>
      <description>
        
        
        &lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; If your project was created with an &lt;code&gt;operator-sdk&lt;/code&gt; version prior to &lt;code&gt;v1.0.0&lt;/code&gt;
please &lt;a href=&#34;/docs/building-operators/helm/migration&#34;&gt;migrate&lt;/a&gt;, or consult the &lt;a href=&#34;https://github.com/operator-framework/operator-sdk/tree/v0.19.x/website/content/en/docs/helm/quickstart.md&#34;&gt;legacy docs&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Go through the &lt;a href=&#34;/docs/building-operators/helm/installation&#34;&gt;installation guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Make sure your user is authorized with &lt;code&gt;cluster-admin&lt;/code&gt; permissions.&lt;/li&gt;
&lt;li&gt;An accessible image registry for various operator images (ex. &lt;a href=&#34;https://hub.docker.com/signup&#34;&gt;hub.docker.com&lt;/a&gt;,
&lt;a href=&#34;https://quay.io/&#34;&gt;quay.io&lt;/a&gt;) and be logged in to your command line environment.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;example.com&lt;/code&gt; is used as the registry Docker Hub namespace in these examples.
Replace it with another value if using a different registry or namespace.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/olm-integration/cli-overview#private-bundle-and-catalog-image-registries&#34;&gt;Authentication and certificates&lt;/a&gt; if the registry is private or uses a custom CA.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;
&lt;p&gt;We will create a sample project to let you know how it works and this sample will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create an Nginx Deployment if it doesn&amp;rsquo;t exist&lt;/li&gt;
&lt;li&gt;Ensure that the Deployment size is the same as specified by the Nginx CR spec&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;create-a-new-project&#34;&gt;Create a new project&lt;/h2&gt;
&lt;p&gt;Use the CLI to create a new Helm-based nginx-operator project:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;mkdir nginx-operator
&lt;span style=&#34;color:#204a87&#34;&gt;cd&lt;/span&gt; nginx-operator
operator-sdk init --plugins helm --domain example.com --group demo --version v1alpha1 --kind Nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This creates the nginx-operator project specifically for watching the
Nginx resource with APIVersion &lt;code&gt;demo.example.com/v1alpha1&lt;/code&gt; and Kind
&lt;code&gt;Nginx&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For Helm-based projects, &lt;code&gt;operator-sdk init&lt;/code&gt; also generates the RBAC rules
in &lt;code&gt;config/rbac/role.yaml&lt;/code&gt; based on the resources that would be deployed by the
chart&amp;rsquo;s default manifest. Be sure to double check that the rules generated
in &lt;code&gt;config/rbac/role.yaml&lt;/code&gt; meet the operator&amp;rsquo;s permission requirements.&lt;/p&gt;
&lt;p&gt;To learn more about the project directory structure, see the
&lt;a href=&#34;/docs/overview/project-layout&#34;&gt;project layout&lt;/a&gt; doc.&lt;/p&gt;
&lt;h3 id=&#34;use-an-existing-chart&#34;&gt;Use an existing chart&lt;/h3&gt;
&lt;p&gt;Instead of creating your project with a boilerplate Helm chart, you can also use &lt;code&gt;--helm-chart&lt;/code&gt;, &lt;code&gt;--helm-chart-repo&lt;/code&gt;, and &lt;code&gt;--helm-chart-version&lt;/code&gt; to use an existing chart, either from your local filesystem or a remote chart repository.&lt;/p&gt;
&lt;p&gt;If &lt;code&gt;--helm-chart&lt;/code&gt; is specified, the &lt;code&gt;--group&lt;/code&gt;, &lt;code&gt;--version&lt;/code&gt;, and &lt;code&gt;--kind&lt;/code&gt; flags become optional. If left unset, the default will be:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th align=&#34;left&#34;&gt;Flag&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td align=&#34;left&#34;&gt;domain&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;my.domain&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&#34;left&#34;&gt;group&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;charts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&#34;left&#34;&gt;kind&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;deduce from the specified chart&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&#34;left&#34;&gt;version&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;v1alpha1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;If &lt;code&gt;--helm-chart&lt;/code&gt; is a local chart archive (e.g &lt;code&gt;example-chart-1.2.0.tgz&lt;/code&gt;) or directory,
it will be validated and unpacked or copied into the project.&lt;/p&gt;
&lt;p&gt;Otherwise, the SDK will attempt to fetch the specified helm chart from a remote repository.&lt;/p&gt;
&lt;p&gt;If a custom repository URL is not specified by &lt;code&gt;--helm-chart-repo&lt;/code&gt;, the following chart reference formats are supported:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;repoName&amp;gt;/&amp;lt;chartName&amp;gt;&lt;/code&gt;: Fetch the helm chart named &lt;code&gt;chartName&lt;/code&gt; from the helm
chart repository named &lt;code&gt;repoName&lt;/code&gt;, as specified in the
&lt;code&gt;$HELM_HOME/repositories/repositories.yaml&lt;/code&gt; file.
Use &lt;a href=&#34;https://helm.sh/docs/helm/helm_repo_add&#34;&gt;&lt;code&gt;helm repo add&lt;/code&gt;&lt;/a&gt; to configure this file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;url&amp;gt;&lt;/code&gt;: Fetch the helm chart archive at the specified URL.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If a custom repository URL is specified by &lt;code&gt;--helm-chart-repo&lt;/code&gt;, the only supported format for &lt;code&gt;--helm-chart&lt;/code&gt; is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;chartName&amp;gt;&lt;/code&gt;: Fetch the helm chart named &lt;code&gt;chartName&lt;/code&gt; in the helm chart repository
specified by the &lt;code&gt;--helm-chart-repo&lt;/code&gt; URL.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If &lt;code&gt;--helm-chart-version&lt;/code&gt; is not set, the SDK will fetch the latest available version of the helm chart. Otherwise, it will fetch the specified version. The option &lt;code&gt;--helm-chart-version&lt;/code&gt; is not used when &lt;code&gt;--helm-chart&lt;/code&gt; itself refers to a specific version, for example when it is a local path or a URL.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; For more details and examples run &lt;code&gt;operator-sdk init --plugins helm --help&lt;/code&gt;.&lt;/p&gt;
&lt;!--
todo(camilamacedo86): Create an Ansible operator scope document.
https://github.com/operator-framework/operator-sdk/issues/3447
--&gt;
&lt;h2 id=&#34;customize-the-operator-logic&#34;&gt;Customize the operator logic&lt;/h2&gt;
&lt;p&gt;For this example the nginx-operator will execute the following
reconciliation logic for each &lt;code&gt;Nginx&lt;/code&gt; Custom Resource (CR):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create an nginx Deployment if it doesn&amp;rsquo;t exist&lt;/li&gt;
&lt;li&gt;Create an nginx Service if it doesn&amp;rsquo;t exist&lt;/li&gt;
&lt;li&gt;Create an nginx Ingress if it is enabled and doesn&amp;rsquo;t exist&lt;/li&gt;
&lt;li&gt;Ensure that the Deployment, Service, and optional Ingress match the desired configuration (e.g. replica count, image, service type, etc) as specified by the &lt;code&gt;Nginx&lt;/code&gt; CR&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;watch-the-nginx-cr&#34;&gt;Watch the Nginx CR&lt;/h3&gt;
&lt;p&gt;By default, the nginx-operator watches &lt;code&gt;Nginx&lt;/code&gt; resource events as shown
in &lt;code&gt;watches.yaml&lt;/code&gt; and executes Helm releases using the specified chart:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;# Use the &amp;#39;create api&amp;#39; subcommand to add watches to this file.&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;- &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;group&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;demo&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;version&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;v1alpha1&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;kind&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;Nginx&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;chart&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;helm-charts/nginx&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#+kubebuilder:scaffold:watch&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;reviewing-the-nginx-helm-chart&#34;&gt;Reviewing the Nginx Helm Chart&lt;/h3&gt;
&lt;p&gt;When a Helm operator project is created, the SDK creates an example Helm chart
that contains a set of templates for a simple Nginx release.&lt;/p&gt;
&lt;p&gt;For this example, we have templates for deployment, service, and ingress
resources, along with a &lt;code&gt;NOTES.txt&lt;/code&gt; template, which Helm chart developers use
to convey helpful information about a release.&lt;/p&gt;
&lt;p&gt;If you aren&amp;rsquo;t already familiar with Helm Charts, take a moment to review
the &lt;a href=&#34;https://helm.sh/docs/topics/charts/&#34;&gt;Helm Chart developer documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;understanding-the-nginx-cr-spec&#34;&gt;Understanding the Nginx CR spec&lt;/h3&gt;
&lt;p&gt;Helm uses a concept called &lt;a href=&#34;https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing&#34;&gt;values&lt;/a&gt; to provide customizations
to a Helm chart&amp;rsquo;s defaults, which are defined in the Helm chart&amp;rsquo;s &lt;code&gt;values.yaml&lt;/code&gt;
file.&lt;/p&gt;
&lt;p&gt;Overriding these defaults is as simple as setting the desired values in the CR
spec. Let&amp;rsquo;s use the number of replicas as an example.&lt;/p&gt;
&lt;p&gt;First, inspecting &lt;code&gt;helm-charts/nginx/values.yaml&lt;/code&gt;, we see that the chart has a
value called &lt;code&gt;replicaCount&lt;/code&gt; and it is set to &lt;code&gt;1&lt;/code&gt; by default. If we want to have
2 nginx instances in our deployment, we would need to make sure our CR spec
contained &lt;code&gt;replicaCount: 2&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Update &lt;code&gt;config/samples/demo_v1alpha1_nginx.yaml&lt;/code&gt; to look like the following:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;demo.example.com/v1alpha1&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;kind&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;Nginx&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;metadata&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;nginx-sample&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;spec&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;replicaCount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Similarly, we see that the default service port is set to &lt;code&gt;80&lt;/code&gt;, but we would
like to use &lt;code&gt;8080&lt;/code&gt;, so we&amp;rsquo;ll again update &lt;code&gt;config/samples/demo_v1alpha1_nginx.yaml&lt;/code&gt;
by adding the service port override:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;demo.example.com/v1alpha1&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;kind&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;Nginx&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;metadata&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;nginx-sample&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;spec&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;replicaCount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;service&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;port&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;8080&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8;text-decoration:underline&#34;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you may have noticed, the Helm operator simply applies the entire spec as if
it was the contents of a values file, just like &lt;code&gt;helm install -f ./overrides.yaml&lt;/code&gt;
works.&lt;/p&gt;
&lt;h2 id=&#34;configure-the-operators-image-registry&#34;&gt;Configure the operator&amp;rsquo;s image registry&lt;/h2&gt;
&lt;p&gt;All that remains is to build and push the operator image to the desired image registry.
Your Makefile composes image tags either from values written at project initialization or from the CLI.
In particular, &lt;code&gt;IMAGE_TAG_BASE&lt;/code&gt; lets you define a common image registry, namespace, and partial name
for all your image tags. Update this to another registry and/or namespace if the current value is incorrect.
Afterwards you can update the &lt;code&gt;IMG&lt;/code&gt; variable definition like so:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;color:#a40000&#34;&gt;-IMG ?= controller:latest
&lt;/span&gt;&lt;span style=&#34;color:#a40000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+IMG ?= $(IMAGE_TAG_BASE):$(VERSION)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once done, you do not have to set &lt;code&gt;IMG&lt;/code&gt; or any other image variable in the CLI. The following command will
build and push an operator image tagged as &lt;code&gt;example.com/nginx-operator:v0.0.1&lt;/code&gt; to Docker Hub:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;make docker-build docker-push
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;run-the-operator&#34;&gt;Run the operator&lt;/h2&gt;
&lt;p&gt;There are three ways to run the operator:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;As a Go program outside a cluster&lt;/li&gt;
&lt;li&gt;As a Deployment inside a Kubernetes cluster&lt;/li&gt;
&lt;li&gt;Managed by the &lt;a href=&#34;/docs/olm-integration/tutorial-bundle/#enabling-olm&#34;&gt;Operator Lifecycle Manager (OLM)&lt;/a&gt; in &lt;a href=&#34;/docs/olm-integration/tutorial-bundle&#34;&gt;bundle&lt;/a&gt; format&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;1-run-locally-outside-the-cluster&#34;&gt;1. Run locally outside the cluster&lt;/h3&gt;
&lt;p&gt;Execute the following command, which installs your CRDs and runs the manager locally:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;make install run
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;2-run-as-a-deployment-inside-the-cluster&#34;&gt;2. Run as a Deployment inside the cluster&lt;/h3&gt;
&lt;p&gt;By default, a new namespace is created with the name &lt;code&gt;&amp;lt;project-name&amp;gt;-system&lt;/code&gt;, ex. &lt;code&gt;nginx-operator-system&lt;/code&gt;, and will be used for the deployment.&lt;/p&gt;
&lt;p&gt;Run the following to deploy the operator. This will also install the RBAC manifests from &lt;code&gt;config/rbac&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;make deploy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Verify that the nginx-operator is up and running:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;$ kubectl get deployment -n nginx-operator-system
NAME                                    READY   UP-TO-DATE   AVAILABLE   AGE
nginx-operator-controller-manager   1/1     1            1           8m
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;3-deploy-your-operator-with-olm&#34;&gt;3. Deploy your Operator with OLM&lt;/h3&gt;
&lt;p&gt;First, install &lt;a href=&#34;/docs/olm-integration/tutorial-bundle/#enabling-olm&#34;&gt;OLM&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;operator-sdk olm install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Bundle your operator, then build and push the bundle image. The &lt;code&gt;bundle&lt;/code&gt; target generates a [bundle][doc-bundle]
in the &lt;code&gt;bundle&lt;/code&gt; directory containing manifests and metadata defining your operator.
&lt;code&gt;bundle-build&lt;/code&gt; and &lt;code&gt;bundle-push&lt;/code&gt; build and push a bundle image defined by &lt;code&gt;bundle.Dockerfile&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;make bundle bundle-build bundle-push
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, run your bundle. If your bundle image is hosted in a registry that is private and/or
has a custom CA, these &lt;a href=&#34;/docs/olm-integration/cli-overview#private-bundle-and-catalog-image-registries&#34;&gt;configuration steps&lt;/a&gt; must be completed.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;operator-sdk run bundle example.com/nginx-operator-bundle:v0.0.1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Check out the &lt;a href=&#34;/docs/olm-integration/tutorial-bundle&#34;&gt;docs&lt;/a&gt; for a deep dive into the &lt;code&gt;operator-sdk&lt;/code&gt;&#39;s OLM integration.&lt;/p&gt;
&lt;h2 id=&#34;create-a-nginx-cr&#34;&gt;Create a Nginx CR&lt;/h2&gt;
&lt;p&gt;Create the nginx CR that we modified earlier:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;kubectl apply -f config/samples/demo_v1alpha1_nginx.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ensure that the nginx-operator creates the deployment for the CR:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;$ kubectl get deployment
NAME           READY   UP-TO-DATE   AVAILABLE   AGE
nginx-sample   2/2     2            2           2m13s
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check the pods to confirm 2 replicas were created:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;$ kubectl get pods
NAME                                                   READY   STATUS    RESTARTS   AGE
nginx-sample-c786bfdcf-4g6md                           1/1     Running   0          81s
nginx-sample-c786bfdcf-6bhmx                           1/1     Running   0          81s
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check that the service port is set to &lt;code&gt;8080&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;$ kubectl get service
NAME                                      TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
nginx-sample                              ClusterIP   10.96.26.3   &amp;lt;none&amp;gt;        8080/TCP   1m
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;update-the-replicacount-and-remove-the-port&#34;&gt;Update the replicaCount and remove the port&lt;/h3&gt;
&lt;p&gt;Change the &lt;code&gt;spec.replicaCount&lt;/code&gt; field from 2 to 3, remove the &lt;code&gt;spec.service&lt;/code&gt;
field:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;$ cat config/samples/demo_v1alpha1_nginx.yaml
apiVersion: demo.example.com/v1alpha1
kind: Nginx
metadata:
  name: nginx-sample
spec:
  replicaCount: 3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And apply the change:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;kubectl apply -f config/samples/demo_v1alpha1_nginx.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Confirm that the operator changes the deployment size:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;$ kubectl get deployment
NAME                                           DESIRED   CURRENT   UP-TO-DATE     AGE
nginx-sample                                   3/3       3            3           7m29s
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check that the service port is set to the default (&lt;code&gt;80&lt;/code&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;$ kubectl get service
NAME                                      TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)  AGE
nginx-sample                              ClusterIP   10.96.152.76    &amp;lt;none&amp;gt;        80/TCP   7m54s
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;troubleshooting&#34;&gt;Troubleshooting&lt;/h3&gt;
&lt;p&gt;Use the following command to check the operator logs.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;kubectl logs deployment.apps/nginx-operator-controller-manager  -n nginx-operator-system -c manager
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use the following command to check the CR status and events.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;kubectl describe nginxes.demo.example.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;cleanup&#34;&gt;Cleanup&lt;/h3&gt;
&lt;p&gt;Clean up the resources:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;kubectl delete -f config/samples/demo_v1alpha1_nginx.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Make sure the above custom resource has been deleted before proceeding to
run &lt;code&gt;make undeploy&lt;/code&gt;, as helm-operator&amp;rsquo;s controller adds finalizers to the custom resources.
Otherwise your cluster may have dangling custom resource objects that cannot be deleted.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;make undeploy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;p&gt;Next, check out the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Operator packaging and distribution with &lt;a href=&#34;/docs/olm-integration&#34;&gt;OLM&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&#34;/docs/building-operators/helm/reference/advanced_features&#34;&gt;advanced features&lt;/a&gt; doc for more use cases and under-the-hood details.&lt;/li&gt;
&lt;/ol&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: Reference for Helm-based Operators</title>
      <link>/docs/building-operators/helm/reference/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/building-operators/helm/reference/</guid>
      <description>
        
        
        
      </description>
    </item>
    
  </channel>
</rss>
