def atest_secret_reader(context: 'IRTLSContext', secret_name: str, namespace: str) -> SavedSecret:
    # In the Real World, the secret reader should, y'know, read secrets..
    # Here we're just gonna fake it.

    logger.debug("atest_secret_reader faking finding secret %s" % secret_name)

    cert_path = os.path.join("/ambassador/certs", secret_name, "tls.crt")
    key_path = os.path.join("/ambassador/certs", secret_name, "tls.key")

    return SavedSecret(secret_name, namespace, cert_path, key_path, {})
    def cache_secret(self, resource: 'IRResource', secret_info: SecretInfo):
        self.logger.debug(
            "SecretRecorder (%s %s): skipping cache step for secret %s in namespace %s"
            % (resource.kind, resource.name, secret_info.name,
               secret_info.namespace))

        return SavedSecret(secret_info.name, secret_info.namespace,
                           '-crt-path-', '-key-path-', '-user-path-', {
                               'tls.crt': '-crt-',
                               'tls.key': '-key-',
                               'user.key': '-user-'
                           })
Exemple #3
0
 def cache_secret(self, context: 'IRTLSContext', secret_info: SecretInfo):
     return SavedSecret(secret_info.name, secret_info.namespace, '-crt-path-', '-key-path-',
                        { 'tls_crt': '-crt-', 'tls_key': '-key-' })