Skip to content

Commit dbae7e1

Browse files
Make labels and annotations in the Kptfile accessible via the PackageRevision object (kptdev#375)
* Introduce packageMetadata field to PackageRevision * Add .status.selfLock field to api packagerevision * Implement packageMetadata updates * remove sorting of slices in SetConditions, fix rebase, fix tests * PackageRevision field selectors for Kptfile labels * add missing PackageMetadata return to db cache, add basens/v4 with labels and annotations, fix .env read for make * fix cli e2e * fix cli e2e even more * resolve bundle conflict * update bundle + adapt to merged e2e tests * fix bad cli e2e merge --------- Co-authored-by: jkosimov <javlonbek.kosimov@nokia.com>
1 parent 158ddc0 commit dbae7e1

41 files changed

Lines changed: 1672 additions & 412 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ KIND_CONTEXT_NAME ?= porch-test
4747
# Include environment file if it exists
4848
ifneq ("$(wildcard .env)", "")
4949
include .env
50+
export
5051
endif
5152

5253
# Include module makefiles
@@ -77,4 +78,3 @@ dev: build check ## Full development cycle (build + check)
7778

7879
.PHONY: quick-test
7980
quick-test: fmt vet test ## Quick development test cycle
80-

api/generated/openapi/zz_generated.openapi.go

Lines changed: 86 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/porch/types.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ type PackageRevisionSpec struct {
118118
Tasks []Task `json:"tasks,omitempty"`
119119

120120
ReadinessGates []ReadinessGate `json:"readinessGates,omitempty"`
121+
122+
PackageMetadata *PackageMetadata `json:"packageMetadata,omitempty"`
123+
}
124+
125+
type PackageMetadata struct {
126+
Labels map[string]string `json:"labels,omitempty"`
127+
Annotations map[string]string `json:"annotations,omitempty"`
121128
}
122129

123130
type ReadinessGate struct {
@@ -135,7 +142,10 @@ type ParentReference struct {
135142
// PackageRevisionStatus defines the observed state of PackageRevision
136143
type PackageRevisionStatus struct {
137144
// UpstreamLock identifies the upstream data for this package.
138-
UpstreamLock *UpstreamLock `json:"upstreamLock,omitempty"`
145+
UpstreamLock *Locator `json:"upstreamLock,omitempty"`
146+
147+
// SelfLock identifies the location of the current package's data
148+
SelfLock *Locator `json:"selfLock,omitempty"`
139149

140150
// PublishedBy is the identity of the user who approved the packagerevision.
141151
PublishedBy string `json:"publishedBy,omitempty"`
@@ -311,14 +321,14 @@ type Selector struct {
311321
Namespace string `json:"namespace,omitempty"`
312322
}
313323

314-
// The following types (UpstreamLock, OriginType, and GitLock) are duplicates from the kpt library.
324+
// The following types (Locator, OriginType, and GitLock) are duplicates from the kpt library.
315325
// We are repeating them here to avoid cyclic dependencies, but these duplicate type should be removed when
316326
// https://github.com/kptdev/kpt/issues/3297 is resolved.
317327

318328
type OriginType string
319329

320-
// UpstreamLock is a resolved locator for the last fetch of the package.
321-
type UpstreamLock struct {
330+
// Locator is a resolved locator for the last fetch of the package.
331+
type Locator struct {
322332
// Type is the type of origin.
323333
Type OriginType `json:"type,omitempty"`
324334

api/porch/v1alpha1/types.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ type PackageRevisionSpec struct {
119119
Tasks []Task `json:"tasks,omitempty"`
120120

121121
ReadinessGates []ReadinessGate `json:"readinessGates,omitempty"`
122+
123+
PackageMetadata *PackageMetadata `json:"packageMetadata,omitempty"`
124+
}
125+
126+
type PackageMetadata struct {
127+
Labels map[string]string `json:"labels,omitempty"`
128+
Annotations map[string]string `json:"annotations,omitempty"`
122129
}
123130

124131
type ReadinessGate struct {
@@ -136,7 +143,10 @@ type ParentReference struct {
136143
// PackageRevisionStatus defines the observed state of PackageRevision
137144
type PackageRevisionStatus struct {
138145
// UpstreamLock identifies the upstream data for this package.
139-
UpstreamLock *UpstreamLock `json:"upstreamLock,omitempty"`
146+
UpstreamLock *Locator `json:"upstreamLock,omitempty"`
147+
148+
// SelfLock identifies the location of the current package's data
149+
SelfLock *Locator `json:"selfLock,omitempty"`
140150

141151
// PublishedBy is the identity of the user who approved the packagerevision.
142152
PublishedBy string `json:"publishedBy,omitempty"`
@@ -312,14 +322,14 @@ type Selector struct {
312322
Namespace string `json:"namespace,omitempty"`
313323
}
314324

315-
// The following types (UpstreamLock, OriginType, and GitLock) are duplicates from the kpt library.
325+
// The following types (Locator, OriginType, and GitLock) are duplicates from the kpt library.
316326
// We are repeating them here to avoid cyclic dependencies, but these duplicate type should be removed when
317327
// https://github.com/kptdev/kpt/issues/3297 is resolved.
318328

319329
type OriginType string
320330

321-
// UpstreamLock is a resolved locator for the last fetch of the package.
322-
type UpstreamLock struct {
331+
// Locator is a resolved locator for the last fetch of the package.
332+
type Locator struct {
323333
// Type is the type of origin.
324334
Type OriginType `json:"type,omitempty"`
325335

0 commit comments

Comments
 (0)