<?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 Deepak Devadathan on Medium]]></title>
        <description><![CDATA[Stories by Deepak Devadathan on Medium]]></description>
        <link>https://medium.com/@xsgdkh?source=rss-65589502497------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*p5RJLjBV6jBN4dN2acYncw@2x.jpeg</url>
            <title>Stories by Deepak Devadathan on Medium</title>
            <link>https://medium.com/@xsgdkh?source=rss-65589502497------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 04:32:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@xsgdkh/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[Rook- Cloud native storage orchestrator deployment in OKE]]></title>
            <link>https://medium.com/@xsgdkh/rook-cloud-native-storage-orchestrator-deployment-in-oke-f0f0e0346f67?source=rss-65589502497------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0f0e0346f67</guid>
            <dc:creator><![CDATA[Deepak Devadathan]]></dc:creator>
            <pubDate>Thu, 05 Dec 2024 04:09:55 GMT</pubDate>
            <atom:updated>2024-12-05T04:09:55.960Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*ZFSAKFBd5NyKEPyqnrvLYw.png" /></figure><h3>What is Rook?</h3><p>Rook is an open source <strong>cloud-native storage orchestrator</strong>, providing the platform, framework, and support for Ceph storage to natively integrate with cloud-native environments. Rook automates deployment and management of Ceph to provide self-managing, self-scaling, and self-healing storage services. The Rook operator does this by building on Kubernetes resources to deploy, configure, provision, scale, upgrade, and monitor Ceph. The Ceph operator was declared stable in December 2018 in the Rook v0.9 release, providing a production storage platform for many years. Rook is hosted by the <a href="https://cncf.io/">Cloud Native Computing Foundation</a> (CNCF) as a <a href="https://www.cncf.io/announcements/2020/10/07/cloud-native-computing-foundation-announces-rook-graduation/">graduated</a> level project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q7t1PRUpxP2YuhG_Rz7scg.png" /></figure><h3>Ceph Prerequisites</h3><p>To configure the Ceph storage cluster, at least one of these local storage types is required:</p><ul><li>Raw devices (no partitions or formatted filesystems)</li><li>Raw partitions (no formatted filesystem)</li><li>LVM Logical Volumes (no formatted filesystem)</li><li>Persistent Volumes available from a storage class in block mode</li></ul><p>Confirm whether the partitions or devices are formatted with filesystems with the following command:</p><pre>$ lsblk -f<br>NAME                  FSTYPE      LABEL UUID                                   MOUNTPOINT<br>vda<br>└─vda1                LVM2_member       &gt;eSO50t-GkUV-YKTH-WsGq-hNJY-eKNf-3i07IB<br>  ├─ubuntu--vg-root   ext4              c2366f76-6e21-4f10-a8f3-6776212e2fe4   /<br>  └─ubuntu--vg-swap_1 swap              9492a3dc-ad75-47cd-9596-678e8cf17ff9   [SWAP]<br>vdb</pre><p>If the FSTYPE field is not empty, there is a filesystem on top of the corresponding device. In this example, vdb is available to Rook, while vda and its partitions have a filesystem and are not available.</p><p>This is an important point when it comes deployment in OKE as you will see later in this blog</p><h3>Ceph Cluster Type</h3><p>There are broadly two choice to make when it comes to configuring a Ceph Cluster.</p><ul><li><a href="https://rook.io/docs/rook/latest-release/CRDs/Cluster/host-cluster/">Host Storage Cluster</a>: Consume storage from host paths and raw devices</li><li><a href="https://rook.io/docs/rook/latest-release/CRDs/Cluster/pvc-cluster/">PVC Storage Cluster</a>: Dynamically provision storage underneath Rook by specifying the storage class Rook should use to consume storage (via PVCs)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*Haogx3YuyxCeKLQdz63cLw.png" /><figcaption>Storage Architecture</figcaption></figure><p>Below the dotted line in the above diagram, the components fall into three categories:</p><ul><li>Rook operator (blue layer): The operator automates configuration of Ceph</li><li>CSI plugins and provisioners (orange layer): The Ceph-CSI driver provides the provisioning and mounting of volumes</li><li>Ceph daemons (red layer): The Ceph daemons run the core storage architecture. See the <a href="https://rook.io/docs/rook/latest-release/Getting-Started/glossary/#ceph">Glossary</a> to learn more about each daemon.</li></ul><h3>Deployment Challenge</h3><p><strong>PVC Storage Cluster</strong> — The Ceph persistent data is stored on volumes requested from a storage class of your choice. This type of cluster is recommended in a cloud environment where volumes can be dynamically created and also in clusters where a local PV provisioner is available.</p><p>For an OKE deployment , CephCluster object will look like this</p><pre>apiVersion: ceph.rook.io/v1<br>kind: CephCluster<br>metadata:<br>  name: rook-ceph<br>  namespace: rook-ceph<br>spec:<br>  cephVersion:<br>    image: quay.io/ceph/ceph:v18.2.4<br>  dataDirHostPath: /var/lib/rook<br>  mon:<br>    count: 3<br>    allowMultiplePerNode: false<br>    volumeClaimTemplate:<br>      spec:<br>        storageClassName: oci-bv<br>        resources:<br>          requests:<br>            storage: 10Gi<br>  storage:<br>    storageClassDeviceSets:<br>    - name: set1<br>      count: 3<br>      portable: false<br>      encrypted: false<br>      volumeClaimTemplates:<br>      - metadata:<br>          name: data<br>        spec:<br>          resources:<br>            requests:<br>              storage: 10Gi<br>          storageClassName: oci-bv<br>          volumeMode: Block        # Block is mandatory<br>          accessModes:<br>            - ReadWriteOnce<br>    onlyApplyOSDPlacement: false</pre><p>The key thing to note here is the VolumeMode value for storage specs.</p><p>This means when the operator creates a persistentvolumeclaim object it will set <strong>volumeMode: Block</strong></p><p>The problem is OKE storage class oci-bv do not support VolumeMode: Block as of today.</p><p>In short we can’t deploy PVC Storage cluster using OCI natvie storage class.</p><p>This leads to our second option.</p><p><strong>Host Storage Cluster</strong> — Rook configures Ceph to store data directly on the host. The Ceph mons will store the metadata on the host (at a path defined by the dataDirHostPath), and the OSDs will consume raw devices or partitions.</p><pre>apiVersion: ceph.rook.io/v1<br>kind: CephCluster<br>metadata:<br>  name: rook-ceph<br>  namespace: rook-ceph<br>spec:<br>  cephVersion:<br>    # see the &quot;Cluster Settings&quot; section below for more details on which image of ceph to run<br>    image: quay.io/ceph/ceph:v18.2.4<br>  dataDirHostPath: /var/lib/rook<br>  mon:<br>    count: 3<br>    allowMultiplePerNode: false<br>  storage:<br>    useAllNodes: true<br>    useAllDevices: true</pre><p>This sounds deployable. The worker nodes in a OKE cluster has a boot volume attached. One can create a node with a larger boot volume size for the Ceph cluster to consume. But there is a problem here. Remember what the prerequisite mentioned</p><blockquote>Raw devices (no partitions or formatted filesystems)</blockquote><p>Lets take a look at one of the worker nodes</p><pre>lsblk -f<br>NAME   FSTYPE LABEL UUID                                 MOUNTPOINT<br>sda<br>├─sda2 swap         f0126a93-753e-4769-xxxx<br>├─sda3 xfs          4b47378a-02eb-4548-xxxx              /<br>└─sda1 vfat         2B75-2AD5                            /boot/efi</pre><p>There is a device sda but it has filesystems on it. So Ceph OSD will not start as it doesn’t find the right device for storage.</p><p>So we cant use the boot volume as its has filesystem on it.</p><p>Lets create block volume and attach it to the worker node</p><pre>oci bv volume create --availability-domain &lt;ad_name&gt; --compartment-id &lt;compartment_id&gt; --display-name rook-bv-0 --size-in-gbs 50<br><br># Note downt the created block volume ocid<br><br># Attach the block block volume to the worker node<br>oci compute volume-attachment attach --instance-id &lt;worker_node_ocid&gt;  --type paravirtualized --volume-id &lt;block_volume_ocid&gt;</pre><p>Lets take a look at the worker nodes with block volume attached</p><pre>lsblk -f<br>NAME   FSTYPE LABEL UUID                                 MOUNTPOINT<br>sdb<br>sda<br>├─sda2 swap         f0126a93-753e-4769-ada8-7499a1efb3a9<br>├─sda3 xfs          4b47378a-02eb-4548-bab8-59cbf379252a /<br>└─sda1 vfat         2B75-2AD5                            /boot/efi</pre><blockquote>If the FSTYPE field is not empty, there is a filesystem on top of the corresponding device. In this example, sdb is available to Rook, while sda and its partitions have a filesystem and are not available.</blockquote><p>Now we have the prerequisites met for a Host Storage Cluster deployment on OKE.</p><h3>Deployment Approach</h3><p>This is an opinionated way of deploying Rook on OKE leveraging nodepool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*iDIDff7ax8niop2OosIs0g.png" /><figcaption>Deployment architecture</figcaption></figure><p>Create two nodepool with the desired sizing.</p><p>node pool : rook — For deploying rook and ceph components only.</p><p>node pool : workload — For deploying regular deployments</p><p>I want to leverage placement groups in rook deployment. So nodepool rook should be used only for rook and its components deployment.</p><p>For this I put a taint on the worker nodes in the nodepool rook</p><pre>kubectl taint nodes -l oke.oraclecloud.com/pool.name=rook node-role.kubernetes.io/rook-node=true:NoSchedule --overwrite</pre><p>Next I create and attach block storage to the worker nodes in the rook nodepool.</p><p>Deploy Prometheus &amp; Grafana</p><pre>helm repo add prometheus-community https://prometheus-community.github.io/helm-charts<br>helm repo update<br>helm install monitoring-stack prometheus-community/kube-prometheus-stack \<br>  --namespace monitoring-stack \<br>  --create-namespace \<br>  --set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false</pre><p>Deploy Rook Operator</p><p>Create a helm values override file like below</p><pre>#rook-operator-values.yaml<br><br>monitoring:<br>  enabled: true<br>nodeSelector:<br> oke.oraclecloud.com/pool.name: rook<br>tolerations:<br>- key: &quot;node-role.kubernetes.io/rook-node&quot;<br>  operator: &quot;Exists&quot;<br>  effect: &quot;NoSchedule&quot;<br>csi:<br>  provisionerTolerations:<br>  - key: &quot;node-role.kubernetes.io/rook-node&quot;<br>    operator: &quot;Exists&quot;<br>    effect: &quot;NoSchedule&quot;<br>  provisionerNodeAffinity: <br>    oke.oraclecloud.com/pool.name: rook<br>  pluginTolerations:<br>  - key: &quot;node-role.kubernetes.io/rook-node&quot;<br>    operator: &quot;Exists&quot;<br>    effect: &quot;NoSchedule&quot;<br>  pluginNodeAffinity: <br>    oke.oraclecloud.com/pool.name: rook<br>discover:<br>  tolerations:<br>  - key: &quot;node-role.kubernetes.io/rook-node&quot;<br>    operator: &quot;Exists&quot;<br>    effect: &quot;NoSchedule&quot;<br>  nodeAffinity:<br>    oke.oraclecloud.com/pool.name: rook</pre><pre>helm repo add rook-release https://charts.rook.io/release<br>helm install --create-namespace --namespace rook-ceph rook-ceph rook-release/rook-ceph -f rook-operator-values.yaml</pre><p>Deploy Ceph Cluster</p><p>Create a helm override values for ceph cluster</p><pre>#ceph-cluster-values.yaml<br>monitoring:<br>  enabled: true<br>  createPrometheusRules: true<br>toolbox:<br>  enabled: true<br>  tolerations: <br>  - key: &quot;node-role.kubernetes.io/rook-node&quot;<br>    operator: &quot;Exists&quot;<br>    effect: &quot;NoSchedule&quot;<br>  affinity: <br>    oke.oraclecloud.com/pool.name: rook<br>cephClusterSpec:<br>  dashboard:<br>    enabled: true<br>    ssl: false<br>    prometheusEndpoint: http://monitoring-stack-kube-prom-prometheus.monitoring-stack:9090<br>    prometheusEndpointSSLVerify: false<br>  mgr:<br>    # When higher availability of the mgr is needed, increase the count to 2.<br>    # In that case, one mgr will be active and one in standby. When Ceph updates which<br>    # mgr is active, Rook will update the mgr services to match the active mgr.<br>    count: 2<br>    allowMultiplePerNode: false<br>    modules:<br>      - name: rook<br>        enabled: true<br>  placement:<br>    all:<br>      nodeAffinity:<br>        requiredDuringSchedulingIgnoredDuringExecution:<br>          nodeSelectorTerms:<br>            - matchExpressions:<br>              - key: oke.oraclecloud.com/pool.name<br>                operator: In<br>                values:<br>                - rook<br>      podAffinity:<br>        oke.oraclecloud.com/pool.name: rook<br>      tolerations:<br>      - key: &quot;node-role.kubernetes.io/rook-node&quot;<br>        operator: &quot;Exists&quot;<br>        effect: &quot;NoSchedule&quot;</pre><pre>helm repo add rook-release https://charts.rook.io/release<br>helm install --create-namespace --namespace rook-ceph rook-ceph-cluster \<br>rook-release/rook-ceph-cluster -f ceph-cluster-values.yaml</pre><p>Check pod deployment status</p><pre>kubectl -n rook-ceph get pods -l ceph_daemon_type=osd<br>NAME                               READY   STATUS    RESTARTS   AGE<br>rook-ceph-osd-0-5f74fb76f5-rp497   2/2     Running   0          21h<br>rook-ceph-osd-1-b7847fc69-fm7sg    2/2     Running   0          21h<br>rook-ceph-osd-2-784f57d88-97wdb    2/2     Running   0          21h<br><br>kubectl -n rook-ceph get pods -l ceph_daemon_type=mon<br>NAME                               READY   STATUS    RESTARTS   AGE<br>rook-ceph-mon-a-65947449d4-b8zpz   2/2     Running   0          21h<br>rook-ceph-mon-b-6789665fff-7csgj   2/2     Running   0          21h<br>rook-ceph-mon-c-b79576847-77fvv    2/2     Running   0          21h<br><br>kubectl -n rook-ceph get pods -l ceph_daemon_type=mgr<br>NAME                               READY   STATUS    RESTARTS   AGE<br>rook-ceph-mgr-a-587cc4895-mxcr8    3/3     Running   0          21h<br>rook-ceph-mgr-b-545745d8d6-dslvd   3/3     Running   0          21h<br><br>kubectl -n rook-ceph get pods -l ceph_daemon_type=mds<br>NAME                                               READY   STATUS    RESTARTS   AGE<br>rook-ceph-mds-ceph-filesystem-a-57dbc74bcd-nxfl6   2/2     Running   0          21h<br>rook-ceph-mds-ceph-filesystem-b-5466cc6b76-tkrkw   2/2     Running   0          21h</pre><p>Check ceph status</p><pre>kubectl -n rook-ceph exec -it $(kubectl -n rook-ceph get pod -l app=rook-ceph-tools -o jsonpath=&#39;{.items[0].metadata.name}&#39;) -- ceph status<br>  cluster:<br>    id:     e2f1403b-ef60-4523-8ffa-0403996664b6<br>    health: HEALTH_OK<br><br>  services:<br>    mon: 3 daemons, quorum a,b,c (age 21h)<br>    mgr: a(active, since 21h), standbys: b<br>    mds: 1/1 daemons up, 1 hot standby<br>    osd: 3 osds: 3 up (since 21h), 3 in (since 2d)<br>    rgw: 1 daemon active (1 hosts, 1 zones)<br><br>  data:<br>    volumes: 1/1 healthy<br>    pools:   12 pools, 169 pgs<br>    objects: 4.68k objects, 13 GiB<br>    usage:   42 GiB used, 178 GiB / 220 GiB avail<br>    pgs:     169 active+clean<br><br>  io:<br>    client:   853 B/s rd, 53 KiB/s wr, 1 op/s rd, 2 op/s wr</pre><p>Check the storage class created by rook</p><pre>kubectl get storageclass<br>NAME                   PROVISIONER                       RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE<br>ceph-block (default)   rook-ceph.rbd.csi.ceph.com        Delete          Immediate              true                   2d20h<br>ceph-bucket            rook-ceph.ceph.rook.io/bucket     Delete          Immediate              false                  2d20h<br>ceph-filesystem        rook-ceph.cephfs.csi.ceph.com     Delete          Immediate              true                   2d20h<br>oci                    oracle.com/oci                    Delete          Immediate              false                  3d1h<br>oci-bv (default)       blockvolume.csi.oraclecloud.com   Delete          WaitForFirstConsumer   true                   3d1h</pre><p>Deploy a simple application which will create a persistent volume. For this demo , we will deploy minio</p><p>First create a helm override values file for minio. Make sure to use storageclass value as <strong>ceph-block</strong></p><pre># minio-values.yaml<br>global:<br>  storageClass: &quot;ceph-block&quot;<br>auth:<br>  rootUser: admin<br>  rootPassword: &lt;password&gt;<br>persistence:<br>  size: 70Gi<br>metrics:<br>  enabled: true<br>  serviceMonitor:<br>    enabled: true<br>provisioning:<br>  enabled: true<br>  buckets:<br>    - name: test-bucket<br>      region: us-east-1<br>      versioning: Suspended<br>      withLock: false<br>      lifecycle:<br>        - id: TestPrefix7dRetention<br>          prefix: test-prefix<br>          disabled: false<br>          expiry:<br>            days: 7<br>            nonconcurrentDays: 3<br>      quota:<br>        type: clear<br>      tags:<br>        name: test-bucket</pre><pre>helm repo add minio https://charts.rook.io/release<br>helm install --create-namespace --namespace minio minio minio/minio -f minio-values.yaml</pre><p>Check minio deployment status</p><pre>kubectl -n minio get pods<br>NAME                       READY   STATUS      RESTARTS   AGE<br>minio-5c68cc8d66-spd8c     1/1     Running     0          27h<br>minio-provisioning-76dhm   0/1     Completed   0          27h</pre><p>Check Persistent volume</p><pre>kubectl -n minio get pv<br>NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM         STORAGECLASS   VOLUMEATTRIBUTESCLASS   REASON   AGE<br>pvc-59d38961-5dab-482e-9a9e-4fab2e51b4e2   70Gi       RWO            Delete           Bound    minio/minio   ceph-block     &lt;unset&gt;                          27h</pre><p>We have now successfully deployed an application which uses storage from the ceph cluster.</p><p>This is was a quick demonstration of deploying Rook operator with Host Storage Ceph cluster in OKE.</p><p>In another blog, we will try some chaos testing on this and see how it performs.</p><p>Stay tuned…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0f0e0346f67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oracle Cloud Infrastructure: cert-manager issuing acme certificate using DNS validation]]></title>
            <link>https://medium.com/@xsgdkh/oracle-cloud-infrastructure-cert-manager-issuing-acme-certificate-using-dns-validation-713b9c54deba?source=rss-65589502497------2</link>
            <guid isPermaLink="false">https://medium.com/p/713b9c54deba</guid>
            <dc:creator><![CDATA[Deepak Devadathan]]></dc:creator>
            <pubDate>Wed, 13 Nov 2024 03:10:23 GMT</pubDate>
            <atom:updated>2024-11-13T03:10:23.339Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*qiuqtNJAg4GMPtgF_XXggw.png" /></figure><h3>What is cert-manager?</h3><p><a href="https://cert-manager.io/">cert-manager</a> helps cloud native developers automate Transport Layer Security (TLS) and Mutual Transport Layer Security (mTLS) certificate issuance and renewal. It ensures secure communication within distributed systems by automating and simplifying the issuance, renewal, and lifecycle management of X.509 certificates in Kubernetes platforms. This eliminates the manual process of generating and managing certificates and helps ensure systems remain secure without constant manual intervention.</p><p>With cert-manager’s <a href="https://cert-manager.io/docs/usage/certificate/">Certificate resource</a>, the private key and certificate are stored in a Kubernetes Secret which is mounted by an application Pod or used by an Ingress controller</p><p>cert-manager is open sourced &amp; Cloud Native Computing Foundation(CNCF) graduated project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*q2oE6N7-kEyl2I9bZa6ABA.png" /></figure><h3>Issuing an ACME certificate using DNS validation</h3><p>cert-manager can be used to obtain certificates from a CA using the <a href="https://en.wikipedia.org/wiki/Automated_Certificate_Management_Environment">ACME</a> protocol. The ACME protocol supports various challenge mechanisms which are used to prove ownership of a domain so that a valid certificate can be issued for that domain.</p><p>One such challenge mechanism is DNS01. With a DNS01 challenge, you prove ownership of a domain by proving you control its DNS records. This is done by creating a TXT record with specific content that proves you have control of the domains DNS records.</p><p>A number of different DNS providers are supported for the ACME Issuer. Below is a listing of available providers, their .yaml configurations, along with additional Kubernetes and provider specific notes regarding their usage.</p><ul><li><a href="https://cert-manager.io/docs/configuration/acme/dns01/acme-dns/">ACMEDNS</a></li><li><a href="https://cert-manager.io/docs/configuration/acme/dns01/akamai/">Akamai</a></li><li><a href="https://cert-manager.io/docs/configuration/acme/dns01/azuredns/">AzureDNS</a></li><li><a href="https://cert-manager.io/docs/configuration/acme/dns01/cloudflare/">CloudFlare</a></li><li><a href="https://cert-manager.io/docs/configuration/acme/dns01/google/">Google</a></li><li><a href="https://cert-manager.io/docs/configuration/acme/dns01/route53/">Route53</a></li><li><a href="https://cert-manager.io/docs/configuration/acme/dns01/digitalocean/">DigitalOcean</a></li><li><a href="https://cert-manager.io/docs/configuration/acme/dns01/rfc2136/">RFC2136</a></li></ul><p>Due to the large number of requests to support DNS providers to resolve DNS challenges, it became impractical and infeasible to maintain and test all DNS providers in the main cert-manager repository.</p><p>For this reason, it was decided that new DNS providers should be supported out-of-tree by way of external webhooks.</p><h3>OCI webhook for cert-manager DNS validation</h3><p>In this blog , we will take a look at how we can use OCI webhook for DNS validation challenge.</p><h4>Installing cert-manager</h4><pre>helm repo add jetstack https://charts.jetstack.io --force-update<br>helm install \<br>  cert-manager jetstack/cert-manager \<br>  --namespace cert-manager \<br>  --create-namespace \<br>  --version v1.16.1 \<br>  --set crds.enabled=true</pre><h4>Installing ACME webhook for Oracle Cloud Infrastructure</h4><pre>helm repo add cert-manager-webhook-oci \<br>https://dn13.gitlab.io/cert-manager-webhook-oci<br><br>helm install \<br>cert-manager-webhook-oci cert-manager-webhook-oci/cert-manager-webhook-oci \<br>--namespace cert-manager \<br>--create-namespace \</pre><h4>Verify Deployment</h4><pre>kubectl -n cert-manager get pods<br>NAME                                       READY   STATUS    RESTARTS   AGE<br>cert-manager-9647b459d-jgnr9               1/1     Running   0          1m<br>cert-manager-cainjector-5d8798687c-5bbgj   1/1     Running   0          1m<br>cert-manager-webhook-c77744d75-96jl4       1/1     Running   0          1m<br>cert-manager-webhook-oci-97db649b4-85ws8   1/1     Running   0          1m</pre><p>The cert-manager-webhook-oci pods will handle the DNS validation in OCI DNS service. For this we have to configure how its access to the OCI service.</p><p>In order to access the Oracle Cloud Infrastructure API, you have 3 options to authenticate:</p><ol><li>OCI configuration profile (in a form of k8s secret)</li><li>Workload identity principal</li><li>Instance Principal</li></ol><h4>OCI configuration profile</h4><p>In this method we create a kubernetes secret with the OCI API key credentials</p><pre>apiVersion: v1<br>kind: Secret<br>metadata:<br>  name: oci-profile<br>  namespace: cert-manager<br>type: Opaque<br>stringData:<br>  tenancy: &quot;your tenancy ocid&quot;<br>  user: &quot;your user ocid&quot;<br>  region: &quot;your region&quot;<br>  fingerprint: &quot;your key fingerprint&quot;<br>  privateKey: |<br>    -----BEGIN RSA PRIVATE KEY-----<br>    ...KEY DATA HERE...<br>    -----END RSA PRIVATE KEY-----<br>  privateKeyPassphrase: &quot;private keys passphrase or empty string if none&quot;</pre><p>You can read the documentation about <a href="https://cert-manager.io/docs/concepts/issuer/">Issuers</a></p><p>Create a ClusterIssuer</p><pre>apiVersion: cert-manager.io/v1<br>kind: ClusterIssuer<br>metadata:<br>  name: letsencrypt-staging<br>spec:<br>  acme:<br>    # The ACME server URL<br>    server: https://acme-staging-v02.api.letsencrypt.org/directory<br><br>    # Email address used for ACME registration<br>    email: mail@example.com # REPLACE THIS WITH YOUR EMAIL!!!<br><br>    # Name of a secret used to store the ACME account private key<br>    privateKeySecretRef:<br>      name: letsencrypt-staging<br><br>    solvers:<br>      - dns01:<br>          webhook:<br>            groupName: acme.d-n.be<br>            solverName: oci<br>            config:<br>              ociProfileSecretName: oci-profile ## Should match the secret name created before</pre><h4>Workload Identity principal</h4><p>Create an IAM policy</p><pre>Allow any-user to manage dns in compartment &lt;compartment-name&gt; where all {request.principal.type=&#39;workload&#39;,request.principal.cluster_id=&#39;&lt;cluster-id&gt;&#39;,request.principal.service_account=&#39;&lt;external-dns-service-account-name&gt;&#39;}</pre><p>Create a ClusterIssuer</p><pre>apiVersion: cert-manager.io/v1<br>kind: ClusterIssuer<br>metadata:<br>  name: letsencrypt-staging<br>spec:<br>  acme:<br>    # The ACME server URL<br>    server: https://acme-staging-v02.api.letsencrypt.org/directory<br><br>    # Email address used for ACME registration<br>    email: mail@example.com # REPLACE THIS WITH YOUR EMAIL!!!<br><br>    # Name of a secret used to store the ACME account private key<br>    privateKeySecretRef:<br>      name: letsencrypt-staging<br><br>    solvers:<br>      - dns01:<br>          webhook:<br>            groupName: acme.d-n.be<br>            solverName: oci<br>            config:<br>              ociWorkloadIdentityEnabled: true<br>              ociRegion: us-ashburn-1     ## Give the appropriate region code</pre><h4>Instance principal</h4><p>Create the dynamic-group &amp; set the correct policy configure in your OCI account</p><pre>Allow dynamic-group &lt;dynamic-group-name&gt; to manage dns in compartment &lt;compartment-name&gt;</pre><p>Create a ClusterIssuer</p><pre>apiVersion: cert-manager.io/v1<br>kind: ClusterIssuer<br>metadata:<br>  name: letsencrypt-staging<br>spec:<br>  acme:<br>    # The ACME server URL<br>    server: https://acme-staging-v02.api.letsencrypt.org/directory<br><br>    # Email address used for ACME registration<br>    email: mail@example.com # REPLACE THIS WITH YOUR EMAIL!!!<br><br>    # Name of a secret used to store the ACME account private key<br>    privateKeySecretRef:<br>      name: letsencrypt-staging<br><br>    solvers:<br>      - dns01:<br>          webhook:<br>            groupName: acme.d-n.be<br>            solverName: oci<br>            config: {}</pre><h4>Create a certificate</h4><pre>apiVersion: cert-manager.io/v1<br>kind: Certificate<br>metadata:<br>  name: example-cert<br>  namespace: cert-manager<br>spec:<br>  privateKey:<br>    rotationPolicy: Always<br>  commonName: example.com<br>  dnsNames:<br>    - example.com<br>  issuerRef:<br>    name: letsencrypt-staging<br>  secretName: example-cert</pre><p>This will create the Certificate create workflow. Once done you should see something like below.</p><pre>kubectl -n cert-manager get certificates -o custom-columns=&quot;NAME:.metadata.name,READY:.status.conditions[0].status,SECRET:.spec.secretName,ISSUER:.spec.issuerRef.name,STATUS:.status.conditions[0].message,EXPIRATION_DATE:.status.notAfter&quot;<br><br>NAME                   READY   SECRET                 ISSUER                    STATUS                                          EXPIRATION_DATE<br>example-cert           True    example-cert         letsencrypt-staging   Certificate is up to date and has not expired       2025-01-27T19:37:59Z</pre><p>The certificate will be stored in a secret in this case example-cert.</p><p>Now we can use this secret for tls configuration. Below is an example on how its used for Istio Gateway TLS configuration</p><pre>apiVersion: networking.istio.io/v1alpha3<br>kind: Gateway<br>metadata:<br>  name: all-hosts<br>  namespace: cert-manager<br>spec:<br>  selector:<br>    istio: ingress<br>  servers:<br>  - hosts:<br>    - &#39;*&#39;<br>    port:<br>      name: http<br>      number: 80<br>      protocol: HTTP<br>    tls:<br>      httpsRedirect: true<br>  - hosts:<br>    - &#39;*&#39;<br>    port:<br>      name: https<br>      number: 443<br>      protocol: HTTPS<br>    tls:<br>      credentialName: example-cert<br>      mode: SIMPLE</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=713b9c54deba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ArgoCD vault plugin using OCI vault service as a backend for secrets management]]></title>
            <link>https://medium.com/@xsgdkh/argocd-vault-plugin-using-oci-vault-service-as-a-backend-for-secrets-management-ae80a025df67?source=rss-65589502497------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae80a025df67</guid>
            <dc:creator><![CDATA[Deepak Devadathan]]></dc:creator>
            <pubDate>Thu, 07 Nov 2024 04:47:17 GMT</pubDate>
            <atom:updated>2024-11-07T08:21:07.877Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is ArgoCD?</h3><p>Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*XfEgu46odRC7bTIrpGvl_A.png" /></figure><p>Argo CD follows the gitops pattern of using Git repositories as the source of truth for defining the desired application state. It basically reads the manifest stored in a git repository and deploys the manifest on the target kubernetes cluster. This makes the process automated and easy to maintain.</p><h3>Secrets Management Problem</h3><p>ArgoCD just pulls the manifest in git and deploys to target kubernetes cluster. But what if the manifests have secrets and other configuration, which we don’t want to commit to git?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*ILYre6OlgxRjS7OQjWqp8A.png" /></figure><p>Argo CD is un-opinionated about how secrets are managed. There are many ways to do it, and there’s no one-size-fits-all solution.</p><h3>ArgoCD vault plugin</h3><p>ArgoCD vault plugin ( AVP ) is an open source plugin developed by argoproj labs. This plugin is aimed at helping to solve the issue of secret management with GitOps and Argo CD. This plugin can be used not just for secrets but also for deployments, configMaps or any other Kubernetes resource.</p><p>It basically works on the principle of using placeholders in the manifest and then converting it to actual secrets before deploying.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*6WS-zWyxwA7K6PcIlhU1Og.png" /></figure><p>AVP supports many backends as a vault store like Hashicorp vault, AWS secrets manager, IBM Cloud Secrets Manager , GCP Secret Manager , AZURE Key Vault and many others. More backends are getting added by community contribution.</p><h3>Oracle Cloud Infrastructure (OCI) Vault Service as AVP secrets backend</h3><p>Vault service is an offering in OCI which centrally manage and maintain control of the encryption keys that protect enterprise data and the secret credentials used to securely access key vault resources.</p><p>I created a fork of avp repo and added the code for OCI vault as a backend. The repo details are <a href="https://github.com/ddevadat/argocd-vault-plugin">here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CVtsftRK4DTu9yWEO0bs2Q.png" /><figcaption>AVP: OCI Vault High Level Flow</figcaption></figure><p>The basic setup for AVP remains the same.</p><p>The AVP plugin must be configured with the below minimum values</p><pre>AVP_TYPE: ocivault<br>AVP_OCI_VAULT_ID: &quot;ocid1.vault.oc1...&quot;<br>AVP_OCI_VAULT_COMPARTMENT_ID: &quot;ocid1.compartment.oc1..aaaaaaa&quot;</pre><p>Suppose the given OCI vault has 2 secrets with different number of password versions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/1*G966Y3B82NDJtlA7hECfzw.png" /></figure><p>Secret manifests can be declared using</p><p><em>path annotation</em></p><pre>kind: Secret<br>apiVersion: v1<br>metadata:<br>  name: test-secret<br>  annotations:<br>    avp.kubernetes.io/path: &quot;ocivault&quot;<br>type: Opaque<br>data:<br>  POSTGRES_PASSWORD: &lt;postgres-password&gt;      ## This will evaluate to the b64encoded value of pg-password2<br>  MYSQL_PASSWORD: &lt;mysql-password&gt;            ## This will evaluate to the b64encoded value of mysql-password3</pre><p><em>inline path</em></p><pre>kind: Secret<br>apiVersion: v1<br>metadata:<br>  name: test-secret<br>type: Opaque<br>data:<br>  POSTGRES_PASSWORD: &lt;path:ocivault#postgres-password&gt;  ## This will evaluate to the b64encoded value of pg-password2<br>  MYSQL_PASSWORD: &lt;path:ocivault#mysql-password&gt;        ## This will evaluate to the b64encoded value of mysql-password3</pre><p>Refer configuration details for <a href="https://github.com/ddevadat/argocd-vault-plugin/blob/main/docs/backends.md#oracle-cloud-infrastruture-vault">OCI Vault backend</a>.</p><p>I have already raised PR for this and waiting for AVP review.</p><h3>AVP OCI Vault Demo</h3><p>Follow the demo <a href="https://github.com/ddevadat/avp-oci-vault-demo">repository</a></p><p>It supports for both API key and instance principal based authentication. For demo purpose I have used instance principal based authentication.</p><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae80a025df67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oracle Cloud Infrastructure Functions: How to create a function image with a custom directory…]]></title>
            <link>https://medium.com/@xsgdkh/oracle-cloud-infrastructure-functions-how-to-create-a-function-image-with-a-custom-directory-1c8831e864e5?source=rss-65589502497------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c8831e864e5</guid>
            <dc:creator><![CDATA[Deepak Devadathan]]></dc:creator>
            <pubDate>Mon, 31 Oct 2022 06:19:59 GMT</pubDate>
            <atom:updated>2022-10-31T06:19:59.996Z</atom:updated>
            <content:encoded><![CDATA[<h3>Oracle Cloud Infrastructure Functions: How to create a function image with a custom directory structure</h3><h3>OCI Functions</h3><p>Oracle Cloud Infrastructure (OCI) function is a Function-as-a-Service (FaaS) platform. It’s a serverless offering which lets developers create, run and scale application without managing any infrastructure. OCI function is based on the open source Fn project and it integrates with OCI services. Its container native, secure and user pay only for execution and not for idle time.</p><p>OCI functions supports various programming languages like Java, Python, Ruby, Go, Node.js, C#(.Net)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*yoECYuHbt1n7HU-1WuTcJw.png" /></figure><h3>OCI Functions — Template Code</h3><p>We can create a template code using fn init command. For this blog we are using the dotnet3.1 runtime as an example</p><pre>fn init — runtime dotnet3.1 oci-dotnet-hello-world</pre><pre>Creating function at: ./oci-dotnet-hello-world<br>Function boilerplate generated.<br>func.yaml created.</pre><p>This will create a directory structure like below</p><pre>└── oci-dotnet-hello-world<br>    ├── Function.sln<br>    ├── func.yaml<br>    ├── src<br>    │   └── Function<br>    │       ├── Function.csproj<br>    │       └── Program.cs<br>    └── tests<br>        └── Function.Tests<br>            ├── Function.Tests.csproj<br>            └── ProgramTest.cs</pre><pre>5 directories, 6 files</pre><h3>Challenge</h3><p>Sometimes there can be a requirement to have some customization on the directory structure. For example requirement could be to have</p><ul><li>No tests folder</li><li>Custom Project Names like OCIHelloWorld.csproj</li><li>Custom Namespace, dotnet class name, function handler name</li></ul><p>Fn builds image on a predefined Dockerfile which follows the template directory structure. So if we change directory structure or project files, the build process will fail.</p><p>e.g Lets rename the Function.csproj file OCIHelloWorld.csproj like below</p><pre>└── oci-dotnet-hello-world<br>    ├── Function.sln<br>    ├── func.yaml<br>    ├── src<br>    │   └── Function<br>    │       ├── <strong>OCIHelloWorld.csproj</strong><br>    │       └── Program.cs<br>    └── tests<br>        └── Function.Tests<br>            ├── Function.Tests.csproj<br>            └── ProgramTest.cs</pre><pre>5 directories, 6 files</pre><p>Lets try to build the image</p><pre>fn build --verbose</pre><p>Even though we renamed the file Function.csproj to OCIHelloWorld.csproj, the build process still refers to the old name</p><p>The build will fail with an error like below.</p><pre><strong>Step 4/12 : RUN dotnet sln add src/Function/Function.csproj tests/Function.Tests/Function.Tests.csproj</strong><br> ---&gt; Running in 05c4bd60cf9d</pre><pre>Welcome to .NET Core 3.1!<br>---------------------<br>SDK Version: 3.1.421</pre><pre>----------------<br>Explore documentation: <a href="https://aka.ms/dotnet-docs">https://aka.ms/dotnet-docs</a><br>Report issues and find source on GitHub: <a href="https://github.com/dotnet/core">https://github.com/dotnet/core</a><br>Find out what&#39;s new: <a href="https://aka.ms/dotnet-whats-new">https://aka.ms/dotnet-whats-new</a><br>Learn about the installed HTTPS developer cert: <a href="https://aka.ms/aspnet-core-https">https://aka.ms/aspnet-core-https</a><br>Use &#39;dotnet --help&#39; to see available commands or visit: <a href="https://aka.ms/dotnet-cli-docs">https://aka.ms/dotnet-cli-docs</a><br>Write your first app: <a href="https://aka.ms/first-net-core-app">https://aka.ms/first-net-core-app</a><br>--------------------------------------------------------------------------------------<br><strong>Could not find project or directory `src/Function/Function.csproj`</strong>.<br>Usage: dotnet sln &lt;SLN_FILE&gt; add [options] &lt;PROJECT_PATH&gt;</pre><h3>Solution</h3><p>This happens because fn build will generate a Dockerfile based on the original template and build image from that.</p><p>First rename the file OCIHelloWorld.csproj back to Function.csproj like below</p><pre>└── oci-dotnet-hello-world<br>    ├── Function.sln<br>    ├── func.yaml<br>    ├── src<br>    │   └── Function<br>    │       ├── Function.csproj<br>    │       └── Program.cs<br>    └── tests<br>        └── Function.Tests<br>            ├── Function.Tests.csproj<br>            └── ProgramTest.cs</pre><pre>5 directories, 6 files</pre><p>We can get the default Dockerfile definition by running the below command</p><pre>cd oci-dotnet-hello-world<br>fn build --verbose | grep Step | cut -d &quot; &quot; -f4- &gt; Dockerfile.original<br>mv Dockerfile.original Dockerfile</pre><p>Contents of Dockerfile</p><pre>FROM fnproject/dotnet:3.1-1.0.4-dev as build-stage<br>WORKDIR /function<br>COPY . .<br>RUN dotnet sln add src/Function/Function.csproj tests/Function.Tests/Function.Tests.csproj<br>RUN dotnet build -c Release<br>RUN dotnet test -c Release<br>RUN dotnet publish src/Function/Function.csproj -c Release -o out<br>FROM fnproject/dotnet:3.1-1.0.4<br>WORKDIR /function<br>COPY --from=build-stage /function/out/ /function/<br>ENTRYPOINT [&quot;dotnet&quot;, &quot;Function.dll&quot;]<br>CMD [&quot;Function:Greeter:greet&quot;]</pre><p>Lets review our customization requirement</p><ol><li>No tests folder</li><li>Flat project structure</li><li>Project file name: OCIHelloWorld.csproj</li><li>Namespace: OCIHelloWorld</li><li>Classname: Function</li><li>Handler function: function_handler</li><li>Main program: HelloWorld.cs</li></ol><p>Lets remove the tests folder and reorganize the directory structure , so it looks like below</p><pre>└── oci-dotnet-hello-world<br>    ├── Dockerfile<br>    ├── Function.sln<br>    ├── HelloWorld.cs<br>    ├── OCIHelloWorld.csproj<br>    └── func.yaml</pre><pre>1 directory, 5 files</pre><p>Change the Dockerfile as below to reflect the new csproj files, updated entrypoint and cmd.</p><pre>FROM fnproject/dotnet:3.1-1.0.4-dev as build-stage<br>WORKDIR /function<br>COPY . .<br>RUN dotnet sln add <strong>OCIHelloWorld.csproj</strong><br>RUN dotnet build <strong>OCIHelloWorld.csproj</strong> -c Release<br>RUN dotnet publish <strong>OCIHelloWorld.csproj</strong> -c Release -o out<br>FROM fnproject/dotnet:3.1-1.0.4<br>WORKDIR /function<br>COPY --from=build-stage /function/out/ /function/<br>ENTRYPOINT [&quot;dotnet&quot;, &quot;<strong>OCIHelloWorld.dll</strong>&quot;]<br>CMD [&quot;<strong>OCIHelloWorld:Function:function_handler</strong>&quot;]</pre><p>Update the cmd &amp; entrypoint in the func.yaml as below</p><pre>schema_version: 20180708<br>name: oci-dotnet-hello-world<br>version: 0.0.1<br>runtime: dotnet3.1<br>build_image: fnproject/dotnet:3.1-1.0.4-dev<br>run_image: fnproject/dotnet:3.1-1.0.4<br>cmd: <strong>OCIHelloWorld:Function:function_handler</strong><br>entrypoint: dotnet <strong>OCIHelloWorld.dll</strong></pre><p>Update the namespace, classname, function handler method in HelloWorld.cs as below</p><pre>using System.Runtime.CompilerServices;<br>namespace <strong>OCIHelloWorld</strong> {<br>    class <strong>Function</strong> {<br>        public string <strong>function_handler</strong>(string input) {<br>            return string.Format(&quot;Hello {0}!&quot;,<br>                string.IsNullOrEmpty(input) ? &quot;World&quot; : input.Trim());<br>        }</pre><pre>static void Main(string[] args) { Fdk.Handle(args[0]); }<br>    }<br>}</pre><p>Test the build</p><pre>fn build --verbose</pre><p>Deploy the function</p><pre>fn --verbose deploy --app &lt;Demo-Fn-Application&gt;</pre><p>Test the function</p><pre>fn invoke &lt;Demo-Fn-Application&gt;oci-dotnet-hello-world<br>Hello World!</pre><pre>echo -n &#39;Bob&#39; | fn invoke &lt;Demo-Fn-Application&gt;oci-dotnet-hello-world<br>Hello Bob!</pre><p>We successfully deployed a function with a customized directory structure. Similar approach can be followed for other supported runtime environment</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c8831e864e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Infrastructure provisioning using OCI DevOps & Resource Manager]]></title>
            <link>https://medium.com/@xsgdkh/infrastructure-provisioning-using-oci-devops-resource-manager-1e8a74d02a70?source=rss-65589502497------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e8a74d02a70</guid>
            <category><![CDATA[oci-devops]]></category>
            <category><![CDATA[oci-resource-manager]]></category>
            <category><![CDATA[oci]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Deepak Devadathan]]></dc:creator>
            <pubDate>Tue, 27 Sep 2022 20:56:25 GMT</pubDate>
            <atom:updated>2022-09-27T20:57:23.041Z</atom:updated>
            <content:encoded><![CDATA[<h3>OCI Devops</h3><p>Oracle Cloud Infrastructure <a href="https://docs.oracle.com/en-us/iaas/Content/devops/using/home.htm">DevOps service</a> is a complete continuous integration/continuous delivery (CI/CD) platform for developers to simplify and automate their software development lifecycle.</p><h3>OCI Resource Manager</h3><p>Resource Manager is an Oracle Cloud Infrastructure service that allows you to automate the process of provisioning your Oracle Cloud Infrastructure resources. Using Terraform, Resource Manager helps you install, configure, and manage resources through the “infrastructure-as-code” model.</p><h3>Solution Overview</h3><p>Our objective is to build a CI/CD pipeline for infrastructure provisioning as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*flm88ipAzimJmECL0FhbYA.png" /><figcaption>Workflow diagram</figcaption></figure><h3>OCI Devops configuration</h3><p>For this demo, lets create a code repository where we will save the terraform source code and configure a build pipeline</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mavgyZsYB7EZd2acMtxJCA.png" /><figcaption>OCI Devops Repository</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*6zBD-0QIyugWWLa4uEk73A.png" /><figcaption>OCI Devops Build Pipeline</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9oui6Rgy8VEusEosbYBc1g.png" /><figcaption>Add a build stage</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kliVgjDLG3zW4gqWtnmOAw.png" /><figcaption>Configure build stage</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ljYKM3UBtYYo4qJQ73-Y0Q.png" /><figcaption>Create a trigger to star the build pipeline</figcaption></figure><p>Clone Repository</p><pre>git clone ssh://devops.scmservice.ap-sydney-1.oci.oraclecloud.com/namespaces/&lt;namespace&gt;/projects/&lt;devops_project&gt;/repositories/orm-stack<br>Cloning into &#39;orm-stack&#39;...<br>remote: Counting objects: 2, done<br>remote: Finding sources: 100% (2/2)<br>remote: Getting sizes: 100% (1/1)<br>remote: Total 2 (delta 0), reused 2 (delta 0)<br>Receiving objects: 100% (2/2), done.</pre><p>Create a dyanamic group</p><p>e.g Demo-Devops-Dynamic-Group</p><pre>All {resource.type = &#39;devopsrepository&#39;, resource.compartment.id = &#39;ocid1.compartment.oc1..XXXXXX&#39; }</pre><pre>All {resource.type = &#39;devopsbuildpipeline&#39;, resource.compartment.id = &#39;ocid1.compartment.oc1..XXXXXX&#39; }</pre><pre>All {resource.type = &#39;devopsdeploypipeline&#39;, resource.compartment.id = &#39;ocid1.compartment.oc1..XXXXXXX&#39; }</pre><pre>All {resource.type = &#39;devopsconnection&#39;, resource.compartment.id = &#39;ocid1.compartment.oc1..XXXXXXXX&#39; }</pre><p>Create a policy as per the requirement. For the purpose of this demo we created a policy like below</p><p>e.g Demo-Devops-Policy</p><pre>Allow dynamic-group Demo-Devops-Dynamic-Group to manage all-resources in compartment id ocid1.compartment.oc1..XXXXX</pre><pre>Allow dynamic-group Demo-Devops-Dynamic-Group to use log-content in compartment id ocid1.compartment.oc1..XXXXXXX</pre><h3>Resource Manager Files</h3><p>For demo purpose, our project structure looks like below</p><pre>└── orm-stack<br>    ├── build_spec.yaml<br>    └── terraform<br>        └── resource_manager.tf</pre><pre>2 directories, 2 files</pre><p>We will be testing this in sydney (ap-sydney-1) region.</p><p>Update the placeholder values with actual values for the below variables<br>region<br>tenancy_ocid<br>compartment_ocid</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0cd547b480d163c7ac646a6577f21d0f/href">https://medium.com/media/0cd547b480d163c7ac646a6577f21d0f/href</a></iframe><p>Create the bucket which will hold all the terraform files. Bucket name can be anything</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac5c01f3004b65756084e762fef02a9d/href">https://medium.com/media/ac5c01f3004b65756084e762fef02a9d/href</a></iframe><p>Upload the base resource_manager.tf to the bucket named ORM-Stack-Terraform-Files created above</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/615117e2cc42a1623797d28a87edf135/href">https://medium.com/media/615117e2cc42a1623797d28a87edf135/href</a></iframe><p>Get the <a href="https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm#About">OCI region key</a></p><p>Get the <a href="https://docs.oracle.com/en-us/iaas/Content/ResourceManager/Reference/terraformversions.htm#supported">Terraform Versions Supported by Resource Manager</a></p><p>Create a resource manager stack and note down the stack ocid</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dab376dad8391ba9d20fd5328b5a361c/href">https://medium.com/media/dab376dad8391ba9d20fd5328b5a361c/href</a></iframe><h3>Build Specification</h3><p>The <a href="https://docs.oracle.com/en-us/iaas/Content/devops/using/build_specs.htm">build specification</a> contains build steps and settings that the build pipeline uses to run a build. The file is named as build_spec.yml or build_spec.yaml and by default is located in the root of your primary build source directory</p><p>Update the placeholder values with actual values for the below variables<br>bucket_name<br>stack_id</p><p>For this example<br>bucket_name: ORM-Stack-Terraform-Files<br>stack_id: &lt;returned value when created orm stack above&gt;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a6400b8872c9bdbdd92c08f31cbd035/href">https://medium.com/media/9a6400b8872c9bdbdd92c08f31cbd035/href</a></iframe><h3>Trigger Build Pipeline</h3><p>We have created a trigger for every push to start the build pipleline.</p><p>Commit and push the changes</p><pre>git add -A<br>git commit -m &quot;Added resource manger tf file&quot;<br>git push</pre><p>This will trigger the build pipeline</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FPiWHWNMxZ1SS1Jmls4h8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gp65cWf9W_6kVhohwBMnoQ.png" /><figcaption>Successful Build Pipeline Run</figcaption></figure><p>This build job trigger the terraform plan and apply job on OCI resource manager stack</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mtzsa-JCS61UToawhfDVeA.png" /><figcaption>Resource Manager Stack Job Status</figcaption></figure><p>We can now create new terraform files in the terraform directory of our project folder.</p><pre>└── orm-stack<br>    ├── build_spec.yaml<br>    └── terraform<br>        ├── buckets.tf<br>        ├── resource_manager.tf<br>        └── variables.tf</pre><pre>2 directories, 4 files</pre><p>Once the files are pushed to the Devops repo, the build pipleline will be triggered to run the OCI Resource manager plan and apply job.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e8a74d02a70" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>