Update kustomize-controller to v0.0.12
This commit is contained in:
@@ -186,7 +186,7 @@ func generateSyncManifests(url, branch, name, namespace, targetPath, tmpDir stri
|
|||||||
},
|
},
|
||||||
Path: fmt.Sprintf("./%s", strings.TrimPrefix(targetPath, "./")),
|
Path: fmt.Sprintf("./%s", strings.TrimPrefix(targetPath, "./")),
|
||||||
Prune: true,
|
Prune: true,
|
||||||
SourceRef: kustomizev1.CrossNamespaceObjectReference{
|
SourceRef: kustomizev1.CrossNamespaceSourceReference{
|
||||||
Kind: sourcev1.GitRepositoryKind,
|
Kind: sourcev1.GitRepositoryKind,
|
||||||
Name: name,
|
Name: name,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
|
helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1"
|
||||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1"
|
||||||
sourcev1 "github.com/fluxcd/source-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,
|
Path: ksPath,
|
||||||
Prune: ksPrune,
|
Prune: ksPrune,
|
||||||
SourceRef: kustomizev1.CrossNamespaceObjectReference{
|
SourceRef: kustomizev1.CrossNamespaceSourceReference{
|
||||||
Kind: sourcev1.GitRepositoryKind,
|
Kind: sourcev1.GitRepositoryKind,
|
||||||
Name: ksSource,
|
Name: ksSource,
|
||||||
},
|
},
|
||||||
@@ -149,31 +150,40 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(ksHealthCheck) > 0 {
|
if len(ksHealthCheck) > 0 {
|
||||||
healthChecks := make([]kustomizev1.WorkloadReference, 0)
|
healthChecks := make([]kustomizev1.CrossNamespaceObjectReference, 0)
|
||||||
for _, w := range ksHealthCheck {
|
for _, w := range ksHealthCheck {
|
||||||
kindObj := strings.Split(w, "/")
|
kindObj := strings.Split(w, "/")
|
||||||
if len(kindObj) != 2 {
|
if len(kindObj) != 2 {
|
||||||
return fmt.Errorf("invalid health check '%s' must be in the format 'kind/name.namespace' %v", w, kindObj)
|
return fmt.Errorf("invalid health check '%s' must be in the format 'kind/name.namespace' %v", w, kindObj)
|
||||||
}
|
}
|
||||||
kind := kindObj[0]
|
kind := kindObj[0]
|
||||||
|
|
||||||
|
//TODO: (stefan) extend this list with all the kstatus builtin kinds
|
||||||
kinds := map[string]bool{
|
kinds := map[string]bool{
|
||||||
"Deployment": true,
|
"Deployment": true,
|
||||||
"DaemonSet": true,
|
"DaemonSet": true,
|
||||||
"StatefulSet": true,
|
"StatefulSet": true,
|
||||||
|
helmv2.HelmReleaseKind: true,
|
||||||
}
|
}
|
||||||
if !kinds[kind] {
|
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], ".")
|
nameNs := strings.Split(kindObj[1], ".")
|
||||||
if len(nameNs) != 2 {
|
if len(nameNs) != 2 {
|
||||||
return fmt.Errorf("invalid health check '%s' must be in the format 'kind/name.namespace'", w)
|
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,
|
Kind: kind,
|
||||||
Name: nameNs[0],
|
Name: nameNs[0],
|
||||||
Namespace: nameNs[1],
|
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.HealthChecks = healthChecks
|
||||||
kustomization.Spec.Timeout = &metav1.Duration{
|
kustomization.Spec.Timeout = &metav1.Duration{
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -5,7 +5,7 @@ go 1.14
|
|||||||
require (
|
require (
|
||||||
github.com/blang/semver v3.5.1+incompatible
|
github.com/blang/semver v3.5.1+incompatible
|
||||||
github.com/fluxcd/helm-controller/api v0.0.8
|
github.com/fluxcd/helm-controller/api v0.0.8
|
||||||
github.com/fluxcd/kustomize-controller/api v0.0.11
|
github.com/fluxcd/kustomize-controller/api v0.0.12
|
||||||
github.com/fluxcd/pkg/git v0.0.7
|
github.com/fluxcd/pkg/git v0.0.7
|
||||||
github.com/fluxcd/pkg/runtime v0.0.1
|
github.com/fluxcd/pkg/runtime v0.0.1
|
||||||
github.com/fluxcd/pkg/ssh v0.0.5
|
github.com/fluxcd/pkg/ssh v0.0.5
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -113,8 +113,8 @@ github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi
|
|||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fluxcd/helm-controller/api v0.0.8 h1:Pf+hZjsUpRmoQJeCe178bGWOOm2/Bvg8/s0aafRa1wQ=
|
github.com/fluxcd/helm-controller/api v0.0.8 h1:Pf+hZjsUpRmoQJeCe178bGWOOm2/Bvg8/s0aafRa1wQ=
|
||||||
github.com/fluxcd/helm-controller/api v0.0.8/go.mod h1:KlzwTkpphQxulgWBwCl/uxfBU0QxK/X+w4YcJqGy/1c=
|
github.com/fluxcd/helm-controller/api v0.0.8/go.mod h1:KlzwTkpphQxulgWBwCl/uxfBU0QxK/X+w4YcJqGy/1c=
|
||||||
github.com/fluxcd/kustomize-controller/api v0.0.11 h1:uFL0FT0AP+NmHR8upy+Y7AhBqcWQh2Lvp1F9FXL22iQ=
|
github.com/fluxcd/kustomize-controller/api v0.0.12 h1:4wTGH+Mf0jmvVMmUg39LHbQto6pT3aescyPr2xT/5os=
|
||||||
github.com/fluxcd/kustomize-controller/api v0.0.11/go.mod h1:88m3p6xY3J2pjh5OsL3ANy7PkyA93KiqAJE58JMQyoc=
|
github.com/fluxcd/kustomize-controller/api v0.0.12/go.mod h1:88m3p6xY3J2pjh5OsL3ANy7PkyA93KiqAJE58JMQyoc=
|
||||||
github.com/fluxcd/pkg/git v0.0.7 h1:tFSYPy7tcIYfOt8H5EUERXIRz7fk0id302oQZde1NtU=
|
github.com/fluxcd/pkg/git v0.0.7 h1:tFSYPy7tcIYfOt8H5EUERXIRz7fk0id302oQZde1NtU=
|
||||||
github.com/fluxcd/pkg/git v0.0.7/go.mod h1:5Vu92x6Q3CpxDUllmB69kAkVY5jAtPpXcY2TSZ/oCJI=
|
github.com/fluxcd/pkg/git v0.0.7/go.mod h1:5Vu92x6Q3CpxDUllmB69kAkVY5jAtPpXcY2TSZ/oCJI=
|
||||||
github.com/fluxcd/pkg/runtime v0.0.1 h1:h8jztHVF9UMGD7XBQSfXDdw80bpT6BOkd0xe4kknPL0=
|
github.com/fluxcd/pkg/runtime v0.0.1 h1:h8jztHVF9UMGD7XBQSfXDdw80bpT6BOkd0xe4kknPL0=
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- github.com/fluxcd/kustomize-controller/config//crd?ref=v0.0.11
|
- github.com/fluxcd/kustomize-controller/config//crd?ref=v0.0.12
|
||||||
- github.com/fluxcd/kustomize-controller/config//manager?ref=v0.0.11
|
- github.com/fluxcd/kustomize-controller/config//manager?ref=v0.0.12
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
|
|||||||
Reference in New Issue
Block a user