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

Add operator flag to define webhook port #6691

Merged
merged 16 commits into from
May 2, 2023

Conversation

KrisJohnstone
Copy link
Contributor

As discussed in #6655, changes have been made to support nominating the port to listen.

Couple of notes:

  • As mentioned in Enable hostNetwork support in eck-operator Helm chart #6655 having issues running this up locally due to vault issues.
  • I've left the operatorhub portions intact as it sources the yaml and applies it, not much room for modification from what I could see. Happy to be proven wrong.
  • Dockerfile won't build due to missing dep config/eck.yaml. Will see if I can pinch a file from 2.7 or something hacky like that.

@botelastic botelastic bot added the triage label Apr 16, 2023
@thbkrkr thbkrkr added the >feature Adds or discusses adding a feature to the product label Apr 17, 2023
@botelastic botelastic bot removed the triage label Apr 17, 2023
@@ -130,6 +130,8 @@ webhook:
# This is required to allow for communication with the kube API when using some alternate CNIs in conjunction with webhook enabled.
# CAUTION: Proceed at your own risk. This setting has security concerns such as allowing malicious users to access workloads running on the host.
hostNetwork: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not from this PR but would it make sense to move hostNetwork as a "top level" field?
hostNetwork is part of the Pod specification, as resources, podSecurityContext, serviceAccount... and is not directly related to the webhook configuration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also a typo in the comment:

--- a/deploy/eck-operator/values.yaml
+++ b/deploy/eck-operator/values.yaml
@@ -126,7 +126,7 @@ webhook:
   # objectSelector corresponds to the objectSelector property of the webhook.
   # Setting this restricts the webhook to act only on objects that match the selector.
   objectSelector: {}
-  # HostNetwork allows a Pod to use the Node network namespace.
+  # hostNetwork allows a Pod to use the Node network namespace.
   # This is required to allow for communication with the kube API when using some alternate CNIs in conjunction with webhook enabled.
   # CAUTION: Proceed at your own risk. This setting has security concerns such as allowing malicious users to access workloads running on the host.
   hostNetwork: false

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not from this PR but would it make sense to move hostNetwork as a "top level" field?
hostNetwork is part of the Pod specification, as resources, podSecurityContext, serviceAccount... and is not directly related to the webhook configuration.

You're absolutely right, I missed that in #6636.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it at the root, but was asked to change. Will move it to the root :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Also need to update:

diff --git a/deploy/eck-operator/templates/statefulset.yaml b/deploy/eck-operator/templates/statefulset.yaml
index e17c34a82..16d66e5e2 100644
--- a/deploy/eck-operator/templates/statefulset.yaml
+++ b/deploy/eck-operator/templates/statefulset.yaml
@@ -117,7 +117,7 @@ spec:
         {{- with .Values.volumes }}
           {{- toYaml . | nindent 8 }}
         {{- end }}
-      {{- if .Values.webhook.hostNetwork }}
+      {{- if .Values.hostNetwork }}

@KrisJohnstone

This comment was marked as resolved.

@thbkrkr
Copy link
Contributor

thbkrkr commented Apr 20, 2023

I'm fine not supporting that in this PR, but still, how would you deploy ECK with hostNetwork: true and replicaCount: 2?

@thbkrkr thbkrkr added the v2.8.0 label Apr 20, 2023
@barkbay
Copy link
Contributor

barkbay commented Apr 20, 2023

I'm fine not supporting that in this PR, but still, how would you deploy ECK with hostNetwork: true and replicaCount: 2?

IIRC there is a scheduler predicate that prevents 2 Pods with hostNetwork: true to be scheduled on a same k8s node as soon as their containers[*].ports[*] intersect.

Edit: to be confirmed, just a vague recollection.

@KrisJohnstone
Copy link
Contributor Author

KrisJohnstone commented Apr 20, 2023

I'm fine not supporting that in this PR, but still, how would you deploy ECK with hostNetwork: true and replicaCount: 2?

IIRC there is a scheduler predicate that prevents 2 Pods with hostNetwork: true to be scheduled on a same k8s node as soon as their containers[*].ports[*] intersect.

Edit: to be confirmed, just a vague recollection.

By default I believe this is the case yes.

EDIT: Its undoubtedly much more work but one way that would also improve the security of the operator would be to separate the webhook validation from the operator.

@thbkrkr
Copy link
Contributor

thbkrkr commented Apr 20, 2023

Could you also add these new config parameters in the following documents, please?

docs/operating-eck/operator-config.asciidoc
docs/operating-eck/webhook.asciidoc

@KrisJohnstone
Copy link
Contributor Author

Could you also add these new config parameters in the following documents, please?

docs/operating-eck/operator-config.asciidoc docs/operating-eck/webhook.asciidoc

Done :)

deploy/eck-operator/values.yaml Outdated Show resolved Hide resolved
pkg/controller/common/operator/flags.go Show resolved Hide resolved
cmd/manager/main.go Outdated Show resolved Hide resolved
KrisJohnstone and others added 3 commits April 27, 2023 10:38
Co-authored-by: Michael Morello <michael.morello@gmail.com>
Co-authored-by: Michael Morello <michael.morello@gmail.com>
@KrisJohnstone
Copy link
Contributor Author

image

Missed a fetch config statement, so was always using default port.

@thbkrkr thbkrkr changed the title CNI Support Add operator flag to define webhook port Apr 28, 2023
@thbkrkr
Copy link
Contributor

thbkrkr commented Apr 28, 2023

buildkite test this

@thbkrkr
Copy link
Contributor

thbkrkr commented Apr 28, 2023

@elasticmachine run elasticsearch-ci/docs

@barkbay
Copy link
Contributor

barkbay commented May 2, 2023

buildkite test this

@barkbay
Copy link
Contributor

barkbay commented May 2, 2023

@elasticmachine run elasticsearch-ci/docs

Copy link
Contributor

@barkbay barkbay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>feature Adds or discusses adding a feature to the product v2.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants