vaultmanager/modules/VaultManagerLDAP.py
def create_kubernetes_policies(self):
        """
        Create policies to allow kubernetes service-accounts to read secrets
        """
        self.logger.debug("creating kubernetes policies for service_accounts")
        with open(os.path.join(
                self.policies_folder,
                self.conf["general"]["kubernetes"]["default_policy"]),
                'r') as fd:
            default_policy = fd.read()

        template = Template(default_policy)

        for env in ["qa", "preprod", "prod"]:
            for group in self.ldap_kubernetes_groups:
                policy_file = os.path.join(self.kubernetes_policies_folder, env,
                                           group + ".hcl")
                self.kubernetes_policies_to_create.append(policy_file)
                if os.path.isfile(policy_file):
                    self.logger.info(
                        "Policy for kubernetes group " + group + " in env " +
                        env + " already exists and will not be overwritten")
                else:
                    with open(policy_file, 'w+') as fd:
                        fd.write(
                            template.render(GROUP=group, ENV=env))
                        self.logger.info(
                            "Policy for kubernetes group " +
                            group + "in env " + env + " created")

        Create policies to allow kubernetes service-accounts to read secrets
        
Create policies to allow kubernetes service-accounts to read secrets
Create policies to allow kubernetes service - accounts to read secrets
def create_kubernetes_policies(self):
        self.logger.debug("creating kubernetes policies for service_accounts")
        with open(os.path.join(
                self.policies_folder,
                self.conf["general"]["kubernetes"]["default_policy"]),
                'r') as fd:
            default_policy = fd.read()
        template = Template(default_policy)
        for env in ["qa", "preprod", "prod"]:
            for group in self.ldap_kubernetes_groups:
                policy_file = os.path.join(self.kubernetes_policies_folder, env,
                                           group + ".hcl")
                self.kubernetes_policies_to_create.append(policy_file)
                if os.path.isfile(policy_file):
                    self.logger.info(
                        "Policy for kubernetes group " + group + " in env " +
                        env + " already exists and will not be overwritten")
                else:
                    with open(policy_file, 'w+') as fd:
                        fd.write(
                            template.render(GROUP=group, ENV=env))
                        self.logger.info(
                            "Policy for kubernetes group " +
                            group + "in env " + env + " created")
def create_kubernetes_policies ( self ) : self . logger . debug ( "creating kubernetes policies for service_accounts" ) with open ( os . path . join ( self . policies_folder , self . conf [ "general" ] [ "kubernetes" ] [ "default_policy" ] ) , 'r' ) as fd : default_policy = fd . read ( ) template = Template ( default_policy ) for env in [ "qa" , "preprod" , "prod" ] : for group in self . ldap_kubernetes_groups : policy_file = os . path . join ( self . kubernetes_policies_folder , env , group + ".hcl" ) self . kubernetes_policies_to_create . append ( policy_file ) if os . path . isfile ( policy_file ) : self . logger . info ( "Policy for kubernetes group " + group + " in env " + env + " already exists and will not be overwritten" ) else : with open ( policy_file , 'w+' ) as fd : fd . write ( template . render ( GROUP = group , ENV = env ) ) self . logger . info ( "Policy for kubernetes group " + group + "in env " + env + " created" )
Create policies to allow kubernetes service-accounts to read secrets
Create policies to allow kubernetes service - accounts to read secrets
"""
        Create policies to allow kubernetes service-accounts to read secrets
        """
self