Context
- Version: v0.1.4
- Deployment method: Kubernetes manifests generated from the project
- Environment: Kubernetes cluster with ArgoCD integration enabled
- Operator namespace: virt-git-sync-system
- ArgoCD namespace: argocd
- Target namespace: production-vms
- Git authentication mode: HTTPS
- Git provider: GitLab repository over HTTPS
Description
When deploying virt-git-sync with ArgoCD integration enabled, the operator successfully reconciles the VirtGitSync resource and pushes VM manifests to the configured Git repository.
However, the ArgoCD integration fails when the operator tries to create an ArgoCD repository Secret in the argocd namespace.
Steps to reproduce
- Deploy v
irt-git-sync with ArgoCD integration enabled.
- Create the target namespace:
apiVersion: v1
kind: Namespace
metadata:
name: production-vms
- Create the Git credentials Secret in the target namespace:
apiVersion: v1
kind: Secret
metadata:
name: git-credentials
namespace: production-vms
type: Opaque
stringData:
username: <git-username>
password: <git-token>
- Create a
VirtGitSync resource:
apiVersion: virt.mathianasj.github.com/v1alpha1
kind: VirtGitSync
metadata:
name: production-vms
namespace: production-vms
spec:
vmSelector:
matchLabels:
managed-by: virt-git-sync
gitRepository:
url: <project_URL>
branch: main
secretRef:
name: git-credentials
syncPath: vms
argocd:
namespace: argocd
applicationName: production-vms
destinationNamespace: production-vms
project: default
- Create or update a
VirtualMachine resource matching the selector.
Observed behaviour
The operator successfully pushes the VM manifest to Git, but the ArgoCD integration fails. No ArgoCD Application is created.
The VirtGitSync status reports:
failed to reconcile Repository: failed to create repository Secret:
secrets is forbidden: User "system:serviceaccount:virt-git-sync-system:virt-git-sync-controller-manager"
cannot create resource "secrets" in API group "" in the namespace "argocd"
Expected behaviour
The operator should create or update the ArgoCD repository Secret, create the ArgoCD Application, and complete the GitOps synchronization flow successfully.
Impact
Priority: Blocking for deployments using ArgoCD integration.
VM manifests may be pushed to Git successfully, but ArgoCD is not configured to consume the repository. As a result, the end-to-end GitOps workflow cannot complete.
Proposed fix
Grant the operator write access to Kubernetes Secrets so it can create and update ArgoCD repository Secrets during ReconcileRepository.
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch;create;update;delete
Context
Description
When deploying virt-git-sync with ArgoCD integration enabled, the operator successfully reconciles the VirtGitSync resource and pushes VM manifests to the configured Git repository.
However, the ArgoCD integration fails when the operator tries to create an ArgoCD repository Secret in the argocd namespace.
Steps to reproduce
irt-git-sync withArgoCD integration enabled.VirtGitSyncresource:VirtualMachineresource matching the selector.Observed behaviour
The operator successfully pushes the VM manifest to Git, but the ArgoCD integration fails. No ArgoCD Application is created.
The
VirtGitSyncstatus reports:Expected behaviour
The operator should create or update the ArgoCD repository Secret, create the ArgoCD
Application, and complete the GitOps synchronization flow successfully.Impact
Priority: Blocking for deployments using ArgoCD integration.
VM manifests may be pushed to Git successfully, but ArgoCD is not configured to consume the repository. As a result, the end-to-end GitOps workflow cannot complete.
Proposed fix
Grant the operator write access to Kubernetes
Secretsso it can create and update ArgoCD repository Secrets duringReconcileRepository.