test the build
This commit is contained in:
@ -89,7 +89,8 @@ spec:
|
||||
args:
|
||||
- --leader-elect
|
||||
- --health-probe-bind-address=:8081
|
||||
image: controller:latest
|
||||
# image: controller:latest
|
||||
image: git.badhouseplants.net/allanger/gitops-diff-operator:latest
|
||||
name: manager
|
||||
env:
|
||||
- name: SSH_KNOWN_HOSTS
|
||||
|
@ -11,6 +11,7 @@ require (
|
||||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
|
||||
gopkg.in/src-d/go-git.v4 v4.13.1
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
k8s.io/api v0.29.6
|
||||
k8s.io/apiextensions-apiserver v0.29.6
|
||||
k8s.io/apimachinery v0.29.6
|
||||
k8s.io/client-go v0.29.6
|
||||
@ -158,7 +159,6 @@ require (
|
||||
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.29.6 // indirect
|
||||
k8s.io/apiserver v0.29.6 // indirect
|
||||
k8s.io/cli-runtime v0.29.6 // indirect
|
||||
k8s.io/component-base v0.29.6 // indirect
|
||||
|
@ -93,7 +93,7 @@ func (r *DiffReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
|
||||
client, err := apiclient.NewClient(&argocdclient.ClientOptions{
|
||||
ServerAddr: "argocd-server.argo-system.svc.cluster.local:80",
|
||||
Insecure: true,
|
||||
AuthToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmdvY2QiLCJzdWIiOiJhbGljZTphcGlLZXkiLCJuYmYiOjE3MTk5MzIwOTEsImlhdCI6MTcxOTkzMjA5MSwianRpIjoiN2VmM2Y2OTYtYjU4Zi00NDIyLTk4YTktNjFlYjMyNjNhNDUxIn0.XmQThdSp_WWUbWv6Ur95URqXnY9-LCXxmcun9kBoYTQ",
|
||||
AuthToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmdvY2QiLCJzdWIiOiJkcm9uZTphcGlLZXkiLCJuYmYiOjE3MTk5NTc1OTMsImlhdCI6MTcxOTk1NzU5MywianRpIjoidGVzdC1kaWZmIn0.eJ-MOONUca0JEtoQlfNFdV_U-dULjyg37u8jrc2boYc",
|
||||
})
|
||||
if err != nil {
|
||||
return reconcileResult, err
|
||||
@ -191,30 +191,28 @@ func getManifestsFromArgo(ctx context.Context, q application.ApplicationManifest
|
||||
app.ObjectMeta.Name = fmt.Sprintf("%s-%s", "diff", app.ObjectMeta.Name)
|
||||
app.Spec.SyncPolicy = &argoappv1.SyncPolicy{}
|
||||
|
||||
app, err := appCl.Create(ctx, &application.ApplicationCreateRequest{
|
||||
Application: app,
|
||||
})
|
||||
cl, err := appCl.GetManifestsWithFiles(ctx)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
output, err := getManifestsFromArgo(ctx, application.ApplicationManifestQuery{
|
||||
AppNamespace: &app.ObjectMeta.Namespace,
|
||||
Name: &app.ObjectMeta.Name,
|
||||
}, appCl)
|
||||
|
||||
chunk := &application.ApplicationManifestQueryWithFilesWrapper_Chunk{
|
||||
Chunk: &application.FileChunk{
|
||||
Chunk: yamlBytes,
|
||||
},
|
||||
}
|
||||
if err := cl.Send(&application.ApplicationManifestQueryWithFilesWrapper{
|
||||
Part: chunk,
|
||||
}); err != nil {
|
||||
return "", err
|
||||
}
|
||||
rawManifest, err := cl.CloseAndRecv()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
_, err = appCl.Delete(ctx, &application.ApplicationDeleteRequest{
|
||||
Name: app.GetMetadata().Name,
|
||||
AppNamespace: &app.ObjectMeta.Namespace,
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
for _, m := range rawManifest.Manifests {
|
||||
resources += fmt.Sprintf("---\n%s\n", m)
|
||||
}
|
||||
resources += output
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user