You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/10/07 22:42:52 UTC

[GitHub] [airflow] joseph-max-coalfire opened a new pull request, #26945: Add nodePort declaration to chart/values.schema.json

joseph-max-coalfire opened a new pull request, #26945:
URL: https://github.com/apache/airflow/pull/26945

   
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   closes: #26812 
   Adding a nodePort declaration to the chart/values.schema.json file to allow users to explicitly define exactly which port the nodePort setting should use when deploying with the Helm chart. 
   
   This is important for users who have external load balancers and firewalls/security groups that have predefined traffic ports for Airflow. (e.g. a load balancer is expecting the airflow-webserver to listen on port 31000, and it's set up via Terraform, so I'd rather be able to specify a known port in Terraform beforehand rather than have to grab a new port every time I build Airflow)
   
   Tested locally on minikube with the following values.yaml override. 
   ```
   webserver:
       service:
         type: NodePort
         ports:
           - name: airflow-ui
             port: 80
             targetPort: airflow-ui
             nodePort: 31000
   ```
   
   Cluster comes up successfully with airflow-webserver service listening on expected nodePort. Output of the deployed `airflow-webserver` service object's YAML below:
   ```
   Name:                     airflow-webserver
   Namespace:                default
   Labels:                   app.kubernetes.io/managed-by=Helm
                             chart=airflow-1.7.0-dev
                             component=webserver
                             heritage=Helm
                             release=airflow
                             tier=airflow
   Annotations:              meta.helm.sh/release-name: airflow
                             meta.helm.sh/release-namespace: default
   Selector:                 component=webserver,release=airflow,tier=airflow
   Type:                     NodePort
   IP Family Policy:         SingleStack
   IP Families:              IPv4
   IP:                       10.104.151.191
   IPs:                      10.104.151.191
   Port:                     airflow-ui  80/TCP
   TargetPort:               airflow-ui/TCP
   NodePort:                 airflow-ui  31000/TCP
   Endpoints:                <none>
   Session Affinity:         None
   External Traffic Policy:  Cluster
   Events:                   <none>
   ```
   
   
   Also tested _without_ specifying a nodePort option (defaulting to ClusterIP) to ensure new schema doesn't break backwards compatibility.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] dstandish commented on a diff in pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #26945:
URL: https://github.com/apache/airflow/pull/26945#discussion_r991652606


##########
tests/charts/test_webserver.py:
##########
@@ -721,6 +721,30 @@ def test_should_add_component_specific_labels(self):
         assert "test_label" in jmespath.search("metadata.labels", docs[0])
         assert jmespath.search("metadata.labels", docs[0])["test_label"] == "test_label_value"
 
+    @parameterized.expand(
+        [
+            (
+                [{"name": "webserver-nodeport", "nodePort": "31000", "port": "8080"}],
+                [{"name": "webserver-nodeport", "nodePort": 31000, "port": 8080}],
+            )
+        ]
+    )
+    def test_nodeport_service(self, ports, expected_ports):

Review Comment:
   looks like your params aren't consistent with those provided in expand
   but let's see what the tests tell us
   i'd also add an entry (in  expand) for when no port is provided
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] dstandish commented on a diff in pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #26945:
URL: https://github.com/apache/airflow/pull/26945#discussion_r1016174254


##########
tests/charts/test_webserver.py:
##########
@@ -721,6 +721,30 @@ def test_should_add_component_specific_labels(self):
         assert "test_label" in jmespath.search("metadata.labels", docs[0])
         assert jmespath.search("metadata.labels", docs[0])["test_label"] == "test_label_value"
 
+    @parameterized.expand(
+        [
+            (
+                [{"name": "webserver-nodeport", "nodePort": "31000", "port": "8080"}],
+                [{"name": "webserver-nodeport", "nodePort": 31000, "port": 8080}],
+            )
+        ]
+    )
+    def test_nodeport_service(self, ports, expected_ports):

Review Comment:
   all good.
   
   one thing though. 
   
   looking [here](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport), it looks like `name` is not a valid attr for nodeport. probably best to remov that.



##########
tests/charts/test_webserver.py:
##########
@@ -719,6 +719,35 @@ def test_should_add_component_specific_labels(self):
         assert "test_label" in jmespath.search("metadata.labels", docs[0])
         assert jmespath.search("metadata.labels", docs[0])["test_label"] == "test_label_value"
 
+    @pytest.mark.parametrize(
+        "ports, expected_ports",
+        [
+            (
+                [{"name": "webserver-nodeport", "nodePort": "31000", "port": "8080"}],
+                [{"name": "webserver-nodeport", "nodePort": 31000, "port": 8080}],
+            ),
+            (
+                [{"name": "webserver-nodeport", "port": "8080"}],
+                [{"name": "webserver-nodeport", "port": 8080}],
+            ),
+        ],
+    )
+    def test_nodeport_service(self, ports, expected_ports):
+        docs = render_chart(
+            values={
+                "webserver": {
+                    "service": {
+                        "type": "NodePort",
+                        "ports": (ports),

Review Comment:
   ```suggestion
                           "ports": ports,
   ```



##########
tests/charts/test_webserver.py:
##########
@@ -719,6 +719,35 @@ def test_should_add_component_specific_labels(self):
         assert "test_label" in jmespath.search("metadata.labels", docs[0])
         assert jmespath.search("metadata.labels", docs[0])["test_label"] == "test_label_value"
 
+    @pytest.mark.parametrize(
+        "ports, expected_ports",
+        [
+            (
+                [{"name": "webserver-nodeport", "nodePort": "31000", "port": "8080"}],
+                [{"name": "webserver-nodeport", "nodePort": 31000, "port": 8080}],
+            ),
+            (
+                [{"name": "webserver-nodeport", "port": "8080"}],
+                [{"name": "webserver-nodeport", "port": 8080}],
+            ),

Review Comment:
   ```suggestion
               (
                   [{"nodePort": "31000", "port": "8080"}],
                   [{"nodePort": 31000, "port": 8080}],
               ),
               (
                   [{"port": "8080"}],
                   [{"port": 8080}],
               ),
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #26945:
URL: https://github.com/apache/airflow/pull/26945#issuecomment-1306234892

   I run the workflow. @dstandish ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] dstandish commented on a diff in pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #26945:
URL: https://github.com/apache/airflow/pull/26945#discussion_r991652606


##########
tests/charts/test_webserver.py:
##########
@@ -721,6 +721,30 @@ def test_should_add_component_specific_labels(self):
         assert "test_label" in jmespath.search("metadata.labels", docs[0])
         assert jmespath.search("metadata.labels", docs[0])["test_label"] == "test_label_value"
 
+    @parameterized.expand(
+        [
+            (
+                [{"name": "webserver-nodeport", "nodePort": "31000", "port": "8080"}],
+                [{"name": "webserver-nodeport", "nodePort": 31000, "port": 8080}],
+            )
+        ]
+    )
+    def test_nodeport_service(self, ports, expected_ports):

Review Comment:
   looks like your params aren't consistent with those provided in expand
   but let's see what the tests tell us
   i'd also add an entry (in  expand) for when no nodePort is provided
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] dstandish commented on pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
dstandish commented on PR #26945:
URL: https://github.com/apache/airflow/pull/26945#issuecomment-1272204155

   Do you think you could add a test for this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] joseph-max-coalfire commented on pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
joseph-max-coalfire commented on PR #26945:
URL: https://github.com/apache/airflow/pull/26945#issuecomment-1307983862

   Thanks @dstandish and @potiuk!
   
   @dstandish I've reviewed and committed your recommended changes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] joseph-max-coalfire commented on pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
joseph-max-coalfire commented on PR #26945:
URL: https://github.com/apache/airflow/pull/26945#issuecomment-1272613877

   > Do you think you could add a test for this?
   
   @dstandish added and tested locally. Let me know if it needs more coverage


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] joseph-max-coalfire commented on a diff in pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
joseph-max-coalfire commented on code in PR #26945:
URL: https://github.com/apache/airflow/pull/26945#discussion_r991703610


##########
tests/charts/test_webserver.py:
##########
@@ -721,6 +721,30 @@ def test_should_add_component_specific_labels(self):
         assert "test_label" in jmespath.search("metadata.labels", docs[0])
         assert jmespath.search("metadata.labels", docs[0])["test_label"] == "test_label_value"
 
+    @parameterized.expand(
+        [
+            (
+                [{"name": "webserver-nodeport", "nodePort": "31000", "port": "8080"}],
+                [{"name": "webserver-nodeport", "nodePort": 31000, "port": 8080}],
+            )
+        ]
+    )
+    def test_nodeport_service(self, ports, expected_ports):

Review Comment:
   > looks like your params aren't consistent with those provided in expand 
   
   @dstandish Not sure I follow-- I used the test_ports_overrides param structure as a reference, and [it looks like CI checks are passing](https://github.com/apache/airflow/actions/runs/3222282528/jobs/5271598232)
   
   > i'd also add an entry (in expand) for when no nodePort is provided
   
   Added (lines 730-733) and tested locally with success. We'll see if the remote CI checks pass as well
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] boring-cyborg[bot] commented on pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on PR #26945:
URL: https://github.com/apache/airflow/pull/26945#issuecomment-1272140260

   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (flake8, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
   Apache Airflow is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] boring-cyborg[bot] commented on pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on PR #26945:
URL: https://github.com/apache/airflow/pull/26945#issuecomment-1312902978

   Awesome work, congrats on your first merged pull request!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk merged pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
potiuk merged PR #26945:
URL: https://github.com/apache/airflow/pull/26945


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] joseph-max-coalfire commented on a diff in pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
joseph-max-coalfire commented on code in PR #26945:
URL: https://github.com/apache/airflow/pull/26945#discussion_r991703610


##########
tests/charts/test_webserver.py:
##########
@@ -721,6 +721,30 @@ def test_should_add_component_specific_labels(self):
         assert "test_label" in jmespath.search("metadata.labels", docs[0])
         assert jmespath.search("metadata.labels", docs[0])["test_label"] == "test_label_value"
 
+    @parameterized.expand(
+        [
+            (
+                [{"name": "webserver-nodeport", "nodePort": "31000", "port": "8080"}],
+                [{"name": "webserver-nodeport", "nodePort": 31000, "port": 8080}],
+            )
+        ]
+    )
+    def test_nodeport_service(self, ports, expected_ports):

Review Comment:
   > looks like your params aren't consistent with those provided in expand 
   
   @dstandish Not sure I follow-- I used the test_ports_overrides param structure as a reference, and [it looks like CI checks are passing](https://github.com/apache/airflow/actions/runs/3222282528/jobs/5271598232)
   
   > i'd also add an entry (in expand) for when no nodePort is provided
   
   Added and tested locally with success. We'll see if the remote CI checks pass as well
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] joseph-max-coalfire commented on pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
joseph-max-coalfire commented on PR #26945:
URL: https://github.com/apache/airflow/pull/26945#issuecomment-1282355316

   ^ added a trailing comma that was causing the Black CI check to fail. Tests can be re-run when possible


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] joseph-max-coalfire commented on pull request #26945: Add nodePort declaration to chart/values.schema.json

Posted by GitBox <gi...@apache.org>.
joseph-max-coalfire commented on PR #26945:
URL: https://github.com/apache/airflow/pull/26945#issuecomment-1281566269

   @dstandish would you be able to re-review this this week? No worries if not, just checking. It also looks like I somehow set you as the _only_ reviewer, so if there's someone else who can review it as well, let me know


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org