diff --git a/ci/upgrade/setup.sh b/ci/upgrade/setup.sh index 3c5cdb50..d973141f 100755 --- a/ci/upgrade/setup.sh +++ b/ci/upgrade/setup.sh @@ -47,3 +47,5 @@ kubectl apply -f https://raw.githubusercontent.com/openebs/cstor-operators/maste -f ./ci/upgrade/cstor-operator.yaml sleep 10 kubectl wait --for=condition=available --timeout=300s deployment/cspc-operator -n openebs + +kubectl apply -f ./ci/upgrade/upgradetaskCRD.yaml diff --git a/ci/upgrade/upgradetaskCRD.yaml b/ci/upgrade/upgradetaskCRD.yaml new file mode 100644 index 00000000..479a4a79 --- /dev/null +++ b/ci/upgrade/upgradetaskCRD.yaml @@ -0,0 +1,270 @@ +# Copyright © 2020 The OpenEBS Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.4.0 + creationTimestamp: null + name: upgradetasks.openebs.io +spec: + group: openebs.io + names: + kind: UpgradeTask + listKind: UpgradeTaskList + plural: upgradetasks + singular: upgradetask + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: UpgradeTask represents an upgrade task + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: Spec i.e. specifications of the UpgradeTask + properties: + cstorPool: + description: CStorPool contains the details of the cstor pool to be + upgraded + properties: + options: + description: Options can be used to change the default behaviour + of upgrade + properties: + ignoreStepsOnError: + description: IgnoreStepsOnError allows to ignore steps which + failed + items: + type: string + type: array + type: object + poolName: + description: PoolName contains the name of the cstor pool to be + upgraded + type: string + type: object + cstorPoolCluster: + description: CStorPoolCluster contains the details of the storage + pool claim to be upgraded + properties: + cspcName: + description: CSPCName contains the name of the storage pool claim + to be upgraded + type: string + options: + description: Options can be used to change the default behaviour + of upgrade + properties: + ignoreStepsOnError: + description: IgnoreStepsOnError allows to ignore steps which + failed + items: + type: string + type: array + type: object + type: object + cstorPoolInstance: + description: CStorPoolInstance contains the details of the cstor pool + to be upgraded + properties: + cspiName: + description: CSPCName contains the name of the storage pool claim + to be upgraded + type: string + options: + description: Options can be used to change the default behaviour + of upgrade + properties: + ignoreStepsOnError: + description: IgnoreStepsOnError allows to ignore steps which + failed + items: + type: string + type: array + type: object + type: object + cstorVolume: + description: CStorVolume contains the details of the cstor volume + to be upgraded + properties: + options: + description: Options can be used to change the default behaviour + of upgrade + properties: + ignoreStepsOnError: + description: IgnoreStepsOnError allows to ignore steps which + failed + items: + type: string + type: array + type: object + pvName: + description: PVName contains the name of the pv associated with + the cstor volume + type: string + type: object + fromVersion: + description: FromVersion is the current version of the resource. + type: string + imagePrefix: + description: ImagePrefix contains the url prefix of the image url. + This field is optional. If not present upgrade takes the previously + present ImagePrefix. + type: string + imageTag: + description: ImageTag contains the customized tag for ToVersion if + any. This field is optional. If not present upgrade takes the ToVersion + as the ImageTag + type: string + jivaVolume: + description: JivaVolume contains the details of the jiva volume to + be upgraded + properties: + options: + description: Options can be used to change the default behaviour + of upgrade + properties: + ignoreStepsOnError: + description: IgnoreStepsOnError allows to ignore steps which + failed + items: + type: string + type: array + type: object + pvName: + description: PVName contains the name of the pv associated with + the jiva volume + type: string + type: object + options: + description: Options contains the optional flags that can be passed + during upgrade. + properties: + timeout: + description: Timeout is maximum seconds to wait at any given step + in the upgrade + type: integer + type: object + storagePoolClaim: + description: StoragePoolClaim contains the details of the storage + pool claim to be upgraded + properties: + options: + description: Options can be used to change the default behaviour + of upgrade + properties: + ignoreStepsOnError: + description: IgnoreStepsOnError allows to ignore steps which + failed + items: + type: string + type: array + type: object + spcName: + description: SPCName contains the name of the storage pool claim + to be upgraded + type: string + type: object + toVersion: + description: ToVersion is the upgraded version of the resource. It + should be same as the version of control plane components version. + type: string + required: + - fromVersion + - toVersion + type: object + status: + description: Status of UpgradeTask + properties: + completedTime: + description: CompletedTime of Upgrade + format: date-time + nullable: true + type: string + phase: + description: Phase indicates if a upgradeTask is started, success + or errored + type: string + retries: + description: Retries is the number of times the job attempted to upgrade + the resource + type: integer + startTime: + description: StartTime of Upgrade + format: date-time + nullable: true + type: string + upgradeDetailedStatuses: + description: UpgradeDetailedStatuses contains the list of statuses + of each step + items: + description: UpgradeDetailedStatuses represents the latest available + observations of a UpgradeTask current state. + properties: + lastUpdatedAt: + description: LastUpdatedTime of a UpgradeStep + format: date-time + nullable: true + type: string + message: + description: A human-readable message indicating details about + why the upgradeStep is in this state + type: string + phase: + description: Phase indicates if the UpgradeStep is waiting, + errored or completed. + type: string + reason: + description: Reason is a brief CamelCase string that describes + any failure and is meant for machine parsing and tidy display + in the CLI + type: string + startTime: + description: StartTime of a UpgradeStep + format: date-time + nullable: true + type: string + step: + description: UpgradeStep is the current step being performed + for a particular resource upgrade + type: string + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/go.mod b/go.mod index 4a0864c5..4abb45d9 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.14 require ( github.com/google/go-cmp v0.4.0 github.com/kubernetes-csi/external-snapshotter/v2 v2.1.1 - github.com/openebs/api/v2 v2.1.0 + github.com/openebs/api/v2 v2.2.1-0.20210127083022-3d3257dd6a71 github.com/openebs/maya v0.0.0-20200602143918-71415115098d github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.0.0 diff --git a/go.sum b/go.sum index 7e5c4dc7..de62f5f4 100644 --- a/go.sum +++ b/go.sum @@ -176,8 +176,8 @@ github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/openebs/api/v2 v2.1.0 h1:2DPzT93t2r76MXTUGbTCcBIhM5x+KXDsC04cNossMLU= -github.com/openebs/api/v2 v2.1.0/go.mod h1:CTvN3qWesanPiu7KWouKPN70nL4DyUwITfyjiO/85cs= +github.com/openebs/api/v2 v2.2.1-0.20210127083022-3d3257dd6a71 h1:VxNxsSedwpx/J6bbnHtHZzU6YvU16+wFYDamed0ppiM= +github.com/openebs/api/v2 v2.2.1-0.20210127083022-3d3257dd6a71/go.mod h1:CTvN3qWesanPiu7KWouKPN70nL4DyUwITfyjiO/85cs= github.com/openebs/maya v0.0.0-20200602143918-71415115098d h1:o8RIc8RzeZkUlzYM+Sg07wRdekIHytCTMaAhFl8Yams= github.com/openebs/maya v0.0.0-20200602143918-71415115098d/go.mod h1:QQY9cOHKQwZ73qbv6O//UYUBLNV2S0MRDIfG7t5KOCk= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= diff --git a/pkg/version/util.go b/pkg/version/util.go index 7fc27e2e..d385c917 100644 --- a/pkg/version/util.go +++ b/pkg/version/util.go @@ -24,7 +24,7 @@ var ( validCurrentVersions = map[string]bool{ "1.10.0": true, "1.11.0": true, "1.12.0": true, "2.0.0": true, "2.1.0": true, "2.2.0": true, "2.3.0": true, - "2.4.0": true, "2.4.1": true, "2.5.0": true, + "2.4.0": true, "2.4.1": true, "2.5.0": true, "2.6.0": true, } validDesiredVersion = strings.Split(GetVersion(), "-")[0] ) diff --git a/vendor/github.com/openebs/api/v2/pkg/apis/openebs.io/v1alpha1/upgradetask_types.go b/vendor/github.com/openebs/api/v2/pkg/apis/openebs.io/v1alpha1/upgradetask_types.go index 1aa1d1da..317fd3f7 100644 --- a/vendor/github.com/openebs/api/v2/pkg/apis/openebs.io/v1alpha1/upgradetask_types.go +++ b/vendor/github.com/openebs/api/v2/pkg/apis/openebs.io/v1alpha1/upgradetask_types.go @@ -32,7 +32,7 @@ type UpgradeTask struct { // Spec i.e. specifications of the UpgradeTask Spec UpgradeTaskSpec `json:"spec"` // Status of UpgradeTask - Status UpgradeTaskStatus `json:"status"` + Status UpgradeTaskStatus `json:"status,omitempty"` } // UpgradeTaskSpec is the properties of an upgrade task @@ -48,10 +48,10 @@ type UpgradeTaskSpec struct { ResourceSpec `json:",inline"` // ImagePrefix contains the url prefix of the image url. This field is // optional. If not present upgrade takes the previously present ImagePrefix. - ImagePrefix string `json:"imagePrefix"` + ImagePrefix string `json:"imagePrefix,omitempty"` // ImageTag contains the customized tag for ToVersion if any. This field is // optional. If not present upgrade takes the ToVersion as the ImageTag - ImageTag string `json:"imageTag"` + ImageTag string `json:"imageTag,omitempty"` } // Options provides additional optional arguments @@ -136,13 +136,15 @@ type UpgradeTaskStatus struct { // Phase indicates if a upgradeTask is started, success or errored Phase UpgradePhase `json:"phase,omitempty"` // StartTime of Upgrade + // +nullable StartTime metav1.Time `json:"startTime,omitempty"` // CompletedTime of Upgrade + // +nullable CompletedTime metav1.Time `json:"completedTime,omitempty"` // UpgradeDetailedStatuses contains the list of statuses of each step UpgradeDetailedStatuses []UpgradeDetailedStatuses `json:"upgradeDetailedStatuses,omitempty"` // Retries is the number of times the job attempted to upgrade the resource - Retries int `json:"retries"` + Retries int `json:"retries,omitempty"` } // UpgradeDetailedStatuses represents the latest available observations @@ -150,8 +152,10 @@ type UpgradeTaskStatus struct { type UpgradeDetailedStatuses struct { Step UpgradeStep `json:"step,omitempty"` // StartTime of a UpgradeStep + // +nullable StartTime metav1.Time `json:"startTime,omitempty"` // LastUpdatedTime of a UpgradeStep + // +nullable LastUpdatedTime metav1.Time `json:"lastUpdatedAt,omitempty"` // Status of a UpgradeStep Status `json:",inline"` diff --git a/vendor/github.com/openebs/api/v2/pkg/util/env.go b/vendor/github.com/openebs/api/v2/pkg/util/env.go index 1ff45056..8e940b24 100644 --- a/vendor/github.com/openebs/api/v2/pkg/util/env.go +++ b/vendor/github.com/openebs/api/v2/pkg/util/env.go @@ -37,7 +37,7 @@ const ( // This environment variable is set via kubernetes downward API Namespace = "NAMESPACE" - // DefaultOpenEBSServiceAccount name of the default openebs service accout with + // DefaultOpenEBSServiceAccount name of the default openebs service account with // required permissions DefaultOpenEBSServiceAccount = "openebs-maya-operator" @@ -47,6 +47,9 @@ const ( // This environment variable is set via kubernetes downward API in cvc and // cspc operators deployments OpenEBSServiceAccount = "OPENEBS_SERVICEACCOUNT_NAME" + + // OpenEBSImagePullSecret is the environment variable that provides the image pull secrets + OpenEBSImagePullSecret = "OPENEBS_IO_IMAGE_PULL_SECRETS" ) // LookupOrFalse looks up an environment variable and returns a string "false" @@ -97,3 +100,8 @@ func GetServiceAccountName() string { } return name } + +// GetOpenEBSImagePullSecrets gets the image pull secrets as string from the environment variable +func GetOpenEBSImagePullSecrets() string { + return os.Getenv(OpenEBSImagePullSecret) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 75dd603a..b6c28904 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -49,7 +49,7 @@ github.com/matttproud/golang_protobuf_extensions/pbutil github.com/modern-go/concurrent # github.com/modern-go/reflect2 v1.0.1 github.com/modern-go/reflect2 -# github.com/openebs/api/v2 v2.1.0 +# github.com/openebs/api/v2 v2.2.1-0.20210127083022-3d3257dd6a71 ## explicit github.com/openebs/api/v2/pkg/apis/cstor github.com/openebs/api/v2/pkg/apis/cstor/v1