Skip to content

Commit 5258185

Browse files
committed
feat(gateway): add ForceReleaseCertLock RPC and expose dns credential fields
- Add ForceReleaseCertLock admin RPC to manually release stuck certificate renewal locks in WaveKV - Add dns_txt_ttl and max_dns_wait fields to DnsCredentialInfo proto message so these values are returned when querying DNS credentials - Update dns_cred_to_proto to populate the new fields
1 parent 140b3ce commit 5258185

2 files changed

Lines changed: 34 additions & 11 deletions

File tree

gateway/rpc/proto/gateway_rpc.proto

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,8 @@ service Admin {
404404
rpc DeleteZtDomain(DeleteZtDomainRequest) returns (google.protobuf.Empty) {}
405405
// Manually trigger certificate renewal for a ZT-Domain
406406
rpc RenewZtDomainCert(RenewZtDomainCertRequest) returns (RenewZtDomainCertResponse) {}
407+
// Force release certificate renewal lock for a ZT-Domain
408+
rpc ForceReleaseCertLock(ForceReleaseCertLockRequest) returns (google.protobuf.Empty) {}
407409
// List certificate attestations for a domain
408410
rpc ListCertAttestations(ListCertAttestationsRequest) returns (ListCertAttestationsResponse) {}
409411

@@ -426,9 +428,13 @@ message DnsCredentialInfo {
426428
string cf_api_token = 4;
427429
// Cloudflare API URL (empty means default)
428430
string cf_api_url = 5;
431+
// DNS TXT record TTL in seconds (optional)
432+
optional uint32 dns_txt_ttl = 6;
433+
// Maximum DNS wait time in seconds (optional)
434+
optional uint32 max_dns_wait = 7;
429435
// Timestamps
430-
uint64 created_at = 6;
431-
uint64 updated_at = 7;
436+
uint64 created_at = 8;
437+
uint64 updated_at = 9;
432438
}
433439

434440
// List DNS credentials response
@@ -560,6 +566,11 @@ message RenewZtDomainCertResponse {
560566
uint64 not_after = 2;
561567
}
562568

569+
// Force release certificate lock request
570+
message ForceReleaseCertLockRequest {
571+
string domain = 1;
572+
}
573+
563574
// Certificate attestation info
564575
message CertAttestationInfo {
565576
// Certificate public key (DER encoded)

gateway/src/admin_service.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ use dstack_gateway_rpc::{
1010
admin_server::{AdminRpc, AdminServer},
1111
CertAttestationInfo, CertbotConfigResponse, CreateDnsCredentialRequest,
1212
DeleteDnsCredentialRequest, DeleteZtDomainRequest, DnsCredentialInfo,
13-
GetDefaultDnsCredentialResponse, GetDnsCredentialRequest, GetInfoRequest, GetInfoResponse,
14-
GetInstanceHandshakesRequest, GetInstanceHandshakesResponse, GetMetaResponse,
15-
GetNodeStatusesResponse, GetZtDomainRequest, GlobalConnectionsStats, HandshakeEntry, HostInfo,
16-
LastSeenEntry, ListCertAttestationsRequest, ListCertAttestationsResponse,
17-
ListDnsCredentialsResponse, ListZtDomainsResponse, NodeStatusEntry,
18-
PeerSyncStatus as ProtoPeerSyncStatus, RenewCertResponse, RenewZtDomainCertRequest,
19-
RenewZtDomainCertResponse, SetCertbotConfigRequest, SetDefaultDnsCredentialRequest,
20-
SetNodeStatusRequest, SetNodeUrlRequest, StatusResponse, StoreSyncStatus,
21-
UpdateDnsCredentialRequest, WaveKvStatusResponse, ZtDomainCertStatus,
13+
ForceReleaseCertLockRequest, GetDefaultDnsCredentialResponse, GetDnsCredentialRequest,
14+
GetInfoRequest, GetInfoResponse, GetInstanceHandshakesRequest, GetInstanceHandshakesResponse,
15+
GetMetaResponse, GetNodeStatusesResponse, GetZtDomainRequest, GlobalConnectionsStats,
16+
HandshakeEntry, HostInfo, LastSeenEntry, ListCertAttestationsRequest,
17+
ListCertAttestationsResponse, ListDnsCredentialsResponse, ListZtDomainsResponse,
18+
NodeStatusEntry, PeerSyncStatus as ProtoPeerSyncStatus, RenewCertResponse,
19+
RenewZtDomainCertRequest, RenewZtDomainCertResponse, SetCertbotConfigRequest,
20+
SetDefaultDnsCredentialRequest, SetNodeStatusRequest, SetNodeUrlRequest, StatusResponse,
21+
StoreSyncStatus, UpdateDnsCredentialRequest, WaveKvStatusResponse, ZtDomainCertStatus,
2222
ZtDomainConfig as ProtoZtDomainConfig, ZtDomainInfo,
2323
};
2424
use ra_rpc::{CallContext, RpcCall};
@@ -541,6 +541,16 @@ impl AdminRpc for AdminRpcHandler {
541541
}
542542
}
543543

544+
async fn force_release_cert_lock(self, request: ForceReleaseCertLockRequest) -> Result<()> {
545+
let kv_store = self.state.kv_store();
546+
kv_store.release_cert_lock(&request.domain)?;
547+
info!(
548+
"Force released certificate lock for domain: {}",
549+
request.domain
550+
);
551+
Ok(())
552+
}
553+
544554
async fn list_cert_attestations(
545555
self,
546556
request: ListCertAttestationsRequest,
@@ -695,6 +705,8 @@ fn dns_cred_to_proto(cred: DnsCredential) -> DnsCredentialInfo {
695705
cf_api_url,
696706
created_at: cred.created_at,
697707
updated_at: cred.updated_at,
708+
dns_txt_ttl: Some(cred.dns_txt_ttl),
709+
max_dns_wait: Some(cred.max_dns_wait.as_secs() as u32),
698710
}
699711
}
700712

0 commit comments

Comments
 (0)