@@ -11,7 +11,6 @@ import (
1111 "log"
1212
1313 k8s "github.com/codesphere-cloud/oms/internal/util"
14- "k8s.io/client-go/dynamic"
1514 "k8s.io/client-go/kubernetes"
1615)
1716
@@ -22,28 +21,23 @@ type ArgoCDResources interface {
2221
2322type argoCDResources struct {
2423 clientset kubernetes.Interface
25- dynClient dynamic.Interface
2624
2725 DatacenterId string
2826 OciPassword string
2927 OciRegistryURL string
3028 GitPassword string
3129}
3230
33- func NewArgoCDResources (clientset kubernetes.Interface , dynClient dynamic. Interface , dataCenterId string , ociPassword string , ociRegistryURL string , gitPassword string ) (ArgoCDResources , error ) {
31+ func NewArgoCDResources (clientset kubernetes.Interface , dataCenterId string , ociPassword string , ociRegistryURL string , gitPassword string ) (ArgoCDResources , error ) {
3432 return & argoCDResources {
3533 clientset : clientset ,
36- dynClient : dynClient ,
3734 DatacenterId : dataCenterId ,
3835 OciPassword : ociPassword ,
3936 OciRegistryURL : ociRegistryURL ,
4037 GitPassword : gitPassword ,
4138 }, nil
4239}
4340
44- //go:embed manifests/app-projects.yaml
45- var appProjectsYAML []byte
46-
4741//go:embed manifests/cluster-local.yaml.tpl
4842var localClusterTpl []byte
4943
@@ -54,10 +48,6 @@ var helmRegistryTpl []byte
5448var gitRepoTpl []byte
5549
5650func (a * argoCDResources ) ApplyAll (ctx context.Context ) error {
57- if err := a .applyAppProjects (ctx ); err != nil {
58- return fmt .Errorf ("applying app projects: %w" , err )
59- }
60-
6151 if a .DatacenterId != "" {
6252 if err := a .applyLocalCluster (ctx ); err != nil {
6353 return fmt .Errorf ("applying local cluster secret: %w" , err )
@@ -81,25 +71,6 @@ func (a *argoCDResources) ApplyAll(ctx context.Context) error {
8171 return nil
8272}
8373
84- func (a * argoCDResources ) applyAppProjects (ctx context.Context ) error {
85- log .Println ("Applying AppProjects... " )
86- objects , err := k8s .DecodeMultiDocYAML (appProjectsYAML )
87- if err != nil {
88- return fmt .Errorf ("decoding app projects yaml: %w" , err )
89- }
90-
91- for _ , obj := range objects {
92- gvr , err := k8s .GvrForUnstructured (obj )
93- if err != nil {
94- return err
95- }
96- if err := k8s .ApplyUnstructured (ctx , a .dynClient , gvr , obj ); err != nil {
97- return fmt .Errorf ("applying app project %q: %w" , obj .GetName (), err )
98- }
99- }
100- return nil
101- }
102-
10374func (a * argoCDResources ) applyLocalCluster (ctx context.Context ) error {
10475 log .Println ("Applying local cluster secret... " )
10576 rendered , err := k8s .RenderTemplate (localClusterTpl , map [string ]string {
0 commit comments