Fixes #228 ## Motivation and Context See #19 ## How Has This Been Tested? - Run locally - Run in docker compose - Run infra in minikube - Unit and integration tests all passing :) ## Breaking Changes Yes: users will not be able to access any data they used to have in custom mongodb. We are accepting this breaking change, given the registry is in experimental development status. ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [x] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [x] I have added appropriate error handling - [x] I have added or updated documentation as needed ## Additional context I have not implemented connection pooling support for simplicity, and because cloudnative-pg already provides built-in connection pooling with pgBouncer so if we want it later we can switch to this endpoint easily.
78 lines
2.4 KiB
Go
78 lines
2.4 KiB
Go
package k8s
|
|
|
|
import (
|
|
"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes"
|
|
"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/apiextensions"
|
|
v1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1"
|
|
"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/helm/v3"
|
|
metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
|
|
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
|
|
|
"github.com/modelcontextprotocol/registry/deploy/infra/pkg/providers"
|
|
)
|
|
|
|
// SetupCertManager sets up cert-manager for TLS certificates
|
|
func SetupCertManager(ctx *pulumi.Context, cluster *providers.ProviderInfo) error {
|
|
// Create namespace for cert-manager
|
|
certManagerNamespace, err := v1.NewNamespace(ctx, "cert-manager", &v1.NamespaceArgs{
|
|
Metadata: &metav1.ObjectMetaArgs{
|
|
Name: pulumi.String("cert-manager"),
|
|
},
|
|
}, pulumi.Provider(cluster.Provider))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// Install cert-manager for TLS certificates
|
|
certManager, err := helm.NewChart(ctx, "cert-manager", helm.ChartArgs{
|
|
Chart: pulumi.String("cert-manager"),
|
|
Version: pulumi.String("v1.18.2"),
|
|
FetchArgs: helm.FetchArgs{
|
|
Repo: pulumi.String("https://charts.jetstack.io"),
|
|
},
|
|
Namespace: certManagerNamespace.Metadata.Name().Elem(),
|
|
Values: pulumi.Map{
|
|
"installCRDs": pulumi.Bool(true),
|
|
"ingressShim": pulumi.Map{
|
|
"defaultIssuerName": pulumi.String("letsencrypt-prod"),
|
|
"defaultIssuerKind": pulumi.String("ClusterIssuer"),
|
|
},
|
|
},
|
|
}, pulumi.Provider(cluster.Provider))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
_, err = apiextensions.NewCustomResource(ctx, "letsencrypt-prod", &apiextensions.CustomResourceArgs{
|
|
ApiVersion: pulumi.String("cert-manager.io/v1"),
|
|
Kind: pulumi.String("ClusterIssuer"),
|
|
Metadata: &metav1.ObjectMetaArgs{
|
|
Name: pulumi.String("letsencrypt-prod"),
|
|
},
|
|
OtherFields: kubernetes.UntypedArgs{
|
|
"spec": pulumi.Map{
|
|
"acme": pulumi.Map{
|
|
"server": pulumi.String("https://acme-v02.api.letsencrypt.org/directory"),
|
|
"email": pulumi.String("admin@modelcontextprotocol.io"),
|
|
"privateKeySecretRef": pulumi.Map{
|
|
"name": pulumi.String("letsencrypt-prod-key"),
|
|
},
|
|
"solvers": pulumi.Array{
|
|
pulumi.Map{
|
|
"http01": pulumi.Map{
|
|
"ingress": pulumi.Map{
|
|
"ingressClassName": pulumi.String("nginx"),
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}, pulumi.Provider(cluster.Provider), pulumi.DependsOnInputs(certManager.Ready))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|