Skip to content

Commit 6bd4ae3

Browse files
dhaiducekopenshift-merge-robot
authored andcommitted
Only set the dependency namespace for Policy
IamPolicy, CertificatePolicy, and ConfigurationPolicy should not have a namespace set. ref: https://issues.redhat.com/browse/ACM-7353 Signed-off-by: Dale Haiducek <[email protected]>
1 parent 8890de1 commit 6bd4ae3

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

internal/ordering_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,8 @@ policies:
657657
manifests:
658658
- path: {{printf "%v/%v" .Dir "configpolicy.yaml"}}
659659
extraDependencies:
660-
- name: manifestextra
660+
- kind: IamPolicy
661+
name: manifestextra
661662
- path: {{printf "%v/%v" .Dir "configmap.yaml"}}
662663
- name: two
663664
manifests:

internal/plugin.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -783,21 +783,21 @@ func (p *Plugin) applyDefaults(unmarshaledConfig map[string]interface{}) {
783783

784784
func applyDefaultDependencyFields(deps []types.PolicyDependency, namespace string) {
785785
for i, dep := range deps {
786-
if dep.Namespace == "" {
787-
deps[i].Namespace = namespace
788-
}
789-
790-
if dep.Compliance == "" {
791-
deps[i].Compliance = "Compliant"
792-
}
793-
794786
if dep.Kind == "" {
795787
deps[i].Kind = policyKind
796788
}
797789

798790
if dep.APIVersion == "" {
799791
deps[i].APIVersion = policyAPIVersion
800792
}
793+
794+
if dep.Namespace == "" && deps[i].Kind == policyKind {
795+
deps[i].Namespace = namespace
796+
}
797+
798+
if dep.Compliance == "" {
799+
deps[i].Compliance = "Compliant"
800+
}
801801
}
802802
}
803803

internal/testdata/ordering/manifest-extradeps-configpolicy.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ spec:
1414
- extraDependencies:
1515
- apiVersion: policy.open-cluster-management.io/v1
1616
compliance: Compliant
17-
kind: Policy
17+
kind: IamPolicy
1818
name: manifestextra
19-
namespace: my-policies
2019
objectDefinition:
2120
apiVersion: policy.open-cluster-management.io/v1
2221
kind: ConfigurationPolicy

0 commit comments

Comments
 (0)