potiuk commented on a change in pull request #8974:
URL: https://github.com/apache/airflow/pull/8974#discussion_r436378446



##########
File path: UPDATING.md
##########
@@ -62,6 +62,25 @@ https://developers.google.com/style/inclusive-documentation
 
 -->
 
+### Hashicorp Vault Secret Backend mount_points
+
+In Vault Secret Backend mount_point could be passed as parameter of the 
backend. It impacted only
+secret retrieval but not authentication. The documentation mistakenly stated 
that the
+mount_point parameter defaults to 'secret' when not specified, but it only 
defaulted to "secret"
+for secret retrieval. For authentication the mount_point defaulted to the 
mount_point specific for
+each authentication method (for example "kubernetes" for "kubernetes" 
authentication, "github" for
+"github" authentication etc.). Only for "token" authentication default 
authetnication mount_point
+was "secret".
+
+The behaviour in 2.0 changed:
+
+- when you create a backend without the mount_point, the client uses default 
mount_point specific
+  for each method in both: authentication and retrieval
+- when you create a backend with the mount_point, the client uses the mount 
point in both -
+  authentication and retrieval
+
+Same behavior applies for the newly created VaultHook.

Review comment:
       Yeah. I removed it. We have fully backwards-compatible behaviour now.

##########
File path: airflow/providers/hashicorp/common/vault_client.py
##########
@@ -0,0 +1,392 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from typing import List, Optional
+
+import hvac
+from cached_property import cached_property
+from hvac.api.auth_methods import github, kubernetes, ldap, radius, userpass
+from hvac.api.secrets_engines import aws, azure, gcp, kv_v1, kv_v2
+from hvac.exceptions import InvalidPath, VaultError
+from requests import Response
+
+from airflow.utils.log.logging_mixin import LoggingMixin
+
+VALID_KV_VERSIONS: List[int] = [1, 2]
+VALID_AUTH_TYPES: List[str] = [
+    'approle',
+    'aws_iam',
+    'azure',
+    'github',
+    'gcp',
+    'kubernetes',
+    'ldap',
+    'radius',
+    'token',
+    'userpass'
+]
+
+
+class VaultClient(LoggingMixin):  # pylint: 
disable=too-many-instance-attributes
+    """
+    Retrieves Authenticated client from Hashicorp Vault.
+
+    :param url: Base URL for the Vault instance being addressed.
+    :type url: str
+    :param auth_type: Authentication Type for Vault. Default is ``token``. 
Available values are in
+        
:py:const:`airflow.providers.hashicorp.common.vault_client.VALID_AUTH_TYPES`.
+    :type auth_type: str
+    :param mount_point: The "path" the secret engine was mounted on. Default 
depends on the engine used.
+          For "aws_iam" the default mount_point is "aws", for "token" it is 
"secret" and for
+          all other authentication methods it's the same as the authentication 
method.

Review comment:
       I think I now understa YEp.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to