<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Julian OI on Medium]]></title>
        <description><![CDATA[Stories by Julian OI on Medium]]></description>
        <link>https://medium.com/@j2joi.w?source=rss-46b5d958313e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Julian OI on Medium</title>
            <link>https://medium.com/@j2joi.w?source=rss-46b5d958313e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:54:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@j2joi.w/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Granular RBAC access with Verrazzano]]></title>
            <link>https://medium.com/verrazzano/granular-rbac-access-with-verrazzano-1e6dd236c839?source=rss-46b5d958313e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e6dd236c839</guid>
            <category><![CDATA[verrazzano]]></category>
            <dc:creator><![CDATA[Julian OI]]></dc:creator>
            <pubDate>Wed, 14 Jun 2023 12:02:59 GMT</pubDate>
            <atom:updated>2023-06-26T04:02:01.387Z</atom:updated>
            <content:encoded><![CDATA[<p>In this short blog, I will be sharing a step-by-step guide on how to grant users/groups created in <strong>Verrazzano User Management Console</strong> granular RBAC access to in resources in <strong>Verrazzano Infrastructure Management Console</strong> and <strong>Verrazzano GitOps</strong> tool.</p><p><strong>TLDR;</strong></p><p>1. Create custom Groups in <strong>Verrazzano User Management Console</strong> -Keycloak.</p><p>2. Map Groups from external Identity Provider to Keycloak groups <em>(if users are stored outside Verrazzano)</em></p><p>3. Create a custom RoleTemplate in <strong>Verrazzano Infrastructure Management</strong> tool -Rancher- with specific permissions to manage Verrazzano clusters resources</p><p>4. Assign custom RoleTemplate in Rancher to groups created in Keycloak.</p><p>5. Define custom permissions in <strong><em>Verrazzano GitOps -</em></strong><em>ArgoCD- following </em>RBAC permission structure : p, &lt;role/user/group&gt;, &lt;resource&gt;, &lt;action&gt;, &lt;object&gt;</p><p>6. Add policy.csv values to ArgoCD overrides in Verrazzano Custom Resource.</p><pre>argoCD:<br>        enabled: true<br>        overrides:<br>        - values:<br>            configs:<br>              cm:<br>                exec.enabled: true<br>              rbac:<br>                policy.csv: |<br>                  p, role:staging-dev-admins, applications, create, dev-project/*, allow<br>                  p, role:staging-dev-admins, exec, create, dev-project/*, allow<br>                  g, ACME-project-key, role:staging-dev-admins</pre><h3><strong>Intro</strong></h3><p>In<em> Verrazzano -at least in version 1.5.x- </em>user management is accomplished by mapping individual <em>roles</em> and <em>groups</em> to a specific set of <em>users </em>in Keycloak. User information can be stored either locally or delegated to an external user store. In the example presented in this blog, Keycloak is configured as an Identity Broker with <strong><em>Oracle Cloud Infrastructure Identity Cloud Service</em></strong> as an Identity Provider. Remember that Verrazzano can be integrated with any Identity Provider that supports SAML v2.0, OpenID Connect v1.0, OAuth 2.0.</p><p>Once users and groups are defined, granular RBAC access is configured based on scopes included in the authentication token sent when using OAuth 2.0 framework. In other words, Keycloak will attach a list of groups, a user belongs to, in the request to access a resource in ArgoCD or Rancher or any Verrazzano Console that is enabled during install. Then, each console will have its own group mapping to limit its own resources.</p><p>Below is a very high level diagram of how groups scopes are passed down to each tool. One of key feature in Verrazzano is that it comes pre-configured<em> </em>to<em> </em>authenticate users using OpenID Connect (OIDC) PKCE flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*L6ElhzJxHkuzYv3Gwa3Dyw.jpeg" /></figure><p>Note that using an external Identity Provider is not a must for granting granular permissions, but is a very common use case.</p><p>Let’s start with Keycloak groups.</p><p><strong>Create Custom Groups in Keycloak</strong></p><ul><li>Login to KeyCloak with <strong><em>keycloakadmin</em></strong></li><li>Create a Group Structure under <strong><em>verrazzano-system</em> </strong>Realm</li><li>Create a group named <strong><em>ACME</em></strong> with a child group <strong>ACME-DevOpsGroups</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8xzQIkaCNWzHT5TGZmTm8w.png" /></figure><ul><li>Select Members tab and add <em>verrazzano</em> admin user to custom Group created (ACME-DevOpsGroup)</li></ul><p><strong>2)</strong> <strong>Map Groups from external Identity Provider to Keycloak group</strong></p><p>If your Keycloak is configured to store user information locally, you can skip to step 3.</p><p>For reference on how to configure OCI IDCS, see : <a href="https://blogs.oracle.com/coretec/post/coupling-keycloak-and-oracle-cloud-iam-domains">coupling-keycloak-and-oracle-cloud-iam-domains</a></p><p>In Keycloak, go to <strong>Identity providers </strong>and create an identity provider configuration under <strong><em>verrazzano-system</em></strong><em> </em>realm.</p><p>For fields:</p><ul><li><strong><em>Alias:</em></strong> <em>oidc</em></li><li><strong><em>Display Name</em>:</strong> Any name will do.. Let’s say “<em>Employee Login</em>”</li><li><strong><em>Discovery Endpoint, Client authentication, Client ID, Client Secret</em></strong> values are to retrieved from the Confidential Application configured in OCI IDCS. see : <a href="https://blogs.oracle.com/coretec/post/coupling-keycloak-and-oracle-cloud-iam-domains">coupling-keycloak-and-oracle-cloud-iam-domains</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y6TekwJxKxYE808yhaVCwA.png" /></figure><p>Select Tab “Mappers” and proceed to create a Group Mapper for the recently created OpenID configuration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*RenNN51KJTdvyYO4G-NJuQ.png" /></figure><ul><li>Set Name</li><li>Set Sync Mode override : <strong>Force</strong></li><li>Set Mapper type: “Advanced Claim to Group”</li></ul><p>For Oracle OCI IDCS, set Claims Key to <strong><em>groups[0].name</em> </strong>and <strong><em>Claims Value</em></strong> to the group name that will be federated from the configured IDp. It has to match exactly . In the image below, note that you have to replace GROUP_NAME_FROM_OCI with your group name.</p><p>· Select a Group created in Item 1 ( Acme-DevOpsGroup)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BBU-I9_u7PhgnmPAKU39ig.png" /></figure><h3><strong>Grant Access to specific resources in Rancher.</strong></h3><p>A Rancher Custom Cluster Role can be tailored to grant specific access to resources in a registered Kubernetes cluster. In this example, we are enforcing a single cluster access policy to pods and namespaces resources, but you can customized further depending on your own requirements.</p><p>Go to Rancher Dashboard and Authenticate with <em>Verrazzano</em> SSO user. It is important to authenticate with a user who has been federated from Keycloak, otherwise groups created in the first step <strong>will not</strong> be listed.</p><ul><li>Click on <strong><em>Users &amp; Authentication</em></strong></li><li>Click on “<strong><em>Roles</em></strong>”</li><li>Select “<strong><em>Cluster”</em></strong> tab in the Center Pane</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*h-5t0l5JWds9KpDEgVFCPA.png" /></figure><ul><li>Select the option to “<strong><em>Create Cluster Role</em></strong>” in the upper right cornet</li><li><strong>Name</strong>: “ACME-DevOps-ClusterRole”</li><li><strong>Description</strong>: “ACME-DevOps-ClusterRole Description”</li><li><strong>Cluster Creator Default</strong>: No</li><li><strong>Locked</strong>: No</li><li>In<strong><em> Grants Resources</em></strong> section: The assumption is that members of a DevOps Team should only have access to do CRUD operations on <em>Pods, Persistentvolumes</em>, and list <em>namespaces </em>only.</li></ul><p>You can add more grants and customized further depending on your requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XPM1WJBJEbaEwRJcX0WL9g.png" /></figure><p><strong>Assign custom RoleTemplate to imported Keycloak group.</strong></p><p>There is two options to assign a RoleTemplate to a user; either by assigning a Global Role or via Cluster Member option.</p><p><strong>Option 1: Cluster Members</strong></p><ul><li>Go to Rancher Dashboard. Login with <strong><em>Verrazzano</em></strong> SSO user.</li><li>Click on <strong><em>Explore Cluster</em></strong>, and select <strong><em>Local</em></strong> cluster.</li><li>Select<strong><em> Cluster and Project Members</em></strong></li><li>Click on <strong><em>“Add”</em></strong> to include a new Cluster Member.</li></ul><p>At this point, all ACME groups created in Keycloak should be added to Rancher automatically. Those groups will be visible in the <strong><em>Select Member </em></strong>drop-down field.</p><p>Select <strong>ACME-DevOpsGroup</strong> and choose the newly created Cluster Role Template <strong>ACME-DevOps-ClusterRole</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*y1_bZXigwC3kAXA2zwkX4g.png" /></figure><p>Users that belong to Group Acme-DevOpsGroup should be able to login and only have access to resources specified in custom RoleTemplate. In this case, CRUD operations on Pods and list namespaces only.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mL8Jw6tcrDIdraLdOfV4ww.png" /></figure><p><strong>Option 2: Assign Global Roles To Groups.</strong></p><p>a) Go to Rancher Dashboard and go to <strong>Users &amp; Authentication Groups</strong>.</p><p>b) Click on <strong><em>Groups</em></strong></p><p>c) Go to the upper right corner and click on <strong>Assign Global Roles</strong> .</p><p>d) From “<strong>Select Member</strong>” drop-down — you should see all Keycloak Groups — select <strong><em>ACME-DevOpsGroup/ Keycloak group</em></strong>. This group should be a child group.</p><p>e) From <strong><em>Global Permission </em></strong>section, select <strong><em>Standard User</em></strong> or if you want to be more restrictive, select <strong><em>User-Base</em></strong></p><p>f) From <strong><em>Built-in</em></strong> section, select <strong><em>DevOpsLocalClusterRole</em></strong> (<em>Roles not created by Verrazzano</em>) that was created at the beginning of this section.</p><p>At this point, All resources required to federate Keycloak groups into Rancher should have been created. Next, testing…</p><p><strong>Testing RoleTemplate with Keycloak Groups</strong></p><p>To test and validate that a given federated user is constraint based on an assigned RoleTemplate, open an new browser window ( or a private tab) to make sure JWT tokens/sessions are not stored from previous VZ dashboard logins</p><ul><li>Go to Rancher Dashboard. Select option to “<strong>Log in with Keycloak”</strong></li><li>Select the external Identity Provider configured in Keycloak. i.e <em>Employee Login</em></li><li>Provide the user credentials for your external identity provider. In this example, OCI IDCS authorization form is displayed.</li></ul><p>At this point the user should only be able to list the resources that the mapped grouped was allowed to. Compare an Admin user options displayed when user authenticated is an admin user vs a user who belongs to the group ACME-DevOps-group in Keyclaok.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*9roKXTHB9-hwkX5DEv_eNA.png" /></figure><h3><strong>Restricting access in ArgoCD</strong></h3><p>Next in line is ArgoCD. This GitOps Tool, pre-configured with Verrazano, is regularly used by developers to deploy applications in a Verrazzano managed cluster. It is imperative to limit how much access a given developer has to avoid messing up with production or somebody else deployments. Furthermore, ArgoCD has a single super-privilege user built-in out of the box.</p><p>To limit access you have to follow ArgoCD’s Permission structure:</p><blockquote><strong>RBAC Permission Structure</strong></blockquote><blockquote>All resources <em>except</em> application-specific permissions (see next bullet):</blockquote><blockquote>p, &lt;role/user/group&gt;, &lt;resource&gt;, &lt;action&gt;, &lt;object&gt;</blockquote><blockquote>Applications, applicationsets, logs, and exec (which belong to an AppProject):</blockquote><blockquote>p, &lt;role/user/group&gt;, &lt;resource&gt;, &lt;action&gt;, &lt;appproject&gt;/&lt;object&gt;</blockquote><p><em>Resources</em> can be clusters, applications, repositories, etc. A complete list of resources and action is well described in <a href="https://argo-cd.readthedocs.io/en/stable/operator-manual/rbac/">ArgoCD’s documentation</a>.</p><p>Once you have the idea of the RBAC structure you want to set, you can define them in Verrazzano Custom Resource as an override value under configs to<em> policy.csv </em>attribute similar to :</p><pre>spec:<br>  components:<br>    argoCD:<br>      enabled: true<br>      overrides:<br>      - values:<br>          configs:<br>            rbac:<br>              policy.csv: |<br>                p, role:staging-dev-admins, applications, create, dev-project/*, allow<br>                p, role:staging-dev-admins, exec, create, dev-project/*, allow<br>                g, ACME-DevOpsGroups, role:staging-dev-admins</pre><p>The snippet above defines ACME-DevOps-Group group example created in Keycloak and “broadcasted” to every Verrazzano Console.</p><p>In order to limit the access to ACME-DevOps-Group to a set of resources, we are mapping it to <strong><em>staging-dev-admins </em></strong>custom role<strong><em>.</em></strong> Permissions to this role where limited to “<em>create</em>” actions on any application and “<em>exec</em>” privileges to pods created under <strong><em>dev-project </em></strong><em>project.</em></p><p>If your system is already installed, update Verrazzano Custom Resource with snippet code above and then wait for all changes to complete and Verrazzano is back to Ready state.</p><pre>kubectl edit vz <br>kubectl get vz -w</pre><p>Look for any errors in Verrazzano Platform Operator Log.</p><h3>Testing ArgoCD RBAC policies.</h3><p>Testing require you to login to ArgoCD with a user added to ACME-DevOps-Group. Then, attempt to create a project. You should see a similar error message <em>“Unable to create project: permission denied”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*YANwwsZg7KDKTuCjenFXyA.png" /></figure><p>Verrazzano centralizes user management using Keycloak, which makes it easier to have one single place to manage groups and user memberships. Uses OIDC to support Single Sign On across all Open Source Tools which enables Admins/Operators to grant permissions based on RBAC policies defined in each individual Verrazzano Console like Rancher and ArgoCD, to groups and users stored in Keycloak.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e6dd236c839" width="1" height="1" alt=""><hr><p><a href="https://medium.com/verrazzano/granular-rbac-access-with-verrazzano-1e6dd236c839">Granular RBAC access with Verrazzano</a> was originally published in <a href="https://medium.com/verrazzano">Verrazzano</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Authenticate ArgoCD cli with Verrazzano SSO]]></title>
            <link>https://medium.com/verrazzano/authenticate-argocd-cli-with-verrazzano-sso-1fbe422cf2ff?source=rss-46b5d958313e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fbe422cf2ff</guid>
            <category><![CDATA[cncf]]></category>
            <category><![CDATA[openid]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[verrazzano]]></category>
            <dc:creator><![CDATA[Julian OI]]></dc:creator>
            <pubDate>Thu, 20 Apr 2023 22:06:19 GMT</pubDate>
            <atom:updated>2023-04-20T22:06:19.356Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial I am going to show how to authenticate Argo CD Command Line Interface (cli) with <strong>Verrazzano</strong> Single Sign-On user.</p><p>First, a brief explanation on two key Verrazzano components that play a role in this configuration.</p><ul><li>Verrazzano uses <strong>Keycloak</strong> as its primary user store and configures OpenID Connect (OIDC) PKCE to authenticate users for all <em>Verrazzano System Component</em>s such as “Prometheus, Grafana, ArgoCD, Kiali, etc”, providing Verrazzano Administrators a Single Sign On experience. <strong>Keycloak</strong> supports standard protocols OAuth 2.0, OpenID Connect SA ML for authorization and authentication.</li><li><strong>Argo CD</strong> is a GitOps continuous delivery tool. It maintains a desired application state between a git repository and a registered Kubernetes cluster.</li></ul><p>When <strong>Keycloak</strong> and <strong>ArgoCD</strong> are deployed on o vanilla Kubernetes, a user has to invest time learning how to manually configure and secure them. However, when a user chooses to install <em>ArgoCD</em><strong> </strong>and<strong> </strong><em>Keycloak with </em><strong>Verrazzano, </strong>they come preconfigured and wired on your behalf. The only thing you need to do is authenticate using the verrazzano user configured in Keycloak and start deploying your apps. I recommend reading <a href="https://medium.com/verrazzano/intro-to-argocd-in-verrazzano-1-5-0-3972690ad720">Intro to ArgoCD in Verrazzano 1.5.0 </a>blog for more details about ArgoCD.</p><p><strong>ArgoCD CLI.</strong></p><p>Initially users configure their applications, repositories and deployments from ArgoCD UI. But eventually, with automation requirements, many configurations may need to be ran from command line. ArgoCD includes an easy to use CLI to manage almost every resource in ArgoCD server from this tool.</p><p><strong>Download Argo CLI</strong></p><p>ArgoCD includes an easy way to download a compatible cli version with the server installed on Verrazzano. First, collect ArgoCD endpoint.</p><pre>vz status  |grep -i argoCDUrl<br><br>or <br><br>kubectl get vz -o yaml |grep argoCDUrl</pre><p>Open a new browser window/tab with <em>argoCDUrl</em> and click on the option “<em>log in via Keylcoak”</em> as shown in picture below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XNe79ejJsu3CmGXd89IqoA.png" /></figure><p>After submitting the authentication form, click on “<em>Documentation”</em> option. Then click on the button below “<em>Want to download the CLI Tool</em>?” text to download ArgoCD’s cli. The release provided out of the box is compatible with Linux amd64 distros.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*chIQfAIBLJ-Ebi1x_JDf8Q.png" /></figure><p>Download the file, save it and rename it as <em>argocd.</em></p><pre>curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64<br>sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd<br>rm argocd-linux-amd64</pre><p>Make sure you add it to your linux <em>PATH</em>. If you need a different version, you can download it from <strong><em>argoproj</em></strong> repository directly. Follow cli_installation notes at <a href="https://github.com/argoproj/argo-cd/blob/master/docs/cli_installation.md">https://github.com/argoproj/argo-cd/blob/master/docs/cli_installation.md</a></p><p>To confirm installation was successful, type in your terminal `<em>argocd`</em> . It should print out its help menu, similar to the output below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7aekGh_3nWq0XcAwmIL-kw.png" /><figcaption>argocd cli help</figcaption></figure><p>Let’s table this for now, as I want to describe how the authorization flow works, using OpenID + Oauth2 protocol, between <em>ArgoCD server</em>, <em>Verrazzano AuthProxy</em>, <em>Keycloak</em> to authenticate argoCD cli using Single Sign On option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6f3gGPfqEUly-Wtv5gcYDA.jpeg" /><figcaption>SSO Flow</figcaption></figure><ol><li>ArgoCD cli will send a login request to ArgoCD endpoint deployed in Verrazzano.</li></ol><p>2. Verrazzano Auth Proxy will intercept the request and checks if a valid token is associated with the user session before granting access to ArgoCD server. If JWT token is not valid or non existent, it will redirect the client (argoCD cli) to authenticate with <em>Keycloak</em>.</p><p>3. ArgoCD cli only supports browser authentication. It will attempt to open a browser on your workstation if you are running it from the same host it is installed on. Else, it will print a similar output like below. Copy and Paste the url right after “Performing authorization_code flow login:” text.</p><pre> <br>argocd login argocd.default.${domain} --sso         <br>WARNING: server certificate had error: x509: certificate signed by unknown authority. Proceed insecurely (y/n)? y<br>Opening browser for authentication<br>Performing authorization_code flow login: <br>https://keycloak.default.${domain}/auth/realms/verrazzano-system/protocol/openid-connect/auth?access_type=offline&amp;client_id=argocd&amp;code_challenge=_iH0t\<br>&amp;code_challenge_method=S256 \<br>&amp;redirect_uri=http%3A%2F%2Flocalhost%3A8085%2Fauth%2Fcallback&amp;response_type=code \ <br>&amp;scope=openid+profile+email+groups+offline_access\ <br>&amp;state=QsRXxdXePwtCcBfLesfrtPLN</pre><p>4. User will be prompted to login using Verrazzano Single Sign On user and password through a basic Authorization Form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*5rRXDXJsi6GKxtJ6uu6paA.png" /></figure><p>5 . Keycloak will confirm that provided credentials match with an existing user under “<strong><em>verrazzano-system”</em></strong> realm. It also checks wether <strong><em>client_id=argocd</em></strong> exists and compares <strong><em>redirect_uri </em></strong>param<strong><em> </em></strong>value matches any entry in “<em>Valid redirect URI</em>s” list configured under <strong><em>argoCD openID connect </em></strong>client settings.</p><p>6. Keycloak responds with an authorization code.</p><p>7. Browser is redirected to <a href="http://localhost:8085/">http://localhost:8085</a> with this authorization_code. Note that ArgoCD cli starts a simple listening webserver on port 8085. It collects the authorization code passed down by a the browser which will be included in a new request sent to <strong>Keycloak</strong>. If the code is valid, the response to ArgoCD cli will include a JWT token and the end user will be presented with “Authentication successful” page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*jp-lb3Fk32XzYMfzuiHQGw.png" /></figure><p>At this point, ArgoCD cli stores an <strong><em>auth-token </em></strong>and <strong><em>refresh-token</em></strong> in the default config file at <em>$HOME/.config/argocd/config</em></p><pre>contexts:<br>- name: argocd.default.XXX<br>  server: argocd.default.XXX<br>  user: argocd.default.XXX<br>current-context: argocd.default.XXXX<br>servers:<br>- grpc-web-root-path: &quot;&quot;<br>  insecure: true<br>  server: argocd.default.XXXX<br>users:<br>- auth-token: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi.....<br>  name: argocd.default.XXXXX<br>  refresh-token: eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiS......</pre><p>Now, here are the changes needed in “<em>verrazzano-system”</em> realm inside Keycloak to make sure authorization flow happens correctly.</p><p><strong>What needs to change?</strong></p><p>Login to your Keycloak admin console. Authenticate with keycloak <strong>admin</strong> user, not Verrazzano SSO user. Then, select “<em>verrazzano-system</em>” realm from realm drop down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*BOtSSaHYB6hhVEpxggc6bQ.png" /></figure><p>Next, go to <strong><em>Clients</em></strong>, and select <strong><em>argocd</em></strong> from Client list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*uBOzYyX-8Gfjmqg6d1e0Zg.png" /></figure><p>Under <em>argocd</em> <strong><em>Settings</em></strong>, go to “<strong><em>Valid redirect URIs</em></strong>”, and add a new entry with a value of <a href="http://localhost:8085/auth/callback"><strong><em>http://localhost:8085/auth/callback</em></strong></a><strong><em> .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTKIaJPRAjnacxYlCJ22cw.jpeg" /></figure><p>Above step is <strong>key</strong>, otherwise you will run into “<em>invalid parameter: redirect_uri</em>” error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*4IUFpycqofnlR6VG3EaEFA.png" /><figcaption>redirect_uri not authorized</figcaption></figure><p>Next, switch “Client Authentication” to <em>public access</em> from <em>confidential access </em>type by turning it <strong>off</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*ftO6uEQriRjZzeRuT39CHA.png" /></figure><p><strong>Why switching turning it off?</strong></p><p>Here is an excerpt from <a href="https://www.rfc-editor.org/rfc/rfc6749#section-2.1"><strong>Oauth 2 specification</strong></a>, which states the following:</p><blockquote>OAuth defines two client types, based on their ability to<br> authenticate securely with the authorization server (i.e., ability to<br> maintain the confidentiality of their client credentials):<br><br> confidential<br> Clients capable of maintaining the confidentiality of their<br> credentials (e.g., client implemented on a secure server with<br> restricted access to the client credentials), or capable of secure<br> client authentication using other means.<br><br> public<br> Clients incapable of maintaining the confidentiality of their<br> credentials (e.g., clients executing on the device used by the<br> resource owner, such as an installed native application or a web<br> browser-based application), and incapable of secure client<br> authentication via any other means.</blockquote><p>In ArgoCD cli case, it behaves as a client side application and it cannot safely store a secret, thus the use of public client type.</p><p>Be sure to <strong>save</strong> all changes.</p><p>Now you can run $&gt; argocd <em>login</em> and then for example <em>list servers</em> registered in ArgoCD server from command line</p><pre>[~]$ argocd login argocd.default.${DOMAIN} --sso<br>WARNING: server certificate had error: x509: certificate signed by unknown authority. Proceed insecurely (y/n)? y<br>Opening browser for authentication<br>Performing authorization_code flow login: <br>https://keycloak.default.${DOMAIN}/auth/realms/verrazzano-system/protocol/openid-connect/auth?access_type=offline \<br>&amp;client_id=argocd \<br>&amp;code_challenge=_fylBB0bgJwH89sYAAoPCJSKPXQUaqmSOluLd4rGKOs \<br>&amp;code_challenge_method=S256<br>&amp;redirect_uri=http%3A%2F%2Flocalhost%3A8085%2Fauth%2Fcallback<br>&amp;response_type=code<br>&amp;scope=openid+profile+email+groups+offline_access<br>&amp;state=DVbOCHyapLrqwzPoIOoIaqDm<br>Authentication successful<br>&#39;Verrazzano Admin&#39; logged in successfully<br>Context &#39;argocd.default.XXXXXX&#39; updated<br><br>[~]$ argocd cluster list --grpc-web<br>SERVER                          NAME        VERSION  STATUS      MESSAGE  PROJECT<br>https://kubernetes.default.svc  in-cluster  1.24     Successful    </pre><p>It should be working now!</p><p>This blog showed how to enable argoCD cli login with Single Sign On option. An additional <strong>redirect_uri</strong> to <a href="http://localhost:8085/">http://localhost:8085</a> is needed in argocd OIDC client and changing client type. Is important to note that this changes are ment for your Development Environment only.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fbe422cf2ff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/verrazzano/authenticate-argocd-cli-with-verrazzano-sso-1fbe422cf2ff">Authenticate ArgoCD cli with Verrazzano SSO</a> was originally published in <a href="https://medium.com/verrazzano">Verrazzano</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configure AlertManager receivers in Verrazzano]]></title>
            <link>https://medium.com/verrazzano/configure-alertmanager-receivers-in-verrazzano-32b02c3b703f?source=rss-46b5d958313e------2</link>
            <guid isPermaLink="false">https://medium.com/p/32b02c3b703f</guid>
            <category><![CDATA[alertmanager]]></category>
            <category><![CDATA[verrazzano]]></category>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Julian OI]]></dc:creator>
            <pubDate>Tue, 11 Apr 2023 02:02:04 GMT</pubDate>
            <atom:updated>2023-04-18T15:54:33.377Z</atom:updated>
            <content:encoded><![CDATA[<p>Verrazzano includes Prometheus, Grafana and AlertManager to assist sysadmins identifying trends that could eventually evolve into issues. Remember that in Tech, everything can fail and things can go south fast. In this blog, I will be describing the process on how to setup AlertManager to send notifications via Email to alert Developers and/or Operators when something has fallen out of place in your application or infrastructure.</p><p>Prometheus pulls metrics from different components in Verrazzano including, but not limited to Kubernetes Worker Nodes, Kubernetes API endpoints, Application metrics and so on. You can define rules and be alerted when a resource’s behavior breaches your Business policies. When this happens, Prometheus will push alerts to AlertManager, which in turn, determines who should be the receiver of a notification coming in and how to appropriately route it. For our test case, I will be showing you how to configure an SMTP receiver in a Verrazzano alert notification pipeline.</p><p>Enough Intro, let’s get into action.</p><p>Verrazzano configures Prometheus and AlertManager using the community <a href="https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack"><em>kube-prometheus-stack</em></a><em> </em>Helm chart . Chart’s values are defined in your cluster’s Verrazzano Custom Resource under <em>prometheusOperator</em> component. The example below shows a fully working AlertManager configuration, declared as override values, passed internally to the <em>kube-prometheus-stack chart</em> in Verrazzano.</p><pre>apiVersion: install.verrazzano.io/v1beta1<br>kind: Verrazzano<br>metadata:<br>  name: verrazzano<br>  namespace: default  <br>spec:<br>  components:<br>    argoCD:<br>      enabled: true<br>    prometheus:<br>      enabled: true<br>    prometheusOperator:<br>      overrides:<br>        - values:<br>            alertmanager:<br>              enabled: true<br>              alertmanagerSpec:<br>                podMetadata:<br>                  annotations:<br>                    sidecar.istio.io/inject: &quot;false&quot;<br>              config:<br>                global:<br>                  resolve_timeout: 15m<br>                  smtp_auth_password: &lt;YOUR PASS&gt;<br>                  smtp_auth_username: ocid1.user.oc1..aaaaaaaae<br>                  smtp_from: vzalerts@acme.com<br>                  smtp_hello: prometheus.vmi.system.XXXX<br>                  smtp_smarthost: smtp.email.oci.oraclecloud.com:587<br>                receivers:<br>                  - name: &quot;null&quot;<br>                  - name: oci_smtp<br>                    email_configs:<br>                      - to: sysadmin1@acme.com<br>                route:<br>                  group_by:<br>                    - alertname<br>                  receiver: oci_smtp<br>                  repeat_interval: 1h<br>                  routes:<br>                    - match:<br>                        alertname: Watchdog<br>                      receiver: &quot;null&quot;              <br>  profile: dev</pre><p>You can edit the Verrazzano CR in your cluster directly — <em>kubectl edit vz —</em> to match above snippet or apply it through the <em>kubectl</em> <em>apply</em> command line. Either way, it will get you a simple SMTP receiver configured in AlertManager.</p><p>Let’s break it into smaller chunks to explain what each section does.</p><p>First, AlertManager component in Verrazzano 1.5 (<em>latest version at this time</em>) is not enabled by default. To enable it, set “<em>enabled: true</em>” inside <em>prometheusOperartor</em> component. Then, it needs to be excluded from the Istio Service Mesh, as it needs to communicate with Prometheus directly. Setting “<em>sidecar.istio.io/inject: “false</em>” will do the trick. Oh by the way, Verrazzano uses Istio Service Mesh enabled with mTLS to secure all traffic with Applications and Verrazzano System components.</p><pre>prometheusOperator:<br>      overrides:<br>        - values:<br>            alertmanager:<br>              enabled: true<br>              alertmanagerSpec:<br>                podMetadata:<br>                  annotations:<br>                    sidecar.istio.io/inject: &quot;false&quot;</pre><p>Managing alert recipients in AlertManager is accomplished by defining a <em>route </em>section<em>. </em>All incoming Alerts enter the root <em>route</em> . Then the path to a child <em>routes</em> (<em>receiver</em>) is chosen based on a set of filters/matchers. You can define a single <em>route</em> block to catch all alerts or configure multiple child <em>routes</em> block, with different matching criteria, to deliver notifications through different channels.</p><p>In this case, I am opting for a single <em>route</em> block, grouped by <em>alertname</em>, to be sent to a receiver under the attribute <em>name:oci_smtp. </em>In the next section we have to define what type of receiver is <em>oci_smtp. </em>But you can guess based on the name</p><pre>route:<br>                  group_by:<br>                    - alertname<br>                  receiver: oci_smtp<br>                  repeat_interval: 1h<br>                  routes:<br>                    - match:<br>                        alertname: Watchdog<br>                      receiver: &quot;null&quot;</pre><p>Note that Alertmanager has a prebuilt alert<em> “Watchdog” </em>to confirm that the entire notification pipeline is working as expected. It needs to be included. By pairing it with a <em>receiver “null”, </em>we avoid this always-firing alert to be sent out.</p><p><strong>Receivers</strong></p><p>We have linked a <em>route</em> with a <em>receiver. </em>Now, <em>oci_smtp</em> receiver details must be described under “<em>receivers</em>” section. Receivers can reach recipients by email (SMTP), SMS, Slack or Webhooks for custom alerting. We just need to declare its settings within a &lt;<em>service&gt;_configs </em>section<em>.</em></p><p>In our example, <em>oci_smtp</em> single receiver is defined by adding “<em>receivers.name: oci_smtp</em>”. It will be identified as an SMTP reciever by appending <em>“email_configs”</em> attribute and listing one or multiple Email recipients in “<em>receivers.name.email_configs.to[]”.</em></p><p>You can define multiple SMTP receivers by providing each one a unique name for different types of alerts, each receiver can have its own <em>config.receivers.email_configs </em>section<em>. </em>More details about routes, matchers, and all possible combinations in AlertManager <a href="https://prometheus.io/docs/alerting/latest/configuration/"><em>public documentation</em></a>.</p><pre>global:<br>  resolve_timeout: 15m<br>  smtp_auth_password: &lt;YOUR PASS&gt;<br>  smtp_auth_username: ocid1.user.oc1..aaaaaaaae<br>  smtp_from: vzalerts@acme.com<br>  smtp_hello: prometheus.vmi.system.XXXX<br>  smtp_smarthost: smtp.email.oci.oraclecloud.com:587<br>receivers:<br>  - name: &quot;null&quot;<br>  - name: oci_smtp<br>    email_configs:<br>      - to: sysadmin1@acme.com</pre><p>Because we are sending notifications using a single SMTP server, all of its SMTP Service properties were added to <em>config.global</em> section instead of adding them under “<em>config.receivers.name.email_configs”. </em>All<em> global.smtp_*</em> configuration attributes expect standard SMTP Server properties. SMTP user, password, an authorized/approved email sender account — <em>vzalerts@acme.com</em> — , <em>smtp_smarthost</em> as your SMTP server. I have set those values according to my OCI Email Delivery Service. I tested OCI Email Delivery service because it is quick to setup and includes all features email providers offers to send secure emails. See <a href="https://docs.oracle.com/en-us/iaas/Content/Email/Concepts/overview.htm">Email Delivery documentation</a> for more details.</p><p>Next, configure a Prometheus rule to test Alerts in Verrazzano. My suggestion is to start with a simple rule, then progressively customize it until you have your requirement completely covered. With that in mind, this step configures a simple alert in Prometheus to identify resources that are unavailable. The resulting rule defined as “expr: up == 0” uses Prometheus own expression language</p><pre>apiVersion: monitoring.coreos.com/v1<br>kind: PrometheusRule<br>metadata:<br>  labels:<br>    release: prometheus-operator<br>  name: prometheus-operator-test<br>  namespace: verrazzano-monitoring<br>spec:<br>  groups:<br>    - name: mayday_mayday_server_down<br>      rules:<br>        - alert: mayday_service_down<br>          expr:  up == 0<br>          for: 1m<br>          labels:<br>            serverity: page<br>          annotations:<br>            summary: Mayday Mayday. Service is Down</pre><p>Create a YAML file with the contents above and <em>kubectl-apply’ed</em> it in your Verrazzano Cluster. Make sure the rule is created in <em>verrazzano-monitoring</em> namespace.</p><p>Then, get your Prometheus endpoint from <em>“vz status”</em> output. Authenticate with Verrazzano’s Single-Sign-On user and go to Alerts section. You should see a new “<em>mayday_service_down</em>” Alert. Initially, when no service is down, <em>mayday_service_down </em>alert<em> </em>will be label as “<em>Inactive</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ze0lRKT4k9cVlbQt-oIHxw.png" /></figure><p>To confirm that your rule syntax is valid, you can type it in the <em>expression </em>search bar in Prometheus. Give it a go by typing “<em>up</em>”. Notice that a number next to each resource that matches up alert will display a number next to it. Number “1” means resource is running and “0” for resources not running. This is why in the alert created before the expression looks for up == 0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*emDLf7s2ej1u0LXIH9gvFA.jpeg" /></figure><p>If the rule finds a match, Prometheus will move it to <em>Pending</em> state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*kcJx7YZYk1nf72xxmDrlSA.png" /></figure><p>An alarm will remain in <em>pending</em> state, if matching criteria remains valid for a given time and no remedy action has been taken. For <em>mayday_serivice_down </em>alert, we set the attribute <em>for: 1m</em> which will give an operator <em>1 minute</em> to fix it. Go grab a coffee or you will have to stare at your screen for 1 minute before it changes state to <em>“Firing”</em> from “<em>Pending</em>”. At this point, you should see <strong>a new incoming email </strong>in your inbox!!!</p><p>Eventually, you may start getting overwhelmed by the number of emails you may have received. So, I would suggest as a next step to add <em>group_interval, </em>and<em> repeat_interval </em>to control the rate and number of notifications in <em>alertmanager.config.route </em>spec.</p><pre># How long to wait before sending a notification about new alerts that<br># are added to a group of alerts for which an initial notification has<br># already been sent. (Usually ~5m or more.)<br>[ group_interval: &lt;duration&gt; | default = 5m ]<br><br># How long to wait before sending a notification again if it has already<br># been sent successfully for an alert. (Usually ~3h or more).<br>[ repeat_interval: &lt;duration&gt; | default = 4h ]</pre><p>To sum up, Verrazzano gives you the option to notify your teams when something unexpected has happened. You do not have to go trough a lengthly process to install and configure any additional notification software. Just use AlertManger that is bundled with you Verrazzano Cluster. It takes a few steps for Teams to get alerts.</p><p>Furthermore, if you have requirements to customize Rules and Receivers further, remember that you can rely on experiences published by OpenSource communities around Prometheus, AlertManager, etc. Verrazzano honors those configurations because it installs OpenSource products. It is as simple as applying configurations in the Verrazzano Custom Resource and Verrazzano Operator will take care of the rest. Nothing else needed. Your team will be enabled to take remedial actions faster.</p><p>Have a good one !</p><p><strong>Troubleshooting</strong></p><p>Check <em>prometheus-operator-kube-p-operator </em>pod<em> logs </em>in<em> verrazzano-monitoring </em>namespace to find out what it may have been missed configuring the service.</p><p><strong>Enhance Security</strong></p><p>The most recent Prometheus Operator version added support for <em>smtp_auth_password_file. </em>With this attribute, AlertManager can read smtp password from a secret<em>.</em></p><pre>apiVersion: v1<br>kind: Secret<br>metadata:<br>  name: alertmanager-config<br>  namespace: verrazzano-monitoring<br>type: Opaque<br>data:<br>  smtp_password: &lt;base64 Encoded Password&gt;</pre><p>Configure alertManager to replace <em>smtp_auth_password </em>with clear plain text and set smtp_auth_password_file instead.</p><pre>prometheusOperator:<br>      overrides:<br>        - values:<br>            alertmanager:<br>              enabled: true<br>              alertmanagerSpec:<br>                podMetadata:<br>                  annotations:<br>                    sidecar.istio.io/inject: &quot;false&quot;<br>                secrets:<br>                  - alertmanager-config<br>config:  <br>                global:<br>                  resolve_timeout: 15m<br>                  smtp_auth_password_file: /etc/alertmanager/secrets/alertmanager-config/smtp_password<br>....</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32b02c3b703f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/verrazzano/configure-alertmanager-receivers-in-verrazzano-32b02c3b703f">Configure AlertManager receivers in Verrazzano</a> was originally published in <a href="https://medium.com/verrazzano">Verrazzano</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shift-Left validation with Verrazzano]]></title>
            <link>https://medium.com/verrazzano/shift-left-validation-with-verrazzano-4d07bb37968?source=rss-46b5d958313e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d07bb37968</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[verrazzano]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <dc:creator><![CDATA[Julian OI]]></dc:creator>
            <pubDate>Mon, 06 Feb 2023 15:43:08 GMT</pubDate>
            <atom:updated>2023-03-24T16:58:29.680Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://verrazzano.io/latest/docs/setup/install/profiles/"><strong><em>Verrazzano Installation Profiles</em></strong></a><em> </em>are files written using <strong>YAML language</strong> following a specific <strong><em>install.verrazzanio.io</em></strong> api version linked to a schema. This schema by itself is a reference on how to declare the constraints and relationships between the resources that will be created by Verrazzano Operator on a Kubernetes Cluster. Because of the nature of YAML language, one might argue that YAML files can be painful to edit. This difficulty grows as the rules in a schema gets larger, which can lead to misconfigured sections. These sections can be hard to find and diagnose. This blog will illustrate a common practice, known as shift-left static validation. Shift-left validation ensures your YAML manifest files are valid before deploying to Kubernetes.</p><p>Kubernetes community has developed several tools to do static validation. I am going to walk you through how to use <strong>Datree</strong> and <strong>kubeconform </strong>tools<strong> </strong>using the Verrazzano Installation Profiles as input. Note that this is just a subset of all the validation tools that are available in the open-source community. Whichever tool you choose, it is important the tool supports <em>Custom Resource Definitions</em>.</p><p>Let’s go over the list of pre-reqs:</p><ul><li>Download the latest Verrazzano Custom Resource Definition (CRD) from the Verrazzano public repository at Verrazzano.io: <a href="https://github.com/verrazzano/verrazzano/blob/v1.4.2/platform-operator/helm_config/charts/verrazzano-platform-operator/crds/install.verrazzano.io_verrazzanos.yaml"><em>install.verrazzano.io_verrazzanos.yaml</em></a></li></ul><pre>$&gt; curl -LO https://raw.githubusercontent.com/verrazzano/verrazzano/v1.4.2/platform-operator/helm_config/charts/verrazzano-platform-operator/crds/install.verrazzano.io_verrazzanos.yaml</pre><ul><li>Most static validation tools require openAPI specs to be in json format to do their magic. We will need -<em>enters</em>… <a href="https://github.com/yannh/kubeconform/blob/master/scripts/openapi2jsonschema.py"><strong><em>openapi2jsonschema.py</em></strong></a><strong><em> -</em></strong> script from <strong><em>kubeconform </em></strong>to transform <em>Verrazzano</em> specs to json format<strong><em>. </em></strong>This is developed in <strong><em>python</em></strong>, so,<em> guess what?</em> we need <em>python</em> as a pre-req also.</li></ul><pre>$&gt; wget https://github.com/yannh/kubeconform/blob/master/scripts/openapi2jsonschema.py<br>$&gt; python --version<br>Python 3.9.13 <br>$&gt; python openapi2jsonschema.py<br></pre><ul><li>Finally, the already famous <strong><em>kubectl</em></strong> . check the version that is compatible with the Kubernetes cluster your are planning to install <strong><em>Verrazzano</em></strong> on.</li></ul><p>Note: <em>I am a Linux user. Steps detailed in this blog post were tested on my Linux distro, but you should be able to make it work with other OS too.</em></p><p><strong>Ready? </strong>Let’s start with<strong> <em>kubeconform</em></strong></p><h3><strong>[ Kubeconform ]</strong></h3><p>As their team describes it</p><blockquote>“a Kubernetes manifest validation tool” that “enables validating Kubernetes custom resources (CRDs) and offline validation capabilities” .</blockquote><p>Sounds exactly what we are looking for. Proceeding to install it.</p><pre>$&gt; wget https://github.com/yannh/kubeconform/releases/download/v0.5.0/kubeconform-linux-amd64.tar.gz<br>$&gt; tar -C ~/tools/bin -xzf kubeconform-linux-amd64.tar.gz<br>$&gt; kubeconform -v -verbose<br>v0.5.0</pre><p>Next Step, I need to transform <a href="https://github.com/verrazzano/verrazzano/blob/v1.4.2/platform-operator/helm_config/charts/verrazzano-platform-operator/crds/install.verrazzano.io_verrazzanos.yaml"><em>install.verrazzano.io_verrazzanos.yaml</em></a><em> spec </em>file listed in the pre-reqs section to json format. The resulting conversion will create two json files, each file corresponding to a different Verrazzano API version.</p><p>$&gt; <em>python </em><strong><em>openapi2jsonschema.py install.verrazzano.io_verrazzanos.yaml</em></strong></p><pre>$&gt; cd /tmp<br>$&gt; ls -l<br>total 324<br>-rw-r--r--. 1 opc opc 321534 Feb  3 20:15 install.verrazzano.io_verrazzanos.yaml<br>-rw-rw-r--. 1 opc opc   6746 Feb  3 20:16 openapi2jsonschema.py<br>$&gt; python openapi2jsonschema.py install.verrazzano.io_verrazzanos.yaml<br>JSON schema written to verrazzano_v1alpha1.json<br>JSON schema written to verrazzano_v1beta1.json</pre><p><strong>Super!</strong> we have json files generated. <em>verrazzano_v1alpha1.json</em> and <strong>verrazzano_v1beta1.json</strong></p><p>Back to Verrazzano Installation Profile. There are at least 15+ components you can customize in Verrazzano from the get-go. For example, <em>opensearch’s number of replicas, index state management policies, jaeger, DNS, prometheus, istio, authproxy, keycloak, etc. and </em>each component has its own set of attributes that can be updated based on a given environment. If you want to install a Dev environment, you could go with a <a href="https://github.com/verrazzano/verrazzano/blob/v1.4.2/platform-operator/config/samples/install-default.yaml"><em>basic installation profile</em></a>, but if you are thinking about production environment, your mind could take you to configure them for High Availability, certain policies, and so on, leading to a fully customized <a href="https://github.com/verrazzano/verrazzano/blob/v1.4.2/platform-operator/apis/verrazzano/testdata/fromallcomps/v1beta1.yaml"><em>Installation Profile</em></a><em>.</em></p><p>All those possible permutations on a YAML format is error-prone business. Luckily, I will be customizing DNS and Certificates components only to illustrate how to spot errors in an Installation profile as follows:</p><ul><li><strong><em>DNS: </em></strong>Verrazzano supports seamless integration with <a href="https://docs.oracle.com/en-us/iaas/Content/DNS/Concepts/dnszonemanagement.htm"><strong><em>Oracle Cloud Infrastructure DNS service</em></strong></a><strong><em> t</em></strong>o create DNS records automatically for each accessible component, including deployed apps. I will configure <em>ociConfigSecret, dnsCompartmentOCID, dnsZoneOCID, and dnsZoneName</em></li><li><strong>Certificates</strong>: Verrazzano supports generating SSL certificates automatically with LetsEncrypt, among other options. For this use case, one needs to provide a value for <em>emailAddress</em> property to receive a challenge question.</li></ul><p>My Verrazzano installation Profile file named <em>install_custom_dns_certificate.yaml</em> is taking shape. Again, more examples can be found <a href="https://github.com/verrazzano/verrazzano/tree/v1.4.2/platform-operator/config/samples">here</a></p><pre>$&gt; cat install_custom_dns_certificate.yaml<br><br>apiVersion: install.verrazzano.io/v1beta1<br>kind: Verrazzano<br>metadata:<br>  name: example-verrazzano<br>spec:<br>  environmentName: env<br>  profile: prod<br>  components:<br>    certManager:<br>      certificate:<br>        acme:<br>          provider: letsEncrypt<br>          emailAddress: emailAddress@example.com<br>    dns:<br>      oci:<br>        ociConfigSecret: oci<br>        dnsZoneCompartmentOCID: dnsZoneCompartmentOcid<br>        dnsZoneOCID: dnsZoneOcid<br>        dnsZoneName: my.dns.zone.name<br>    ingressNGINX:<br>      type: LoadBalancer</pre><p>…we are getting closer to the action. I promise.</p><p>We have all inputs required: a valid install file and json spec file. Now it is time for <em>Kubeconform</em> to tell me if it is valid or not.</p><p><strong>Kubeconform</strong> can validate files against Kubernetes API cluster and/or offline CDRs. In this case, I will be enabling the offline option by using — <em>schema-location </em>flag<em> </em>and specifying the spec file location.</p><p>Here we go… Let’s validate our install file.</p><pre>$&gt; INSTALL_FILE=install_custom_dns_certificate.yaml<br>$&gt; SPEC_FILE=verrazzano_v1beta1.json<br>$&gt; kubeconform -summary -verbose -debug -schema-location $SPEC_FILE $INSTALL_FILE<br><br>2023/02/04 00:40:46 using schema found at verrazzano_v1beta1.json<br>install_custom_dns_certificate.yaml - Verrazzano example-verrazzano is valid<br>Summary: 1 resource found in 1 file - Valid: 1, Invalid: 0, Errors: 0, Skipped: 0</pre><p><strong>Is a valid file.. </strong>Phew!</p><p>Now, create a copy of the <em>install_custom_dns_certificate.yaml </em>and replace the word<strong> <em>ingressNGINX</em></strong><em> to </em><strong><em>ingress</em></strong><em> -s</em>omething that someone would possibly mistyped — and saved it with a new name “<em>install_custom_dns_certificate</em><strong><em>_error.</em></strong><em>yaml”, </em>and run it again.</p><pre>$&gt; kubeconform -debug -verbose -schema-location verrazzano_v1beta1.json install_custom_dns_certificate_error.yaml<br><br>2023/02/04 00:43:58 using schema found at verrazzano_v1beta1.json<br>install_custom_dns_certificate_error.yaml <br>- Verrazzano example-verrazzano is invalid: <br>For field spec.components: Additional property ingress is not allowed<br>Summary: 1 resource found in 1 file - Valid: 0, Invalid: 1, Errors: 0, Skipped: 0</pre><p>There it is… <em>Kubeconform</em> not only list it as an invalid YAML file, but also pointed exactly to the property that triggered the error. “Additional property <strong>ingress</strong> is not allowed”.</p><h3>[ Datree ]</h3><p>Another good alternative to do static validations is open source community tool Datree.</p><blockquote>Datree secures your Kubernetes by blocking the deployment of misconfigured resources.</blockquote><p>Steps to install it are quite simple. Download the latest binary and it will self install in your current path.</p><pre>$&gt;curl https://get.datree.io | /bin/bash<br>  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current<br>                                 Dload  Upload   Total   Spent    Left  Speed<br>100  2218  100  2218    0     0  28075      0 --:--:-- --:--:-- --:--:-- 28075<br>Installing Datree...<br><br>[V] Downloaded Datree<br>[V] Finished Installation<br><br> Usage: $ datree test ~/.datree/k8s-demo.yaml<br> Using Helm? =&gt; https://github.com/datreeio/helm-datree<br> Using Kustomize? =&gt; https://hub.datree.io/kustomize-support<br> Run &#39;datree completion -h&#39; to learn how to generate shell autocompletions<br><br>$&gt;datree version<br>1.8.21</pre><p>Tool ready. Now I am going to start with the Install Verrazzano file containing mistyped “ingress”. But this time, I will introduce another error under certManager section, to mistype the acme LetsEncrypt protocol name to <em>acmeERROR</em>. Note that this is two levels down into component name certManager, as opposed to first level error for the <em>ingress</em> name.</p><pre>apiVersion: install.verrazzano.io/v1beta1<br>kind: Verrazzano<br>metadata:<br>  name: example-verrazzano<br>spec:<br>  environmentName: env<br>  profile: prod<br>  components:<br>    certManager:<br>      certificate:<br>        acmeError:<br>          provider: letsEncrypt<br>          emailAddress: emailAddress@example.com<br>    dns:<br>      oci:<br>        ociConfigSecret: oci<br>        dnsZoneCompartmentOCID: dnsZoneCompartmentOcid<br>        dnsZoneOCID: dnsZoneOcid<br>        dnsZoneName: my.dns.zone.name<br>    ingress:<br>      type: LoadBalancer</pre><p>Great, so Datree has multiple options to run validations. It can pull yaml files directly from a repository, use another community tool -<em>kustomize- </em>to render new patched yaml files, and <em>test</em> flag, which is what will be focused on to do static validations. Similar to <em>kubeconform,</em> it uses <em>— schema-location</em> flag to provide an offline path to specific schemas.</p><p>A first run on the Verrazzano install file (<em>the one with errors</em>) reported correctly two errors.</p><pre>datree test --schema-location verrazzano_v1beta1.json install_custom_dns_certificate_error.yaml<br>&gt;&gt;  File: /tmp/install_validation/install_custom_dns_certificate_error.yaml<br><br>[V] YAML validation<br>[X] Kubernetes schema validation<br><br>❌  k8s schema validation error: For field spec.components: Additional property ingress is not allowed<br><br>❌  k8s schema validation error: For field spec.components.certManager.certificate: Additional property acmeERROR is not allowed<br><br><br>[?] Policy check didn&#39;t run for this file<br><br><br>(Summary)<br><br>- Passing YAML validation: 1/1<br><br>- Passing Kubernetes (1.20.0) schema validation: 0/1<br><br>- Passing policy check: 0/1<br><br>+-----------------------------------+------------------------------------------------------+<br>| Enabled rules in policy &quot;Default&quot; | 21                                                   |<br>| Configs tested against policy     | 0                                                    |<br>| Total rules evaluated             | 0                                                    |<br>| Total rules skipped               | 0                                                    |<br>| Total rules failed                | 0                                                    |<br>| Total rules passed                | 0                                                    |<br>| See all rules in policy           | https://app.datree.io/login?t=bPTwhTQfzZFfm4m9TaNFea |<br>+-----------------------------------+------------------------------------------------------+</pre><p>It nicely displays a break down of the polices ran — some out of the box- and a <strong><em>Kubernetes schema validation </em></strong>section marked with an X, indicating a schema validation test has <strong>failed</strong>. This is an expected result. But I was surprise that it didn’t stop on the first error and exited. It completely validated the file and reported the second error. Nice Job!</p><p>For our final act, let’s validate our first Installation Profile.</p><pre>datree test --schema-location verrazzano_v1beta1.json  install_custom_dns_certificate.yaml<br><br>(Summary)<br><br>- Passing YAML validation: 1/1<br><br>- Passing Kubernetes (1.20.0) schema validation: 1/1<br><br>- Passing policy check: 1/1<br><br>+-----------------------------------+------------------------------------------------------+<br>| Enabled rules in policy &quot;Default&quot; | 21                                                   |<br>| Configs tested against policy     | 1                                                    |<br>| Total rules evaluated             | 21                                                   |<br>| Total rules skipped               | 0                                                    |<br>| Total rules failed                | 0                                                    |<br>| Total rules passed                | 21                                                   |<br>| See all rules in policy           | https://app.datree.io/login?t=bPTwhTQfzZFfm4m9TaNFea |<br>+-----------------------------------+------------------------------------------------------+</pre><p>Assessment: <strong><em>Valid YAML file</em></strong>. ;-)</p><p>I personally like <strong><em>datree</em></strong> better over <strong>kubeconform</strong><em>,</em> just because the development team has done a better job of printing this sort of results.</p><h3>What is Next?</h3><p>Both <strong><em>kubeconform</em></strong> and <strong><em>Datree</em></strong> are great tools to help validate Verrazzano Install Profile files before you attempt to install <strong>Verrazzano</strong>. These basic tests can be enhanced further depending on your rules, requirements and corporate policies. But as long as you can run static validation at an early stage in your workflow, it will help you catch simple typos, save you time, and lot’s of hair pulling when dealing with long YAML files.</p><p>You are unblocked now! Go ahead and install Verrazzano. But before you proceed, I suggest reading <a href="https://medium.com/verrazzano/introducing-the-verrazzano-cli-44d080ad112f"><strong><em>Introducing Verrazzano CLI</em></strong></a> blog -authored by great friend- and we will meet again on my next post on <strong>How to validate applications YAML files based on </strong><a href="https://verrazzano.io/latest/docs/applications/"><strong>Open Application Model specification</strong></a><strong> adopted by Verrazzano</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d07bb37968" width="1" height="1" alt=""><hr><p><a href="https://medium.com/verrazzano/shift-left-validation-with-verrazzano-4d07bb37968">Shift-Left validation with Verrazzano</a> was originally published in <a href="https://medium.com/verrazzano">Verrazzano</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>