Skip to content

Commit

Permalink
Fixing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
VladaZakharova committed Jan 29, 2024
1 parent c23cbc5 commit 7c52afd
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
4 changes: 1 addition & 3 deletions airflow/providers/google/cloud/hooks/kubernetes_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from google.cloud.container_v1.types import Cluster, Operation
from kubernetes import client, utils
from kubernetes_asyncio import client as async_client
from kubernetes_asyncio.client.models import V1Deployment
from kubernetes.client.models import V1Deployment
from kubernetes_asyncio.config.kube_config import FileOrData
from urllib3.exceptions import HTTPError

Expand Down Expand Up @@ -565,7 +565,6 @@ def apply_from_yaml_file(
):
"""
Perform an action from a yaml file on a Pod.
This is done until the given Pod reaches given State, or raises an error.
:param yaml_file: Contains the path to yaml file.
Expand All @@ -574,7 +573,6 @@ def apply_from_yaml_file(
:param namespace: Contains the namespace to create all
resources inside. The namespace must preexist otherwise the resource creation will fail. If the API
object in the yaml file already contains a namespace definition this parameter has no effect.
"""
k8s_client = self.get_conn()

Expand Down
6 changes: 3 additions & 3 deletions airflow/providers/google/cloud/operators/kubernetes_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,10 @@ class GKEStartKueueInsideClusterOperator(GoogleCloudBaseOperator):
For more details about Kueue have a look at the reference:
https://kueue.sigs.k8s.io/docs/overview/
:param project_id: The Google Developers Console [project ID or project number]
:param project_id: The Google Developers Console [project ID or project number].
:param location: The name of the Google Kubernetes Engine zone or region in which the cluster resides.
:param cluster_name: The Cluster name in which to install Kueue
:param kueue_version: Version of Kueue to install
:param cluster_name: The Cluster name in which to install Kueue.
:param kueue_version: Version of Kueue to install.
:param gcp_conn_id: The connection ID to use connecting to Google Cloud.
:param impersonation_chain: Optional service account to impersonate using short-term
credentials, or chained list of accounts required to get the access_token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ lot less resources wasted on idle Operators or Sensors:
.. _howto/operator:GKEStartKueueInsideClusterOperator:

Install Kueue of specific version inside Cluster
""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""

Kueue is a Cloud Native Job scheduler that works with the default Kubernetes scheduler, the Job controller,
and the cluster autoscaler to provide an end-to-end batch system. Kueue implements Job queueing, deciding when
Jobs should wait and when they should start, based on quotas and a hierarchy for sharing resources fairly among teams.
Kueue supports Autopilot clusters, Standard GKE with Node Auto-provisioning and regular autoscaled node pools.
To install and use Kueue on your Cluster use this example:
To install and use Kueue on your cluster with the help of
:class:`~airflow.providers.google.cloud.operators.kubernetes_engine.GKEStartKueueInsideClusterOperator`
as shown in this example:

.. exampleinclude:: /../../tests/system/providers/google/cloud/kubernetes_engine/example_kubernetes_engine_kueue.py
:language: python
Expand Down
2 changes: 2 additions & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,7 @@ kubeconfig
Kubernetes
kubernetes
KubernetesPodOperator
Kueue
Kusto
kv
kwarg
Expand Down Expand Up @@ -1281,6 +1282,7 @@ QuboleCheckHook
Quboles
queryParameters
querystring
queueing
quickstart
quotechar
rabbitmq
Expand Down
12 changes: 10 additions & 2 deletions tests/providers/google/cloud/operators/test_kubernetes_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
KUBE_ENV_VAR = "KUBECONFIG"
FILE_NAME = "/tmp/mock_name"
KUB_OP_PATH = "airflow.providers.cncf.kubernetes.operators.pod.KubernetesPodOperator.{}"
GKE_HOOK_MODULE_PATH = "airflow.providers.google.cloud.operators.kubernetes_engine"
GKE_HOOK_MODULE_PATH = "airflow.providers.google.cloud.hooks.kubernetes_engine"
GKE_HOOK_PATH = f"{GKE_HOOK_MODULE_PATH}.GKEHook"
GKE_POD_HOOK_PATH = f"{GKE_HOOK_MODULE_PATH}.GKEPodHook"
GKE_DEPLOYMENT_HOOK_PATH = f"{GKE_HOOK_MODULE_PATH}.GKEDeploymentHook"
Expand Down Expand Up @@ -345,7 +345,15 @@ def test_cluster_info(self, get_cluster_mock, use_internal_ip):
assert ssl_ca_cert == SSL_CA_CERT

@pytest.mark.db_test
def test_default_gcp_conn_id(self):
@mock.patch(f"{GKE_HOOK_PATH}.get_cluster")
def test_default_gcp_conn_id(self, get_cluster_mock):
get_cluster_mock.return_value = mock.MagicMock(
**{
"endpoint": "test-host",
"private_cluster_config.private_endpoint": "test-private-host",
"master_auth.cluster_ca_certificate": SSL_CA_CERT,
}
)
gke_op = GKEStartPodOperator(
project_id=TEST_GCP_PROJECT_ID,
location=PROJECT_LOCATION,
Expand Down

0 comments on commit 7c52afd

Please sign in to comment.