|
63 | 63 | schedule_interval=datetime.timedelta(days=1), |
64 | 64 | start_date=YESTERDAY, |
65 | 65 | ) as dag: |
66 | | - # Only name, namespace, image, and task_id are required to create a |
| 66 | + # Only name, image, and task_id are required to create a |
67 | 67 | # KubernetesPodOperator. In Cloud Composer, the config file found at |
68 | 68 | # `/home/airflow/composer_kube_config` contains credentials for |
69 | 69 | # Cloud Composer's Google Kubernetes Engine cluster that is created |
|
79 | 79 | cmds=["echo"], |
80 | 80 | # The namespace to run within Kubernetes. In Composer 2 environments |
81 | 81 | # after December 2022, the default namespace is |
82 | | - # `composer-user-workloads`. |
| 82 | + # `composer-user-workloads`. Always use the |
| 83 | + # `composer-user-workloads` namespace with Composer 3. |
83 | 84 | namespace="composer-user-workloads", |
84 | 85 | # Docker image specified. Defaults to hub.docker.com, but any fully |
85 | 86 | # qualified URLs will point to a custom repository. Supports private |
|
100 | 101 | name="ex-kube-templates", |
101 | 102 | namespace="composer-user-workloads", |
102 | 103 | image="bash", |
103 | | - # All parameters below are able to be templated with jinja -- cmds, |
104 | | - # arguments, env_vars, and config_file. For more information visit: |
105 | | - # https://airflow.apache.org/docs/apache-airflow/stable/macros-ref.html |
| 104 | + # All parameters below can be templated with Jinja. For more information |
| 105 | + # and the list of variables available in Airflow, see |
| 106 | + # the Airflow templates reference: |
| 107 | + # https://airflow.apache.org/docs/apache-airflow/stable/templates-ref.html |
106 | 108 | # Entrypoint of the container, if not specified the Docker container's |
107 | 109 | # entrypoint is used. The cmds parameter is templated. |
108 | 110 | cmds=["echo"], |
109 | | - # DS in jinja is the execution date as YYYY-MM-DD, this docker image |
110 | | - # will echo the execution date. Arguments to the entrypoint. The docker |
| 111 | + # DS in Jinja is the execution date as YYYY-MM-DD, this Docker image |
| 112 | + # will echo the execution date. Arguments to the entrypoint. The Docker |
111 | 113 | # image's CMD is used if this is not provided. The arguments parameter |
112 | 114 | # is templated. |
113 | 115 | arguments=["{{ ds }}"], |
114 | 116 | # The var template variable allows you to access variables defined in |
115 | 117 | # Airflow UI. In this case we are getting the value of my_value and |
116 | 118 | # setting the environment variable `MY_VALUE`. The pod will fail if |
117 | | - # `my_value` is not set in the Airflow UI. |
| 119 | + # `my_value` is not set in the Airflow UI. The env_vars parameter |
| 120 | + # is templated. |
118 | 121 | env_vars={"MY_VALUE": "{{ var.value.my_value }}"}, |
119 | | - # Sets the config file to a kubernetes config file specified in |
120 | | - # airflow.cfg. If the configuration file does not exist or does |
121 | | - # not provide validcredentials the pod will fail to launch. If not |
122 | | - # specified, config_file defaults to ~/.kube/config |
123 | | - config_file="{{ conf.get('core', 'kube_config') }}", |
| 122 | + # Specifies path to Kubernetes config. The config_file is templated. |
| 123 | + config_file="/home/airflow/composer_kube_config", |
124 | 124 | # Identifier of connection that should be used |
125 | 125 | kubernetes_conn_id="kubernetes_default", |
126 | 126 | ) |
|
135 | 135 | # The secrets to pass to Pod, the Pod will fail to create if the |
136 | 136 | # secrets you specify in a Secret object do not exist in Kubernetes. |
137 | 137 | secrets=[secret_env, secret_volume], |
| 138 | + # Entrypoint of the container, if not specified the Docker container's |
| 139 | + # entrypoint is used. The cmds parameter is templated. |
138 | 140 | cmds=["echo"], |
139 | 141 | # env_vars allows you to specify environment variables for your |
140 | | - # container to use. env_vars is templated. |
| 142 | + # container to use. The env_vars parameter is templated. |
141 | 143 | env_vars={ |
142 | 144 | "EXAMPLE_VAR": "/example/value", |
143 | 145 | "GOOGLE_APPLICATION_CREDENTIALS": "/var/secrets/google/service-account.json", |
|
157 | 159 | # Entrypoint of the container, if not specified the Docker container's |
158 | 160 | # entrypoint is used. The cmds parameter is templated. |
159 | 161 | cmds=["perl"], |
160 | | - # Arguments to the entrypoint. The docker image's CMD is used if this |
| 162 | + # Arguments to the entrypoint. The Docker image's CMD is used if this |
161 | 163 | # is not provided. The arguments parameter is templated. |
162 | 164 | arguments=["-Mbignum=bpi", "-wle", "print bpi(2000)"], |
163 | 165 | # The secrets to pass to Pod, the Pod will fail to create if the |
|
167 | 169 | labels={"pod-label": "label-name"}, |
168 | 170 | # Timeout to start up the Pod, default is 600. |
169 | 171 | startup_timeout_seconds=600, |
170 | | - # The environment variables to be initialized in the container |
171 | | - # env_vars are templated. |
| 172 | + # The environment variables to be initialized in the container. |
| 173 | + # The env_vars parameter is templated. |
172 | 174 | env_vars={"EXAMPLE_VAR": "/example/value"}, |
173 | 175 | # If true, logs stdout output of container. Defaults to True. |
174 | 176 | get_logs=True, |
|
0 commit comments