Skip to content

Instantly share code, notes, and snippets.

@oliverholliday
Created March 11, 2019 15:35
Show Gist options
  • Save oliverholliday/066ec5e01f08150effb97551d794dc4c to your computer and use it in GitHub Desktop.
Save oliverholliday/066ec5e01f08150effb97551d794dc4c to your computer and use it in GitHub Desktop.
import * as kubernetes from "@pulumi/kubernetes";
/**
* Installs the cert-manager custom resource definitions as defined here:
* https://raw.githubusercontent.com/jetstack/cert-manager/release-0.6/deploy/manifests/00-crds.yaml
* @param k8sprovider The cluster to install the CRDs into.
*/
export function InstallCertManagerCrds(k8sprovider: kubernetes.Provider): kubernetes.apiextensions.v1beta1.CustomResourceDefinition[] {
const certificates = new kubernetes.apiextensions.v1beta1.CustomResourceDefinition("certificates.certmanager.k8s.io", {
apiVersion: "apiextensions.k8s.io/v1beta1",
metadata: {
name: "certificates.certmanager.k8s.io",
labels: {
app: "cert-manager"
}
},
spec: {
additionalPrinterColumns: [
{
JSONPath: ".status.conditions[?(@.type==\"Ready\")].status",
name: "Ready",
type: "string"
},
{
JSONPath: ".spec.secretName",
name: "Secret",
type: "string"
},
{
JSONPath: ".spec.issuerRef.name",
name: "Issuer",
type: "string",
priority: 1
},
{
JSONPath: ".status.conditions[?(@.type==\"Ready\")].message",
name: "Status",
type: "string",
priority: 1
},
{
JSONPath: ".metadata.creationTimestamp",
description: "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
name: "Age",
type: "date"
}
],
group: "certmanager.k8s.io",
version: "v1alpha1",
scope: "Namespaced",
names: {
kind: "Certificate",
plural: "certificates",
shortNames: [
"cert",
"certs"
]
}
}
}, { provider: k8sprovider });
const issuers = new kubernetes.apiextensions.v1beta1.CustomResourceDefinition("issuers.certmanager.k8s.io", {
apiVersion: "apiextensions.k8s.io/v1beta1",
metadata: {
name: "issuers.certmanager.k8s.io",
labels: {
app: "cert-manager"
}
},
spec: {
group: "certmanager.k8s.io",
version: "v1alpha1",
scope: "Namespaced",
names: {
kind: "Issuer",
plural: "issuers"
}
}
}, { provider: k8sprovider });
const clusterissuers = new kubernetes.apiextensions.v1beta1.CustomResourceDefinition("clusterissuers.certmanager.k8s.io", {
apiVersion: "apiextensions.k8s.io/v1beta1",
metadata: {
name: "clusterissuers.certmanager.k8s.io",
labels: {
app: "cert-manager"
}
},
spec: {
group: "certmanager.k8s.io",
version: "v1alpha1",
scope: "Cluster",
names: {
kind: "ClusterIssuer",
plural: "clusterissuers"
}
}
}, { provider: k8sprovider });
const orders = new kubernetes.apiextensions.v1beta1.CustomResourceDefinition("orders.certmanager.k8s.io", {
apiVersion: "apiextensions.k8s.io/v1beta1",
metadata: {
name: "orders.certmanager.k8s.io",
labels: {
app: "cert-manager"
}
},
spec: {
additionalPrinterColumns: [
{
JSONPath: ".status.state",
name: "State",
type: "string"
},
{
JSONPath: ".spec.issuerRef.name",
name: "Issuer",
type: "string",
priority: 1
},
{
JSONPath: ".status.reason",
name: "Reason",
type: "string",
priority: 1
},
{
JSONPath: ".metadata.creationTimestamp",
description: "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
name: "Age",
type: "date"
}
],
group: "certmanager.k8s.io",
version: "v1alpha1",
scope: "Namespaced",
names: {
kind: "Order",
plural: "orders"
}
}
}, { provider: k8sprovider });
const challenges = new kubernetes.apiextensions.v1beta1.CustomResourceDefinition("challenges.certmanager.k8s.io", {
apiVersion: "apiextensions.k8s.io/v1beta1",
metadata: {
name: "challenges.certmanager.k8s.io",
labels: {
app: "cert-manager"
}
},
spec: {
additionalPrinterColumns: [
{
JSONPath: ".status.state",
name: "State",
type: "string"
},
{
JSONPath: ".spec.dnsName",
name: "Domain",
type: "string"
},
{
JSONPath: ".status.reason",
name: "Reason",
type: "string"
},
{
JSONPath: ".metadata.creationTimestamp",
description: "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
name: "Age",
type: "date"
}
],
group: "certmanager.k8s.io",
version: "v1alpha1",
scope: "Namespaced",
names: {
kind: "Challenge",
plural: "challenges"
}
}
}, { provider: k8sprovider });
return [
certificates,
issuers,
clusterissuers,
orders,
challenges
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment