@startuml
' This diagram outlines to folder structure
' and dependencies between kustomize overlays
' used to deploy the devworkspace-operator
' manually.

Title Kustomize deployment structure
skinparam TitleFontSize 24
skinparam Object {
  BackgroundColor white
  BorderColor black
  FontSize 16
  FontColor #0000AA
  AttributeFontSize 12
}

object "templates/cert-manager" as certmanager {
  - Patch controller deployment
    with webhook secret name
  - Patch CRDs with cert-manager
    annotation to inject webhook
    and cert-manager certificate
  - Apply devworkspace-operator name
    prefix, namespace, and common
    labels
  --Output--
  Controller configured for k8s
    and cert-manager
}
object "templates/service-ca" as serviceca {
  - Patch CRDs with service-ca
    annotation to inject webhooks
    and certificate
  - Apply devworkspace-operator name
    prefix, namespace, and common
    labels
  --Output--
  Controller configured for OpenShift
    and Service CA
}

object "templates/base" as base {
  - Create default configmap for
    controller
  - Patch image used for controller
    and webhook server with ${DWO_IMG}
  --Output--
  Basic controller with no webhooks;
  namespace and namePrefix unconfigured
}
object "templates/crd" as crd {
  - Combine all defined CRDs
  - Set configuration to allow
    kustomize to inject namespace,
    names for services, etc.
  --Output--
  List of CRDs to be deployed
}

object "templates/components/manager" as manager {
  - Store deployment.yaml for controller
  --Output--
  deployment spec for controller
}
object "templates/components/rbac" as rbac {
  - Store autogenerated RBAC files for
    controller
  - Includes aggregated roles for edit/view
  --Output--
  Cluster roles/rolebindings used by
    controller and CRDs
}
object "templates/components/cert-manager" as certs {
  - Configure a self-signed issuer and
    a self-signed certificate on the cluster
  - Configure kustomize to allow referencing
    fields in the cert-manager CRDs in other
    files
  --Output--
  Basic requirements to automatically deploy
    certificates with cert-manager
}

certmanager *-- base
certmanager *-- certs
serviceca *-- base

base *-- manager
base *-- rbac
base *-- crd

@enduml
