Skip to content

Add a public package for xpkg specification values #827

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions pkg/xpkg/spec.go
Original file line number Diff line number Diff line change
@@ -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"
Comment on lines +36 to +43
Copy link
Member Author

@jastang jastang Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamwg rightfully points out that some of these aren't technically defined by the specification, just often re-declared in other projects and specific implementation details.


// 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"
)