From ecb1bca81f64756a5a4fbaf72fa0b40da3ea3874 Mon Sep 17 00:00:00 2001 From: Jason Tang Date: Wed, 2 Apr 2025 12:24:14 -0400 Subject: [PATCH] Add a public package for xpkg specification values Signed-off-by: Jason Tang --- pkg/xpkg/spec.go | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 pkg/xpkg/spec.go diff --git a/pkg/xpkg/spec.go b/pkg/xpkg/spec.go new file mode 100644 index 000000000..ef4f8adce --- /dev/null +++ b/pkg/xpkg/spec.go @@ -0,0 +1,61 @@ +/* +Copyright 2025 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package xpkg contains constants for values defined by Crossplane's xpkg specification. +package xpkg + +import ( + "os" +) + +const ( + // MetaFile is the name of a Crossplane package metadata file. + MetaFile string = "crossplane.yaml" + + // StreamFile is the name of the file in a Crossplane package image that + // contains its YAML stream. + StreamFile string = "package.yaml" + + // StreamFileMode determines the permissions on the stream file. + StreamFileMode os.FileMode = 0o644 + + // XpkgExtension is the extension for compiled Crossplane packages. + XpkgExtension string = ".xpkg" + + // XpkgMatchPattern is the match pattern for identifying compiled Crossplane packages. + XpkgMatchPattern string = "*" + XpkgExtension + + // XpkgExamplesFile is the name of the file in a Crossplane package image + // that contains the examples YAML stream. + XpkgExamplesFile string = ".up/examples.yaml" + + // AnnotationKey is the key value for xpkg annotations. + AnnotationKey string = "io.crossplane.xpkg" + + // PackageAnnotation is the annotation value used for the package.yaml + // layer. + PackageAnnotation string = "base" + + // ExamplesAnnotation is the annotation value used for the examples.yaml + // layer. + ExamplesAnnotation string = "upbound" + + // MetaAPIGroup is the API group for package metadata. + MetaAPIGroup string = "meta.pkg.crossplane.io" + + // MetaAnnotationKey is the key value for xpkg metadata annotations. + MetaAnnotationKey string = "meta.crossplane.io" +)