Skip to content

Commit

Permalink
ROX-26039: PR Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ludydoo committed Oct 22, 2024
1 parent 3d957d3 commit a614365
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions fleetshard/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ type Config struct {
// It is required when central images need to fetched from a private Quay registry.
// It needs to given as Docker Config JSON object.
TenantImagePullSecret string `env:"TENANT_IMAGE_PULL_SECRET"`
DefaultTenantArgoCdAppSourceRepoURL string `env:"TENANT_ARGOCD_APP_SOURCE_REPO_URL_DEFAULT" envDefault:"https://github.com/stackrox/acscs-manifests.git"`
DefaultTenantArgoCdAppSourceRef string `env:"TENANT_ARGOCD_APP_SOURCE_REF_DEFAULT" envDefault:"HEAD"`
DefaultTenantArgoCdAppSourcePath string `env:"TENANT_ARGOCD_APP_SOURCE_PATH_DEFAULT" envDefault:"tenant-resources"`
DefaultTenantArgoCdAppSourceRepoURL string `env:"DEFAULT_TENANT_ARGOCD_APP_SOURCE_REPO_URL" envDefault:"https://github.com/stackrox/acscs-manifests.git"`
DefaultTenantArgoCdAppSourceRef string `env:"DEFAULT_TENANT_ARGOCD_APP_SOURCE_REF" envDefault:"HEAD"`
DefaultTenantArgoCdAppSourcePath string `env:"DEFAULT_TENANT_ARGOCD_APP_SOURCE_PATH" envDefault:"tenant-resources"`
ManagedDB ManagedDB
Telemetry Telemetry
AuditLogging AuditLogging
Expand Down
10 changes: 7 additions & 3 deletions fleetshard/pkg/central/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ func (r *CentralReconciler) Reconcile(ctx context.Context, remoteCentral private
} else {

{
// This little part would only happen if we enable, then disable ArgoCD for a tenant
// This part handles the case where we enable, then disable ArgoCD for a tenant
// to make sure the ArgoCD application is cleaned up.
ok, err := r.ensureArgoCdApplicationDeleted(ctx, remoteCentral)
if err != nil {
return nil, errors.Wrapf(err, "unable to delete ArgoCD application for central %s/%s", remoteCentral.Metadata.Namespace, remoteCentral.Metadata.Name)
Expand Down Expand Up @@ -1803,7 +1804,7 @@ func (r *CentralReconciler) isTenantResourcesChartObject(existingObject *unstruc
func (r *CentralReconciler) ensureArgoCdApplicationExists(ctx context.Context, remoteCentral private.ManagedCentral) error {
const lastAppliedHashLabel = "last-applied-hash"

want, err := r.getArgoCDApplication(remoteCentral)
want, err := r.makeDesiredArgoCDApplication(remoteCentral)
if err != nil {
return fmt.Errorf("getting ArgoCD application: %w", err)
}
Expand Down Expand Up @@ -1839,7 +1840,7 @@ func (r *CentralReconciler) ensureArgoCdApplicationExists(ctx context.Context, r
return nil
}

func (r *CentralReconciler) getArgoCDApplication(remoteCentral private.ManagedCentral) (*argocd.Application, error) {
func (r *CentralReconciler) makeDesiredArgoCDApplication(remoteCentral private.ManagedCentral) (*argocd.Application, error) {

values := map[string]interface{}{
"tenant": map[string]interface{}{
Expand Down Expand Up @@ -2254,6 +2255,9 @@ func NewCentralReconciler(k8sClient ctrlClient.Client, fleetmanagerClient *fleet
resourcesChart: resourcesChart,
clock: realClock{},

// Todo: Allow overriding the tenant source path, repo URL, and ref
// on a per-tenant basis.

defaultTenantArgoCdAppSourcePath: opts.DefaultTenantArgoCdAppSourcePath,
defaultTenantArgoCdAppSourceRepoURL: opts.DefaultTenantArgoCdAppSourceRepoURL,
defaultTenantArgoCdAppSourceRef: opts.DefaultTenantArgoCdAppSourceRef,
Expand Down

0 comments on commit a614365

Please sign in to comment.