Skip to content

Commit

Permalink
Merge pull request #2 from wasmCloud/add_credentials_docs
Browse files Browse the repository at this point in the history
chore: add docs on how to use the `registryCredentialsSecret` option
  • Loading branch information
protochron authored Mar 27, 2024
2 parents b375604 + c0e782d commit 0756cde
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ spec:
hostLabels:
some-label: value
# Which wasmCloud version to use
version: 0.81.0
version: 0.82.0
# The name of a secret in the same namespace that provides the required secrets.
secretName: cluster-secrets
# Enable the following to run the wasmCloud hosts as a DaemonSet
#daemonset: true
# The name of the image pull secret to use with wasmCloud hosts so that they
# can authenticate to a private registry to pull components.
# registryCredentialsSecret: my-registry-secret
```

The CRD requires a Kubernetes Secret with the following keys:
Expand All @@ -48,13 +51,23 @@ data:
WASMCLOUD_CLUSTER_SEED: <seed>
# Only required if using a NATS creds file
# nats.creds: <base64 encoded creds file>
# Only required if using OCI private registry
# OCI_REGISTRY_PASSWORD: <password>
```

The operator will fail to provision the wasmCloud Deployment if any of these
secrets are missing!

### Image Pull Secrets

You can also specify an image pull secret to use use with the wasmCloud hosts
so that they can pull components from a private registry. This secret needs to
be in the same namespace as the WasmCloudHostConfig CRD and must be a
`kubernetes.io/dockerconfigjson` type secret. See the [Kubernetes
documentation](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#registry-secret-existing-credentials)
for more information on how to provision that secret.

Once it is created, you can reference it in the WasmCloudHostConfig CRD by
setting the `registryCredentialsSecret` field to the name of the secret.

## Deploying the operator

A wasmCloud cluster requires a few things to run:
Expand Down
22 changes: 21 additions & 1 deletion crates/types/src/v1alpha1/wasmcloud_host_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,54 @@ use std::collections::HashMap;
kind = "WasmCloudHostConfig",
group = "k8s.wasmcloud.dev",
version = "v1alpha1",
shortname = "chc",
shortname = "whc",
namespaced,
status = "WasmCloudHostConfigStatus",
printcolumn = r#"{"name":"App Count", "type":"integer", "jsonPath":".status.app_count"}"#
)]
#[serde(rename_all = "camelCase")]
pub struct WasmCloudHostConfigSpec {
/// The number of replicas to use for the wasmCloud host Deployment.
#[serde(default = "default_host_replicas")]
pub host_replicas: u32,
/// A list of cluster issuers to use when provisioning hosts. See
/// https://wasmcloud.com/docs/deployment/security/zero-trust-invocations for more information.
pub issuers: Vec<String>,
/// The lattice to use for these hosts.
pub lattice: String,
/// An optional set of labels to apply to these hosts.
pub host_labels: Option<HashMap<String, String>>,
/// The version of the wasmCloud host to deploy.
pub version: String,
/// The name of a secret containing the primary cluster issuer key along with an optional set
/// of NATS credentials.
pub secret_name: String,
/// Enable structured logging for host logs.
pub enable_structured_logging: Option<bool>,
/// Name of a secret containing the registry credentials
pub registry_credentials_secret: Option<String>,
/// Kubernetes resources to allocate for the host. See
/// https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ for valid
/// values to use here.
pub resources: Option<WasmCloudHostConfigResources>,
/// The control topic prefix to use for the host.
pub control_topic_prefix: Option<String>,
/// The leaf node domain to use for the NATS sidecar. Defaults to "leaf".
#[serde(default = "default_leaf_node_domain")]
pub leaf_node_domain: String,
/// Enable the config service for this host.
#[serde(default)]
pub config_service_enabled: bool,
/// The address of the NATS server to connect to. Defaults to "nats://nats.default.svc.cluster.local".
#[serde(default = "default_nats_address")]
pub nats_address: String,
/// The Jetstream domain to use for the NATS sidecar. Defaults to "default".
#[serde(default = "default_jetstream_domain")]
pub jetstream_domain: String,
/// The log level to use for the host. Defaults to "INFO".
#[serde(default = "default_log_level")]
pub log_level: String,
/// Run hosts as a DaemonSet instead of a Deployment.
#[serde(default)]
pub daemonset: bool,
}
Expand Down
2 changes: 1 addition & 1 deletion sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
hostLabels:
test: value
# Which wasmCloud version to use
version: 0.81.0
version: 0.82.0
# The name of a secret in the same namespace that provides the required secrets.
secretName: cluster-secrets
logLevel: INFO
Expand Down

0 comments on commit 0756cde

Please sign in to comment.