Skip to content

Commit

Permalink
Merge pull request #127 from projectsyn/feat/argocd-annotations
Browse files Browse the repository at this point in the history
Add ArgoCD sync options to prevent premature pruning of bootstrap deployment
  • Loading branch information
HappyTetrahedron committed Jul 12, 2023
2 parents 9dc1ee5 + 4e3831c commit 29bfc0f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/argocd/app-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ func createApplicationControllerStatefulSet(ctx context.Context, clientset *kube
for k, v := range argoLabels {
labels[k] = v
}
annotations := argoAnnotations
statefulset := &appsv1.StatefulSet{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
Labels: labels,
Annotations: annotations,
},
Spec: appsv1.StatefulSetSpec{
Selector: &metav1.LabelSelector{
Expand Down
4 changes: 4 additions & 0 deletions pkg/argocd/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ var (
argoLabels = map[string]string{
"app.kubernetes.io/part-of": "argocd",
"argocd.argoproj.io/instance": "argocd",
"steward.syn.tools/bootstrap": "true",
}
argoAnnotations = map[string]string{
"argocd.argoproj.io/sync-options": "Prune=false",
}
argoSSHSecretName = "argo-ssh-key"
argoSSHPublicKey = "sshPublicKey"
Expand Down
3 changes: 3 additions & 0 deletions pkg/argocd/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ func createRedisDeployment(ctx context.Context, clientset *kubernetes.Clientset,
for k, v := range argoLabels {
labels[k] = v
}
annotations := argoAnnotations
service := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
Labels: labels,
Annotations: annotations,
},
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeClusterIP,
Expand All @@ -48,6 +50,7 @@ func createRedisDeployment(ctx context.Context, clientset *kubernetes.Clientset,
Name: name,
Namespace: namespace,
Labels: labels,
Annotations: annotations,
},
Spec: appsv1.DeploymentSpec{
Selector: &metav1.LabelSelector{
Expand Down
3 changes: 3 additions & 0 deletions pkg/argocd/repo-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ func createRepoServerDeployment(ctx context.Context, clientset *kubernetes.Clien
for k, v := range argoLabels {
labels[k] = v
}
annotations := argoAnnotations
service := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
Labels: labels,
Annotations: argoAnnotations,
},
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeClusterIP,
Expand All @@ -47,6 +49,7 @@ func createRepoServerDeployment(ctx context.Context, clientset *kubernetes.Clien
Name: name,
Namespace: namespace,
Labels: labels,
Annotations: annotations,
},
Spec: appsv1.DeploymentSpec{
Selector: &metav1.LabelSelector{
Expand Down
2 changes: 2 additions & 0 deletions pkg/argocd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ func createServerDeployment(ctx context.Context, clientset *kubernetes.Clientset
for k, v := range argoLabels {
labels[k] = v
}
annotations := argoAnnotations
deployment := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
Labels: labels,
Annotations: annotations,
},
Spec: appsv1.DeploymentSpec{
Selector: &metav1.LabelSelector{
Expand Down

0 comments on commit 29bfc0f

Please sign in to comment.