mik-laj commented on a change in pull request #19181:
URL: https://github.com/apache/airflow/pull/19181#discussion_r741610474
##########
File path: chart/values.schema.json
##########
@@ -89,13 +89,18 @@
"description": "Specify scheduling constraints for all pods.",
"type": "object",
"default": {},
- "x-docsSection": "Kubernetes"
+ "x-docsSection": "Kubernetes",
+ "$ref":
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0/_definitions.json#/definitions/io.k8s.api.core.v1.Affinity"
},
"tolerations": {
"description": "Specify Tolerations for all pods.",
"type": "array",
"default": [],
- "x-docsSection": "Kubernetes"
+ "x-docsSection": "Kubernetes",
+ "items": {
+ "type": "object",
+ "$ref":
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0/_definitions.json#/definitions/io.k8s.api.core.v1.Toleration"
Review comment:
Fie `_definitions.json` is easier to browse as we can use CTRL + F to
search by field name.
##########
File path: chart/values.schema.json
##########
@@ -2069,11 +2258,38 @@
"annotations": {
"description": "Annotations for the webserver
Service.",
"type": "object",
- "default": {}
+ "default": {},
+ "additionalProperties": {
+ "type": "string"
+ }
},
"ports": {
"description": "Ports for the webserver Service.",
"type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "port": {
+ "type": [
+ "string",
+ "integer"
+ ]
+ },
+ "targetPort": {
+ "type": [
+ "string",
+ "integer"
+ ]
+ },
+ "protocol": {
+ "type": "string"
+ }
+ }
+ },
Review comment:
No. It is not compatible with current default value:
```
{
"name": "airflow-ui",
"port": "{{ .Values.ports.airflowUI }}"
}
```
In the Kubernetes schema, the `port` field is defined as `integer`, but we
use `string`.
##########
File path: chart/values.schema.json
##########
@@ -568,6 +601,23 @@
"type": "array",
"x-docsSection": "Airflow",
"default": [],
+ "items": {
+ "type": "object",
+ "properties": {
+ "envName": {
+ "description": "The name of the environment variable
under which the secret will be available",
+ "type": "string"
+ },
+ "secretName": {
+ "description": "The name of the Kubernetes secret that
will be read",
+ "type": "string"
+ },
+ "secretKey": {
+ "description": "The key of the Kubernetes secret",
+ "type": "string"
+ }
+ }
Review comment:
Thanks. I also checked and ` "additionalProperties": false,` was missing
from the other definitions as well.
##########
File path: chart/values.schema.json
##########
@@ -89,13 +89,18 @@
"description": "Specify scheduling constraints for all pods.",
"type": "object",
"default": {},
- "x-docsSection": "Kubernetes"
+ "x-docsSection": "Kubernetes",
+ "$ref":
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0/_definitions.json#/definitions/io.k8s.api.core.v1.Affinity"
},
"tolerations": {
"description": "Specify Tolerations for all pods.",
"type": "array",
"default": [],
- "x-docsSection": "Kubernetes"
+ "x-docsSection": "Kubernetes",
+ "items": {
+ "type": "object",
+ "$ref":
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0/_definitions.json#/definitions/io.k8s.api.core.v1.Toleration"
Review comment:
Good idea. Updated. I added `"additionalProperties": false,` in a few
place also.
##########
File path: chart/values.schema.json
##########
@@ -89,13 +89,18 @@
"description": "Specify scheduling constraints for all pods.",
"type": "object",
"default": {},
- "x-docsSection": "Kubernetes"
+ "x-docsSection": "Kubernetes",
+ "$ref":
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0/_definitions.json#/definitions/io.k8s.api.core.v1.Affinity"
},
"tolerations": {
"description": "Specify Tolerations for all pods.",
"type": "array",
"default": [],
- "x-docsSection": "Kubernetes"
+ "x-docsSection": "Kubernetes",
+ "items": {
+ "type": "object",
+ "$ref":
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0/_definitions.json#/definitions/io.k8s.api.core.v1.Toleration"
Review comment:
I checked, and we use a very narrow subset of object types, so it's
better to fetch each definition separately.
```
cat chart/values.schema.json | jq '.. | objects| .["$ref"] | strings' | sort
| uniq
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.api.apps.v1.DeploymentStrategy"
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.Affinity"
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.Container"
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.HostAlias"
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.LimitRangeItem"
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements"
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.Toleration"
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.Volume"
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.VolumeMount"
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.api.networking.v1.NetworkPolicyPeer"
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.api.networking.v1.NetworkPolicyPort"
"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.0-standalone-strict/_definitions.json#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity"
```
##########
File path: chart/tests/test_flower.py
##########
@@ -358,18 +358,18 @@ def test_defaults(self):
"ports, expected_ports",
[
(
- [{"name": "{{ .Release.Name }}", "protocol": "UDP", "port":
"{{ .Values.ports.flowerUI }}"}],
- [{"name": "RELEASE-NAME", "protocol": "UDP", "port": 5555}],
+ [{"protocol": "UDP", "port": "{{ .Values.ports.flowerUI }}"}],
+ [{"protocol": "UDP", "port": 5555}],
),
- ([{"name": "only_sidecar", "port": "sidecar"}], [{"name":
"only_sidecar", "port": "sidecar"}]),
+ ([{"port": "sidecar"}], [{"port": "sidecar"}]),
(
[
- {"name": "flower-ui", "port": "{{ .Values.ports.flowerUI
}}"},
- {"name": "sidecar", "port": 80},
+ {"port": "{{ .Values.ports.flowerUI }}"},
+ {"port": 80},
Review comment:
This is a test for NetworkPolicy, not Service. In NetworkPolicy, we use
[https://github.com/yannh/kubernetes-json-schema/blob/master/v1.21.0/networkpolicyport-networking-v1.json](NetworkPolicyPort),
not
[ServicePort](https://github.com/yannh/kubernetes-json-schema/blob/master/v1.21.0/serviceport-v1.json),
so `name` field is illegal here.
##########
File path: chart/tests/test_flower.py
##########
@@ -358,18 +358,18 @@ def test_defaults(self):
"ports, expected_ports",
[
(
- [{"name": "{{ .Release.Name }}", "protocol": "UDP", "port":
"{{ .Values.ports.flowerUI }}"}],
- [{"name": "RELEASE-NAME", "protocol": "UDP", "port": 5555}],
+ [{"protocol": "UDP", "port": "{{ .Values.ports.flowerUI }}"}],
+ [{"protocol": "UDP", "port": 5555}],
),
- ([{"name": "only_sidecar", "port": "sidecar"}], [{"name":
"only_sidecar", "port": "sidecar"}]),
+ ([{"port": "sidecar"}], [{"port": "sidecar"}]),
(
[
- {"name": "flower-ui", "port": "{{ .Values.ports.flowerUI
}}"},
- {"name": "sidecar", "port": 80},
+ {"port": "{{ .Values.ports.flowerUI }}"},
+ {"port": 80},
Review comment:
This is a test for NetworkPolicy, not Service. In NetworkPolicy, we use
[NetworkPolicyPort](https://github.com/yannh/kubernetes-json-schema/blob/master/v1.21.0/serviceport-v1.json),
not
[ServicePort](https://github.com/yannh/kubernetes-json-schema/blob/master/v1.21.0/serviceport-v1.json),
so `name` field is illegal here.
##########
File path: chart/tests/test_flower.py
##########
@@ -358,18 +358,18 @@ def test_defaults(self):
"ports, expected_ports",
[
(
- [{"name": "{{ .Release.Name }}", "protocol": "UDP", "port":
"{{ .Values.ports.flowerUI }}"}],
- [{"name": "RELEASE-NAME", "protocol": "UDP", "port": 5555}],
+ [{"protocol": "UDP", "port": "{{ .Values.ports.flowerUI }}"}],
+ [{"protocol": "UDP", "port": 5555}],
),
- ([{"name": "only_sidecar", "port": "sidecar"}], [{"name":
"only_sidecar", "port": "sidecar"}]),
+ ([{"port": "sidecar"}], [{"port": "sidecar"}]),
(
[
- {"name": "flower-ui", "port": "{{ .Values.ports.flowerUI
}}"},
- {"name": "sidecar", "port": 80},
+ {"port": "{{ .Values.ports.flowerUI }}"},
+ {"port": 80},
Review comment:
This is a test for NetworkPolicy, not Service. In NetworkPolicy, we use
[NetworkPolicyPort](https://github.com/yannh/kubernetes-json-schema/blob/master/v1.21.0/networkpolicyport-networking-v1.json),
not
[ServicePort](https://github.com/yannh/kubernetes-json-schema/blob/master/v1.21.0/serviceport-v1.json),
so `name` field is illegal here.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]