constructor()

in infra/lib/addons/fluxv2.ts [58:104]


  constructor(scope: Construct, id: string, props: FluxV2Props) {
    super(scope, id);

    // Actually install Flux components onto the cluster
    const fluxRelease = new FluxRelease(props.fluxVersion);
    const fluxManifest = props.cluster.addManifest('fluxManifest', ...fluxRelease.getManifest());

    // Bootstrap manifests
    const gitRepoManifest = props.cluster.addManifest('GitRepoSelf', {
      apiVersion: 'source.toolkit.fluxcd.io/v1beta1',
      kind: 'GitRepository',
      metadata: {
        name: 'flux-system',
        namespace: 'flux-system'
      },
      spec: {
        interval: '10m0s',
        ref: {
          branch: props.repoBranch,
        },
        secretRef: {
          name: props.secretName
        },
        url: props.repoUrl
      }  
    });
    gitRepoManifest.node.addDependency(fluxManifest);
    const kustomizationManifest = props.cluster.addManifest('KustomizationSelf', {
      apiVersion: 'kustomize.toolkit.fluxcd.io/v1beta1',
      kind: 'Kustomization',
      metadata: {
        name: 'flux-system',
        namespace: 'flux-system'
      },
      spec: {
        interval: '10m0s',
        path: props.repoPath,
        prune: true,
        sourceRef: {
          kind: 'GitRepository',
          name: 'flux-system'
        },
        validation: 'client'
      }
    });
    kustomizationManifest.node.addDependency(fluxManifest);
  }