Skip to content

Commit 80e93f8

Browse files
authored
Merge branch 'argoproj-labs:master' into master
2 parents f1c338a + b92f257 commit 80e93f8

16 files changed

Lines changed: 72 additions & 14 deletions

File tree

.github/workflows/ci-build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
run: mkdir -p ~/go/src/github.com/argoproj-labs
2323

2424
- name: Checkout code
25-
uses: actions/checkout@v6
25+
uses: actions/checkout@v7
2626

2727
- name: Create symlink in GOPATH
2828
run: ln -s $(pwd) ~/go/src/github.com/argoproj-labs
@@ -76,7 +76,7 @@ jobs:
7676
kubectl version
7777
k3d version
7878
- name: Checkout code
79-
uses: actions/checkout@v6
79+
uses: actions/checkout@v7
8080
- name: Setup Golang
8181
uses: actions/setup-go@v6
8282
with:

.github/workflows/codegen.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v6
18+
uses: actions/checkout@v7
1919
- name: Setup Golang
2020
uses: actions/setup-go@v6
2121
with:
@@ -33,7 +33,7 @@ jobs:
3333
runs-on: ubuntu-latest
3434
steps:
3535
- name: Checkout code
36-
uses: actions/checkout@v6
36+
uses: actions/checkout@v7
3737
- name: Setup Golang
3838
uses: actions/setup-go@v6
3939
with:

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
build:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v6
22+
- uses: actions/checkout@v7
2323

2424
- name: Set up Go
2525
uses: actions/setup-go@v6

.github/workflows/lint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v6
17+
uses: actions/checkout@v7
1818
- name: Set up Go
1919
uses: actions/setup-go@v6
2020
with:
@@ -34,7 +34,7 @@ jobs:
3434
runs-on: ubuntu-latest
3535
steps:
3636
- name: Checkout code
37-
uses: actions/checkout@v6
37+
uses: actions/checkout@v7
3838
- name: Set up Go
3939
uses: actions/setup-go@v6
4040
with:

.github/workflows/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
steps:
1818

1919
- name: Checkout code
20-
uses: actions/checkout@v6
20+
uses: actions/checkout@v7
2121

2222
- name: Set up Go
2323
uses: actions/setup-go@v6

build/redis/init.sh.tpl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,4 @@ echo "Setting redis auth values.."
266266
ESCAPED_AUTH=$(echo "${AUTH}" | sed -e 's/[\/&]/\\&/g');
267267
sed -i "s/__REPLACE_DEFAULT_AUTH__/${ESCAPED_AUTH}/" "${REDIS_CONF}" "${SENTINEL_CONF}"
268268

269-
if [ "${SENTINELAUTH:-}" ]; then
270-
echo "Setting sentinel auth values"
271-
ESCAPED_AUTH_SENTINEL=$(echo "$SENTINELAUTH" | sed -e 's/[\/&]/\\&/g');
272-
sed -i "s/__REPLACE_DEFAULT_SENTINEL_AUTH__/${ESCAPED_AUTH_SENTINEL}/" "$SENTINEL_CONF"
273-
fi
274-
275269
echo "$(date) Ready..."

controllers/argocd/applicationset.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,9 @@ func (r *ReconcileArgoCD) reconcileApplicationSetClusterRole(cr *argoproj.ArgoCD
645645

646646
// ArgoCD not cluster scoped, cleanup any existing resource and exit
647647
if !allowed {
648+
if !argoutil.CheckClusterRoleOwnership(existingClusterRole, cr) {
649+
return existingClusterRole, nil
650+
}
648651
argoutil.LogResourceDeletion(log, existingClusterRole, "argocd not cluster scoped")
649652
err := r.Delete(context.TODO(), existingClusterRole)
650653
if err != nil {
@@ -709,6 +712,9 @@ func (r *ReconcileArgoCD) reconcileApplicationSetClusterRoleBinding(cr *argoproj
709712

710713
// ArgoCD not cluster scoped, cleanup any existing resource and exit
711714
if !allowed {
715+
if !argoutil.CheckClusterRoleBindingOwnership(existingClusterRB, cr) {
716+
return nil
717+
}
712718
argoutil.LogResourceDeletion(log, existingClusterRB, "argocd not cluster scoped")
713719
err := r.Delete(context.TODO(), existingClusterRB)
714720
if err != nil {

controllers/argocd/image_updater.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,16 @@ func (r *ReconcileArgoCD) deleteImageUpdaterClusterRBAC(cr *argoproj.ArgoCD) err
502502
return err
503503
}
504504
} else {
505+
switch o := obj.(type) {
506+
case *rbacv1.ClusterRole:
507+
if !argoutil.CheckClusterRoleOwnership(o, cr) {
508+
continue
509+
}
510+
case *rbacv1.ClusterRoleBinding:
511+
if !argoutil.CheckClusterRoleBindingOwnership(o, cr) {
512+
continue
513+
}
514+
}
505515
argoutil.LogResourceDeletion(log, obj, "IMAGE_UPDATER_WATCH_NAMESPACES is no longer \"*\"")
506516
if err := r.Delete(context.TODO(), obj); err != nil && !errors.IsNotFound(err) {
507517
return err
@@ -732,6 +742,9 @@ func (r *ReconcileArgoCD) reconcileRoleHelper(cr *argoproj.ArgoCD, desiredRole c
732742

733743
// role exists but shouldn't, so it should be deleted
734744
if !cr.Spec.ImageUpdater.Enabled {
745+
if clusterRole, ok := existingRole.(*rbacv1.ClusterRole); ok && !argoutil.CheckClusterRoleOwnership(clusterRole, cr) {
746+
return nil, nil
747+
}
735748
argoutil.LogResourceDeletion(log, existingRole, "image updater is disabled")
736749
return nil, r.Delete(context.TODO(), existingRole)
737750
}
@@ -814,6 +827,9 @@ func (r *ReconcileArgoCD) reconcileRoleBindingHelper(cr *argoproj.ArgoCD, desire
814827

815828
// roleBinding exists but shouldn't, so it should be deleted
816829
if !cr.Spec.ImageUpdater.Enabled {
830+
if clusterRoleBinding, ok := existingRoleBinding.(*rbacv1.ClusterRoleBinding); ok && !argoutil.CheckClusterRoleBindingOwnership(clusterRoleBinding, cr) {
831+
return nil
832+
}
817833
argoutil.LogResourceDeletion(log, existingRoleBinding, "image updater is disabled")
818834
return r.Delete(context.TODO(), existingRoleBinding)
819835
}

controllers/argocd/role.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,10 @@ func (r *ReconcileArgoCD) reconcileClusterRole(componentName string, policyRules
384384
}
385385

386386
if !allowed {
387+
ownedByCurrentArgoCD := argoutil.CheckClusterRoleOwnership(existingClusterRole, cr)
388+
if !ownedByCurrentArgoCD {
389+
return nil, nil
390+
}
387391
// delete existing ClusterRole as namespace can not host cluster-scoped Argo CD instance
388392
argoutil.LogResourceDeletion(log, existingClusterRole, fmt.Sprintf("namespace '%s' cannot host cluster-scoped argocd instance", cr.Namespace))
389393
return nil, r.Delete(context.TODO(), existingClusterRole)

controllers/argocd/rolebinding.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ func (r *ReconcileArgoCD) reconcileClusterRoleBinding(name string, role *v1.Clus
392392
}
393393

394394
if roleBindingExists && role == nil {
395+
if !argoutil.CheckClusterRoleBindingOwnership(roleBinding, cr) {
396+
return nil
397+
}
395398
argoutil.LogResourceDeletion(log, roleBinding, "role binding has no corresponding role")
396399
return r.Delete(context.TODO(), roleBinding)
397400
}

0 commit comments

Comments
 (0)