Skip to content

krateoplatformops/composition-dynamic-controller-v2

 
 

Repository files navigation

Composition Dynamic Controller V2

The composition-dynamic-controller-v2 is an operator that is instantiated by the oasgen-provider to manage the Custom Resources whose Custom Resource Definition is generated by the oasgen-provider.

Summary

Overview

The composition-dynamic-controller-v2 is a fork of composition-dynamic-controller that adds the capability to manage Remote Resources (via REST APIs) in addition to managing Helm charts.

In practice, when a Custom Resource (CR) is created and its Custom Resource Definition (CRD) has been generated by a RestDefinition from oasgen-provider, the instance of composition-dynamic-controller-v2 enabled to manage this specific Group Version Kind (GVK) checks if the remote resource already exists by following the instructions defined in the RestDefinition. If the resource does not exist, it performs the action described in the verbsDescription field of the RestDefinition CR. The same process occurs when a request is made to delete the resource. Additionally, when observing the resource, composition-dynamic-controller-v2 checks if the remote resource is up-to-date with the CR and performs an update if it is not.

Examples

kind: Repo
apiVersion: gen.github.com/v1alpha1
metadata:
  name: gh-repo1
  namespace: default
  annotations:
    krateo.io/connector-verbose: "true"
spec:
  org: krateoplatformops
  name: test-generatore
  authenticationRefs:
    bearerAuthRef: bearer-gh-ref

The manifest described above represents a Custom Resource (CR) of kind Repo, and its apiVersion is gen.github.com/v1alpha1. This CRD was generated by the oasgen-provider based on the specifications outlined in the RestDefinition below. Applying this manifest within the cluster initiates the reconciliation process for the resource described.

Github Repo RestDefinition
kind: RestDefinition
apiVersion: swaggergen.krateo.io/v1alpha1
metadata:
  name: def-github
  namespace: default
spec:
  deletionPolicy: Delete 
  oasPath: https://github.com/krateoplatformops/github-oas3/raw/1-oas-specification-fixes/openapi.yaml
  resourceGroup: gen.github.com
  resource: 
    kind: Repo
    identifiers:
      - id 
      - name
      - html_url
    verbsDescription:
    - action: create
      method: POST
      path: /orgs/{org}/repos
    - action: delete
      method: DELETE
      path: /repos/{owner}/{repo}
      altFieldMapping:
        org: owner
        name: repo
    - action: get
      method: GET
      path: /repos/{owner}/{repo}
      altFieldMapping:
        org: owner
        name: repo

Configuration

Operator Env Vars

These enviroment varibles can be changed in the Deployment of the composition-dynamic-controller we need to tweak.

Name Description Default Value
COMPOSITION_CONTROLLER_DEBUG dump verbose output false
COMPOSITION_CONTROLLER_WORKERS number of workers 1
COMPOSITION_CONTROLLER_RESYNC_INTERVAL resync interval 3m
COMPOSITION_CONTROLLER_GROUP resource api group
COMPOSITION_CONTROLLER_VERSION resource api version
COMPOSITION_CONTROLLER_RESOURCE resource plural name

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Go 98.8%
  • Other 1.2%