Skip to content

Commit

Permalink
Merge pull request #809 from consideRatio/pr/fix-outdated-k8s-docs-links
Browse files Browse the repository at this point in the history
docs: fix outdated k8s api reference links
  • Loading branch information
consideRatio committed Nov 21, 2023
2 parents 1132a4c + e781b82 commit 09016b0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
18 changes: 9 additions & 9 deletions kubespawner/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def make_pod(
https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/.
Pass this field an array of "Toleration" objects.
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#toleration-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#toleration-v1-core
node_affinity_preferred:
Affinities describe where pods prefer or require to be scheduled, they
Expand All @@ -274,7 +274,7 @@ def make_pod(
Pass this field an array of "PreferredSchedulingTerm" objects.
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20#preferredschedulingterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28#preferredschedulingterm-v1-core
node_affinity_required:
Affinities describe where pods prefer or require to be scheduled, they
Expand All @@ -284,7 +284,7 @@ def make_pod(
Pass this field an array of "NodeSelectorTerm" objects.
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#nodeselectorterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#nodeselectorterm-v1-core
pod_affinity_preferred:
Affinities describe where pods prefer or require to be scheduled, they
Expand All @@ -294,7 +294,7 @@ def make_pod(
Pass this field an array of "WeightedPodAffinityTerm" objects.
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#weightedpodaffinityterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#weightedpodaffinityterm-v1-core
pod_affinity_required:
Affinities describe where pods prefer or require to be scheduled, they
Expand All @@ -304,7 +304,7 @@ def make_pod(
Pass this field an array of "PodAffinityTerm" objects.
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podaffinityterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#podaffinityterm-v1-core
pod_anti_affinity_preferred:
Affinities describe where pods prefer or require to be scheduled, they
Expand All @@ -314,7 +314,7 @@ def make_pod(
Pass this field an array of "WeightedPodAffinityTerm" objects.
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#weightedpodaffinityterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#weightedpodaffinityterm-v1-core
pod_anti_affinity_required:
Affinities describe where pods prefer or require to be scheduled, they
Expand All @@ -323,7 +323,7 @@ def make_pod(
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
Pass this field an array of "PodAffinityTerm" objects.
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podaffinityterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#podaffinityterm-v1-core
priority_class_name:
The name of the PriorityClass to be assigned the pod. This feature is Beta available in K8s 1.11 and GA in 1.14.
Expand Down Expand Up @@ -421,8 +421,8 @@ def make_pod(
# | - | windowsOptions | Pod and Container |
#
# ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
# ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#securitycontext-v1-core (container)
# ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podsecuritycontext-v1-core (pod)
# ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#securitycontext-v1-core (container)
# ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#podsecuritycontext-v1-core (pod)
#
psc = {}
# populate with fs_gid / supplemental_gids
Expand Down
4 changes: 2 additions & 2 deletions kubespawner/reflector.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ async def _watch_and_update(self):
# reside in the WatchEvent's object field depending on what
# kind of resource is watched.
#
# ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#watchevent-v1-meta
# ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#event-v1-core
# ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#watchevent-v1-meta
# ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#event-v1-core
cur_delay = 0.1
resource = watch_event['raw_object']
ref_key = "{}/{}".format(
Expand Down
36 changes: 18 additions & 18 deletions kubespawner/spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def pods(self):
API. The dictionary keys are the pod ids and the values are
dictionaries of the actual pod resource values.
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#pod-v1-core
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#pod-v1-core
"""
return self.resources

Expand All @@ -87,7 +87,7 @@ def events(self):
Returns list of dictionaries representing the k8s
events within the namespace, sorted by the latest event.
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#event-v1-core
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#event-v1-core
"""

# NOTE:
Expand Down Expand Up @@ -882,7 +882,7 @@ def _validate_image_pull_secrets(self, proposal):
upgrades to break.
You'll *have* to set this if you are using auto-provisioned volumes with most
cloud providers. See `fsGroup <https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podsecuritycontext-v1-core>`__
cloud providers. See `fsGroup <https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#podsecuritycontext-v1-core>`__
for more details.
""",
)
Expand Down Expand Up @@ -955,7 +955,7 @@ def _validate_image_pull_secrets(self, proposal):
`allow_privilege_escalation` will be overridden by this.
Rely on `the Kubernetes reference
<https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#securitycontext-v1-core>`__
<https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#securitycontext-v1-core>`__
for details on allowed configuration.
""",
)
Expand All @@ -978,7 +978,7 @@ def _validate_image_pull_secrets(self, proposal):
containers, including init containers and sidecar containers.
Rely on `the Kubernetes reference
<https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podsecuritycontext-v1-core>`__
<https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#podsecuritycontext-v1-core>`__
for details on allowed configuration.
""",
)
Expand Down Expand Up @@ -1239,7 +1239,7 @@ def _validate_image_pull_secrets(self, proposal):
This list will be directly added under `initContainers` in the kubernetes pod spec,
so you should use the same structure. Each item in the dict must a field
of the `V1Container specification <https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#container-v1-core>`__
of the `V1Container specification <https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#container-v1-core>`__
One usage is disabling access to metadata service from single-user
notebook server with configuration below::
Expand Down Expand Up @@ -1270,7 +1270,7 @@ def _validate_image_pull_secrets(self, proposal):
This dict will be directly merge into `container` of notebook server,
so you should use the same structure. Each item in the dict must a field
of the `V1Container specification <https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#container-v1-core>`__.
of the `V1Container specification <https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#container-v1-core>`__.
One usage is set ``envFrom`` on notebook container with configuration below::
Expand All @@ -1296,7 +1296,7 @@ def _validate_image_pull_secrets(self, proposal):
This dict will be directly merge into pod,so you should use the same structure.
Each item in the dict is field of pod configuration
which follows spec at https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podspec-v1-core
which follows spec at https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#podspec-v1-core
One usage is set restartPolicy and dnsPolicy with configuration below::
Expand All @@ -1319,7 +1319,7 @@ def _validate_image_pull_secrets(self, proposal):
This list will be directly appended under `containers` in the kubernetes pod spec,
so you should use the same structure. Each item in the list is container configuration
which follows spec at https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#container-v1-core
which follows spec at https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#container-v1-core
One usage is setting crontab in a container to clean sensitive data with configuration below::
Expand All @@ -1344,7 +1344,7 @@ def _validate_image_pull_secrets(self, proposal):
allow_none=True,
config=True,
help="""
Set the pod's scheduler explicitly by name. See `the Kubernetes documentation <https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podspec-v1-core>`__
Set the pod's scheduler explicitly by name. See `the Kubernetes documentation <https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#podspec-v1-core>`__
for more information.
""",
)
Expand All @@ -1357,7 +1357,7 @@ def _validate_image_pull_secrets(self, proposal):
https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
Pass this field an array of "Toleration" objects
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#toleration-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#toleration-v1-core
Example::
Expand Down Expand Up @@ -1387,7 +1387,7 @@ def _validate_image_pull_secrets(self, proposal):
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
Pass this field an array of "PreferredSchedulingTerm" objects.*
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#preferredschedulingterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#preferredschedulingterm-v1-core
""",
)
Expand All @@ -1400,7 +1400,7 @@ def _validate_image_pull_secrets(self, proposal):
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
Pass this field an array of "NodeSelectorTerm" objects.*
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#nodeselectorterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#nodeselectorterm-v1-core
""",
)
Expand All @@ -1413,7 +1413,7 @@ def _validate_image_pull_secrets(self, proposal):
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
Pass this field an array of "WeightedPodAffinityTerm" objects.*
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#weightedpodaffinityterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#weightedpodaffinityterm-v1-core
""",
)
Expand All @@ -1426,7 +1426,7 @@ def _validate_image_pull_secrets(self, proposal):
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
Pass this field an array of "PodAffinityTerm" objects.*
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podaffinityterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#podaffinityterm-v1-core
""",
)
Expand All @@ -1439,7 +1439,7 @@ def _validate_image_pull_secrets(self, proposal):
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
Pass this field an array of "WeightedPodAffinityTerm" objects.*
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#weightedpodaffinityterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#weightedpodaffinityterm-v1-core
""",
)
pod_anti_affinity_required = List(
Expand All @@ -1451,7 +1451,7 @@ def _validate_image_pull_secrets(self, proposal):
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
Pass this field an array of "PodAffinityTerm" objects.*
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podaffinityterm-v1-core
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#podaffinityterm-v1-core
""",
)

Expand Down Expand Up @@ -2292,7 +2292,7 @@ async def progress(self):
This is working with events parsed by the python kubernetes client,
and here is the specification of events that is relevant to understand:
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#event-v1-core
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#event-v1-core
"""

if not self.events_enabled:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def test_pod_security_context_container():
"""
Test specification of the container to run with a security context.
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podsecuritycontext-v1-core
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#podsecuritycontext-v1-core
"""
assert api_client.sanitize_for_serialization(
make_pod(
Expand Down Expand Up @@ -515,7 +515,7 @@ def test_container_security_context_container():
"""
Test specification of the container to run with a security context.
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#securitycontext-v1-core
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#securitycontext-v1-core
"""
assert api_client.sanitize_for_serialization(
make_pod(
Expand Down Expand Up @@ -587,7 +587,7 @@ def test_bad_pod_security_context_container():
"""
Test specification of the container to run with a security context.
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#securitycontext-v1-core
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#securitycontext-v1-core
"""
with pytest.raises(ValueError):
assert api_client.sanitize_for_serialization(
Expand All @@ -608,7 +608,7 @@ def test_bad_container_security_context_container():
"""
Test specification of the container to run with a security context.
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#securitycontext-v1-core
ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#securitycontext-v1-core
"""
with pytest.raises(ValueError):
assert api_client.sanitize_for_serialization(
Expand Down

0 comments on commit 09016b0

Please sign in to comment.