mirror of
https://github.com/hanzoai/cd.git
synced 2026-10-30 14:56:45 +00:00
Rename test names, comments, fixture data, and mock GitHub/webhook responses that still said Argo/ArgoCD/argocd/argoproj in our own voice, matching the hanzocd-* binary/configmap names and the apps.hanzo.ai CRD/annotation domain already established elsewhere in the fork. Also drop the dated argov1alpha1/argoprojiov1alpha1 import aliases for our own v1alpha1 API package. Restore the CRD groups a prior blind rename had mangled on a vendored third-party Argo Workflows example manifest back to the real argoproj.io, and fix several places where an earlier half-finished rename had gone silently wrong instead of just being cosmetic: stale CD_BINARY_NAME values and a stale --argocd-repo-server flag no longer recognized by the binary, cert filenames and an ssh_known_hosts alias that didn't match what's actually on disk, a namespace and a kustomize image substitution that were silent no-ops, and a test assertion regex that could never match its own fixture. External lookup keys we don't control are left byte-exact: quay.io/argoprojlabs images, the docker.io/argoproj CI builder image, live argoproj/argo-workflows release URLs, the generated ArgoprojV1alpha1() clientset method, and the Makefile-coupled /tmp/argo-e2e and GOPATH mount conventions.
42 lines
1.6 KiB
Go
42 lines
1.6 KiB
Go
package generators
|
|
|
|
import (
|
|
"errors"
|
|
"time"
|
|
|
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
|
|
|
"github.com/hanzoai/cd/pkg/apis/application/v1alpha1"
|
|
"github.com/hanzoai/cd/util/env"
|
|
)
|
|
|
|
// Generator defines the interface implemented by all ApplicationSet generators.
|
|
type Generator interface {
|
|
// GenerateParams interprets the ApplicationSet and generates all relevant parameters for the application template.
|
|
// The expected / desired list of parameters is returned, it then will be render and reconciled
|
|
// against the current state of the Applications in the cluster.
|
|
GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, applicationSetInfo *v1alpha1.ApplicationSet, client client.Client) ([]map[string]any, error)
|
|
|
|
// GetRequeueAfter is the generator can controller the next reconciled loop
|
|
// In case there is more then one generator the time will be the minimum of the times.
|
|
// In case NoRequeueAfter is empty, it will be ignored
|
|
GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
|
|
|
|
// GetTemplate returns the inline template from the spec if there is any, or an empty object otherwise
|
|
GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
|
|
}
|
|
|
|
var (
|
|
ErrEmptyAppSetGenerator = errors.New("ApplicationSet is empty")
|
|
NoRequeueAfter time.Duration
|
|
)
|
|
|
|
const (
|
|
DefaultRequeueAfter = 3 * time.Minute
|
|
)
|
|
|
|
func getDefaultRequeueAfter() time.Duration {
|
|
// Default is 3 minutes, min is 1 second, max is 1 year
|
|
return env.ParseDurationFromEnv("CD_APPLICATIONSET_CONTROLLER_REQUEUE_AFTER", DefaultRequeueAfter, 1*time.Second, 8760*time.Hour)
|
|
}
|