Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor redis-ha NetworkPolicy to include egress rules (#9968) #10226

Merged
merged 1 commit into from Aug 8, 2022

Conversation

34fathombelow
Copy link
Member

@34fathombelow 34fathombelow commented Aug 6, 2022

Fixes #9968

This policy change includes egress rules to only allow DNS traffic outbound and maintain inter-Redis and Sentinel connectivity. argocd-redis-ha-server & argocd-redis-ha-proxy should not be allowed to communicate with other pods in the cluster to prevent lateral movement in the event a redis pod is breached.

kubectl describe networkpolicies.networking.k8s.io argocd-redis-ha-server-network-policy 

Name:         argocd-redis-ha-server-network-policy
Namespace:    argocd
Created on:   2022-08-05 17:36:44 -0700 PDT
Labels:       <none>
Annotations:  <none>
Spec:
  PodSelector:     app.kubernetes.io/name=argocd-redis-ha
  Allowing ingress traffic:
    To Port: 6379/TCP
    To Port: 26379/TCP
    From:
      PodSelector: app.kubernetes.io/name=argocd-redis-ha-haproxy
    From:
      PodSelector: app.kubernetes.io/name=argocd-redis-ha
  Allowing egress traffic:
    To Port: 6379/TCP
    To Port: 26379/TCP
    To:
      PodSelector: app.kubernetes.io/name=argocd-redis-ha
    ----------
    To Port: 53/UDP
    To Port: 53/TCP
    To:
      NamespaceSelector: <none>
  Policy Types: Ingress, Egress
kubectl describe networkpolicies.networking.k8s.io argocd-redis-ha-proxy-network-policy

Name:         argocd-redis-ha-proxy-network-policy
Namespace:    argocd
Created on:   2022-08-05 17:36:44 -0700 PDT
Labels:       <none>
Annotations:  <none>
Spec:
  PodSelector:     app.kubernetes.io/name=argocd-redis-ha-haproxy
  Allowing ingress traffic:
    To Port: 6379/TCP
    To Port: 26379/TCP
    From:
      PodSelector: app.kubernetes.io/name=argocd-server
    From:
      PodSelector: app.kubernetes.io/name=argocd-repo-server
    From:
      PodSelector: app.kubernetes.io/name=argocd-application-controller
  Allowing egress traffic:
    To Port: 6379/TCP
    To Port: 26379/TCP
    To:
      PodSelector: app.kubernetes.io/name=argocd-redis-ha
    ----------
    To Port: 53/UDP
    To Port: 53/TCP
    To:
      NamespaceSelector: <none>
  Policy Types: Ingress, Egress

Signed-off-by: Justin Marquis 34fathombelow@protonmail.com

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

Signed-off-by: Justin Marquis <34fathombelow@protonmail.com>
@codecov
Copy link

codecov bot commented Aug 6, 2022

Codecov Report

Merging #10226 (b8cd5e3) into master (3520dfc) will increase coverage by 0.05%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master   #10226      +/-   ##
==========================================
+ Coverage   45.93%   45.98%   +0.05%     
==========================================
  Files         227      226       -1     
  Lines       27419    27413       -6     
==========================================
+ Hits        12594    12605      +11     
+ Misses      13114    13094      -20     
- Partials     1711     1714       +3     
Impacted Files Coverage Δ
controller/state.go 73.89% <0.00%> (-0.33%) ⬇️
controller/sync.go 56.09% <0.00%> (ø)
cmd/util/cluster.go 41.17% <0.00%> (ø)
pkg/apiclient/apiclient.go 0.96% <0.00%> (ø)
reposerver/repository/repository.go 64.30% <0.00%> (ø)
cmd/argocd/commands/admin/settings_rbac.go 23.80% <0.00%> (ø)
util/argo/managedfields/parser.go
cmd/argocd/commands/app.go 20.44% <0.00%> (+0.06%) ⬆️
util/argo/diff/diff.go 52.41% <0.00%> (+0.20%) ⬆️
util/settings/settings.go 51.42% <0.00%> (+0.51%) ⬆️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

@34fathombelow 34fathombelow changed the title feat: refactor redis-ha NetworkPolicy to include egress rules feat: refactor redis-ha NetworkPolicy to include egress rules (#9968) Aug 6, 2022
@crenshaw-dev crenshaw-dev merged commit 2260c79 into argoproj:master Aug 8, 2022
@34fathombelow 34fathombelow deleted the redis-ha-egress branch August 8, 2022 20:30
ashutosh16 pushed a commit to ashutosh16/argo-cd that referenced this pull request Aug 11, 2022
…oj#10226)

Signed-off-by: Justin Marquis <34fathombelow@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TOB-ARGO-TM2: Add network policies for ApplicationSet and Notifications controllers
2 participants