def get_service_principals(service_name: str, realm: str) -> list: """ Sets up the appropriate principals needed for a kerberized deployment of HDFS. :return: A list of said principals """ primaries = ["hdfs", "HTTP"] tasks = [ "name-0-node", "name-0-zkfc", "name-1-node", "name-1-zkfc", "journal-0-node", "journal-1-node", "journal-2-node", "data-0-node", "data-1-node", "data-2-node", ] instances = map(lambda task: sdk_hosts.autoip_host(service_name, task), tasks) principals = kerberos.generate_principal_list(primaries, instances, realm) principals.extend(kerberos.generate_principal_list(USERS, [ None, ], realm)) http_instance = sdk_hosts.vip_host("marathon", ".".join(["api", service_name])) http_principal = kerberos.genererate_principal("HTTP", http_instance, realm) principals.append(http_principal) return principals
def get_service_principals(service_name: str, realm: str) -> list: """ Sets up the appropriate principals needed for a kerberized deployment of HDFS. :return: A list of said principals """ primaries = ["hdfs", "HTTP"] tasks = [ "name-0-node", "name-0-zkfc", "name-1-node", "name-1-zkfc", "journal-0-node", "journal-1-node", "journal-2-node", "data-0-node", "data-1-node", "data-2-node", ] instances = map(lambda task: sdk_hosts.autoip_host(service_name, task), tasks) principals = kerberos.generate_principal_list(primaries, instances, realm) principals.extend(kerberos.generate_principal_list(USERS, [None], realm)) http_instance = sdk_hosts.vip_host("marathon", ".".join(["api", service_name])) http_principal = kerberos.genererate_principal("HTTP", http_instance, realm) principals.append(http_principal) return principals
def get_service_principals(service_name: str, realm: str, custom_domain: str = None) -> list: """ Sets up the appropriate principals needed for a kerberized deployment of HDFS. :return: A list of said principals """ primaries = [ "kafka", ] tasks = [ "kafka-0-broker", "kafka-1-broker", "kafka-2-broker", ] if custom_domain: instances = map( lambda task: sdk_hosts.custom_host(service_name, task, custom_domain), tasks) else: instances = map(lambda task: sdk_hosts.autoip_host(service_name, task), tasks) principals = kerberos.generate_principal_list(primaries, instances, realm) principals.extend(kerberos.generate_principal_list(USERS, [ None, ], realm)) return principals
def get_zookeeper_principals(service_name: str, realm: str) -> list: primaries = ["zookeeper"] tasks = ["zookeeper-0-server", "zookeeper-1-server", "zookeeper-2-server"] instances = map(lambda task: sdk_hosts.autoip_host(service_name, task), tasks) principals = krb5.generate_principal_list(primaries, instances, realm) return principals
def get_zookeeper_principals(service_name: str, realm: str) -> list: primaries = ["zookeeper", ] tasks = [ "zookeeper-0-server", "zookeeper-1-server", "zookeeper-2-server", ] instances = map(lambda task: sdk_hosts.autoip_host(service_name, task), tasks) principals = krb5.generate_principal_list(primaries, instances, realm) return principals
def get_service_principals(service_name: str, realm: str, custom_domain: str = None) -> list: """ Sets up the appropriate principals needed for a kerberized deployment of HDFS. :return: A list of said principals """ primaries = ["kafka", ] tasks = [ "kafka-0-broker", "kafka-1-broker", "kafka-2-broker", ] if custom_domain: instances = map(lambda task: sdk_hosts.custom_host(service_name, task, custom_domain), tasks) else: instances = map(lambda task: sdk_hosts.autoip_host(service_name, task), tasks) principals = kerberos.generate_principal_list(primaries, instances, realm) principals.extend(kerberos.generate_principal_list(USERS, [None, ], realm)) return principals