...

Source file src/edge-infra.dev/pkg/f8n/warehouse/annotations.go

Documentation: edge-infra.dev/pkg/f8n/warehouse

     1  package warehouse
     2  
     3  import ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
     4  
     5  // Warehouse OCI schema version. When the schema version is incremented, this
     6  // package version should be incremented, creating distinct Go packages for each
     7  // Warehouse schema version.
     8  //
     9  // Note that while pallet/ and cluster/ share this version today, they can be
    10  // versioned independently under the v1 Warehouse spec as necessary, so long as
    11  // the changes are still compatible with the Warehouse spec.
    12  const (
    13  	Schema1 = "v1"
    14  )
    15  
    16  // Artifact (OCI Image Index / OCI Image) annotations.
    17  const (
    18  	// AnnotationSchemaVersion communicates to registry clients what version
    19  	// of the Warehouse schema is used to define this artifact.
    20  	//
    21  	// This annotation MUST be present on all Warehouse artifacts.
    22  	AnnotationSchemaVersion = "com.ncr.warehouse.schema.version"
    23  
    24  	// AnnotationKind describes what kind of Warehouse artifact an OCI manifest
    25  	// represents.
    26  	//
    27  	// This annotation MUST be added to all Warehouse artifacts.
    28  	// Any values other than "pallet" are ignored by clients.
    29  	AnnotationKind = "com.ncr.warehouse.kind"
    30  
    31  	// AnnotationRefName contains the name of the target being referenced in a
    32  	// v1.Descriptor.
    33  	//
    34  	// For example, external-secrets is the name of the pallet being referenced
    35  	// in this descriptor, embedded in a v1.ImageIndex:
    36  	//
    37  	// 		  "manifests": [
    38  	// 				{
    39  	// 					"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
    40  	// 					"size": 1421,
    41  	// 					"digest": "sha256:87545f3257ce454d1a39361fd82ae0e9e1058b4e838747ae47a4fb62ed083592",
    42  	// 					"annotations": {
    43  	// 						"com.ncr.pallet.cluster.providers": "gke",
    44  	// 						"com.ncr.warehouse.ref.name": "external-secrets"
    45  	// 					}
    46  	// 				},
    47  	//			...
    48  	//			]
    49  	//
    50  	// This annotation MUST be added to all v1.Descriptors in v1.ImageIndexes.
    51  	AnnotationRefName = "com.ncr.warehouse.ref.name"
    52  
    53  	// AnnotationName contains the globally unique Warehouse package name.
    54  	AnnotationName = "com.ncr.warehouse.name"
    55  
    56  	// AnnotationClusterProviders contains information about what cluster providers
    57  	// this specific artifact supports.
    58  	//
    59  	// For Pallets, this annotation MUST be present and contain a comma separated
    60  	// list of K8s providers, e.g., "gke,sds".
    61  	AnnotationClusterProviders = "com.ncr.warehouse.cluster.providers"
    62  )
    63  
    64  // Layer annotations used by Warehouse clients when processing OCI Artifacts.
    65  //
    66  // These annotations MUST be present on all Warehouse layers.
    67  const (
    68  	// AnnotationLayerType indicates what "kind" of contents are in an OCI Layer.
    69  	// This is used to separate runtime manifests from infrastructure manifests
    70  	// during packing and unpacking of Warehouse artifacts (e.g., Pallets).
    71  	//
    72  	// This annotation MUST be present on all valid Warehouse layers.
    73  	AnnotationLayerType = "com.ncr.warehouse.layer.type"
    74  )
    75  
    76  // Annotations for Pallet artifacts.
    77  //
    78  // These annotations MUST be present for all Pallet artifacts in addition to the
    79  // required Warehouse v1 annotations.
    80  const (
    81  	// AnnotationTeam contains the GitHub team name that is responsible
    82  	// for the Pallet.  This data could be used for labeling monitoring data
    83  	// to identify billing costs incurred by teams, or reporting for manifest
    84  	// linting errors and other actions that the package owner needs to take.
    85  	AnnotationTeam = "com.ncr.warehouse.pallet.meta.team"
    86  
    87  	// AnnotationRevision is an alias for the official OCI revision annotation:
    88  	// https://github.com/opencontainers/image-spec/blob/main/annotations.md#annotations
    89  	//
    90  	// The source control revision that produced the artifact, e.g., a commit hash.
    91  	AnnotationRevision = ociv1.AnnotationRevision
    92  
    93  	// AnnotationSource is an alias for the official OCI source annotation:
    94  	// https://github.com/opencontainers/image-spec/blob/main/annotations.md#annotations
    95  	//
    96  	// A fully qualified URL to the revision, e.g., `https://github.com/golang/go/tree/c81b6d8bf807eb5d01e72c02a3fd3d044d7b681a`
    97  	AnnotationSource = ociv1.AnnotationSource
    98  
    99  	// AnnotationVersion is an alias for the official OCI version annotation:
   100  	// https://github.com/opencontainers/image-spec/blob/main/annotations.md#annotations
   101  	//
   102  	// It MUST be a valid SemVer string.
   103  	AnnotationVersion = ociv1.AnnotationVersion
   104  
   105  	// AnnotationCreated is an alias for the official OCI created annotation:
   106  	// https://github.com/opencontainers/image-spec/blob/main/annotations.md#annotations
   107  	//
   108  	// A RFC3339-formatted date that the revision was authored, per the OCI spec.
   109  	//
   110  	// For example:
   111  	//
   112  	// 		`2022-04-29T22:40:28Z`
   113  	AnnotationCreated = ociv1.AnnotationCreated
   114  
   115  	// AnnotationVendor is an alias for the official OCI software vendor annotation.
   116  	AnnotationVendor = ociv1.AnnotationVendor
   117  )
   118  
   119  // Optional annotations for Pallet artifacts.
   120  const (
   121  	// AnnotationTitle is an alias for the official OCI title annotation.
   122  	// https://github.com/opencontainers/image-spec/blob/main/annotations.md#annotations
   123  	//
   124  	// It should be generally be set to the same value as warehouse.AnnotationName,
   125  	// but it able to be set independently to allow flexibility for interop with
   126  	// future OCI ecosystem uses for the annotation.
   127  	AnnotationTitle = ociv1.AnnotationTitle
   128  
   129  	// AnnotationDescription is an alias for the official OCI description annotation:
   130  	// https://github.com/opencontainers/image-spec/blob/main/annotations.md#annotations
   131  	//
   132  	// It should be a short description of the package.
   133  	AnnotationDescription = ociv1.AnnotationDescription
   134  
   135  	// AnnotationDocumentation is an alias for the official OCI documentation annotation:
   136  	// https://github.com/opencontainers/image-spec/blob/main/annotations.md#annotations
   137  	//
   138  	// It should contain a link to the documentation for the package.
   139  	AnnotationDocumentation = ociv1.AnnotationDocumentation
   140  
   141  	// AnnotationRender determines whether or not environment variable
   142  	// substitution will occur for a package.
   143  	//
   144  	// If not present, it is assumed to be true. To disable rendering, the
   145  	// annotation must be present and contain the string "false".
   146  	AnnotationRender = "com.ncr.warehouse.pallet.render"
   147  
   148  	// AnnotationCapabilities contains information about which cluster
   149  	// capabilities this specific Pallet integrates with.
   150  	//
   151  	// If the Pallet integrates with any capabilities, this value MUST be a comma
   152  	// separated list of capabilities made available via capability provider packages.
   153  	AnnotationCapabilities = "com.ncr.warehouse.pallet.capabilities"
   154  
   155  	// AnnotationParameters contains the rendering parameters used.
   156  	// The parameters of any dependencies are also included here.
   157  	AnnotationParameters = "com.ncr.warehouse.pallet.parameters"
   158  )
   159  
   160  // Pallet-specific OCI Layer annotations
   161  const (
   162  	// AnnotationLayerRuntimeCapability contains the name of the runtime capability
   163  	// that is associated with a specific OCI Layer.
   164  	//
   165  	// Any non-default runtime layer MUST have this annotation.
   166  	AnnotationLayerRuntimeCapability = "com.ncr.warehouse.pallet.layer.runtime.capability"
   167  )
   168  

View as plain text