Skip to content

Commit dfec9a4

Browse files
authored
update annotation to be a pointer (#682)
Signed-off-by: Stephanie <[email protected]>
1 parent 937a762 commit dfec9a4

File tree

6 files changed

+26
-11
lines changed

6 files changed

+26
-11
lines changed

pkg/apis/workspaces/v1alpha2/component_container.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Container struct {
3636

3737
// +optional
3838
// Annotations that should be added to specific resources for this container
39-
Annotation Annotation `json:"annotation,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
39+
Annotation *Annotation `json:"annotation,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
4040

4141
// +optional
4242
// List of volumes mounts that should be mounted is this container.

pkg/apis/workspaces/v1alpha2/zz_generated.deepcopy.go

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

pkg/apis/workspaces/v1alpha2/zz_generated.parent_overrides.go

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

pkg/apis/workspaces/v1alpha2/zz_generated.plugin_overrides.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/validation/components.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package validation
22

33
import (
44
"fmt"
5-
"reflect"
65
"strings"
76

87
"github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
@@ -63,7 +62,7 @@ func ValidateComponents(components []v1alpha2.Component) (returnedErr error) {
6362
}
6463

6564
// if annotation is not empty and dedicatedPod is false
66-
if !reflect.DeepEqual(component.Container.Annotation, v1alpha2.Annotation{}) && component.Container.DedicatedPod != nil && !(*component.Container.DedicatedPod) {
65+
if component.Container.Annotation != nil && component.Container.DedicatedPod != nil && !(*component.Container.DedicatedPod) {
6766
for key, value := range component.Container.Annotation.Deployment {
6867
if processedVal, exist := processedDeploymentAnnotations[key]; exist && processedVal != value {
6968
// only append the error for a single key once

pkg/validation/components_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func generateDummyContainerComponent(name string, volMounts []v1alpha2.VolumeMou
2121
Container: &v1alpha2.ContainerComponent{
2222
Container: v1alpha2.Container{
2323
Image: image,
24-
Annotation: annotation,
24+
Annotation: &annotation,
2525
Env: envs,
2626
VolumeMounts: volMounts,
2727
MountSources: &mountSources,

0 commit comments

Comments
 (0)