diff --git a/src/test/ks-core/Chart.yaml b/src/test/ks-core/Chart.yaml index 4378bb5a..4d6819d9 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.10 +version: 0.6.11 # 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 de13b99c..9d27b83d 100644 --- a/src/test/ks-core/crds/application.kubesphere.io_applicationreleases.yaml +++ b/src/test/ks-core/crds/application.kubesphere.io_applicationreleases.yaml @@ -83,10 +83,7 @@ spec: status: description: ApplicationReleaseStatus defines the observed state of ApplicationRelease properties: - jobName: - type: string - lastDeployed: - format: date-time + installJobName: type: string lastUpdate: format: date-time @@ -103,11 +100,11 @@ spec: type: string type: array specHash: - description: This is used to compare whether the spec has been modified - to determine if an upgrade is needed. type: string state: type: string + uninstallJobName: + type: string required: - state type: object 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 ce416aae..020bcb96 100644 --- a/src/test/ks-core/crds/application.kubesphere.io_applicationversions.yaml +++ b/src/test/ks-core/crds/application.kubesphere.io_applicationversions.yaml @@ -84,6 +84,8 @@ spec: type: string type: object type: array + pullUrl: + type: string versionName: type: string required: diff --git a/src/test/ks-core/crds/kubesphere.io_extensions.yaml b/src/test/ks-core/crds/kubesphere.io_extensions.yaml index 655d2fec..9579c30e 100644 --- a/src/test/ks-core/crds/kubesphere.io_extensions.yaml +++ b/src/test/ks-core/crds/kubesphere.io_extensions.yaml @@ -252,6 +252,10 @@ spec: - type type: object type: array + enabled: + type: boolean + installedVersion: + type: string plannedInstallVersion: type: string recommendedVersion: diff --git a/src/test/ks-core/crds/kubesphere.io_extensionversions.yaml b/src/test/ks-core/crds/kubesphere.io_extensionversions.yaml index 29493883..0ca41e9f 100644 --- a/src/test/ks-core/crds/kubesphere.io_extensionversions.yaml +++ b/src/test/ks-core/crds/kubesphere.io_extensionversions.yaml @@ -95,7 +95,7 @@ spec: description: Indicates if the dependency is required type: boolean type: - description: Type of dependency, default to extension + description: Type of dependency, defaults to extension type: string version: description: SemVer diff --git a/src/test/ks-core/crds/kubesphere.io_installplans.yaml b/src/test/ks-core/crds/kubesphere.io_installplans.yaml index 442471d4..cd163f4a 100644 --- a/src/test/ks-core/crds/kubesphere.io_installplans.yaml +++ b/src/test/ks-core/crds/kubesphere.io_installplans.yaml @@ -300,6 +300,8 @@ spec: - type type: object type: array + enabled: + type: boolean jobName: type: string releaseName: diff --git a/src/test/ks-core/scripts/post-delete.sh b/src/test/ks-core/scripts/post-delete.sh index c5d5f618..fb466643 100755 --- a/src/test/ks-core/scripts/post-delete.sh +++ b/src/test/ks-core/scripts/post-delete.sh @@ -3,6 +3,22 @@ # set -x CRD_NAMES=$1 +MAPPING_CONFIG=$2 + +for extension in `kubectl get extension | grep 'Installed' | awk '{print $1}'` +do + version=$(kubectl get extension $extension -o=jsonpath='{.status.installedVersion}') + extensionversion=$extension-$version + echo "Found extension $extensionversion installed" + helm status $extension --namespace extension-$extension + if [ $? -eq 0 ]; then + helm mapkubeapis $extension --namespace extension-$extension --mapfile $MAPPING_CONFIG + fi + helm status $extension-agent --namespace extension-$extension + if [ $? -eq 0 ]; then + helm mapkubeapis $extension-agent --namespace extension-$extension --mapfile $MAPPING_CONFIG + fi +done # delete crds for crd in `kubectl get crds -o jsonpath="{.items[*].metadata.name}"` diff --git a/src/test/ks-core/templates/ks-agent.yml b/src/test/ks-core/templates/ks-agent.yml index c187f948..0bb0efe9 100644 --- a/src/test/ks-core/templates/ks-agent.yml +++ b/src/test/ks-core/templates/ks-agent.yml @@ -22,6 +22,9 @@ spec: tier: backend template: metadata: + annotations: + # force restart ks-agent after the upgrade is complete (even if there is no update) + kubesphere.io/update-time: {{ dateInZone "2006-01-02T15:05:05Z" (now) "UTC"| quote }} labels: app: ks-agent tier: backend diff --git a/src/test/ks-core/templates/post-delete-job.yaml b/src/test/ks-core/templates/post-delete-job.yaml index 4a7e7d9e..79096dd7 100644 --- a/src/test/ks-core/templates/post-delete-job.yaml +++ b/src/test/ks-core/templates/post-delete-job.yaml @@ -1,3 +1,4 @@ +{{- $kubeVersion := .Capabilities.KubeVersion }} apiVersion: v1 kind: ConfigMap metadata: @@ -7,6 +8,15 @@ metadata: "helm.sh/hook-weight": "-1" "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed data: + map.yaml: | + mappings: + {{- range $path, $_ := .Files.Glob "crds/**" }} + {{- $crd := $.Files.Get $path | fromYaml }} + {{- range $_, $version := $crd.spec.versions }} + - deprecatedAPI: "apiVersion: {{ $crd.spec.group }}/{{ $version.name }}\nkind: {{ $crd.spec.names.kind }}\n" + removedInVersion: "{{ $kubeVersion }}" + {{- end }} + {{- end }} {{ (.Files.Glob "scripts/post-delete.sh").AsConfig | indent 2 }} --- @@ -67,6 +77,7 @@ spec: - /bin/bash - /scripts/post-delete.sh - '{{ join " " $crdNameList }}' + - /scripts/map.yaml volumeMounts: - mountPath: /scripts name: scripts diff --git a/src/test/ks-core/templates/webhook.yaml b/src/test/ks-core/templates/webhook.yaml index 0349452d..0c3d0511 100644 --- a/src/test/ks-core/templates/webhook.yaml +++ b/src/test/ks-core/templates/webhook.yaml @@ -249,40 +249,7 @@ webhooks: timeoutSeconds: 30 --- -apiVersion: admissionregistration.k8s.io/v1 -kind: MutatingWebhookConfiguration -metadata: - name: applicationreleases.application.kubesphere.io -webhooks: - - admissionReviewVersions: - - v1 - clientConfig: - caBundle: {{ b64enc $ca.Cert | quote }} - service: - name: ks-controller-manager - namespace: kubesphere-system - path: /mutate-application-kubesphere-io-v2-applicationrelease - port: 443 - failurePolicy: Fail - matchPolicy: Exact - name: applicationreleases.application.kubesphere.io - namespaceSelector: {} - objectSelector: {} - rules: - - apiGroups: - - application.kubesphere.io - apiVersions: - - v2 - operations: - - CREATE - - UPDATE - resources: - - applicationreleases - scope: '*' - sideEffects: None - timeoutSeconds: 30 ---- apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: