Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(crate): introduce crate concept. #138

Merged
merged 16 commits into from
Mar 7, 2022
Merged

Conversation

Zenithar
Copy link
Contributor

@Zenithar Zenithar commented Feb 28, 2022

Context

  • For me, the secret's management is heavily linked to configuration management. I'm preparing a technical move to migrate to configuration management.
  • Try to break the Vault dependency.
  • Implement the legacy harp registry concept using OCI registry.

Golden circle

Why

  • Harmonize configuration deployment to the same way we deploy code.
  • Decouple Vault usages – Harp uses Vault for Bundle storage and secret storage, but Harp bundle lifecycle is not bound to a secret storage, and this usage make Vault as a critical component for harp usages.

What

  • Harp Bundles contains secret management related information such as labels, annotations, patches, generation templates, validation policies, etc. This information must be securely stored and retrievable.
  • Harp should use a persistent Bundle storage where all resources are embedded in one manageable file structure. This file structure will be called a crate. #YetAnotherContainerSynonym

How

  • A crate contains one and only one sealed container which can be unsealed by multiple crate consumers.
  • A crate can contain multiple archives (templates, patch, or policy collection)
  • By using OCI registries to store and retrieve crates, we offer a generic way to handle content already used to deploy code. The idea is to ignite a configuration container concept.
  • Reuse code container registry and infrastructure settings (no additional network configuration required to access secret storage).
  • Authentication/Authorization is delegated to the registry implementation.
  • Integrity/Confidentiality properties are controlled by the sealing process and optional pre-sealing value encryption, to decouple the ability to unseal and the ability to read the secret value.
  • Registry event webhooks can be used to trigger external processes (Bundle refresh, etc.).
  • All OCI based tools can be used (replication, signing, notarization, provenance authorization, etc.)

Use cases

  • Exchange bundles via registry (store the bundle state)
  • Generate final configuration from a crate with a valid identity authorized by encryption to unseal the container and use an attached configuration archive as a template configuration file system. (ie. Act as a kubernetes projected volume provider for configMap)

Visual overview

Diagramme sans nom drawio

Samples

Sample Cratefile - Used to define the crate OCI layers.

# Required
container "region-eu" {
    # Path to the container.
    path = "region-eu.bundle"# Idetities for sealing purpose if the container is not sealed.
    identities = [
        "v1.ipk.7u8B1VFrHyMeWyt8Jzj1Nj2BgVB7z-umD8R-OOnJahE", # Security public key
    ]
}
​
# Optional archive layer
# All files matching the filter will be compressed as a tar.gz and embedded
# in the crate.
archive "production" {
    # Root path from where files are crawled to create the archive.
    root = "./production"# Include filters.
    includes = [
        "**"
    ]
​
    # Exclude filters.
    excludes = [
        "**.go"
    ]
}

Build and push the crate

$ harp crate push --in Cratefile --to registry:ghcr.io/elastic/harp --ref region-boostrap:v1

@Zenithar Zenithar self-assigned this Feb 28, 2022
@Zenithar Zenithar force-pushed the feat_to_support_oci_registry branch 3 times, most recently from 73250ff to 73c203a Compare February 28, 2022 16:10
@Zenithar Zenithar changed the title feat(oci): push to registry support. feat(crate): introduce crate concept. Mar 1, 2022
@Zenithar
Copy link
Contributor Author

Zenithar commented Mar 2, 2022

image

@Zenithar
Copy link
Contributor Author

Zenithar commented Mar 3, 2022

OCI image now supports Archives.

image

@Zenithar Zenithar force-pushed the feat_to_support_oci_registry branch 2 times, most recently from 6291693 to fd46978 Compare March 4, 2022 18:36
@Zenithar Zenithar force-pushed the feat_to_support_oci_registry branch from ba4bbc8 to ada0d4e Compare March 7, 2022 16:21
@Zenithar Zenithar marked this pull request as ready for review March 7, 2022 16:32
Signed-off-by: Thibault NORMAND <[email protected]>
@Zenithar Zenithar force-pushed the feat_to_support_oci_registry branch from eb4e5a2 to fc516d5 Compare March 7, 2022 16:35
@Zenithar Zenithar merged commit a568795 into main Mar 7, 2022
@Zenithar Zenithar deleted the feat_to_support_oci_registry branch March 7, 2022 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant