<commit_before>require "../kubernetes/secret"

class Psykube::Generator
  class Secret < Generator
    protected def result
      unless combined_secrets.empty?
        Kubernetes::Secret.new(manifest.name, combined_secrets).tap do |secret|
          secret.metadata.namespace = namespace
        end
      end
    end

    private def combined_secrets
      manifest_secrets.merge cluster_secrets
    end

    private def manifest_secrets
      manifest.secrets || {} of String => String
    end

    private def cluster_secrets
      cluster_manifest.secrets || {} of String => String
    end
  end
end
<commit_msg>secrets needs to be base64 encoded<commit_after>require "../kubernetes/secret"

class Psykube::Generator
  class Secret < Generator
    protected def result
      unless combined_secrets.empty?
        Kubernetes::Secret.new(manifest.name, encoded_secrets).tap do |secret|
          secret.metadata.namespace = namespace
        end
      end
    end

    private def encoded_secrets
      combined_secrets.each_with_object({} of String => String) do |(k, v), hash|
        hash[k] = Base64.encode(v)
      end
    end

    private def combined_secrets
      manifest_secrets.merge(cluster_secrets)
    end

    private def manifest_secrets
      manifest.secrets || {} of String => String
    end

    private def cluster_secrets
      cluster_manifest.secrets || {} of String => String
    end
  end
end

{'fraction_non_alphanumeric': 0.07378777231201687, 'fraction_numerical': 0.0028109627547434997, 'mean_word_length': 2.777188328912467, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2740058', 'n_tokens_mistral': 428, 'n_tokens_neox': 390, 'n_words': 109}