-
Notifications
You must be signed in to change notification settings - Fork 95
feat: add support for appset plugin generators #624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for appset plugin generators #624
Conversation
a31700e
to
5de458f
Compare
This has one caveat, which likely cannot be fixed until argoproj-labs#615 is merged; we're limited to simple string maps for `parameters`, which is only a subset of what the plugin generator supports. In reality pretty much anything can go in as a parameter from the perspective of the plugin generator, but `terraform-plugin-sdk` needs an explicit type. With `terraform-plugin-framework` we can use any as a type, then we can handle the marshaling/unmarshaling appropriately. I don't believe this will be a breaking change in the future since we will be widening the types `parameters` will accept at a later stage. Fixes argoproj-labs#620. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
5de458f
to
39a0f59
Compare
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Dear maintainers @oboukili @onematchfox @the-technat @mkilchhofer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@blakepettersson have you also done a manual test locally to see if the fields are set correctly? |
@the-technat yes, this TF resource "argocd_application_set" "plugin" {
metadata {
name = "plugin"
}
spec {
generator {
plugin {
config_map_ref = "plugin"
input {
parameters = {
key1 = "value1"
}
}
requeue_after_seconds = 30
}
}
template {
metadata {
name = "{{cluster}}-guestbook"
}
spec {
project = "default"
source {
repo_url = "https://github.com/argoproj/argo-cd.git"
target_revision = "HEAD"
path = "applicationset/examples/list-generator/guestbook/{{cluster}}"
}
destination {
server = "{{url}}"
namespace = "guestbook"
}
}
}
}
} Will create this appset apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: plugin
namespace: argocd
spec:
generators:
- plugin:
configMapRef:
name: plugin
input:
parameters:
key1: value1
requeueAfterSeconds: 30
template:
metadata: {}
spec:
destination: {}
project: ""
template:
metadata:
name: '{{cluster}}-guestbook'
spec:
destination:
namespace: guestbook
server: '{{url}}'
project: default
revisionHistoryLimit: 10
source:
path: applicationset/examples/list-generator/guestbook/{{cluster}}
repoURL: https://github.com/argoproj/argo-cd.git
targetRevision: HEAD
templatePatch: "" |
argoproj-labs#624 added support for plugin generators, but the support for it was never added to the nested generators. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
* fix: add plugin generator to nested generator #624 added support for plugin generators, but the support for it was never added to the nested generators. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: add flatten step This needs to go the other way as well. Added test which verifies this works E2E. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * chore: please linter Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix(test): make sure appset name is unique Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> --------- Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
* fix: add plugin generator to nested generator argoproj-labs#624 added support for plugin generators, but the support for it was never added to the nested generators. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: add flatten step This needs to go the other way as well. Added test which verifies this works E2E. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * chore: please linter Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix(test): make sure appset name is unique Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> --------- Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> Signed-off-by: VerhovnikU <verhovnik.uros@gmail.com>
This has one caveat, which likely cannot be fixed until #615 is merged; we're limited to simple string maps for
parameters
, which is only a subset of what the plugin generator supports. In reality pretty much anything can go in as a parameter from the perspective of the plugin generator, butterraform-plugin-sdk
needs an explicit type.With
terraform-plugin-framework
we can use any as a type, then we can handle the marshaling/unmarshaling appropriately. I don't believe this will be a breaking change in the future since we will be widening the typesparameters
will accept at a later stage.Fixes #620