1
0
mirror of synced 2026-02-06 19:05:55 +00:00

Update kustomize-controller to v0.0.12

This commit is contained in:
stefanprodan
2020-09-14 17:10:22 +03:00
parent c121a4c0f5
commit c36e02bba9
5 changed files with 24 additions and 14 deletions

View File

@@ -186,7 +186,7 @@ func generateSyncManifests(url, branch, name, namespace, targetPath, tmpDir stri
},
Path: fmt.Sprintf("./%s", strings.TrimPrefix(targetPath, "./")),
Prune: true,
SourceRef: kustomizev1.CrossNamespaceObjectReference{
SourceRef: kustomizev1.CrossNamespaceSourceReference{
Kind: sourcev1.GitRepositoryKind,
Name: name,
},

View File

@@ -30,6 +30,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"sigs.k8s.io/controller-runtime/pkg/client"
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
)
@@ -139,7 +140,7 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
},
Path: ksPath,
Prune: ksPrune,
SourceRef: kustomizev1.CrossNamespaceObjectReference{
SourceRef: kustomizev1.CrossNamespaceSourceReference{
Kind: sourcev1.GitRepositoryKind,
Name: ksSource,
},
@@ -149,31 +150,40 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
}
if len(ksHealthCheck) > 0 {
healthChecks := make([]kustomizev1.WorkloadReference, 0)
healthChecks := make([]kustomizev1.CrossNamespaceObjectReference, 0)
for _, w := range ksHealthCheck {
kindObj := strings.Split(w, "/")
if len(kindObj) != 2 {
return fmt.Errorf("invalid health check '%s' must be in the format 'kind/name.namespace' %v", w, kindObj)
}
kind := kindObj[0]
//TODO: (stefan) extend this list with all the kstatus builtin kinds
kinds := map[string]bool{
"Deployment": true,
"DaemonSet": true,
"StatefulSet": true,
"Deployment": true,
"DaemonSet": true,
"StatefulSet": true,
helmv2.HelmReleaseKind: true,
}
if !kinds[kind] {
return fmt.Errorf("invalid health check kind '%s' can be Deployment, DaemonSet or StatefulSet", kind)
return fmt.Errorf("invalid health check kind '%s' can be HelmRelease, Deployment, DaemonSet or StatefulSet", kind)
}
nameNs := strings.Split(kindObj[1], ".")
if len(nameNs) != 2 {
return fmt.Errorf("invalid health check '%s' must be in the format 'kind/name.namespace'", w)
}
healthChecks = append(healthChecks, kustomizev1.WorkloadReference{
check := kustomizev1.CrossNamespaceObjectReference{
Kind: kind,
Name: nameNs[0],
Namespace: nameNs[1],
})
}
//TODO: (stefan) define the API version as a constant in the API package
if kind == helmv2.HelmReleaseKind {
check.APIVersion = "helm.toolkit.fluxcd.io/v2alpha1"
}
healthChecks = append(healthChecks, check)
}
kustomization.Spec.HealthChecks = healthChecks
kustomization.Spec.Timeout = &metav1.Duration{