Add debug output to fleet apply in gitjob
Also add another '--' to deal with argument disambiguity.
@@ -23,6 +23,7 @@ import (
"github.com/rancher/wrangler/pkg/name"
"github.com/rancher/wrangler/pkg/relatedresource"
"github.com/rancher/wrangler/pkg/yaml"
+ "github.com/sirupsen/logrus"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
@@ -583,6 +584,13 @@ func argsAndEnvs(gitrepo *fleet.GitRepo) ([]string, []corev1.EnvVar) {
args := []string{
"fleet",
"apply",
+ }
+
+ if logrus.IsLevelEnabled(logrus.DebugLevel) {
+ args = append(args, "--debug", "--debug-level", "9")
+ }
+
+ args = append(args,
"--targets-file=/run/config/targets.yaml",
"--label="+fleet.RepoLabel+"="+gitrepo.Name,
"--namespace", gitrepo.Namespace,
@@ -590,7 +598,8 @@ func argsAndEnvs(gitrepo *fleet.GitRepo) ([]string, []corev1.EnvVar) {
fmt.Sprintf("--sync-generation=%d", gitrepo.Spec.ForceSyncGeneration),
fmt.Sprintf("--paused=%v", gitrepo.Spec.Paused),
"--target-namespace", gitrepo.Spec.TargetNamespace,
- }
+ "--",
+ )
var env []corev1.EnvVar
if gitrepo.Spec.HelmSecretName != "" {
@@ -622,5 +631,6 @@ func argsAndEnvs(gitrepo *fleet.GitRepo) ([]string, []corev1.EnvVar) {
},
})
}
+
return append(args, gitrepo.Name), env
}
