Conversation
Makefile
Outdated
|
||
.PHONY: image | ||
image: | ||
docker build -t registry.cn-hangzhou.aliyuncs.com/appcenter/argocd-aplicationset:$(IMAGE_TAG) . |
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.
Could we make the registry configurable as well, $IMAGE perhaps?
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.
I agree. Can make it such that it builds a local image (without a registry), but will prepend IMAGE_PREFIX
if it is defined?
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.
Done
Makefile
Outdated
|
||
.PHONY: image | ||
image: | ||
docker build -t registry.cn-hangzhou.aliyuncs.com/appcenter/argocd-aplicationset:$(IMAGE_TAG) . |
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.
I agree. Can make it such that it builds a local image (without a registry), but will prepend IMAGE_PREFIX
if it is defined?
api/v1alpha1/applicationset_types.go
Outdated
type ApplicationSetSpec struct { | ||
Generators ApplicationSetGenerators `json:"generators"` | ||
Template ApplicationSetTemplate `json:"template"` | ||
Operation *v1alpha1.SyncOperation `json:"operation,omitempty"` |
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.
Regarding the operation
field:
-
Reusing the SyncOperation from the Applications APIs probably doesn't make sense here, since that object deals with a single git revision. But ApplicationSets may deal with many revisions, and even many repositories. If we do decide to have operation, we will need a new data structure.
-
In fact, we're not sure what a sync operation even means for an AppSet. Currently, I think it would only be used as a convenience field which carries forward setting the operation field for all the Applications in the ApplicationSet. But this could be done as a convenience in the API server instead.
-
We've had some regrets about introducing this operation field in Applications, since a better alternative might have been to introduce an
SyncOperation
CRD and controller to perform the logic. This CRD would act like a Job object and finish Successfully or Failed.
So with the above, I think we should leave out operation, until we think about how we want to do operations (if at all).
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.
agree
api/v1alpha1/applicationset_types.go
Outdated
type SyncPolicyAutomated struct { | ||
// Prune will prune resources automatically as part of automated sync (default: false) | ||
Prune bool `json:"prune,omitempty"` | ||
InitialSync bool `json:"initialSync,omitempty"` |
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.
I'm thinking the word sync
is redundant in the initialSync
, since it's already part of a syncPolicy
. How about:
spec:
syncPolicy:
automated:
prune: true
initial: true
Let's also comment this to explain what this option is for:
// Initial will perform an initial sync for any newly created Applications which do not have automated sync turned on.
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.
Done
4a34567
to
f3ff421
Compare
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.
Just a couple quick thoughts on naming the structs, please disregard if this doesn't look better to you.
api/v1alpha1/applicationset_types.go
Outdated
} | ||
|
||
// GeneratorsList include items info | ||
type GeneratorsList struct { |
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.
GeneratorsList implies this is a list of all generators, what do you think about ListGenerator to more clearly indicate what this is?
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.
Agree
api/v1alpha1/applicationset_types.go
Outdated
} | ||
|
||
// GeneratorsItems include cluster and url info | ||
type GeneratorsItems struct { |
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.
Suggest ListGeneratorItem
api/v1alpha1/applicationset_types.go
Outdated
|
||
// ApplicationSetGenerators include list item info | ||
type ApplicationSetGenerators struct { | ||
List GeneratorsList `json:"list, omitempty"` |
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.
Feels like this should be *GeneratorsList as it is optional.
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.
Yes
main.go
Outdated
|
||
if err = (&controllers.ApplicationSetReconciler{ | ||
Client: mgr.GetClient(), | ||
Log: ctrl.Log.WithName("controllers").WithName("ApplicationSet"), |
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.
Minor compile error here as the reconciler has no Log field.
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.
fix
api/v1alpha1/applicationset_types.go
Outdated
|
||
// ApplicationSetSpec represents a class of application set state. | ||
type ApplicationSetSpec struct { | ||
Generators ApplicationSetGenerators `json:"generators"` |
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.
Per spec, it should be an array of ApplicationSetGenerator:
spec:
generators:
- clusters: {}
Generators []ApplicationSetGenerator `json:"generators"`
api/v1alpha1/applicationset_types.go
Outdated
} | ||
|
||
// ApplicationSetGenerators include list item info | ||
type ApplicationSetGenerators struct { |
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.
We should remove s
from ApplicationSetGenerators since this should be a single generator
type ApplicationSetGenerator struct {
List *ListGenerator `json:"list, omitempty"`
}
Also, we should remove s from ListGenerators
as well.
api/v1alpha1/applicationset_types.go
Outdated
} | ||
|
||
// ItemGenerators include cluster and url info | ||
type ItemGenerators struct { |
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.
type ListGeneratorItem struct
api/v1alpha1/applicationset_types.go
Outdated
} | ||
|
||
// ListGenerators include items info | ||
type ListGenerators struct { |
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.
Should be:
type ListGenerator struct {
(no s)
api/v1alpha1/applicationset_types.go
Outdated
// ApplicationSetTemplate represents argocd ApplicationSpec | ||
type ApplicationSetTemplate struct { | ||
metav1.ObjectMeta `json:"metadata"` | ||
TemplateSpec v1alpha1.ApplicationSpec `json:"spec"` |
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.
I think the field name needs to be named Spec
, otherwise this may be an K8s API violation since the golang field name does not match the json field name.
First crd implement list item function