Skip to content

Repository files navigation

Istio custom resource definition generated for Typescript

Usage

installation

yarn add @rugal/pulumi-istio

create CRD just like K8S

import * as istio from "@rugal/pulumi-istio";

const vs = new istio.networking.v1beta1.VirtualService(name, {
      metadata: {
        name,
        namespace: args.namespace,
      },
      spec: {
        gateways: args.gateway,
        hosts: args.hosts,
        http: [
          {
            match: [
              {
                uri: { prefix: "/" },
              },
            ],
            route: [
              {
                destination: {
                  host: this.service.metadata.name,
                  port: {
                    number: 80,
                  },
                },
              },
            ],
          },
        ],
      },
    }, {
      parent: this,
    });

Contribution

  1. Download istio package Will find CRD files in it

    curl -L https://istio.io/downloadIstio | sh -
  2. Generate the base

    crd2pulumi --nodejsPath src istio/manifests/charts/base/crds/crd-all.gen.yaml
  3. Replace | undefined> with >

    sed -i 's/ | undefined>/>/g' src/*
  4. Replace pulumi.Output<ObjectMeta> with pulumi.Output<k8s.types.output.meta.v1.ObjectMeta>;
    Also add import * as k8s from "@pulumi/kubernetes"; on the top of the changed files.
    The later part is tedious, one must manually add it.

  5. Add more fields for AuthorizationPolicy
    There is AuthorizationPolicy in CRD file, but it does not contain complete configurable fields as specified in document. You may update the CRD to have it, or just update the generated code to have it as well

  6. Then you can build the package and deploy it to npm

    yarn build && yarn deploy

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages