Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Commit

Permalink
fix: using labels instead of annotations for finding project namespace (
Browse files Browse the repository at this point in the history
#70)

* fix: using labels instead of annotations for finding project namespace

* add release docs
  • Loading branch information
Skarlso authored Oct 26, 2023
1 parent b04fdbe commit 6ca2cc9
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
5 changes: 3 additions & 2 deletions controllers/get_project_in_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"context"
"fmt"

"github.com/open-component-model/mpas-project-controller/api/v1alpha1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/open-component-model/mpas-project-controller/api/v1alpha1"
)

// GetProjectFromObjectNamespace returns the Project from the annotation of the current namespace that an object
Expand All @@ -19,7 +20,7 @@ func GetProjectFromObjectNamespace(ctx context.Context, c client.Client, obj cli
return nil, fmt.Errorf("failed to retrieve namespace for object: %w", err)
}

v, ok := ns.Annotations[v1alpha1.ProjectKey]
v, ok := ns.Labels[v1alpha1.ProjectKey]
if !ok {
return nil, fmt.Errorf("project key %s not found on namespace", v1alpha1.ProjectKey)
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/productdeploymentgenerator_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestProductDeploymentGeneratorReconciler(t *testing.T) {
testNamespace := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: "test-namespace",
Annotations: map[string]string{
Labels: map[string]string{
projectv1.ProjectKey: "project",
},
},
Expand Down Expand Up @@ -266,7 +266,7 @@ func TestProductDeploymentGeneratorReconcilerWithValueFile(t *testing.T) {
testNamespace := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: "test-namespace",
Annotations: map[string]string{
Labels: map[string]string{
projectv1.ProjectKey: "project",
},
},
Expand Down
2 changes: 1 addition & 1 deletion controllers/productdeploymentpipeline_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestProductDeploymentPipelineReconciler(t *testing.T) {
testNamespace := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: "test-namespace",
Annotations: map[string]string{
Labels: map[string]string{
projectv1.ProjectKey: "project",
},
},
Expand Down
4 changes: 2 additions & 2 deletions controllers/validation_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestBasicReconcile(t *testing.T) {
testNamespace := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: "test-namespace",
Annotations: map[string]string{
Labels: map[string]string{
projectv1.ProjectKey: "project",
},
},
Expand Down Expand Up @@ -194,7 +194,7 @@ func TestRemovingGitRepositoryWhenPullRequestIsMerged(t *testing.T) {
testNamespace := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: "test-namespace",
Annotations: map[string]string{
Labels: map[string]string{
projectv1.ProjectKey: "project",
},
},
Expand Down
9 changes: 9 additions & 0 deletions docs/release_notes/v0.6.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Release 0.6.0

- fix: using labels instead of annotations for finding project namespace #70
- add mend scans (#68)
- build(deps): bump google.golang.org/grpc from 1.57.0 to 1.57.1 (#69)
- Update actions/checkout to v4 (#67)
- remove (#65)
- Add blackduck scans (#63)
- Adding a target reconciler (#59)
2 changes: 1 addition & 1 deletion pkg/version/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package version

// ReleaseVersion is the version number in semver format "vX.Y.Z", prefixed with "v".
var ReleaseVersion = "v0.5.1"
var ReleaseVersion = "v0.6.0"

// ReleaseCandidate is the release candidate ID in format "rc.X", which will be appended to the release version.
var ReleaseCandidate = "rc.1"

0 comments on commit 6ca2cc9

Please sign in to comment.