WIP: Implementing Network Policy #207

Closed
safaG wants to merge 12 commits from safaG/helm-chart:network-policy into main
First-time contributor

Hi All!

I have created network policy yaml file and adjusted helpers.tpl file in order to stop gitea pods from communicating outside of gitea pods. What I have is really basic as I am not a pro with helm charts. Maybe there is another way of doing it better but this is what I have. What I did was to add below to _helpers.tpl file:

{{/*
Network Policy labels
*/}}
{{- define "gitea.netpolLabels" -}}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

I have added this file to pull the unique label that Gitea creates on all pods. Then I created the networkpolicy.yaml file and used the above label under matchLabels: in the networkpolicy.yaml file

I have tested this with a new deployment and everything seemed working fine. However not sure if it will be a breaking change with existing deployments, I have not tested that.

Hi All! I have created network policy yaml file and adjusted helpers.tpl file in order to stop gitea pods from communicating outside of gitea pods. What I have is really basic as I am not a pro with helm charts. Maybe there is another way of doing it better but this is what I have. What I did was to add below to _helpers.tpl file: ``` {{/* Network Policy labels */}} {{- define "gitea.netpolLabels" -}} app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} ``` I have added this file to pull the unique label that Gitea creates on all pods. Then I created the networkpolicy.yaml file and used the above label under ```matchLabels:``` in the networkpolicy.yaml file I have tested this with a new deployment and everything seemed working fine. However not sure if it will be a breaking change with existing deployments, I have not tested that.
safaG added 2 commits 2021-07-09 15:59:01 +00:00
added network policy
All checks were successful
continuous-integration/drone/pr Build is passing
1fa281bde4
Member

Thanks for your already invested time to provide that PR. Not sure if you like to have a review since the PR is marked as WIP.

Referring to your comment: to prevent such a breaking change the use of NetworkPolicy would need to be configurable with default value false. That way it wouldn't change existing installs. There are a few examples in the chart to see how this can be achieved. See this example.

Thanks for your already invested time to provide that PR. Not sure if you like to have a review since the PR is marked as WIP. Referring to your comment: to prevent such a breaking change the use of NetworkPolicy would need to be configurable with default value `false`. That way it wouldn't change existing installs. There are a few examples in the chart to see how this can be achieved. [See this example](https://gitea.com/gitea/helm-chart/src/branch/master/templates/gitea/statefulset.yaml#L156).
justusbunsi added the
kind
security
label 2021-11-13 11:49:20 +00:00
justusbunsi changed title from WIP: Security: Implementing Network-Policy to Gitea Pods. to WIP: Implementing Network Policy 2021-11-13 11:49:46 +00:00
Member

@safaG Do you want to continue your work on this pull request? There would be two things to do:

  • Resolve conflicts
  • Disable Network policies by default to prevent breaking changes on existing installations
  • Wrap the template in conditions such as here
  • At least allow customization for the CIDR value.
@safaG Do you want to continue your work on this pull request? There would be two things to do: - Resolve conflicts - Disable Network policies by default to prevent breaking changes on existing installations - Wrap the template in conditions such as [here](https://gitea.com/gitea/helm-chart/src/branch/master/templates/gitea/servicemonitor.yaml#L1) - At least allow customization for the `CIDR` value.
safaG added 1 commit 2022-03-12 03:18:38 +00:00
adding network policy
Some checks failed
continuous-integration/drone/pr Build is failing
e5b77d36ad
safaG added 1 commit 2022-03-12 03:19:12 +00:00
adding enabled statement & cidr to values
Some checks failed
continuous-integration/drone/pr Build is failing
d3e32a0e60
safaG added 1 commit 2022-03-12 03:45:55 +00:00
adding ending
Some checks failed
continuous-integration/drone/pr Build is failing
ef08cda6a7
safaG added 6 commits 2022-03-12 04:27:08 +00:00
safaG added 1 commit 2022-03-12 04:35:09 +00:00
updating helper gile
All checks were successful
continuous-integration/drone/pr Build is passing
c48db96373
Author
First-time contributor

@justusbunsi can we close this PR and move to pull request 306? I have made the neccessary changes there and tested it on my local cluster.

@justusbunsi can we close this PR and move to pull request [306](https://gitea.com/gitea/helm-chart/pulls/306)? I have made the neccessary changes there and tested it on my local cluster.
justusbunsi closed this pull request 2022-03-12 08:43:02 +00:00
Some checks are pending
continuous-integration/drone/pr Build is passing
check-and-test / check-and-test (pull_request)
Required

Pull request closed

Sign in to join this conversation.
No description provided.