configMap.ts 768 B

1234567891011121314151617181920212223242526272829
  1. import * as pulumi from '@pulumi/pulumi'
  2. import * as k8s from '@pulumi/kubernetes'
  3. import * as fs from 'fs'
  4. export class ConfigMapFromFile extends pulumi.ComponentResource {
  5. public readonly configName?: pulumi.Output<string>
  6. constructor(name: string, args: ConfigMapArgs, opts: pulumi.ComponentResourceOptions = {}) {
  7. super('pkg:query-node:configMap', name, {}, opts)
  8. this.configName = new k8s.core.v1.ConfigMap(
  9. name,
  10. {
  11. metadata: {
  12. namespace: args.namespaceName,
  13. },
  14. data: {
  15. 'fileData': fs.readFileSync(args.filePath).toString(),
  16. },
  17. },
  18. opts
  19. ).metadata.apply((m) => m.name)
  20. }
  21. }
  22. export interface ConfigMapArgs {
  23. filePath: string
  24. namespaceName: pulumi.Output<string>
  25. }