Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
13a611b
tls
Aug 13, 2025
5acec1d
tls
Aug 18, 2025
00c9526
add instruction
Aug 27, 2025
ed77baf
clean up
Aug 27, 2025
1335f35
clean up
Aug 27, 2025
33ce9aa
Merge branch 'main' of https://github.com/microsoft/documentdb-kubern…
Sep 26, 2025
cdae47e
use TLSConfiguration
Sep 26, 2025
5b2ad43
address comments
Sep 30, 2025
3aacb40
Merge branch 'microsoft:main' into main
guanzhousongmicrosoft Oct 6, 2025
8bbbe03
rename gateway_tls_controller
Oct 13, 2025
c2df3a2
remove
Oct 13, 2025
9ed222e
fix db.microsoft.com
guanzhousongmicrosoft Oct 13, 2025
6c212c0
add tls argument
guanzhousongmicrosoft Oct 13, 2025
bcd268e
add retry logic
guanzhousongmicrosoft Oct 14, 2025
3c5c58d
fix helm chart
guanzhousongmicrosoft Oct 15, 2025
2b189c3
fix helm chart
guanzhousongmicrosoft Oct 15, 2025
25e6d2f
Merge branch 'main' of https://github.com/guanzhousongmicrosoft/docum…
guanzhousongmicrosoft Oct 15, 2025
7dfb904
chart
guanzhousongmicrosoft Oct 15, 2025
333667d
skip
guanzhousongmicrosoft Oct 15, 2025
b2b1fe6
skip image build
guanzhousongmicrosoft Oct 15, 2025
f3d91a0
skip image build
guanzhousongmicrosoft Oct 15, 2025
4b4989f
skip
guanzhousongmicrosoft Oct 15, 2025
10b9c30
skip test temporary
guanzhousongmicrosoft Oct 15, 2025
048ad33
skip test
guanzhousongmicrosoft Oct 15, 2025
417e430
testing
guanzhousongmicrosoft Oct 15, 2025
b99b71a
Merge branch 'main' of https://github.com/microsoft/documentdb-kubern…
guanzhousongmicrosoft Oct 17, 2025
a896d57
fix
guanzhousongmicrosoft Oct 17, 2025
5111bf8
release workflow
guanzhousongmicrosoft Oct 17, 2025
c882f82
changes
guanzhousongmicrosoft Oct 17, 2025
0cb7d90
modify the scripts
guanzhousongmicrosoft Oct 20, 2025
aa5cde8
add e2e test script
guanzhousongmicrosoft Oct 20, 2025
9cf5318
Merge branch 'main' of https://github.com/microsoft/documentdb-kubern…
guanzhousongmicrosoft Nov 3, 2025
c52d788
Merge branch 'main' of https://github.com/microsoft/documentdb-kubern…
guanzhousongmicrosoft Nov 4, 2025
7abb9dd
refactor
guanzhousongmicrosoft Nov 4, 2025
baf648c
update docs
guanzhousongmicrosoft Nov 4, 2025
138491f
Merge branch 'main' of https://github.com/microsoft/documentdb-kubern…
guanzhousongmicrosoft Nov 5, 2025
823496a
update and clean up
guanzhousongmicrosoft Nov 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -405,4 +405,4 @@ charts/
Chart.lock

# Test output
*.out
*.out
67 changes: 67 additions & 0 deletions api/preview/documentdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ type DocumentDBSpec struct {
ExposeViaService ExposeViaService `json:"exposeViaService,omitempty"`

Timeouts Timeouts `json:"timeouts,omitempty"`

// TLS configures certificate management for DocumentDB components.
TLS *TLSConfiguration `json:"tls,omitempty"`
}

type Resource struct {
Expand Down Expand Up @@ -81,11 +84,75 @@ type Timeouts struct {
StopDelay int32 `json:"stopDelay,omitempty"`
}

// TLSConfiguration aggregates TLS settings across DocumentDB components.
type TLSConfiguration struct {
// Gateway configures TLS for the gateway sidecar (Phase 1: certificate provisioning only).
Gateway *GatewayTLS `json:"gateway,omitempty"`

// Postgres configures TLS for the Postgres server (placeholder for future phases).
Postgres *PostgresTLS `json:"postgres,omitempty"`

// GlobalEndpoints configures TLS for global endpoints (placeholder for future phases).
GlobalEndpoints *GlobalEndpointsTLS `json:"globalEndpoints,omitempty"`
}

// GatewayTLS defines TLS configuration for the gateway sidecar (Phase 1: certificate provisioning only)
type GatewayTLS struct {
// Mode selects the TLS management strategy.
// +kubebuilder:validation:Enum=Disabled;SelfSigned;CertManager;Provided
Mode string `json:"mode,omitempty"`

// CertManager config when Mode=CertManager.
CertManager *CertManagerTLS `json:"certManager,omitempty"`

// Provided secret reference when Mode=Provided.
Provided *ProvidedTLS `json:"provided,omitempty"`
}

// PostgresTLS acts as a placeholder for future Postgres TLS settings.
type PostgresTLS struct{}

// GlobalEndpointsTLS acts as a placeholder for future global endpoint TLS settings.
type GlobalEndpointsTLS struct{}

// CertManagerTLS holds parameters for cert-manager driven certificates.
type CertManagerTLS struct {
IssuerRef IssuerRef `json:"issuerRef"`
// DNSNames for the certificate SANs. If empty, operator will add Service DNS names.
DNSNames []string `json:"dnsNames,omitempty"`
// SecretName optional explicit name for the target secret. If empty a default is chosen.
SecretName string `json:"secretName,omitempty"`
}

// ProvidedTLS references an existing secret that contains tls.crt/tls.key (and optional ca.crt).
type ProvidedTLS struct {
SecretName string `json:"secretName"`
}

// IssuerRef references a cert-manager Issuer or ClusterIssuer.
type IssuerRef struct {
Name string `json:"name"`
// Kind of issuer (Issuer or ClusterIssuer). Defaults to Issuer.
Kind string `json:"kind,omitempty"`
// Group defaults to cert-manager.io
Group string `json:"group,omitempty"`
}

// DocumentDBStatus defines the observed state of DocumentDB.
type DocumentDBStatus struct {
// Status reflects the status field from the underlying CNPG Cluster.
Status string `json:"status,omitempty"`
ConnectionString string `json:"connectionString,omitempty"`

// TLS reports gateway TLS provisioning status (Phase 1).
TLS *TLSStatus `json:"tls,omitempty"`
}

// TLSStatus captures readiness and secret information.
type TLSStatus struct {
Ready bool `json:"ready,omitempty"`
SecretName string `json:"secretName,omitempty"`
Message string `json:"message,omitempty"`
}

// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=".status.status",description="CNPG Cluster Status"
Expand Down
163 changes: 162 additions & 1 deletion api/preview/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

cmapi "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1"
cnpgv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
dbpreview "github.com/microsoft/documentdb-operator/api/preview"
"github.com/microsoft/documentdb-operator/internal/controller"
Expand All @@ -41,6 +42,7 @@ func init() {

utilruntime.Must(dbpreview.AddToScheme(scheme))
utilruntime.Must(cnpgv1.AddToScheme(scheme))
utilruntime.Must(cmapi.AddToScheme(scheme))
utilruntime.Must(fleetv1alpha1.AddToScheme(scheme))
// +kubebuilder:scaffold:scheme
}
Expand Down Expand Up @@ -193,6 +195,14 @@ func main() {
os.Exit(1)
}

if err = (&controller.CertificateReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Certificate")
os.Exit(1)
}

if err = (&controller.DocumentDBReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Expand Down
Loading
Loading