Some changes
This commit is contained in:
parent
a218ca3cb4
commit
ca10abaa7f
@ -7,7 +7,7 @@ WORKDIR /workspace/src
|
|||||||
# Copy the Go Modules manifests
|
# Copy the Go Modules manifests
|
||||||
COPY src/go.mod go.mod
|
COPY src/go.mod go.mod
|
||||||
COPY src/go.sum go.sum
|
COPY src/go.sum go.sum
|
||||||
COPY _argocd ../_argocd/
|
COPY _argo-cd/ ../_argo-cd/
|
||||||
# cache deps before building and copying source so that we don't need to re-download as much
|
# cache deps before building and copying source so that we don't need to re-download as much
|
||||||
# and so that source changes don't invalidate our downloaded layer
|
# and so that source changes don't invalidate our downloaded layer
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
@ -26,9 +26,9 @@ import (
|
|||||||
// AppSourceSpec defines the desired state of AppSource
|
// AppSourceSpec defines the desired state of AppSource
|
||||||
type AppSourceSpec struct {
|
type AppSourceSpec struct {
|
||||||
Resource *Resource `json:"resource"`
|
Resource *Resource `json:"resource"`
|
||||||
|
ArgoInstance *ArgoInstance `json:"argoInstance,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Api string `json:"api"`
|
Api string `json:"api"`
|
||||||
Kind string `json:"kind"`
|
Kind string `json:"kind"`
|
||||||
@ -36,9 +36,20 @@ type Resource struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ArgoInstance struct {
|
||||||
|
URL string `json:"url"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
TokenRef *SecretRef `json:"tokenRef"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SecretRef struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Namespace string `json:"namespace"`
|
||||||
|
Key string `json:"key"`
|
||||||
|
}
|
||||||
|
|
||||||
// AppSourceStatus defines the observed state of AppSource
|
// AppSourceStatus defines the observed state of AppSource
|
||||||
type AppSourceStatus struct {
|
type AppSourceStatus struct {
|
||||||
Branches []string `json:"branches"`
|
|
||||||
MainBranch string `json:"mainBranch"`
|
MainBranch string `json:"mainBranch"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ func (in *AppSource) DeepCopyInto(out *AppSource) {
|
|||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
out.Status = in.Status
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppSource.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppSource.
|
||||||
@ -91,6 +91,11 @@ func (in *AppSourceSpec) DeepCopyInto(out *AppSourceSpec) {
|
|||||||
*out = new(Resource)
|
*out = new(Resource)
|
||||||
**out = **in
|
**out = **in
|
||||||
}
|
}
|
||||||
|
if in.ArgoInstance != nil {
|
||||||
|
in, out := &in.ArgoInstance, &out.ArgoInstance
|
||||||
|
*out = new(ArgoInstance)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppSourceSpec.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppSourceSpec.
|
||||||
@ -106,11 +111,6 @@ func (in *AppSourceSpec) DeepCopy() *AppSourceSpec {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *AppSourceStatus) DeepCopyInto(out *AppSourceStatus) {
|
func (in *AppSourceStatus) DeepCopyInto(out *AppSourceStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
if in.Branches != nil {
|
|
||||||
in, out := &in.Branches, &out.Branches
|
|
||||||
*out = make([]string, len(*in))
|
|
||||||
copy(*out, *in)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppSourceStatus.
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppSourceStatus.
|
||||||
@ -123,6 +123,26 @@ func (in *AppSourceStatus) DeepCopy() *AppSourceStatus {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *ArgoInstance) DeepCopyInto(out *ArgoInstance) {
|
||||||
|
*out = *in
|
||||||
|
if in.TokenRef != nil {
|
||||||
|
in, out := &in.TokenRef, &out.TokenRef
|
||||||
|
*out = new(SecretRef)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArgoInstance.
|
||||||
|
func (in *ArgoInstance) DeepCopy() *ArgoInstance {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(ArgoInstance)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *Diff) DeepCopyInto(out *Diff) {
|
func (in *Diff) DeepCopyInto(out *Diff) {
|
||||||
*out = *in
|
*out = *in
|
||||||
@ -226,3 +246,18 @@ func (in *Resource) DeepCopy() *Resource {
|
|||||||
in.DeepCopyInto(out)
|
in.DeepCopyInto(out)
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *SecretRef) DeepCopyInto(out *SecretRef) {
|
||||||
|
*out = *in
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretRef.
|
||||||
|
func (in *SecretRef) DeepCopy() *SecretRef {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(SecretRef)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
@ -39,6 +39,30 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
description: AppSourceSpec defines the desired state of AppSource
|
description: AppSourceSpec defines the desired state of AppSource
|
||||||
properties:
|
properties:
|
||||||
|
argoInstance:
|
||||||
|
properties:
|
||||||
|
port:
|
||||||
|
type: integer
|
||||||
|
tokenRef:
|
||||||
|
properties:
|
||||||
|
key:
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
namespace:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- key
|
||||||
|
- name
|
||||||
|
- namespace
|
||||||
|
type: object
|
||||||
|
url:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- port
|
||||||
|
- tokenRef
|
||||||
|
- url
|
||||||
|
type: object
|
||||||
resource:
|
resource:
|
||||||
properties:
|
properties:
|
||||||
api:
|
api:
|
||||||
@ -61,14 +85,9 @@ spec:
|
|||||||
status:
|
status:
|
||||||
description: AppSourceStatus defines the observed state of AppSource
|
description: AppSourceStatus defines the observed state of AppSource
|
||||||
properties:
|
properties:
|
||||||
branches:
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
type: array
|
|
||||||
mainBranch:
|
mainBranch:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- branches
|
|
||||||
- mainBranch
|
- mainBranch
|
||||||
type: object
|
type: object
|
||||||
type: object
|
type: object
|
||||||
|
@ -90,7 +90,7 @@ spec:
|
|||||||
- --leader-elect
|
- --leader-elect
|
||||||
- --health-probe-bind-address=:8081
|
- --health-probe-bind-address=:8081
|
||||||
# image: controller:latest
|
# image: controller:latest
|
||||||
image: git.badhouseplants.net/allanger/gitops-diff-operator:latest
|
image: controller:latest
|
||||||
name: manager
|
name: manager
|
||||||
env:
|
env:
|
||||||
- name: SSH_KNOWN_HOSTS
|
- name: SSH_KNOWN_HOSTS
|
||||||
|
@ -2,4 +2,5 @@
|
|||||||
resources:
|
resources:
|
||||||
- v1alpha1_appsource.yaml
|
- v1alpha1_appsource.yaml
|
||||||
- v1alpha1_diff.yaml
|
- v1alpha1_diff.yaml
|
||||||
|
- v1alpha1_diff_broke.yaml
|
||||||
# +kubebuilder:scaffold:manifestskustomizesamples
|
# +kubebuilder:scaffold:manifestskustomizesamples
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: src
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
name: appsource-sample
|
||||||
|
stringData:
|
||||||
|
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmdvY2QiLCJzdWIiOiJhbGljZTphcGlLZXkiLCJuYmYiOjE3MjA1MjUyNTYsImlhdCI6MTcyMDUyNTI1NiwianRpIjoiNTJjODFmYTctNmYzOS00ZGIwLTgzYTYtODdhZDAyYjcyZmU1In0.aqiNwECFmlmECORLlSUbKGndKrTY7hsDUxrD1mAtZsQ
|
||||||
|
---
|
||||||
apiVersion: k8s.badhouseplants.net/v1alpha1
|
apiVersion: k8s.badhouseplants.net/v1alpha1
|
||||||
kind: AppSource
|
kind: AppSource
|
||||||
metadata:
|
metadata:
|
||||||
@ -11,3 +22,10 @@ spec:
|
|||||||
api: argoproj.io/v1alpha1
|
api: argoproj.io/v1alpha1
|
||||||
name: vaultflux
|
name: vaultflux
|
||||||
namespace: argo-system
|
namespace: argo-system
|
||||||
|
argoInstance:
|
||||||
|
url: argocd-server.argo-system.svc.cluster.local
|
||||||
|
port: 80
|
||||||
|
tokenRef:
|
||||||
|
name: appsource-sample
|
||||||
|
namespace: src-system
|
||||||
|
key: token
|
||||||
|
@ -8,4 +8,3 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
appSourceName: appsource-sample
|
appSourceName: appsource-sample
|
||||||
targetRef: main
|
targetRef: main
|
||||||
# TODO(user): Add fields here
|
|
||||||
|
11
src/config/samples/v1alpha1_diff_broke.yaml
Normal file
11
src/config/samples/v1alpha1_diff_broke.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: k8s.badhouseplants.net/v1alpha1
|
||||||
|
kind: Diff
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: src
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
|
name: diff-sample-broke
|
||||||
|
spec:
|
||||||
|
appSourceName: appsource-sample
|
||||||
|
targetRef: fail-kust
|
||||||
|
# TODO(user): Add fields here
|
12
src/go.mod
12
src/go.mod
@ -28,7 +28,7 @@ require (
|
|||||||
github.com/Masterminds/semver/v3 v3.2.1 // indirect
|
github.com/Masterminds/semver/v3 v3.2.1 // indirect
|
||||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||||
github.com/ProtonMail/go-crypto v1.0.0 // indirect
|
github.com/ProtonMail/go-crypto v1.0.0 // indirect
|
||||||
github.com/argoproj/gitops-engine v0.7.1-0.20240628145506-f38075deb303 // indirect
|
github.com/argoproj/gitops-engine v0.7.1-0.20240628155502-fa0e8d60a3a4 // indirect
|
||||||
github.com/argoproj/pkg v0.13.7-0.20230626144333-d56162821bd1 // indirect
|
github.com/argoproj/pkg v0.13.7-0.20230626144333-d56162821bd1 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/blang/semver/v4 v4.0.0 // indirect
|
github.com/blang/semver/v4 v4.0.0 // indirect
|
||||||
@ -38,7 +38,7 @@ require (
|
|||||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||||
github.com/chai2010/gettext-go v1.0.2 // indirect
|
github.com/chai2010/gettext-go v1.0.2 // indirect
|
||||||
github.com/cloudflare/circl v1.3.7 // indirect
|
github.com/cloudflare/circl v1.3.7 // indirect
|
||||||
github.com/coreos/go-oidc/v3 v3.6.0 // indirect
|
github.com/coreos/go-oidc/v3 v3.10.0 // indirect
|
||||||
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
|
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||||
@ -56,7 +56,7 @@ require (
|
|||||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||||
github.com/go-git/go-billy/v5 v5.5.0 // indirect
|
github.com/go-git/go-billy/v5 v5.5.0 // indirect
|
||||||
github.com/go-git/go-git/v5 v5.12.0 // indirect
|
github.com/go-git/go-git/v5 v5.12.0 // indirect
|
||||||
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
|
github.com/go-jose/go-jose/v4 v4.0.1 // indirect
|
||||||
github.com/go-logr/logr v1.4.1 // indirect
|
github.com/go-logr/logr v1.4.1 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/go-logr/zapr v1.3.0 // indirect
|
github.com/go-logr/zapr v1.3.0 // indirect
|
||||||
@ -141,7 +141,7 @@ require (
|
|||||||
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
|
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
|
||||||
golang.org/x/mod v0.14.0 // indirect
|
golang.org/x/mod v0.14.0 // indirect
|
||||||
golang.org/x/net v0.25.0 // indirect
|
golang.org/x/net v0.25.0 // indirect
|
||||||
golang.org/x/oauth2 v0.12.0 // indirect
|
golang.org/x/oauth2 v0.13.0 // indirect
|
||||||
golang.org/x/sync v0.6.0 // indirect
|
golang.org/x/sync v0.6.0 // indirect
|
||||||
golang.org/x/sys v0.20.0 // indirect
|
golang.org/x/sys v0.20.0 // indirect
|
||||||
golang.org/x/term v0.20.0 // indirect
|
golang.org/x/term v0.20.0 // indirect
|
||||||
@ -149,7 +149,7 @@ require (
|
|||||||
golang.org/x/time v0.5.0 // indirect
|
golang.org/x/time v0.5.0 // indirect
|
||||||
golang.org/x/tools v0.17.0 // indirect
|
golang.org/x/tools v0.17.0 // indirect
|
||||||
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
|
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.8 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
|
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
|
||||||
@ -176,4 +176,4 @@ require (
|
|||||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/argoproj/argo-cd/v2 => ../_argocd
|
replace github.com/argoproj/argo-cd/v2 => ../_argo-cd
|
||||||
|
22
src/go.sum
22
src/go.sum
@ -41,8 +41,8 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU
|
|||||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
|
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
|
||||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
|
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
|
||||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||||
github.com/argoproj/gitops-engine v0.7.1-0.20240628145506-f38075deb303 h1:EcsNKNKlX7znQsrV6Rh4F0pzvWTYiBIWGm9YZSlMfT4=
|
github.com/argoproj/gitops-engine v0.7.1-0.20240628155502-fa0e8d60a3a4 h1:xctch+EYCzsz012kNrdK3eRALf+/ZLhWJAWG0xfxpl8=
|
||||||
github.com/argoproj/gitops-engine v0.7.1-0.20240628145506-f38075deb303/go.mod h1:ByLmH5B1Gs361tgI5x5f8oSFuBEXDYENYpG3zFDWtHU=
|
github.com/argoproj/gitops-engine v0.7.1-0.20240628155502-fa0e8d60a3a4/go.mod h1:xMIbuLg9Qj2e0egTy+8NcukbhRaVmWwK9vm3aAQZoi4=
|
||||||
github.com/argoproj/pkg v0.13.7-0.20230626144333-d56162821bd1 h1:qsHwwOJ21K2Ao0xPju1sNuqphyMnMYkyB3ZLoLtxWpo=
|
github.com/argoproj/pkg v0.13.7-0.20230626144333-d56162821bd1 h1:qsHwwOJ21K2Ao0xPju1sNuqphyMnMYkyB3ZLoLtxWpo=
|
||||||
github.com/argoproj/pkg v0.13.7-0.20230626144333-d56162821bd1/go.mod h1:CZHlkyAD1/+FbEn6cB2DQTj48IoLGvEYsWEvtzP3238=
|
github.com/argoproj/pkg v0.13.7-0.20230626144333-d56162821bd1/go.mod h1:CZHlkyAD1/+FbEn6cB2DQTj48IoLGvEYsWEvtzP3238=
|
||||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||||
@ -82,8 +82,8 @@ github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBS
|
|||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||||
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k=
|
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k=
|
||||||
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||||
github.com/coreos/go-oidc/v3 v3.6.0 h1:AKVxfYw1Gmkn/w96z0DbT/B/xFnzTd3MkZvWLjF4n/o=
|
github.com/coreos/go-oidc/v3 v3.10.0 h1:tDnXHnLyiTVyT/2zLDGj09pFPkhND8Gl8lnTRhoEaJU=
|
||||||
github.com/coreos/go-oidc/v3 v3.6.0/go.mod h1:ZpHUsHBucTUj6WOkrP4E20UPynbLZzhTQ1XKCXkxyPc=
|
github.com/coreos/go-oidc/v3 v3.10.0/go.mod h1:5j11xcw0D3+SGxn6Z/WFADsgcWVMyNAlSQupk0KK3ac=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
@ -153,6 +153,8 @@ github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZt
|
|||||||
github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY=
|
github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY=
|
||||||
github.com/go-jose/go-jose/v3 v3.0.3 h1:fFKWeig/irsp7XD2zBxvnmA/XaRWp5V3CBsZXJF7G7k=
|
github.com/go-jose/go-jose/v3 v3.0.3 h1:fFKWeig/irsp7XD2zBxvnmA/XaRWp5V3CBsZXJF7G7k=
|
||||||
github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
|
github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
|
||||||
|
github.com/go-jose/go-jose/v4 v4.0.1 h1:QVEPDE3OluqXBQZDcnNvQrInro2h0e4eqNbnZSWqS6U=
|
||||||
|
github.com/go-jose/go-jose/v4 v4.0.1/go.mod h1:WVf9LFMHh/QVrmqrOfqun0C45tMe3RoiKJMPvgWwLfY=
|
||||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
||||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||||
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
|
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
|
||||||
@ -520,7 +522,6 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz
|
|||||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||||
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
|
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
|
||||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
|
||||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
@ -578,8 +579,8 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr
|
|||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE=
|
golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE=
|
||||||
golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4=
|
golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY=
|
||||||
golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4=
|
golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
@ -634,7 +635,6 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
||||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
@ -648,7 +648,6 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
|||||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||||
golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo=
|
golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo=
|
||||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
|
||||||
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
|
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
|
||||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||||
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
@ -658,6 +657,7 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
|||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
|
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
@ -665,7 +665,6 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
|||||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
|
||||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
||||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
@ -703,8 +702,9 @@ google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEt
|
|||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
|
||||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||||
|
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
|
||||||
|
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
|
@ -19,13 +19,9 @@ package controller
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"slices"
|
"slices"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gopkg.in/src-d/go-git.v4"
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
|
||||||
"gopkg.in/src-d/go-git.v4/plumbing/transport/ssh"
|
|
||||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
@ -78,7 +74,6 @@ func (r *AppSourceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
|
|||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
// It should only get sources when they are based on git
|
// It should only get sources when they are based on git
|
||||||
var gitUrl string
|
|
||||||
var mainBranch string
|
var mainBranch string
|
||||||
switch object {
|
switch object {
|
||||||
case connectors.ARGO_APPLICATION:
|
case connectors.ARGO_APPLICATION:
|
||||||
@ -93,55 +88,14 @@ func (r *AppSourceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
|
|||||||
}, argoapp); err != nil {
|
}, argoapp); err != nil {
|
||||||
return reconcileResult, err
|
return reconcileResult, err
|
||||||
}
|
}
|
||||||
gitUrl = argoapp.Spec.Source.RepoURL
|
|
||||||
mainBranch = argoapp.Spec.Source.TargetRevision
|
mainBranch = argoapp.Spec.Source.TargetRevision
|
||||||
}
|
}
|
||||||
sshKeys, err := ssh.NewPublicKeysFromFile("git", "/var/ssh-key", "")
|
|
||||||
if err != nil {
|
|
||||||
return reconcileResult, err
|
|
||||||
}
|
|
||||||
// TODO: Shoulen't be hardcoded
|
|
||||||
path := fmt.Sprintf("/tmp/%s-%s-%s", req.Namespace, req.Name, time.Now().String())
|
|
||||||
repo, err := git.PlainClone(path, false, &git.CloneOptions{
|
|
||||||
URL: gitUrl,
|
|
||||||
Auth: sshKeys,
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return reconcileResult, err
|
|
||||||
}
|
|
||||||
|
|
||||||
refs := []string{}
|
|
||||||
rawRefs, err := repo.Tags()
|
|
||||||
if err != nil {
|
|
||||||
return reconcileResult, err
|
|
||||||
}
|
|
||||||
defer rawRefs.Close()
|
|
||||||
|
|
||||||
rawRefs.ForEach(func(ref *plumbing.Reference) error {
|
|
||||||
refs = append(refs, ref.String())
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
rawRefs, err = repo.Branches()
|
|
||||||
if err != nil {
|
|
||||||
return reconcileResult, err
|
|
||||||
}
|
|
||||||
defer rawRefs.Close()
|
|
||||||
|
|
||||||
rawRefs.ForEach(func(ref *plumbing.Reference) error {
|
|
||||||
refs = append(refs, ref.String())
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
source.Status.Branches = refs
|
|
||||||
source.Status.MainBranch = mainBranch
|
source.Status.MainBranch = mainBranch
|
||||||
if err := r.Status().Update(ctx, source); err != nil {
|
if err := r.Status().Update(ctx, source); err != nil {
|
||||||
return reconcileResult, err
|
return reconcileResult, err
|
||||||
}
|
}
|
||||||
if err := os.RemoveAll(path); err != nil {
|
|
||||||
return reconcileResult, err
|
|
||||||
}
|
|
||||||
return ctrl.Result{
|
return ctrl.Result{
|
||||||
Requeue: true,
|
Requeue: true,
|
||||||
RequeueAfter: 60 * time.Second,
|
RequeueAfter: 60 * time.Second,
|
||||||
|
@ -90,10 +90,28 @@ func (r *DiffReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
|
|||||||
}, source); err != nil {
|
}, source); err != nil {
|
||||||
return reconcileResult, err
|
return reconcileResult, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
secret := &corev1.Secret{}
|
||||||
|
if err := r.Client.Get(ctx, types.NamespacedName{
|
||||||
|
Namespace: source.Spec.ArgoInstance.TokenRef.Namespace,
|
||||||
|
Name: source.Spec.ArgoInstance.TokenRef.Name,
|
||||||
|
}, secret); err != nil {
|
||||||
|
return reconcileResult, err
|
||||||
|
}
|
||||||
|
|
||||||
|
token, ok := secret.Data[source.Spec.ArgoInstance.TokenRef.Key]
|
||||||
|
if !ok {
|
||||||
|
err := fmt.Errorf("key doesn't exists in a secret: %s%s:%s",
|
||||||
|
source.Spec.ArgoInstance.TokenRef.Namespace,
|
||||||
|
source.Spec.ArgoInstance.TokenRef.Name,
|
||||||
|
source.Spec.ArgoInstance.TokenRef.Key,
|
||||||
|
)
|
||||||
|
return reconcileResult, err
|
||||||
|
}
|
||||||
client, err := apiclient.NewClient(&argocdclient.ClientOptions{
|
client, err := apiclient.NewClient(&argocdclient.ClientOptions{
|
||||||
ServerAddr: "argocd-server.argo-system.svc.cluster.local:80",
|
ServerAddr: fmt.Sprintf("%s:%d", source.Spec.ArgoInstance.URL, source.Spec.ArgoInstance.Port),
|
||||||
Insecure: true,
|
Insecure: true,
|
||||||
AuthToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmdvY2QiLCJzdWIiOiJkcm9uZTphcGlLZXkiLCJuYmYiOjE3MTk5NTc1OTMsImlhdCI6MTcxOTk1NzU5MywianRpIjoidGVzdC1kaWZmIn0.eJ-MOONUca0JEtoQlfNFdV_U-dULjyg37u8jrc2boYc",
|
AuthToken: string(token),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return reconcileResult, err
|
return reconcileResult, err
|
||||||
@ -183,37 +201,40 @@ func getManifestsFromArgo(ctx context.Context, q application.ApplicationManifest
|
|||||||
|
|
||||||
resources += fmt.Sprintf("---\n%s\n", string(yamlBytes))
|
resources += fmt.Sprintf("---\n%s\n", string(yamlBytes))
|
||||||
|
|
||||||
app := &argoappv1.Application{}
|
// app := &argoappv1.Application{}
|
||||||
if err := yaml.Unmarshal(yamlBytes, app); err != nil {
|
// if err := utilyaml.UnmarshalStrict(yamlBytes, app); err != nil {
|
||||||
log.Info(err.Error())
|
// log.Info(err.Error())
|
||||||
} else {
|
// } else {
|
||||||
log.Info(fmt.Sprintf("%v", app))
|
// log.Info("building and app", "appName", app.GetName(), "kind", app.GetObjectKind())
|
||||||
app.ObjectMeta.Name = fmt.Sprintf("%s-%s", "diff", app.ObjectMeta.Name)
|
// if app.TypeMeta.Kind == "Application" {
|
||||||
app.Spec.SyncPolicy = &argoappv1.SyncPolicy{}
|
// log.Info(fmt.Sprintf("%v", app))
|
||||||
|
// app.ObjectMeta.Name = fmt.Sprintf("%s-%s", "diff", app.ObjectMeta.Name)
|
||||||
|
// app.Spec.SyncPolicy = &argoappv1.SyncPolicy{}
|
||||||
|
|
||||||
cl, err := appCl.GetManifestsWithFiles(ctx)
|
// cl, err := appCl.GetManifestsWithFiles(ctx)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return "", err
|
// return "", err
|
||||||
}
|
// }
|
||||||
|
|
||||||
chunk := &application.ApplicationManifestQueryWithFilesWrapper_Chunk{
|
// chunk := &application.ApplicationManifestQueryWithFilesWrapper_Chunk{
|
||||||
Chunk: &application.FileChunk{
|
// Chunk: &application.FileChunk{
|
||||||
Chunk: yamlBytes,
|
// Chunk: yamlBytes,
|
||||||
},
|
// },
|
||||||
}
|
// }
|
||||||
if err := cl.Send(&application.ApplicationManifestQueryWithFilesWrapper{
|
// if err := cl.Send(&application.ApplicationManifestQueryWithFilesWrapper{
|
||||||
Part: chunk,
|
// Part: chunk,
|
||||||
}); err != nil {
|
// }); err != nil {
|
||||||
return "", err
|
// return "", err
|
||||||
}
|
// }
|
||||||
rawManifest, err := cl.CloseAndRecv()
|
// rawManifest, err := cl.CloseAndRecv()
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return "", err
|
// return "", err
|
||||||
}
|
// }
|
||||||
for _, m := range rawManifest.Manifests {
|
// for _, m := range rawManifest.Manifests {
|
||||||
resources += fmt.Sprintf("---\n%s\n", m)
|
// resources += fmt.Sprintf("---\n%s\n", m)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resources, nil
|
return resources, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user