-
Notifications
You must be signed in to change notification settings - Fork 40
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
Firewalld as DaemonSet #1429
Open
jakolehm
wants to merge
7
commits into
master
Choose a base branch
from
feature/firewalld-daemonset
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Firewalld as DaemonSet #1429
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
006a202
firewalld as daemonset
jakolehm 866f9cd
cleanup
jakolehm 65c891d
dns node cache v1.15.2
jakolehm 6ae8723
Merge branch 'master' into feature/firewalld-daemonset
jakolehm a7ae643
Merge branch 'master' into feature/firewalld-daemonset
jakolehm 2529e93
use tagged version
jakolehm 0c9411a
Merge branch 'feature/firewalld-daemonset' of github.com:kontena/phar…
jakolehm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,8 +59,6 @@ def call | |
master_ip: master_host.peer_address, | ||
version: CALICO_VERSION, | ||
nat_outgoing: @config.network.calico&.nat_outgoing, | ||
firewalld_enabled: [email protected]&.firewalld&.enabled, | ||
reload_iptables: !!cluster_context['reload-iptables'], | ||
envs: @config.network.calico&.environment || {}, | ||
metrics_enabled: metrics_enabled?, | ||
metrics_port: metrics_port, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,8 +61,6 @@ def ensure_resources | |
ipalloc_range: @config.network.pod_network_cidr, | ||
arch: @host.cpu_arch, | ||
version: WEAVE_VERSION, | ||
firewalld_enabled: firewalld?, | ||
reload_iptables: reload_iptables?, | ||
known_peers: known_peers, | ||
initial_known_peers: initial_known_peers, | ||
flying_shuttle_enabled: flying_shuttle?, | ||
|
@@ -105,16 +103,6 @@ def known_peers | |
@config.hosts.map(&:peer_address) | ||
end | ||
|
||
# @return [Boolean] | ||
def firewalld? | ||
[email protected]&.firewalld&.enabled | ||
end | ||
|
||
# @return [Boolean] | ||
def reload_iptables? | ||
!!cluster_context['reload-iptables'] | ||
end | ||
|
||
# @return [Boolean] | ||
def flying_shuttle? | ||
return true if known_peers | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: pharos-firewalld | ||
namespace: kube-system | ||
data: | ||
pharos-master.xml: <%= services[:master].dump %> | ||
pharos-worker.xml: <%= services[:worker].dump %> | ||
pharos.xml: <%= ipset.dump %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<% %w(master worker).each do |role| %> | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: DaemonSet | ||
metadata: | ||
name: pharos-firewalld-<%= role %> | ||
labels: | ||
name: pharos-firewalld-<%= role %> | ||
namespace: kube-system | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
name: pharos-firewalld-<%= role %> | ||
spec: | ||
<%- if role == 'master' -%> | ||
nodeSelector: | ||
node-role.kubernetes.io/master: '' | ||
<%- else -%> | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: node-role.kubernetes.io/master | ||
operator: DoesNotExist | ||
<%- end -%> | ||
containers: | ||
- name: firewalld | ||
image: '<%= image_repository %>/pharos-firewalld:<%= version %>' | ||
env: | ||
- name: FIREWALLD_ROLE | ||
value: <%= role %> | ||
resources: | ||
requests: | ||
cpu: 10m | ||
memory: 32Mi | ||
securityContext: | ||
privileged: true | ||
volumeMounts: | ||
- name: firewalld | ||
mountPath: /etc/firewalld/configmap | ||
- name: lib-modules | ||
mountPath: /lib/modules | ||
- name: xtables-lock | ||
mountPath: /run/xtables.lock | ||
lifecycle: | ||
preStop: | ||
exec: | ||
command: | ||
- /bin/sh | ||
- -c | ||
- kill -s RTMIN+3 1 | ||
hostNetwork: true | ||
restartPolicy: Always | ||
securityContext: | ||
seLinuxOptions: {} | ||
priorityClassName: system-node-critical | ||
tolerations: | ||
- effect: NoSchedule | ||
operator: Exists | ||
volumes: | ||
- name: firewalld | ||
configMap: | ||
name: pharos-firewalld | ||
- name: lib-modules | ||
hostPath: | ||
path: /lib/modules | ||
- name: xtables-lock | ||
hostPath: | ||
path: /run/xtables.lock | ||
updateStrategy: | ||
type: RollingUpdate | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,21 +12,7 @@ spec: | |
metadata: | ||
labels: | ||
name: weave-net | ||
annotations: | ||
kontena.io/firewalld: "<%= firewalld_enabled %>" | ||
spec: | ||
<% if firewalld_enabled && reload_iptables %> | ||
initContainers: | ||
# This container performs firewalld reload | ||
- name: reload-firewalld | ||
image: <%= image_repository %>/alpine:3.9 | ||
command: ["/bin/sh", "-c"] | ||
env: | ||
- name: TIMESTAMP | ||
value: "<%= Time.now.to_f %>" | ||
args: | ||
- pkill -HUP firewalld | ||
<% end %> | ||
containers: | ||
- name: weave | ||
command: | ||
|
@@ -61,12 +47,19 @@ spec: | |
name: weave-passwd | ||
key: weave-passwd | ||
image: '<%= image_repository %>/weave-kube:<%= version %>' | ||
livenessProbe: | ||
readinessProbe: | ||
httpGet: | ||
host: 127.0.0.1 | ||
path: /status | ||
port: 6784 | ||
initialDelaySeconds: 30 | ||
livenessProbe: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This ensures that required iptables rules are in place. |
||
exec: | ||
command: | ||
- /bin/sh | ||
- -c | ||
- iptables-save | grep -E -e '^-A WEAVE.+MASQUERADE$' | ||
initialDelaySeconds: 60 | ||
periodSeconds: 60 | ||
resources: | ||
requests: | ||
cpu: 10m | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upstream has already switched to
readinessProbe
.