mayadata-io / d-operators

Declarative patterns to write kubernetes controllers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: delete previously created resources that are no longer needed

AmitKumarDas opened this issue · comments

ProblemStatement: As a SRE admin, I would like to delete outdated resources that were created via Recipe tasks. I want to avoid creating new Recipe(s) to delete unused ones.

Draft design

  • Consider below Recipe was applied previously
kind: Recipe
metadata:
  name: auto
  namespace: reconcile
spec:
  deleteUnused: true # tunable to handle this feature
  tasks:
  - name:
    create:
      state:
        kind: Pod
        metadata: 
          name: hello
          name: there
  - name:
    apply:
      state:
        kind: ConfigMap
        metadata: 
          name: hello
          name: there
  • Above Recipe was modified as follows:
kind: Recipe
metadata:
  name: auto
  namespace: reconcile
spec:
  deleteUnused: true # tunable to handle this feature
  tasks:
  - name:
    apply:
      state:
        kind: ConfigMap
        metadata: 
          name: hello
          name: there
  • Above should lead to deletion of Pod that was created earlier by this Recipe