pub struct WebhookCertificate {
pub ca_pem: String,
pub cert_pem: String,
pub key_pem: String,
}k8s only.Expand description
A CA and a serving certificate for <service>.<namespace>.svc (and the
short names): the API server checks the webhook’s certificate against
the CA in the webhook configuration’s caBundle.
Fields§
§ca_pem: String§cert_pem: String§key_pem: StringImplementations§
Source§impl WebhookCertificate
impl WebhookCertificate
Sourcepub fn generate(
service: &str,
namespace: &str,
) -> Result<WebhookCertificate, String>
pub fn generate( service: &str, namespace: &str, ) -> Result<WebhookCertificate, String>
A new CA and a certificate signed by it for the Service service
in namespace, valid for ten years.
Sourcepub fn generate_for(
common_name: &str,
names: Vec<String>,
) -> Result<WebhookCertificate, String>
pub fn generate_for( common_name: &str, names: Vec<String>, ) -> Result<WebhookCertificate, String>
The same for other DNS names (a webhook the API server reaches by URL rather than through a Service).
The certificate every replica of an operator uses: read from the
TLS Secret secret in namespace, or made and stored there by the
first replica to ask (a create race is settled by the API server:
the loser reads the winner’s). Replicas that each made their own
would overwrite each other’s caBundle. The pod needs get and
create on secrets in the namespace.
Sourcepub fn to_secret(&self, name: &str, namespace: &str) -> Secret
pub fn to_secret(&self, name: &str, namespace: &str) -> Secret
A kubernetes.io/tls Secret holding it (tls.crt, tls.key, ca.crt).
Sourcepub fn from_secret(secret: &Secret) -> Option<WebhookCertificate>
pub fn from_secret(secret: &Secret) -> Option<WebhookCertificate>
Read one from a Secret written by to_secret
(or cert-manager, whose Secrets have the same keys).
Sourcepub fn install(&self, dir: &str) -> Result<(), String>
pub fn install(&self, dir: &str) -> Result<(), String>
Write tls.crt, tls.key and ca.crt into dir and point rws’s
TLS settings at them (RWS_CONFIG_TLS_CERT_FILE/KEY_FILE), so
Server::run_tls serves them.
Sourcepub async fn patch_ca_bundle(
&self,
client: &Client,
validating: Option<&str>,
mutating: Option<&str>,
crd: Option<&str>,
) -> Result<(), Error>
pub async fn patch_ca_bundle( &self, client: &Client, validating: Option<&str>, mutating: Option<&str>, crd: Option<&str>, ) -> Result<(), Error>
Put the CA into the caBundle of every webhook in the
Validating/MutatingWebhookConfiguration name (and a CRD’s
conversion webhook, when crd is given) — for an operator that
makes its own certificate at startup.
Trait Implementations§
Source§impl Clone for WebhookCertificate
impl Clone for WebhookCertificate
Source§fn clone(&self) -> WebhookCertificate
fn clone(&self) -> WebhookCertificate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Forget for WebhookCertificate
impl Freeze for WebhookCertificate
impl RefUnwindSafe for WebhookCertificate
impl Send for WebhookCertificate
impl Sync for WebhookCertificate
impl Unpin for WebhookCertificate
impl UnsafeUnpin for WebhookCertificate
impl UnwindSafe for WebhookCertificate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
map-response-body only.Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
trace only.Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
trace only.