Skip to content

Commit

Permalink
Sync CRDs
Browse files Browse the repository at this point in the history
Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
  • Loading branch information
dhaiducek authored and openshift-merge-bot[bot] committed Apr 11, 2024
1 parent 2433148 commit cdccd55
Show file tree
Hide file tree
Showing 3 changed files with 256 additions and 63 deletions.
16 changes: 7 additions & 9 deletions build/crd-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ generate_v1beta1() {
generate_v1beta1 ../policy-crd-v1beta1.yaml
)

crdPrefix='# Copyright Contributors to the Open Cluster Management project
{{- if semverCompare "< 1.16.0" (.Values.hostingClusterCapabilities.KubeVersion.Version | default .Capabilities.KubeVersion.Version) }}'

addLocationLabel='.metadata.labels += {"addon.open-cluster-management.io/hosted-manifest-location": "hosting"}'
addTemplateLabel='.metadata.labels += {"policy.open-cluster-management.io/policy-type": "template"}'

Expand All @@ -56,27 +60,21 @@ addTempAnnotation='.metadata.annotations += {"SEDTARGET": "SEDTARGET"}'
replaceAnnotation='s/SEDTARGET: SEDTARGET/{{ if .Values.onMulticlusterHub }}"addon.open-cluster-management.io\/deletion-orphan": ""{{ end }}/g'

cat > pkg/addon/configpolicy/manifests/managedclusterchart/templates/policy.open-cluster-management.io_configurationpolicies_crd.yaml << EOF
# Copyright Contributors to the Open Cluster Management project
{{- if semverCompare "< 1.16.0" .Capabilities.KubeVersion.Version }}
${crdPrefix}
$(yq e "$addLocationLabel | $addTemplateLabel" .go/config-policy-crd-v1beta1.yaml)
{{ else }}
$(yq e "$addLocationLabel" .go/config-policy-crd-v1.yaml)
{{- end }}
EOF

cat > pkg/addon/configpolicy/manifests/managedclusterchart/templates/policy.open-cluster-management.io_operatorpolicies_crd.yaml << EOF
# Copyright Contributors to the Open Cluster Management project
{{- if semverCompare "> 1.16.0" .Capabilities.KubeVersion.Version }}
$(echo "${crdPrefix}" | sed 's/</>/')
$(yq e "$addLocationLabel" .go/operator-policy-crd-v1.yaml)
{{- end }}
EOF

cat > pkg/addon/policyframework/manifests/managedclusterchart/templates/policy.open-cluster-management.io_policies_crd.yaml << EOF
# Copyright Contributors to the Open Cluster Management project
{{- if semverCompare "< 1.16.0" .Capabilities.KubeVersion.Version }}
${crdPrefix}
$(yq e "$addTempAnnotation | $addLocationLabel" .go/policy-crd-v1beta1.yaml | sed -E "$replaceAnnotation")
{{ else }}
$(yq e "$addTempAnnotation | $addLocationLabel" .go/policy-crd-v1.yaml | sed -E "$replaceAnnotation")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ spec:
description: ComplianceType describes whether we must or must not have a given resource
enum:
- musthave
- mustnothave
type: string
operatorGroup:
description: |-
Expand All @@ -65,6 +66,56 @@ spec:
- Enforce
- enforce
type: string
removalBehavior:
default: {}
description: |-
RemovalBehavior defines what resources will be removed by enforced mustnothave policies.
When in inform mode, any resources that would be deleted if the policy was enforced will
be causes for NonCompliance, but resources that would be kept will be considered Compliant.
properties:
clusterServiceVersions:
default: Delete
description: Specifies whether to delete the ClusterServiceVersion; defaults to 'Delete'
enum:
- Keep
- Delete
type: string
customResourceDefinitions:
default: Keep
description: |-
Specifies whether to delete any CustomResourceDefinitions associated with the operator;
defaults to 'Keep' because deleting them should be done deliberately
enum:
- Keep
- Delete
type: string
installPlans:
default: Keep
description: |-
Specifies whether to delete any InstallPlans associated with the operator; defaults
to 'Keep' because those objects are only for history
enum:
- Keep
- Delete
type: string
operatorGroups:
default: DeleteIfUnused
description: |-
Specifies whether to delete the OperatorGroup; defaults to 'DeleteIfUnused' which
will only delete the OperatorGroup if there is not another Subscription using it.
enum:
- Keep
- Delete
- DeleteIfUnused
type: string
subscriptions:
default: Delete
description: Specifies whether to delete the Subscription; defaults to 'Delete'
enum:
- Keep
- Delete
type: string
type: object
severity:
description: 'Severity : low, medium, high, or critical'
enum:
Expand Down
Loading

0 comments on commit cdccd55

Please sign in to comment.