From 5858acf649ab287e34af12c66003961e37b18645 Mon Sep 17 00:00:00 2001 From: ci-bot Date: Thu, 7 Mar 2024 14:47:24 +0000 Subject: [PATCH] update ks-core helm chart --- src/test/ks-core/Chart.yaml | 2 +- ...ion.kubesphere.io_applicationreleases.yaml | 14 ++-- ...pplication.kubesphere.io_applications.yaml | 6 ++ ...ion.kubesphere.io_applicationversions.yaml | 12 ++++ .../crds/application.kubesphere.io_repos.yaml | 2 - .../crds/kubesphere.io_extensionversions.yaml | 2 - .../extensions.customresourcefilters.rego | 72 +++++++++++++++++++ src/test/ks-core/scripts/post-delete.sh | 8 +++ .../templates/customresourcefilters.yaml | 33 +-------- src/test/ks-core/templates/globalroles.yaml | 7 -- src/test/ks-core/templates/webhook.yaml | 32 --------- 11 files changed, 110 insertions(+), 80 deletions(-) create mode 100644 src/test/ks-core/files/extensions.customresourcefilters.rego diff --git a/src/test/ks-core/Chart.yaml b/src/test/ks-core/Chart.yaml index ca18c2e6..1b924520 100644 --- a/src/test/ks-core/Chart.yaml +++ b/src/test/ks-core/Chart.yaml @@ -7,7 +7,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.6.7 +version: 0.6.8 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/src/test/ks-core/crds/application.kubesphere.io_applicationreleases.yaml b/src/test/ks-core/crds/application.kubesphere.io_applicationreleases.yaml index 41ac4abe..de13b99c 100644 --- a/src/test/ks-core/crds/application.kubesphere.io_applicationreleases.yaml +++ b/src/test/ks-core/crds/application.kubesphere.io_applicationreleases.yaml @@ -17,11 +17,17 @@ spec: scope: Cluster versions: - additionalPrinterColumns: - - jsonPath: .spec.AppID - name: App Name - type: string - jsonPath: .metadata.labels.kubesphere\.io/workspace - name: Workspace + name: workspace + type: string + - jsonPath: .metadata.labels.application\.kubesphere\.io/app-id + name: app + type: string + - jsonPath: .metadata.labels.application\.kubesphere\.io/appversion-id + name: appversion + type: string + - jsonPath: .spec.appType + name: appType type: string - jsonPath: .metadata.labels.kubesphere\.io/cluster name: Cluster diff --git a/src/test/ks-core/crds/application.kubesphere.io_applications.yaml b/src/test/ks-core/crds/application.kubesphere.io_applications.yaml index 1cd42508..d5e127f4 100644 --- a/src/test/ks-core/crds/application.kubesphere.io_applications.yaml +++ b/src/test/ks-core/crds/application.kubesphere.io_applications.yaml @@ -17,9 +17,15 @@ spec: scope: Cluster versions: - additionalPrinterColumns: + - jsonPath: .metadata.labels.application\.kubesphere\.io/repo-name + name: repo + type: string - jsonPath: .metadata.labels.kubesphere\.io/workspace name: workspace type: string + - jsonPath: .spec.appType + name: appType + type: string - jsonPath: .status.state name: State type: string diff --git a/src/test/ks-core/crds/application.kubesphere.io_applicationversions.yaml b/src/test/ks-core/crds/application.kubesphere.io_applicationversions.yaml index d2e82b8f..ce416aae 100644 --- a/src/test/ks-core/crds/application.kubesphere.io_applicationversions.yaml +++ b/src/test/ks-core/crds/application.kubesphere.io_applicationversions.yaml @@ -17,6 +17,18 @@ spec: scope: Cluster versions: - additionalPrinterColumns: + - jsonPath: .metadata.labels.application\.kubesphere\.io/repo-name + name: repo + type: string + - jsonPath: .metadata.labels.kubesphere\.io/workspace + name: workspace + type: string + - jsonPath: .metadata.labels.application\.kubesphere\.io/app-id + name: app + type: string + - jsonPath: .spec.appType + name: appType + type: string - jsonPath: .status.state name: State type: string diff --git a/src/test/ks-core/crds/application.kubesphere.io_repos.yaml b/src/test/ks-core/crds/application.kubesphere.io_repos.yaml index cf1e6e25..fd6054a4 100644 --- a/src/test/ks-core/crds/application.kubesphere.io_repos.yaml +++ b/src/test/ks-core/crds/application.kubesphere.io_repos.yaml @@ -80,8 +80,6 @@ spec: type: object description: type: string - global: - type: boolean syncPeriod: type: integer url: diff --git a/src/test/ks-core/crds/kubesphere.io_extensionversions.yaml b/src/test/ks-core/crds/kubesphere.io_extensionversions.yaml index 29493883..1fa7c4c5 100644 --- a/src/test/ks-core/crds/kubesphere.io_extensionversions.yaml +++ b/src/test/ks-core/crds/kubesphere.io_extensionversions.yaml @@ -82,8 +82,6 @@ spec: additionalProperties: type: string type: object - docs: - type: string externalDependencies: description: ExternalDependencies items: diff --git a/src/test/ks-core/files/extensions.customresourcefilters.rego b/src/test/ks-core/files/extensions.customresourcefilters.rego new file mode 100644 index 00000000..cdd01b11 --- /dev/null +++ b/src/test/ks-core/files/extensions.customresourcefilters.rego @@ -0,0 +1,72 @@ +package filter + +import rego.v1 + +default match := false + +match if { + not listAvailableExtension + not fuzzySearch + not installStatusSearch + not enabledStatusSearch +} + +match if { + listAvailableExtension + isSubscribed +} + +match if { + listAvailableExtension + alreadyInstalled +} + +match if { + listAvailableExtension + not hasExtensionID +} + +match if { + fuzzySearch + displayNameMatch +} + +match if { + installStatusSearch + installStatusMatch +} + +match if { + enabledStatusSearch + enabledStatusMatch +} + +fuzzySearch if "q" == input.filter.field + +installStatusSearch if "status" == input.filter.field + +enabledStatusSearch if "enabled" == input.filter.field + +listAvailableExtension if "available" == input.filter.field + +isSubscribed if input.object.metadata.labels["marketplace.kubesphere.io/subscribed"] == "true" + +alreadyInstalled if input.object.status.state != "" + +hasExtensionID if input.object.metadata.labels["marketplace.kubesphere.io/extension-id"] != "" + +displayNameMatch if { + contains(lower(input.object.spec.displayName[_]), lower(input.filter.value)) +} + +nameMatch if { + contains(lower(input.object.metadata.name), lower(input.filter.value)) +} + +installStatusMatch if { + lower(input.object.status.state) == lower(input.filter.value) +} + +enabledStatusMatch if { + input.filter.value == "true" == input.object.status.enabled +} diff --git a/src/test/ks-core/scripts/post-delete.sh b/src/test/ks-core/scripts/post-delete.sh index f6a2a10e..c5d5f618 100755 --- a/src/test/ks-core/scripts/post-delete.sh +++ b/src/test/ks-core/scripts/post-delete.sh @@ -17,3 +17,11 @@ do kubectl delete crd $crd 2>/dev/null; fi done + + +EXTENSION_RELATED_RESOURCES='jobs.batch roles.rbac.authorization.k8s.io rolebindings.rbac.authorization.k8s.io clusterroles.rbac.authorization.k8s.io clusterrolebindings.rbac.authorization.k8s.io' + +for resource in $EXTENSION_RELATED_RESOURCES;do + echo "kubectl delete $resource -l kubesphere.io/extension-ref --all-namespaces" + kubectl delete $resource -l kubesphere.io/managed=true --all-namespaces +done diff --git a/src/test/ks-core/templates/customresourcefilters.yaml b/src/test/ks-core/templates/customresourcefilters.yaml index 12f73cfc..00015698 100644 --- a/src/test/ks-core/templates/customresourcefilters.yaml +++ b/src/test/ks-core/templates/customresourcefilters.yaml @@ -6,38 +6,7 @@ stringData: version: "v1alpha1" kind: "Extension" regoPolicy: | - package filter - - import rego.v1 - - default match := false - - match if { - not listAvailableExtension - } - - match if { - listAvailableExtension - isSubscribed - } - - match if { - listAvailableExtension - isInstalled - } - - match if { - listAvailableExtension - not hasExtensionID - } - - listAvailableExtension if ["available"][_] == input.filter.field - - isSubscribed if input.object.metadata.labels["marketplace.kubesphere.io/subscribed"] == "true" - - isInstalled if input.object.status.state != "" - - hasExtensionID if input.object.metadata.labels["marketplace.kubesphere.io/extension-id"] != "" +{{ .Files.Get "files/extensions.customresourcefilters.rego" | indent 6 }} kind: Secret metadata: name: extensions.customresourcefilters.kubesphere diff --git a/src/test/ks-core/templates/globalroles.yaml b/src/test/ks-core/templates/globalroles.yaml index dff003ae..f0e36e67 100644 --- a/src/test/ks-core/templates/globalroles.yaml +++ b/src/test/ks-core/templates/globalroles.yaml @@ -129,13 +129,6 @@ rules: verbs: - get - list - - apiGroups: - - license.kubesphere.io - resources: - - licenses - verbs: - - get - - list - apiGroups: - cluster.kubesphere.io resources: diff --git a/src/test/ks-core/templates/webhook.yaml b/src/test/ks-core/templates/webhook.yaml index 0fd1e180..a9021abd 100644 --- a/src/test/ks-core/templates/webhook.yaml +++ b/src/test/ks-core/templates/webhook.yaml @@ -317,38 +317,6 @@ webhooks: --- apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - name: license.kubesphere.io -webhooks: - - admissionReviewVersions: - - v1 - clientConfig: - caBundle: {{ b64enc $ca.Cert | quote }} - service: - name: ks-controller-manager - namespace: kubesphere-system - path: /license-cluster-checker - port: 443 - name: license-cluster-checker.kubesphere.io - failurePolicy: Ignore - matchPolicy: Exact - namespaceSelector: {} - objectSelector: {} - rules: - - apiGroups: - - cluster.kubesphere.io - apiVersions: - - v1alpha1 - operations: - - CREATE - resources: - - clusters - scope: '*' - sideEffects: None - timeoutSeconds: 30 ---- -apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: name: defaulter.config.kubesphere.io