From c1e26dd9d8ab57da6daa35a94ca5caccbe9cffa6 Mon Sep 17 00:00:00 2001 From: annastopel Date: Thu, 27 Jun 2019 14:16:51 +0300 Subject: [PATCH] * convert olm bundle manifets' tree to operator-registry tree * support case when olm bundle contains more than one crd version --- Makefile | 6 +- glide.lock | 14 +- glide.yaml | 4 + hack/build/build-cdi-olm-catalog.sh | 66 +- tools/cdi-olm-catalog/olm-csv-tool.go | 233 +++ .../github.com/appscode/jsonpatch/.gitignore | 3 +- .../github.com/appscode/jsonpatch/.travis.yml | 10 +- .../appscode/jsonpatch/CHANGELOG.md | 39 + .../github.com/appscode/jsonpatch/README.md | 19 +- vendor/github.com/appscode/jsonpatch/go.mod | 11 +- vendor/github.com/appscode/jsonpatch/go.sum | 15 +- .../appscode/jsonpatch/jsonpatch.go | 8 +- .../appscode/jsonpatch/jsonpatch_json_test.go | 2 +- .../appscode/jsonpatch/jsonpatch_test.go | 71 +- .../github.com/appscode/jsonpatch/v2/go.mod | 9 + .../github.com/appscode/jsonpatch/v2/go.sum | 11 + .../appscode/jsonpatch/v2/jsonpatch.go | 336 ++++ .../jsonpatch/v2/jsonpatch_json_test.go | 33 + .../appscode/jsonpatch/v2/jsonpatch_test.go | 874 +++++++++ .../api/apis/operators/catalogsource_types.go | 115 ++ .../operators/clusterserviceversion_types.go | 488 +++++ .../pkg/api/apis/operators/doc.go | 5 + .../pkg/api/apis/operators/install/install.go | 18 + .../api/apis/operators/installplan_types.go | 248 +++ .../api/apis/operators/operatorgroup_types.go | 75 + .../api/apis/operators/reference/reference.go | 22 + .../operators/reference/reference_test.go | 295 +++ .../pkg/api/apis/operators/register.go | 50 + .../api/apis/operators/subscription_types.go | 264 +++ .../pkg/api/apis/operators/v1/doc.go | 6 + .../apis/operators/v1/operatorgroup_types.go | 74 + .../pkg/api/apis/operators/v1/register.go | 49 + .../operators/v1/zz_generated.conversion.go | 182 ++ .../operators/v1/zz_generated.deepcopy.go | 136 ++ .../operators/v1alpha1/catalogsource_types.go | 117 ++ .../v1alpha1/clusterserviceversion.go | 208 +++ .../v1alpha1/clusterserviceversion_test.go | 376 ++++ .../v1alpha1/clusterserviceversion_types.go | 500 +++++ .../pkg/api/apis/operators/v1alpha1/doc.go | 6 + .../operators/v1alpha1/installplan_types.go | 251 +++ .../api/apis/operators/v1alpha1/register.go | 55 + .../operators/v1alpha1/subscription_types.go | 266 +++ .../api/apis/operators/v1alpha1/types_test.go | 104 ++ .../v1alpha1/zz_generated.conversion.go | 1603 +++++++++++++++++ .../v1alpha1/zz_generated.deepcopy.go | 1108 ++++++++++++ .../apis/operators/zz_generated.deepcopy.go | 1218 +++++++++++++ .../pkg/lib/version/version.go | 66 + .../pkg/lib/version/version_test.go | 77 + 48 files changed, 9709 insertions(+), 37 deletions(-) create mode 100644 tools/cdi-olm-catalog/olm-csv-tool.go create mode 100644 vendor/github.com/appscode/jsonpatch/CHANGELOG.md create mode 100644 vendor/github.com/appscode/jsonpatch/v2/go.mod create mode 100644 vendor/github.com/appscode/jsonpatch/v2/go.sum create mode 100644 vendor/github.com/appscode/jsonpatch/v2/jsonpatch.go create mode 100644 vendor/github.com/appscode/jsonpatch/v2/jsonpatch_json_test.go create mode 100644 vendor/github.com/appscode/jsonpatch/v2/jsonpatch_test.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/catalogsource_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/clusterserviceversion_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/install/install.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/installplan_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/operatorgroup_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/reference/reference.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/reference/reference_test.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/register.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/subscription_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/operatorgroup_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/register.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/zz_generated.conversion.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/zz_generated.deepcopy.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/catalogsource_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_test.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/doc.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/installplan_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/register.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/subscription_types.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/types_test.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.conversion.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/zz_generated.deepcopy.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/version/version.go create mode 100644 vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/version/version_test.go diff --git a/Makefile b/Makefile index 71e5c5c391..c92c125313 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ #See the License for the specific language governing permissions and #limitations under the License. -.PHONY: build build-controller build-importer build-cloner build-apiserver build-uploadproxy build-uploadserver build-operator build-functest-file-image-init build-functest-registry-image-init build-functest \ +.PHONY: build build-controller build-importer build-cloner build-apiserver build-uploadproxy build-uploadserver build-operator build-functest-file-image-init build-functest-registry-image-init build-cdi-olm-catalog build-functest \ docker docker-controller docker-cloner docker-importer docker-apiserver docker-uploadproxy docker-uploadserver docker-operator docker-functest-image-init docker-functest-image-http docker-functest-registry-populate docker-functest-registry docker-functest-registry-init \ cluster-up cluster-down cluster-sync cluster-sync-controller cluster-sync-cloner cluster-sync-importer cluster-sync-apiserver cluster-sync-uploadproxy cluster-sync-uploadserver \ olm-verify olm-push \ @@ -51,7 +51,7 @@ apidocs: ${DO} "./hack/update-codegen.sh && ./hack/gen-swagger-doc/gen-swagger-docs.sh v1alpha1 html" build: - ${DO} "DOCKER_REPO=${DOCKER_REPO} DOCKER_TAG=${DOCKER_TAG} VERBOSITY=${VERBOSITY} PULL_POLICY=${PULL_POLICY} QUAY_NAMESPACE=${QUAY_NAMESPACE} QUAY_REPOSITORY=${QUAY_REPOSITORY} CSV_VERSION=${CSV_VERSION} ./hack/build/build-go.sh clean && ./hack/build/build-go.sh build ${WHAT} && ./hack/build/build-cdi-func-test-file-host.sh && ./hack/build/build-cdi-func-test-registry-host.sh && ./hack/build/build-cdi-olm-catalog.sh && ./hack/build/build-copy-artifacts.sh ${WHAT}" + ${DO} "DOCKER_REPO=${DOCKER_REPO} DOCKER_TAG=${DOCKER_TAG} VERBOSITY=${VERBOSITY} PULL_POLICY=${PULL_POLICY} QUAY_NAMESPACE=${QUAY_NAMESPACE} QUAY_REPOSITORY=${QUAY_REPOSITORY} CSV_VERSION=${CSV_VERSION} ./hack/build/build-go.sh clean && ./hack/build/build-go.sh build ${WHAT} && ./hack/build/build-cdi-func-test-file-host.sh && ./hack/build/build-cdi-func-test-registry-host.sh && ./hack/build/build-copy-artifacts.sh ${WHAT}" build-controller: WHAT = cmd/cdi-controller build-controller: build @@ -67,6 +67,8 @@ build-cloner: WHAT = cmd/cdi-cloner build-cloner: build build-operator: WHAT = cmd/cdi-operator build-operator: build +build-cdi-olm-catalog: WHAT = tools/cdi-olm-catalog +build-cdi-olm-catalog: build build-functest-file-image-init: WHAT = tools/cdi-func-test-file-host-init build-functest-file-image-init: build-functest-registry-image-init: WHAT= tools/cdi-func-test-registry-init diff --git a/glide.lock b/glide.lock index 380ba8ede8..c27113e11f 100644 --- a/glide.lock +++ b/glide.lock @@ -1,14 +1,16 @@ -hash: 0e72fc1b3276effcddfeddfcadb0245b25448a0a02997e38eb6be6f3296cb0f4 -updated: 2019-06-24T18:59:38.106669179Z +hash: 3b7f147f88ea81ed85e278d641744b9540e6a601f9872e5151f488299bbaa167 +updated: 2019-06-27T09:01:47.768925038Z imports: - name: github.com/appscode/jsonpatch - version: 7c0e3b262f30165a8ec3d0b4c6059fd92703bfb2 + version: e8422f09d27ee2c8cfb2c7f8089eb9eeb0764849 - name: github.com/asaskevich/govalidator version: f9ffefc3facfbe0caee3fea233cbb6e8208f4541 - name: github.com/beorn7/perks version: 3ac7bf7a47d159a033b107610db8a1b6575507a4 subpackages: - quantile +- name: github.com/blang/semver + version: 1a9109f8c4a1d669a78442f567dfe8eedf982793 - name: github.com/davecgh/go-spew version: 782f4967f2dc4564575ca782fe2d04090b5faca8 subpackages: @@ -222,6 +224,12 @@ imports: - appregistry/info - appregistry/package_appr - models +- name: github.com/operator-framework/operator-lifecycle-manager + version: 73c00f855607f246bfb413566bff78e404eb8302 + subpackages: + - pkg/api/apis/operators + - pkg/api/apis/operators/v1alpha1 + - pkg/lib/version - name: github.com/operator-framework/operator-marketplace version: 1cbd326243493ff9ec589a542fa335fdc84dc3e7 subpackages: diff --git a/glide.yaml b/glide.yaml index 6b2ee20ae0..b6d9a8d841 100644 --- a/glide.yaml +++ b/glide.yaml @@ -5,6 +5,10 @@ import: subpackages: - pkg/appregistry version: 1cbd326243493ff9ec589a542fa335fdc84dc3e7 +- package: github.com/operator-framework/operator-lifecycle-manager + subpackages: + - pkg/api/apis/operators/v1alpha1 + version: 73c00f855607f246bfb413566bff78e404eb8302 - package: github.com/gorilla/mux version: ^1.6.1 - package: github.com/minio/minio-go diff --git a/hack/build/build-cdi-olm-catalog.sh b/hack/build/build-cdi-olm-catalog.sh index bb1cfdbb50..49aeae2f4b 100755 --- a/hack/build/build-cdi-olm-catalog.sh +++ b/hack/build/build-cdi-olm-catalog.sh @@ -27,34 +27,94 @@ OLM_CATALOG_OUT_PATH=${OUT_PATH}/${OLM_CATALOG_INIT_PATH} OLM_MANIFESTS_SRC_PATH=${OUT_PATH}/manifests/release/olm/bundle OLM_MANIFESTS_DIR=olm-catalog OLM_PACKAGE=${QUAY_REPOSITORY} +OLM_TMP_CRDS=${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR}/${OLM_PACKAGE}/crds #create directory for olm catalog container mkdir -p "${OLM_CATALOG_OUT_PATH}" +#extract CRD version supported by given CSV +function getCSVCRDVersion { + csv=$1 + local crdVersion + crdVersion=$(${OLM_CATALOG_OUT_PATH}/cdi-olm-catalog --cmd get-csv-crd-version --csv-file $csv --crd-kind "CDI") + echo $crdVersion +} + +#locate CRD file with the provided version +function getCRD { + crdversion=$1 + crdslocation=$2 + + local crdfilename + crdfilename="none" + for crd in $(ls $crdslocation); do + if [[ $crd =~ "crd" ]]; then + if [[ $(${OLM_CATALOG_OUT_PATH}/cdi-olm-catalog --cmd get-crd-version --crd-file $crdslocation/$crd --crd-kind "CDI") == "$crdVersion" ]]; then + crdfilename=$crd + break + fi + fi + done + + if [ "$crdfilename" = "none" ]; then + echo "Error: No matching CRD for version "$crdversion + exit -1 + fi + echo $crdfilename +} + #copy OLM manifests of a provided csv version to a dedicated directory function packBundle { csv=$1 - mkdir -p ${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR}/${OLM_PACKAGE=}/${csv} + crds=$2 + + mkdir -p ${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR}/${OLM_PACKAGE}/${csv} cp ${OLM_MANIFESTS_SRC_PATH}/${csv} ${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR}/${OLM_PACKAGE}/${csv} - cp ${OLM_MANIFESTS_SRC_PATH}/*crd* ${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR}/${OLM_PACKAGE}/${csv} + + crdVersion=$(getCSVCRDVersion "${OLM_MANIFESTS_SRC_PATH}/${csv}") + crdFile=$(getCRD $crdVersion $crds) + + cp $crds/$crdFile ${OLM_CATALOG_OUT_PATH}/${OLM_MANIFESTS_DIR}/${OLM_PACKAGE}/${csv}/cdi-crds.yaml +} + +#copy crds unified manifiest to temp location and split it into manifests per crd +function prepareCRDFiles { + crds=$1 + cur=$(pwd) + cp ${OLM_MANIFESTS_SRC_PATH}/*crds* $crds + cd $crds + csplit --digits=3 --quiet --elide-empty-files --prefix=cdi-crd --suffix-format=%03d.yaml $crds/cdi-crds.yaml "/--/" "{*}" + rm -rf $crds/cdi-crds.yaml + cd $cur + } #iterate over all OLM bundles and for each one build a dedicated directory function packBundles { + csvs=$1 + crds=${OLM_TMP_CRDS} + + mkdir -p $crds + prepareCRDFiles $crds + for csv in $(ls -1 $csvs); do if [[ $csv =~ "csv" ]]; then echo "pack bundle for CSV "${csv} - packBundle $csv + packBundle $csv $crds fi done + + #cleanup temp crds directory + rm -rf $crds } ${BUILD_DIR}/build-copy-artifacts.sh "${OLM_CATALOG_INIT_PATH}" #copy Dockerfile cp ${BUILD_DIR}/docker/${CDI_OLM_CATALOG}/* ${OLM_CATALOG_OUT_PATH}/ +cp "${OLM_CATALOG_INIT_PATH}"/* ${OLM_CATALOG_OUT_PATH}/ #Build directory structure expected by olm-catalog-registry # olm-catalog--- diff --git a/tools/cdi-olm-catalog/olm-csv-tool.go b/tools/cdi-olm-catalog/olm-csv-tool.go new file mode 100644 index 0000000000..c036b7ec0a --- /dev/null +++ b/tools/cdi-olm-catalog/olm-csv-tool.go @@ -0,0 +1,233 @@ +package main + +import ( + "errors" + "flag" + "fmt" + "io/ioutil" + "strings" + + "gopkg.in/yaml.v2" + + olm "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + extv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "k8s.io/klog" +) + +//CSVAnnotations - CSVAnnotations of OLM CSV manifest +type CSVAnnotations struct { + // AlmExamples is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. They are not + // queryable and should be preserved when modifying objects. + // More info: http://kubernetes.io/docs/user-guide/annotations + // +optional + AlmExamples map[string]string `json:"alm-examples,omitempty" protobuf:"bytes,12,rep,name=annotations"` + //Capabilities + Capabilites string `json:"capabilities,omitempty" protobuf:"bytes,1,opt,name=capabilities"` + //Categories + Categories string `json:"categories,omitempty" protobuf:"bytes,1,opt,name=categories"` + //Description + Description string `json:"description,omitempty" protobuf:"bytes,1,opt,name=description"` +} + +//CSVMetadata - CSVMetadata of OLM CSV manifest +type CSVMetadata struct { + // CSVAnnnotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. They are not + // queryable and should be preserved when modifying objects. + // More info: http://kubernetes.io/docs/user-guide/annotations + // +optional + CSVAnnnotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"` + + // Name must be unique within a namespace. Is required when creating resources, although + // some resources may allow a client to request the generation of an appropriate name + // automatically. Name is primarily intended for creation idempotence and configuration + // definition. + // Cannot be updated. + // More info: http://kubernetes.io/docs/user-guide/identifiers#names + // +optional + Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` + + // Namespace defines the space within each name must be unique. An empty namespace is + // equivalent to the "default" namespace, but "default" is the canonical representation. + // Not all objects are required to be scoped to a namespace - the value of this field for + // those objects will be empty. + // + // Must be a DNS_LABEL. + // Cannot be updated. + // More info: http://kubernetes.io/docs/user-guide/namespaces + // +optional + + Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` +} + +// ClusterServiceVersionSpec declarations tell OLM how to install an operator +// that can manage apps for a given version. +type ClusterServiceVersionSpec struct { + InstallStrategy olm.NamedInstallStrategy `json:"install"` + Version string `json:"version,omitempty"` + Maturity string `json:"maturity,omitempty"` + CustomResourceDefinitions olm.CustomResourceDefinitions `json:"customresourcedefinitions,omitempty"` + APIServiceDefinitions olm.APIServiceDefinitions `json:"apiservicedefinitions,omitempty"` + NativeAPIs []metav1.GroupVersionKind `json:"nativeAPIs,omitempty"` + MinKubeVersion string `json:"minKubeVersion,omitempty"` + DisplayName string `json:"displayName"` + Description string `json:"description,omitempty"` + Keywords []string `json:"keywords,omitempty"` + Maintainers []olm.Maintainer `json:"maintainers,omitempty"` + Provider olm.AppLink `json:"provider,omitempty"` + Links []olm.AppLink `json:"links,omitempty"` + Icon []olm.Icon `json:"icon,omitempty"` + + // InstallModes specify supported installation types + // +optional + InstallModes []olm.InstallMode `json:"installModes,omitempty"` + + // The name of a CSV this one replaces. Should match the `metadata.Name` field of the old CSV. + // +optional + Replaces string `json:"replaces,omitempty"` + + // Map of string keys and values that can be used to organize and categorize + // (scope and select) objects. + // +optional + Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,11,rep,name=labels"` + + // Annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. + // +optional + Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"` + + // Label selector for related resources. + // +optional + Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"` +} + +//CSVManifest - struct that represents CSV manifest +type CSVManifest struct { + APIVersion string `json:"apiVersion,omitempty"` + Kind string `json:"kind,omitempty"` + CSVMetadat CSVMetadata `json:"metadata,omitempty"` + Spec ClusterServiceVersionSpec `json:"spec,omitempty"` +} + +//CustomResourceDefinition - custome resouirce definition +type CustomResourceDefinition struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec describes how the user wants the resources to appear + Spec extv1beta1.CustomResourceDefinitionSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` +} + +func getCSVCRDVersion(csvFile, crdKind string) (string, error) { + var crdVersion string + var csvStruct CSVManifest + + yamlFile, err := ioutil.ReadFile(csvFile) + if err != nil { + return "", errors.New("Failed to read csv struct " + csvFile) + } + + err = yaml.Unmarshal(yamlFile, &csvStruct) + if err != nil { + return "", err + } + + crds := csvStruct.Spec.CustomResourceDefinitions.Owned + for _, crd := range crds { + if strings.Compare(crd.Kind, crdKind) == 0 { + return crd.Version, nil + } //find crd + } //for iterate over crds of csv + + return crdVersion, errors.New("No crd " + crdKind + " defined in csv " + csvFile) +} + +func getCRDVersion(crdFile, crdKind string) (string, error) { + var crdStruct CustomResourceDefinition + + yamlFile, err := ioutil.ReadFile(crdFile) + if err != nil { + return "", errors.New("Failed to read crd manifest " + crdFile) + } + + err = yaml.Unmarshal(yamlFile, &crdStruct) + if err != nil { + return "", err + } + + //sanity + if strings.Compare(crdKind, crdStruct.Kind) != 0 { + return "", errors.New("CRD kind " + crdStruct.Kind + " does not match provided crdKind " + crdKind) + } + + return crdStruct.Spec.Version, nil +} + +const ( + help string = "h" + getCrdVersionCmd string = "get-crd-version" + getCsvVersionCmd string = "get-csv-crd-version" + getCsvVersionCmdHelp string = "olm-csv-tool --cmd get-csv-crd-version --csv-file --crd-kind" + getCrdVersionCmdHelp string = "olm-csv-tool --cmd get-crd-version --crd-file --crd-kind" + helpInfo string = "\nUsage:\n" + getCrdVersionCmdHelp + "\n" + getCsvVersionCmdHelp +) + +func main() { + + cmd := flag.String("cmd", "h", "command") + csvFile := flag.String("csv-file", "", "csv manifest") + crdFile := flag.String("crd-file", "", "crd manifest") + crdKind := flag.String("crd-kind", "CDI", "name of crd") + flag.Parse() + + switch *cmd { + case getCrdVersionCmd: + if *crdFile == "" { + klog.Errorf(getCrdVersionCmdHelp) + klog.Error("No crd manifest provided on command %v", getCrdVersionCmd) + panic(nil) + } + + if *crdKind == "" { + klog.Errorf(getCrdVersionCmdHelp) + klog.Error("No crd-kind provided on command %v", getCrdVersionCmd) + panic(nil) + } + + crdVersion, err := getCRDVersion(*crdFile, *crdKind) + if err != nil { + panic(err) + } + fmt.Println(crdVersion) + + break + case getCsvVersionCmd: + if *csvFile == "" { + klog.Errorf(getCsvVersionCmdHelp) + klog.Error("No csv manifest provided on command %v", getCsvVersionCmd) + panic(nil) + } + if *crdKind == "" { + klog.Errorf(getCsvVersionCmdHelp) + klog.Error("No crd-kind provided on command %v", getCsvVersionCmd) + panic(nil) + } + + crdVersion, err := getCSVCRDVersion(*csvFile, *crdKind) + if err != nil { + panic(err) + } + + fmt.Println(crdVersion) + + break + case help: + fmt.Println(helpInfo) + break + default: + panic("Invalid command " + *cmd + helpInfo) + } +} diff --git a/vendor/github.com/appscode/jsonpatch/.gitignore b/vendor/github.com/appscode/jsonpatch/.gitignore index 0e9448e052..5f90593a04 100644 --- a/vendor/github.com/appscode/jsonpatch/.gitignore +++ b/vendor/github.com/appscode/jsonpatch/.gitignore @@ -23,4 +23,5 @@ _testmain.go *.test *.prof -.idea/ +/.idea +/vendor diff --git a/vendor/github.com/appscode/jsonpatch/.travis.yml b/vendor/github.com/appscode/jsonpatch/.travis.yml index 92f2439d74..0066aaafdf 100644 --- a/vendor/github.com/appscode/jsonpatch/.travis.yml +++ b/vendor/github.com/appscode/jsonpatch/.travis.yml @@ -3,8 +3,16 @@ go: - 1.x - tip +go_import_path: gomodules.xyz/jsonpatch + +cache: + directories: + - $HOME/.cache/go-build + - $GOPATH/pkg/mod + env: - GO111MODULE=on script: - - go test -v + - cd v2 + - go test -v diff --git a/vendor/github.com/appscode/jsonpatch/CHANGELOG.md b/vendor/github.com/appscode/jsonpatch/CHANGELOG.md new file mode 100644 index 0000000000..ae70e4fee5 --- /dev/null +++ b/vendor/github.com/appscode/jsonpatch/CHANGELOG.md @@ -0,0 +1,39 @@ +# Change Log + +## [v2.0.0](https://github.com/gomodules/jsonpatch/tree/v2.0.0) (2019-06-26) +[Full Changelog](https://github.com/gomodules/jsonpatch/compare/1.0.0...v2.0.0) + +**Merged pull requests:** + +- Use Major subdirectory structure to maintain dep compatiability [\#20](https://github.com/gomodules/jsonpatch/pull/20) ([tamalsaha](https://github.com/tamalsaha)) +- Prepare v2 release [\#19](https://github.com/gomodules/jsonpatch/pull/19) ([tamalsaha](https://github.com/tamalsaha)) +- Update go.mod and remove vendor folder [\#18](https://github.com/gomodules/jsonpatch/pull/18) ([tamalsaha](https://github.com/tamalsaha)) +- Change package path to gomodules.xyz/jsonpath [\#17](https://github.com/gomodules/jsonpatch/pull/17) ([tamalsaha](https://github.com/tamalsaha)) +- \[Emergency\] correct array index in backtrace [\#16](https://github.com/gomodules/jsonpatch/pull/16) ([kdada](https://github.com/kdada)) +- Added support for arrays at the root [\#15](https://github.com/gomodules/jsonpatch/pull/15) ([e-nikolov](https://github.com/e-nikolov)) +- Fix the example code in readme [\#14](https://github.com/gomodules/jsonpatch/pull/14) ([pytimer](https://github.com/pytimer)) + +## [1.0.0](https://github.com/gomodules/jsonpatch/tree/1.0.0) (2019-01-08) +**Fixed bugs:** + +- Correctly generate patch for nested object [\#8](https://github.com/gomodules/jsonpatch/issues/8) + +**Closed issues:** + +- Do releases and in SemVer [\#12](https://github.com/gomodules/jsonpatch/issues/12) +- Generated patch incorrect for Array replacement [\#1](https://github.com/gomodules/jsonpatch/issues/1) + +**Merged pull requests:** + +- Add JsonPatchOperation as type alias for Operation [\#13](https://github.com/gomodules/jsonpatch/pull/13) ([tamalsaha](https://github.com/tamalsaha)) +- Migrate to go mod [\#10](https://github.com/gomodules/jsonpatch/pull/10) ([tamalsaha](https://github.com/tamalsaha)) +- Add test for nested object [\#9](https://github.com/gomodules/jsonpatch/pull/9) ([tamalsaha](https://github.com/tamalsaha)) +- Add test for edit distance computation [\#7](https://github.com/gomodules/jsonpatch/pull/7) ([tamalsaha](https://github.com/tamalsaha)) +- Append edit distance operations from end to start [\#6](https://github.com/gomodules/jsonpatch/pull/6) ([tamalsaha](https://github.com/tamalsaha)) +- Add travis file [\#4](https://github.com/gomodules/jsonpatch/pull/4) ([tamalsaha](https://github.com/tamalsaha)) +- Run go fmt [\#3](https://github.com/gomodules/jsonpatch/pull/3) ([tamalsaha](https://github.com/tamalsaha)) +- Fix array comparison [\#2](https://github.com/gomodules/jsonpatch/pull/2) ([tamalsaha](https://github.com/tamalsaha)) + + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/vendor/github.com/appscode/jsonpatch/README.md b/vendor/github.com/appscode/jsonpatch/README.md index bbbf72921f..302a53b306 100644 --- a/vendor/github.com/appscode/jsonpatch/README.md +++ b/vendor/github.com/appscode/jsonpatch/README.md @@ -1,19 +1,20 @@ # jsonpatch -[![Build Status](https://travis-ci.org/appscode/jsonpatch.svg?branch=master)](https://travis-ci.org/appscode/jsonpatch) -[![Go Report Card](https://goreportcard.com/badge/appscode/jsonpatch "Go Report Card")](https://goreportcard.com/report/appscode/jsonpatch) -[![GoDoc](https://godoc.org/github.com/appscode/jsonpatch?status.svg "GoDoc")](https://godoc.org/github.com/appscode/jsonpatch) +[![Build Status](https://travis-ci.org/gomodules/jsonpatch.svg?branch=master)](https://travis-ci.org/gomodules/jsonpatch) +[![Go Report Card](https://goreportcard.com/badge/gomodules.xyz/jsonpatch "Go Report Card")](https://goreportcard.com/report/gomodules.xyz/jsonpatch) +[![GoDoc](https://godoc.org/gomodules.xyz/jsonpatch/v2?status.svg "GoDoc")](https://godoc.org/gomodules.xyz/jsonpatch/v2) As per http://jsonpatch.com JSON Patch is specified in RFC 6902 from the IETF. JSON Patch allows you to generate JSON that describes changes you want to make to a document, so you don't have to send the whole doc. JSON Patch format is supported by HTTP PATCH method, allowing for standards based partial updates via REST APIs. -```console -go get github.com/appscode/jsonpatch +## Usage ## + +```go +import "gomodules.xyz/jsonpatch/v2" ``` -I tried some of the other "jsonpatch" go implementations, but none of them could diff two json documents and -generate format like jsonpatch.com specifies. Here's an example of the patch format: +I tried some of the other "jsonpatch" go implementations, but none of them could diff two json documents and generate format like jsonpatch.com specifies. Here's an example of the patch format: ```json [ @@ -32,14 +33,14 @@ package main import ( "fmt" - "github.com/appscode/jsonpatch" + "gomodules.xyz/jsonpatch/v2" ) var simpleA = `{"a":100, "b":200, "c":"hello"}` var simpleB = `{"a":100, "b":200, "c":"goodbye"}` func main() { - patch, e := jsonpatch.CreatePatch([]byte(simpleA), []byte(simpleA)) + patch, e := jsonpatch.CreatePatch([]byte(simpleA), []byte(simpleB)) if e != nil { fmt.Printf("Error creating JSON patch:%v", e) return diff --git a/vendor/github.com/appscode/jsonpatch/go.mod b/vendor/github.com/appscode/jsonpatch/go.mod index 458d129ec9..b5eaf830eb 100644 --- a/vendor/github.com/appscode/jsonpatch/go.mod +++ b/vendor/github.com/appscode/jsonpatch/go.mod @@ -1,8 +1,9 @@ -module github.com/appscode/jsonpatch +module gomodules.xyz/jsonpatch/v2 + +go 1.12 require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/evanphx/json-patch v4.0.0+incompatible - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/testify v1.2.2 + github.com/evanphx/json-patch v4.5.0+incompatible + github.com/pkg/errors v0.8.1 // indirect + github.com/stretchr/testify v1.3.0 ) diff --git a/vendor/github.com/appscode/jsonpatch/go.sum b/vendor/github.com/appscode/jsonpatch/go.sum index 0972e0e1a9..d8f9ffe1c9 100644 --- a/vendor/github.com/appscode/jsonpatch/go.sum +++ b/vendor/github.com/appscode/jsonpatch/go.sum @@ -1,8 +1,11 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/evanphx/json-patch v4.0.0+incompatible h1:xregGRMLBeuRcwiOTHRCsPPuzCQlqhxUPbqdw+zNkLc= -github.com/evanphx/json-patch v4.0.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= +github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/vendor/github.com/appscode/jsonpatch/jsonpatch.go b/vendor/github.com/appscode/jsonpatch/jsonpatch.go index 3e698949e5..e7cb7d6da5 100644 --- a/vendor/github.com/appscode/jsonpatch/jsonpatch.go +++ b/vendor/github.com/appscode/jsonpatch/jsonpatch.go @@ -58,8 +58,8 @@ func NewPatch(operation, path string, value interface{}) Operation { // // An error will be returned if any of the two documents are invalid. func CreatePatch(a, b []byte) ([]Operation, error) { - aI := map[string]interface{}{} - bI := map[string]interface{}{} + var aI interface{} + var bI interface{} err := json.Unmarshal(a, &aI) if err != nil { return nil, errBadJSONDoc @@ -68,7 +68,7 @@ func CreatePatch(a, b []byte) ([]Operation, error) { if err != nil { return nil, errBadJSONDoc } - return diff(aI, bI, "", []Operation{}) + return handleValues(aI, bI, "", []Operation{}) } // Returns true if the values matches (must be json types) @@ -326,7 +326,7 @@ func backtrace(s, t []interface{}, p string, i int, j int, matrix [][]int) []Ope return append([]Operation{op}, backtrace(s, t, p, i-1, j-1, matrix)...) } - p2, _ := handleValues(s[j-1], t[j-1], makePath(p, i-1), []Operation{}) + p2, _ := handleValues(s[i-1], t[j-1], makePath(p, i-1), []Operation{}) return append(p2, backtrace(s, t, p, i-1, j-1, matrix)...) } if i > 0 && j > 0 && matrix[i-1][j-1] == matrix[i][j] { diff --git a/vendor/github.com/appscode/jsonpatch/jsonpatch_json_test.go b/vendor/github.com/appscode/jsonpatch/jsonpatch_json_test.go index 38743627f5..76ccffc880 100644 --- a/vendor/github.com/appscode/jsonpatch/jsonpatch_json_test.go +++ b/vendor/github.com/appscode/jsonpatch/jsonpatch_json_test.go @@ -3,8 +3,8 @@ package jsonpatch_test import ( "testing" - "github.com/appscode/jsonpatch" "github.com/stretchr/testify/assert" + "gomodules.xyz/jsonpatch/v2" ) func TestMarshalNullableValue(t *testing.T) { diff --git a/vendor/github.com/appscode/jsonpatch/jsonpatch_test.go b/vendor/github.com/appscode/jsonpatch/jsonpatch_test.go index 18c58be7eb..ff2f711d9c 100644 --- a/vendor/github.com/appscode/jsonpatch/jsonpatch_test.go +++ b/vendor/github.com/appscode/jsonpatch/jsonpatch_test.go @@ -4,9 +4,9 @@ import ( "encoding/json" "testing" - "github.com/appscode/jsonpatch" jp "github.com/evanphx/json-patch" "github.com/stretchr/testify/assert" + "gomodules.xyz/jsonpatch/v2" ) var simpleA = `{"a":100, "b":200, "c":"hello"}` @@ -704,7 +704,6 @@ var ( }` ) - var ( oldNestedObj = `{ "apiVersion": "kubedb.com/v1alpha1", @@ -738,6 +737,69 @@ var ( }` ) +var ( + oldArray = `{ + "apiVersion": "kubedb.com/v1alpha1", + "kind": "Elasticsearch", + "metadata": { + "name": "quick-elasticsearch", + "namespace": "demo" + }, + "spec": { + "tolerations": [ + { + "key": "node.kubernetes.io/key1", + "operator": "Equal", + "value": "value1", + "effect": "NoSchedule" + }, + { + "key": "node.kubernetes.io/key2", + "operator": "Equal", + "value": "value2", + "effect": "NoSchedule" + }, + { + "key": "node.kubernetes.io/not-ready", + "operator": "Exists", + "effect": "NoExecute", + "tolerationSeconds": 300 + }, + { + "key": "node.kubernetes.io/unreachable", + "operator": "Exists", + "effect": "NoExecute", + "tolerationSeconds": 300 + } + ] + } +}` + + newArray = `{ + "apiVersion": "kubedb.com/v1alpha1", + "kind": "Elasticsearch", + "metadata": { + "name": "quick-elasticsearch", + "namespace": "demo" + }, + "spec": { + "tolerations": [ + { + "key": "node.kubernetes.io/key2", + "operator": "Equal", + "value": "value2", + "effect": "NoSchedule" + }, + { + "key": "node.kubernetes.io/key1", + "operator": "Equal", + "value": "value1", + "effect": "NoSchedule" + } + ] + } +}` +) func TestCreatePatch(t *testing.T) { cases := []struct { @@ -779,7 +841,12 @@ func TestCreatePatch(t *testing.T) { {"Kubernetes:Annotations", oldDeployment, newDeployment}, // crd with nested object {"Nested Member Object", oldNestedObj, newNestedObj}, + // array with different order + {"Different Array", oldArray, newArray}, + {"Array at root", `[{"asdf":"qwerty"}]`, `[{"asdf":"bla"},{"asdf":"zzz"}]`}, + {"Empty array at root", `[]`, `[{"asdf":"bla"},{"asdf":"zzz"}]`}, } + for _, c := range cases { t.Run(c.name+"[src->dst]", func(t *testing.T) { check(t, c.src, c.dst) diff --git a/vendor/github.com/appscode/jsonpatch/v2/go.mod b/vendor/github.com/appscode/jsonpatch/v2/go.mod new file mode 100644 index 0000000000..b5eaf830eb --- /dev/null +++ b/vendor/github.com/appscode/jsonpatch/v2/go.mod @@ -0,0 +1,9 @@ +module gomodules.xyz/jsonpatch/v2 + +go 1.12 + +require ( + github.com/evanphx/json-patch v4.5.0+incompatible + github.com/pkg/errors v0.8.1 // indirect + github.com/stretchr/testify v1.3.0 +) diff --git a/vendor/github.com/appscode/jsonpatch/v2/go.sum b/vendor/github.com/appscode/jsonpatch/v2/go.sum new file mode 100644 index 0000000000..d8f9ffe1c9 --- /dev/null +++ b/vendor/github.com/appscode/jsonpatch/v2/go.sum @@ -0,0 +1,11 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= +github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/vendor/github.com/appscode/jsonpatch/v2/jsonpatch.go b/vendor/github.com/appscode/jsonpatch/v2/jsonpatch.go new file mode 100644 index 0000000000..e7cb7d6da5 --- /dev/null +++ b/vendor/github.com/appscode/jsonpatch/v2/jsonpatch.go @@ -0,0 +1,336 @@ +package jsonpatch + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "strings" +) + +var errBadJSONDoc = fmt.Errorf("invalid JSON Document") + +type JsonPatchOperation = Operation + +type Operation struct { + Operation string `json:"op"` + Path string `json:"path"` + Value interface{} `json:"value,omitempty"` +} + +func (j *Operation) Json() string { + b, _ := json.Marshal(j) + return string(b) +} + +func (j *Operation) MarshalJSON() ([]byte, error) { + var b bytes.Buffer + b.WriteString("{") + b.WriteString(fmt.Sprintf(`"op":"%s"`, j.Operation)) + b.WriteString(fmt.Sprintf(`,"path":"%s"`, j.Path)) + // Consider omitting Value for non-nullable operations. + if j.Value != nil || j.Operation == "replace" || j.Operation == "add" { + v, err := json.Marshal(j.Value) + if err != nil { + return nil, err + } + b.WriteString(`,"value":`) + b.Write(v) + } + b.WriteString("}") + return b.Bytes(), nil +} + +type ByPath []Operation + +func (a ByPath) Len() int { return len(a) } +func (a ByPath) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a ByPath) Less(i, j int) bool { return a[i].Path < a[j].Path } + +func NewPatch(operation, path string, value interface{}) Operation { + return Operation{Operation: operation, Path: path, Value: value} +} + +// CreatePatch creates a patch as specified in http://jsonpatch.com/ +// +// 'a' is original, 'b' is the modified document. Both are to be given as json encoded content. +// The function will return an array of JsonPatchOperations +// +// An error will be returned if any of the two documents are invalid. +func CreatePatch(a, b []byte) ([]Operation, error) { + var aI interface{} + var bI interface{} + err := json.Unmarshal(a, &aI) + if err != nil { + return nil, errBadJSONDoc + } + err = json.Unmarshal(b, &bI) + if err != nil { + return nil, errBadJSONDoc + } + return handleValues(aI, bI, "", []Operation{}) +} + +// Returns true if the values matches (must be json types) +// The types of the values must match, otherwise it will always return false +// If two map[string]interface{} are given, all elements must match. +func matchesValue(av, bv interface{}) bool { + if reflect.TypeOf(av) != reflect.TypeOf(bv) { + return false + } + switch at := av.(type) { + case string: + bt, ok := bv.(string) + if ok && bt == at { + return true + } + case float64: + bt, ok := bv.(float64) + if ok && bt == at { + return true + } + case bool: + bt, ok := bv.(bool) + if ok && bt == at { + return true + } + case map[string]interface{}: + bt, ok := bv.(map[string]interface{}) + if !ok { + return false + } + for key := range at { + if !matchesValue(at[key], bt[key]) { + return false + } + } + for key := range bt { + if !matchesValue(at[key], bt[key]) { + return false + } + } + return true + case []interface{}: + bt, ok := bv.([]interface{}) + if !ok { + return false + } + if len(bt) != len(at) { + return false + } + for key := range at { + if !matchesValue(at[key], bt[key]) { + return false + } + } + for key := range bt { + if !matchesValue(at[key], bt[key]) { + return false + } + } + return true + } + return false +} + +// From http://tools.ietf.org/html/rfc6901#section-4 : +// +// Evaluation of each reference token begins by decoding any escaped +// character sequence. This is performed by first transforming any +// occurrence of the sequence '~1' to '/', and then transforming any +// occurrence of the sequence '~0' to '~'. +// TODO decode support: +// var rfc6901Decoder = strings.NewReplacer("~1", "/", "~0", "~") + +var rfc6901Encoder = strings.NewReplacer("~", "~0", "/", "~1") + +func makePath(path string, newPart interface{}) string { + key := rfc6901Encoder.Replace(fmt.Sprintf("%v", newPart)) + if path == "" { + return "/" + key + } + if strings.HasSuffix(path, "/") { + return path + key + } + return path + "/" + key +} + +// diff returns the (recursive) difference between a and b as an array of JsonPatchOperations. +func diff(a, b map[string]interface{}, path string, patch []Operation) ([]Operation, error) { + for key, bv := range b { + p := makePath(path, key) + av, ok := a[key] + // value was added + if !ok { + patch = append(patch, NewPatch("add", p, bv)) + continue + } + // Types are the same, compare values + var err error + patch, err = handleValues(av, bv, p, patch) + if err != nil { + return nil, err + } + } + // Now add all deleted values as nil + for key := range a { + _, found := b[key] + if !found { + p := makePath(path, key) + + patch = append(patch, NewPatch("remove", p, nil)) + } + } + return patch, nil +} + +func handleValues(av, bv interface{}, p string, patch []Operation) ([]Operation, error) { + { + at := reflect.TypeOf(av) + bt := reflect.TypeOf(bv) + if at == nil && bt == nil { + // do nothing + return patch, nil + } else if at == nil && bt != nil { + return append(patch, NewPatch("add", p, bv)), nil + } else if at != bt { + // If types have changed, replace completely (preserves null in destination) + return append(patch, NewPatch("replace", p, bv)), nil + } + } + + var err error + switch at := av.(type) { + case map[string]interface{}: + bt := bv.(map[string]interface{}) + patch, err = diff(at, bt, p, patch) + if err != nil { + return nil, err + } + case string, float64, bool: + if !matchesValue(av, bv) { + patch = append(patch, NewPatch("replace", p, bv)) + } + case []interface{}: + bt := bv.([]interface{}) + if isSimpleArray(at) && isSimpleArray(bt) { + patch = append(patch, compareEditDistance(at, bt, p)...) + } else { + n := min(len(at), len(bt)) + for i := len(at) - 1; i >= n; i-- { + patch = append(patch, NewPatch("remove", makePath(p, i), nil)) + } + for i := n; i < len(bt); i++ { + patch = append(patch, NewPatch("add", makePath(p, i), bt[i])) + } + for i := 0; i < n; i++ { + var err error + patch, err = handleValues(at[i], bt[i], makePath(p, i), patch) + if err != nil { + return nil, err + } + } + } + default: + panic(fmt.Sprintf("Unknown type:%T ", av)) + } + return patch, nil +} + +func isBasicType(a interface{}) bool { + switch a.(type) { + case string, float64, bool: + default: + return false + } + return true +} + +func isSimpleArray(a []interface{}) bool { + for i := range a { + switch a[i].(type) { + case string, float64, bool: + default: + val := reflect.ValueOf(a[i]) + if val.Kind() == reflect.Map { + for _, k := range val.MapKeys() { + av := val.MapIndex(k) + if av.Kind() == reflect.Ptr || av.Kind() == reflect.Interface { + if av.IsNil() { + continue + } + av = av.Elem() + } + if av.Kind() != reflect.String && av.Kind() != reflect.Float64 && av.Kind() != reflect.Bool { + return false + } + } + return true + } + return false + } + } + return true +} + +// https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm +// Adapted from https://github.com/texttheater/golang-levenshtein +func compareEditDistance(s, t []interface{}, p string) []Operation { + m := len(s) + n := len(t) + + d := make([][]int, m+1) + for i := 0; i <= m; i++ { + d[i] = make([]int, n+1) + d[i][0] = i + } + for j := 0; j <= n; j++ { + d[0][j] = j + } + + for j := 1; j <= n; j++ { + for i := 1; i <= m; i++ { + if reflect.DeepEqual(s[i-1], t[j-1]) { + d[i][j] = d[i-1][j-1] // no op required + } else { + del := d[i-1][j] + 1 + add := d[i][j-1] + 1 + rep := d[i-1][j-1] + 1 + d[i][j] = min(rep, min(add, del)) + } + } + } + + return backtrace(s, t, p, m, n, d) +} + +func min(x int, y int) int { + if y < x { + return y + } + return x +} + +func backtrace(s, t []interface{}, p string, i int, j int, matrix [][]int) []Operation { + if i > 0 && matrix[i-1][j]+1 == matrix[i][j] { + op := NewPatch("remove", makePath(p, i-1), nil) + return append([]Operation{op}, backtrace(s, t, p, i-1, j, matrix)...) + } + if j > 0 && matrix[i][j-1]+1 == matrix[i][j] { + op := NewPatch("add", makePath(p, i), t[j-1]) + return append([]Operation{op}, backtrace(s, t, p, i, j-1, matrix)...) + } + if i > 0 && j > 0 && matrix[i-1][j-1]+1 == matrix[i][j] { + if isBasicType(s[0]) { + op := NewPatch("replace", makePath(p, i-1), t[j-1]) + return append([]Operation{op}, backtrace(s, t, p, i-1, j-1, matrix)...) + } + + p2, _ := handleValues(s[i-1], t[j-1], makePath(p, i-1), []Operation{}) + return append(p2, backtrace(s, t, p, i-1, j-1, matrix)...) + } + if i > 0 && j > 0 && matrix[i-1][j-1] == matrix[i][j] { + return backtrace(s, t, p, i-1, j-1, matrix) + } + return []Operation{} +} diff --git a/vendor/github.com/appscode/jsonpatch/v2/jsonpatch_json_test.go b/vendor/github.com/appscode/jsonpatch/v2/jsonpatch_json_test.go new file mode 100644 index 0000000000..76ccffc880 --- /dev/null +++ b/vendor/github.com/appscode/jsonpatch/v2/jsonpatch_json_test.go @@ -0,0 +1,33 @@ +package jsonpatch_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "gomodules.xyz/jsonpatch/v2" +) + +func TestMarshalNullableValue(t *testing.T) { + p1 := jsonpatch.Operation{ + Operation: "replace", + Path: "/a1", + Value: nil, + } + assert.JSONEq(t, `{"op":"replace", "path":"/a1","value":null}`, p1.Json()) + + p2 := jsonpatch.Operation{ + Operation: "replace", + Path: "/a2", + Value: "v2", + } + assert.JSONEq(t, `{"op":"replace", "path":"/a2", "value":"v2"}`, p2.Json()) +} + +func TestMarshalNonNullableValue(t *testing.T) { + p1 := jsonpatch.Operation{ + Operation: "remove", + Path: "/a1", + } + assert.JSONEq(t, `{"op":"remove", "path":"/a1"}`, p1.Json()) + +} diff --git a/vendor/github.com/appscode/jsonpatch/v2/jsonpatch_test.go b/vendor/github.com/appscode/jsonpatch/v2/jsonpatch_test.go new file mode 100644 index 0000000000..ff2f711d9c --- /dev/null +++ b/vendor/github.com/appscode/jsonpatch/v2/jsonpatch_test.go @@ -0,0 +1,874 @@ +package jsonpatch_test + +import ( + "encoding/json" + "testing" + + jp "github.com/evanphx/json-patch" + "github.com/stretchr/testify/assert" + "gomodules.xyz/jsonpatch/v2" +) + +var simpleA = `{"a":100, "b":200, "c":"hello"}` +var simpleB = `{"a":100, "b":200, "c":"goodbye"}` +var simpleC = `{"a":100, "b":100, "c":"hello"}` +var simpleD = `{"a":100, "b":200, "c":"hello", "d":"foo"}` +var simpleE = `{"a":100, "b":200}` +var simplef = `{"a":100, "b":100, "d":"foo"}` +var simpleG = `{"a":100, "b":null, "d":"foo"}` +var empty = `{}` + +var arraySrc = ` +{ + "spec": { + "loadBalancerSourceRanges": [ + "192.101.0.0/16", + "192.0.0.0/24" + ] + } +} +` + +var arrayDst = ` +{ + "spec": { + "loadBalancerSourceRanges": [ + "192.101.0.0/24" + ] + } +} +` + +var complexBase = `{"a":100, "b":[{"c1":"hello", "d1":"foo"},{"c2":"hello2", "d2":"foo2"} ], "e":{"f":200, "g":"h", "i":"j"}}` +var complexA = `{"a":100, "b":[{"c1":"goodbye", "d1":"foo"},{"c2":"hello2", "d2":"foo2"} ], "e":{"f":200, "g":"h", "i":"j"}}` +var complexB = `{"a":100, "b":[{"c1":"hello", "d1":"foo"},{"c2":"hello2", "d2":"foo2"} ], "e":{"f":100, "g":"h", "i":"j"}}` +var complexC = `{"a":100, "b":[{"c1":"hello", "d1":"foo"},{"c2":"hello2", "d2":"foo2"} ], "e":{"f":200, "g":"h", "i":"j"}, "k":[{"l":"m"}, {"l":"o"}]}` +var complexD = `{"a":100, "b":[{"c1":"hello", "d1":"foo"},{"c2":"hello2", "d2":"foo2"}, {"c3":"hello3", "d3":"foo3"} ], "e":{"f":200, "g":"h", "i":"j"}}` +var complexE = `{"a":100, "b":[{"c1":"hello", "d1":"foo"},{"c2":"hello2", "d2":"foo2"} ], "e":{"f":200, "g":"h", "i":"j"}}` + +var point = `{"type":"Point", "coordinates":[0.0, 1.0]}` +var lineString = `{"type":"LineString", "coordinates":[[0.0, 1.0], [2.0, 3.0]]}` + +var hyperComplexBase = ` +{ + "goods": [ + { + "id": "0001", + "type": "donut", + "name": "Cake", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" }, + { "id": "1002", "type": "Chocolate" }, + { "id": "1003", "type": "Blueberry" }, + { "id": "1004", "type": "Devil's Food" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5005", "type": "Sugar" }, + { "id": "5007", "type": "Powdered Sugar" }, + { "id": "5006", "type": "Chocolate with Sprinkles" }, + { "id": "5003", "type": "Chocolate" }, + { "id": "5004", "type": "Maple" } + ] + }, + { + "id": "0002", + "type": "donut", + "name": "Raised", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5005", "type": "Sugar" }, + { "id": "5003", "type": "Chocolate" }, + { "id": "5004", "type": "Maple" } + ] + }, + { + "id": "0003", + "type": "donut", + "name": "Old Fashioned", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" }, + { "id": "1002", "type": "Chocolate" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5003", "type": "Chocolate" }, + { "id": "5004", "type": "Maple" } + ] + } +] +}` + +var hyperComplexA = ` +{ + "goods": [ + { + "id": "0001", + "type": "donut", + "name": "Cake", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" }, + { "id": "1002", "type": "Chocolate" }, + { "id": "1003", "type": "Strawberry" }, + { "id": "1004", "type": "Devil's Food" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5005", "type": "Sugar" }, + { "id": "5007", "type": "Powdered Sugar" }, + { "id": "5006", "type": "Chocolate with Sprinkles" }, + { "id": "5003", "type": "Chocolate" }, + { "id": "5004", "type": "Maple" } + ] + }, + { + "id": "0002", + "type": "donut", + "name": "Raised", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5005", "type": "Sugar" }, + { "id": "5003", "type": "Chocolate" }, + { "id": "5004", "type": "Maple" } + ] + }, + { + "id": "0003", + "type": "donut", + "name": "Old Fashioned", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" }, + { "id": "1002", "type": "Chocolate" }, + { "id": "1003", "type": "Vanilla" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5004", "type": "Maple" } + ] + } +] +}` + +var superComplexBase = ` +{ + "annotations": { + "annotation": [ + { + "name": "version", + "value": "8" + }, + { + "name": "versionTag", + "value": "Published on May 13, 2015 at 8:48pm (MST)" + } + ] + }, + "attributes": { + "attribute-key": [ + { + "id": "3b05c943-d81a-436f-b242-8b519e7a6f30", + "properties": { + "visible": true + } + }, + { + "id": "d794c7ee-2a4b-4da4-bba7-e8b973d50c4b", + "properties": { + "visible": true + } + }, + { + "id": "a0259458-517c-480f-9f04-9b54b1b2af1f", + "properties": { + "visible": true + } + }, + { + "id": "9415f39d-c396-4458-9019-fc076c847964", + "properties": { + "visible": true + } + }, + { + "id": "0a2e49a9-8989-42fb-97da-cc66334f828b", + "properties": { + "visible": true + } + }, + { + "id": "27f5f14a-ea97-4feb-b22a-6ff754a31212", + "properties": { + "visible": true + } + }, + { + "id": "6f810508-4615-4fd0-9e87-80f9c94f9ad8", + "properties": { + "visible": true + } + }, + { + "id": "3451b1b2-7365-455c-8bb1-0b464d4d3ba1", + "properties": { + "visible": true + } + }, + { + "id": "a82ec957-8c26-41ea-8af6-6dd75c384801", + "properties": { + "visible": true + } + }, + { + "id": "736c5496-9a6e-4a82-aa00-456725796432", + "properties": { + "visible": true + } + }, + { + "id": "2d428b3c-9d3b-4ec1-bf98-e00673599d60", + "properties": { + "visible": true + } + }, + { + "id": "68566ebb-811d-4337-aba9-a8a8baf90e4b", + "properties": { + "visible": true + } + }, + { + "id": "ca88bab1-a1ea-40cc-8f96-96d1e9f1217d", + "properties": { + "visible": true + } + }, + { + "id": "c63a12c8-542d-47f3-bee1-30b5fe2b0690", + "properties": { + "visible": true + } + }, + { + "id": "cbd9e3bc-6a49-432a-a906-b1674c1de24c", + "properties": { + "visible": true + } + }, + { + "id": "03262f07-8a15-416d-a3f5-e2bf561c78f9", + "properties": { + "visible": true + } + }, + { + "id": "e5c93b87-83fc-45b6-b4d5-bf1e3f523075", + "properties": { + "visible": true + } + }, + { + "id": "72260ac5-3d51-49d7-bb31-f794dd129f1c", + "properties": { + "visible": true + } + }, + { + "id": "d856bde1-1b42-4935-9bee-c37e886c9ecf", + "properties": { + "visible": true + } + }, + { + "id": "62380509-bedf-4134-95c3-77ff377a4a6a", + "properties": { + "visible": true + } + }, + { + "id": "f4ed5ac9-b386-49a6-a0a0-6f3341ce9021", + "properties": { + "visible": true + } + }, + { + "id": "528d2bd2-87fe-4a49-954a-c93a03256929", + "properties": { + "visible": true + } + }, + { + "id": "ff8951f1-61a7-416b-9223-fac4bb6dac50", + "properties": { + "visible": true + } + }, + { + "id": "95c2b011-d782-4042-8a07-6aa4a5765c2e", + "properties": { + "visible": true + } + }, + { + "id": "dbe5837b-0624-4a05-91f3-67b5bd9b812a", + "properties": { + "visible": true + } + }, + { + "id": "13f198ed-82ab-4e51-8144-bfaa5bf77fd5", + "properties": { + "visible": true + } + }, + { + "id": "025312eb-12b6-47e6-9750-0fb31ddc2111", + "properties": { + "visible": true + } + }, + { + "id": "24292d58-db66-4ef3-8f4f-005d7b719433", + "properties": { + "visible": true + } + }, + { + "id": "22e5b5c4-821c-413a-a5b1-ab866d9a03bb", + "properties": { + "visible": true + } + }, + { + "id": "2fde0aac-df89-403d-998e-854b949c7b57", + "properties": { + "visible": true + } + }, + { + "id": "8b576876-5c16-4178-805e-24984c24fac3", + "properties": { + "visible": true + } + }, + { + "id": "415b7d2a-b362-4f1e-b83a-927802328ecb", + "properties": { + "visible": true + } + }, + { + "id": "8ef24fc2-ab25-4f22-9d9f-61902b49dc01", + "properties": { + "visible": true + } + }, + { + "id": "2299b09e-9f8e-4b79-a55c-a7edacde2c85", + "properties": { + "visible": true + } + }, + { + "id": "bf506538-f438-425c-be85-5aa2f9b075b8", + "properties": { + "visible": true + } + }, + { + "id": "2b501dc6-799d-4675-9144-fac77c50c57c", + "properties": { + "visible": true + } + }, + { + "id": "c0446da1-e069-417e-bd5a-34edcd028edc", + "properties": { + "visible": true + } + } + ] + } +}` + +var superComplexA = ` +{ + "annotations": { + "annotation": [ + { + "name": "version", + "value": "8" + }, + { + "name": "versionTag", + "value": "Published on May 13, 2015 at 8:48pm (MST)" + } + ] + }, + "attributes": { + "attribute-key": [ + { + "id": "3b05c943-d81a-436f-b242-8b519e7a6f30", + "properties": { + "visible": true + } + }, + { + "id": "d794c7ee-2a4b-4da4-bba7-e8b973d50c4b", + "properties": { + "visible": true + } + }, + { + "id": "a0259458-517c-480f-9f04-9b54b1b2af1f", + "properties": { + "visible": true + } + }, + { + "id": "9415f39d-c396-4458-9019-fc076c847964", + "properties": { + "visible": true + } + }, + { + "id": "0a2e49a9-8989-42fb-97da-cc66334f828b", + "properties": { + "visible": true + } + }, + { + "id": "27f5f14a-ea97-4feb-b22a-6ff754a31212", + "properties": { + "visible": true + } + }, + { + "id": "6f810508-4615-4fd0-9e87-80f9c94f9ad8", + "properties": { + "visible": true + } + }, + { + "id": "3451b1b2-7365-455c-8bb1-0b464d4d3ba1", + "properties": { + "visible": true + } + }, + { + "id": "a82ec957-8c26-41ea-8af6-6dd75c384801", + "properties": { + "visible": true + } + }, + { + "id": "736c5496-9a6e-4a82-aa00-456725796432", + "properties": { + "visible": true + } + }, + { + "id": "2d428b3c-9d3b-4ec1-bf98-e00673599d60", + "properties": { + "visible": true + } + }, + { + "id": "68566ebb-811d-4337-aba9-a8a8baf90e4b", + "properties": { + "visible": true + } + }, + { + "id": "ca88bab1-a1ea-40cc-8f96-96d1e9f1217d", + "properties": { + "visible": true + } + }, + { + "id": "c63a12c8-542d-47f3-bee1-30b5fe2b0690", + "properties": { + "visible": true + } + }, + { + "id": "cbd9e3bc-6a49-432a-a906-b1674c1de24c", + "properties": { + "visible": true + } + }, + { + "id": "03262f07-8a15-416d-a3f5-e2bf561c78f9", + "properties": { + "visible": true + } + }, + { + "id": "e5c93b87-83fc-45b6-b4d5-bf1e3f523075", + "properties": { + "visible": true + } + }, + { + "id": "72260ac5-3d51-49d7-bb31-f794dd129f1c", + "properties": { + "visible": true + } + }, + { + "id": "d856bde1-1b42-4935-9bee-c37e886c9ecf", + "properties": { + "visible": true + } + }, + { + "id": "62380509-bedf-4134-95c3-77ff377a4a6a", + "properties": { + "visible": true + } + }, + { + "id": "f4ed5ac9-b386-49a6-a0a0-6f3341ce9021", + "properties": { + "visible": true + } + }, + { + "id": "528d2bd2-87fe-4a49-954a-c93a03256929", + "properties": { + "visible": true + } + }, + { + "id": "ff8951f1-61a7-416b-9223-fac4bb6dac50", + "properties": { + "visible": true + } + }, + { + "id": "95c2b011-d782-4042-8a07-6aa4a5765c2e", + "properties": { + "visible": true + } + }, + { + "id": "dbe5837b-0624-4a05-91f3-67b5bd9b812a", + "properties": { + "visible": true + } + }, + { + "id": "13f198ed-82ab-4e51-8144-bfaa5bf77fd5", + "properties": { + "visible": true + } + }, + { + "id": "025312eb-12b6-47e6-9750-0fb31ddc2111", + "properties": { + "visible": true + } + }, + { + "id": "24292d58-db66-4ef3-8f4f-005d7b719433", + "properties": { + "visible": true + } + }, + { + "id": "22e5b5c4-821c-413a-a5b1-ab866d9a03bb", + "properties": { + "visible": true + } + }, + { + "id": "2fde0aac-df89-403d-998e-854b949c7b57", + "properties": { + "visible": true + } + }, + { + "id": "8b576876-5c16-4178-805e-24984c24fac3", + "properties": { + "visible": true + } + }, + { + "id": "415b7d2a-b362-4f1e-b83a-927802328ecb", + "properties": { + "visible": true + } + }, + { + "id": "8ef24fc2-ab25-4f22-9d9f-61902b49dc01", + "properties": { + "visible": true + } + }, + { + "id": "2299b09e-9f8e-4b79-a55c-a7edacde2c85", + "properties": { + "visible": true + } + }, + { + "id": "bf506538-f438-425c-be85-5aa2f9b075b8", + "properties": { + "visible": true + } + }, + { + "id": "2b501dc6-799d-4675-9144-fac77c50c57c", + "properties": { + "visible": true + } + }, + { + "id": "c0446da1-e069-417e-bd5a-34edcd028edc", + "properties": { + "visible": false + } + } + ] + } +}` + +var ( + oldDeployment = `{ + "apiVersion": "apps/v1beta1", + "kind": "Deployment", + "metadata": { + "annotations": { + "k8s.io/app": "busy-dep" + } + } +}` + + newDeployment = `{ + "apiVersion": "apps/v1beta1", + "kind": "Deployment", + "metadata": { + "annotations": { + "k8s.io/app": "busy-dep", + "docker.com/commit": "github.com/myrepo#xyz" + } + } +}` +) + +var ( + oldNestedObj = `{ + "apiVersion": "kubedb.com/v1alpha1", + "kind": "Elasticsearch", + "metadata": { + "name": "quick-elasticsearch", + "namespace": "demo" + }, + "spec": { + "doNotPause": true, + "version": "5.6" + } +}` + + newNestedObj = `{ + "apiVersion": "kubedb.com/v1alpha1", + "kind": "Elasticsearch", + "metadata": { + "name": "quick-elasticsearch", + "namespace": "demo" + }, + "spec": { + "doNotPause": true, + "version": "5.6", + "storageType": "Durable", + "updateStrategy": { + "type": "RollingUpdate" + }, + "terminationPolicy": "Pause" + } +}` +) + +var ( + oldArray = `{ + "apiVersion": "kubedb.com/v1alpha1", + "kind": "Elasticsearch", + "metadata": { + "name": "quick-elasticsearch", + "namespace": "demo" + }, + "spec": { + "tolerations": [ + { + "key": "node.kubernetes.io/key1", + "operator": "Equal", + "value": "value1", + "effect": "NoSchedule" + }, + { + "key": "node.kubernetes.io/key2", + "operator": "Equal", + "value": "value2", + "effect": "NoSchedule" + }, + { + "key": "node.kubernetes.io/not-ready", + "operator": "Exists", + "effect": "NoExecute", + "tolerationSeconds": 300 + }, + { + "key": "node.kubernetes.io/unreachable", + "operator": "Exists", + "effect": "NoExecute", + "tolerationSeconds": 300 + } + ] + } +}` + + newArray = `{ + "apiVersion": "kubedb.com/v1alpha1", + "kind": "Elasticsearch", + "metadata": { + "name": "quick-elasticsearch", + "namespace": "demo" + }, + "spec": { + "tolerations": [ + { + "key": "node.kubernetes.io/key2", + "operator": "Equal", + "value": "value2", + "effect": "NoSchedule" + }, + { + "key": "node.kubernetes.io/key1", + "operator": "Equal", + "value": "value1", + "effect": "NoSchedule" + } + ] + } +}` +) + +func TestCreatePatch(t *testing.T) { + cases := []struct { + name string + src string + dst string + }{ + // simple + {"Simple:OneNullReplace", simplef, simpleG}, + {"Simple:Same", simpleA, simpleA}, + {"Simple:OneStringReplace", simpleA, simpleB}, + {"Simple:OneIntReplace", simpleA, simpleC}, + {"Simple:OneAdd", simpleA, simpleD}, + {"Simple:OneRemove", simpleA, simpleE}, + {"Simple:VsEmpty", simpleA, empty}, + // array types + {"Array:Same", arraySrc, arraySrc}, + {"Array:BoolReplace", arraySrc, arrayDst}, + {"Array:AlmostSame", `{"Lines":[1,2,3,4,5,6,7,8,9,10]}`, `{"Lines":[2,3,4,5,6,7,8,9,10,11]}`}, + {"Array:Remove", `{"x":["A", "B", "C"]}`, `{"x":["D"]}`}, + {"Array:EditDistance", `{"letters":["A","B","C","D","E","F","G","H","I","J","K"]}`, `{"letters":["L","M","N"]}`}, + // complex types + {"Complex:Same", complexBase, complexBase}, + {"Complex:OneStringReplaceInArray", complexBase, complexA}, + {"Complex:OneIntReplace", complexBase, complexB}, + {"Complex:OneAdd", complexBase, complexC}, + {"Complex:OneAddToArray", complexBase, complexC}, + {"Complex:VsEmpty", complexBase, empty}, + // geojson + {"GeoJson:PointLineStringReplace", point, lineString}, + {"GeoJson:LineStringPointReplace", lineString, point}, + // HyperComplex + {"HyperComplex:Same", hyperComplexBase, hyperComplexBase}, + {"HyperComplex:BoolReplace", hyperComplexBase, hyperComplexA}, + // SuperComplex + {"SuperComplex:Same", superComplexBase, superComplexBase}, + {"SuperComplex:BoolReplace", superComplexBase, superComplexA}, + // map + {"Kubernetes:Annotations", oldDeployment, newDeployment}, + // crd with nested object + {"Nested Member Object", oldNestedObj, newNestedObj}, + // array with different order + {"Different Array", oldArray, newArray}, + {"Array at root", `[{"asdf":"qwerty"}]`, `[{"asdf":"bla"},{"asdf":"zzz"}]`}, + {"Empty array at root", `[]`, `[{"asdf":"bla"},{"asdf":"zzz"}]`}, + } + + for _, c := range cases { + t.Run(c.name+"[src->dst]", func(t *testing.T) { + check(t, c.src, c.dst) + }) + t.Run(c.name+"[dst->src]", func(t *testing.T) { + check(t, c.dst, c.src) + }) + } +} + +func check(t *testing.T, src, dst string) { + patch, err := jsonpatch.CreatePatch([]byte(src), []byte(dst)) + assert.Nil(t, err) + + data, err := json.Marshal(patch) + assert.Nil(t, err) + + p2, err := jp.DecodePatch(data) + assert.Nil(t, err) + + d2, err := p2.Apply([]byte(src)) + assert.Nil(t, err) + + assert.JSONEq(t, dst, string(d2)) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/catalogsource_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/catalogsource_types.go new file mode 100644 index 0000000000..71e253f1cf --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/catalogsource_types.go @@ -0,0 +1,115 @@ +package operators + +import ( + "fmt" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// CatalogSourceKind is the PascalCase name of a CatalogSource's kind. +const CatalogSourceKind = "CatalogSource" + +// SourceType indicates the type of backing store for a CatalogSource +type SourceType string + +const ( + // SourceTypeInternal (deprecated) specifies a CatalogSource of type SourceTypeConfigmap + SourceTypeInternal SourceType = "internal" + + // SourceTypeConfigmap specifies a CatalogSource that generates a configmap-server registry + SourceTypeConfigmap SourceType = "configmap" + + // SourceTypeGrpc specifies a CatalogSource that can use an operator registry image to generate a + // registry-server or connect to a pre-existing registry at an address. + SourceTypeGrpc SourceType = "grpc" +) + +type CatalogSourceSpec struct { + // SourceType is the type of source + SourceType SourceType + + // ConfigMap is the name of the ConfigMap to be used to back a configmap-server registry. + // Only used when SourceType = SourceTypeConfigmap or SourceTypeInternal. + // +Optional + ConfigMap string + + // Address is a host that OLM can use to connect to a pre-existing registry. + // Format: : + // Only used when SourceType = SourceTypeGrpc. + // Ignored when the Image field is set. + // +Optional + Address string + + // Image is an operator-registry container image to instantiate a registry-server with. + // Only used when SourceType = SourceTypeGrpc. + // If present, the address field is ignored. + // +Optional + Image string + + // Secrets represent set of secrets that can be used to access the contents of the catalog. + // It is best to keep this list small, since each will need to be tried for every catalog entry. + // +Optional + Secrets []string + + // Metadata + DisplayName string + Description string + Publisher string + Icon Icon +} + +type RegistryServiceStatus struct { + Protocol string + ServiceName string + ServiceNamespace string + Port string + CreatedAt metav1.Time +} + +func (s *RegistryServiceStatus) Address() string { + return fmt.Sprintf("%s.%s.svc.cluster.local:%s", s.ServiceName, s.ServiceNamespace, s.Port) +} + +type CatalogSourceStatus struct { + ConfigMapResource *ConfigMapResourceReference + RegistryServiceStatus *RegistryServiceStatus + LastSync metav1.Time +} + +type ConfigMapResourceReference struct { + Name string + Namespace string + + UID types.UID + ResourceVersion string +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient + +// CatalogSource is a repository of CSVs, CRDs, and operator packages. +type CatalogSource struct { + metav1.TypeMeta + metav1.ObjectMeta + + Spec CatalogSourceSpec + Status CatalogSourceStatus +} + +func (c *CatalogSource) Address() string { + if c.Spec.Address != "" { + return c.Spec.Address + } + return c.Status.RegistryServiceStatus.Address() +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// CatalogSourceList is a list of CatalogSource resources. +type CatalogSourceList struct { + metav1.TypeMeta + metav1.ListMeta + + Items []CatalogSource +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/clusterserviceversion_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/clusterserviceversion_types.go new file mode 100644 index 0000000000..94398e72e6 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/clusterserviceversion_types.go @@ -0,0 +1,488 @@ +package operators + +import ( + "encoding/json" + "fmt" + "sort" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/version" +) + +// ClusterServiceVersionKind is the PascalCase name of a CSV's kind. +const ClusterServiceVersionKind = "ClusterServiceVersion" + +// InstallModeType is a supported type of install mode for CSV installation +type InstallModeType string + +const ( + // InstallModeTypeOwnNamespace indicates that the operator can be a member of an `OperatorGroup` that selects its own namespace. + InstallModeTypeOwnNamespace InstallModeType = "OwnNamespace" + // InstallModeTypeSingleNamespace indicates that the operator can be a member of an `OperatorGroup` that selects one namespace. + InstallModeTypeSingleNamespace InstallModeType = "SingleNamespace" + // InstallModeTypeMultiNamespace indicates that the operator can be a member of an `OperatorGroup` that selects more than one namespace. + InstallModeTypeMultiNamespace InstallModeType = "MultiNamespace" + // InstallModeTypeAllNamespaces indicates that the operator can be a member of an `OperatorGroup` that selects all namespaces (target namespace set is the empty string ""). + InstallModeTypeAllNamespaces InstallModeType = "AllNamespaces" +) + +// InstallMode associates an InstallModeType with a flag representing if the CSV supports it +type InstallMode struct { + Type InstallModeType + Supported bool +} + +// InstallModeSet is a mapping of unique InstallModeTypes to whether they are supported. +type InstallModeSet map[InstallModeType]bool + +// NamedInstallStrategy represents the block of an ClusterServiceVersion resource +// where the install strategy is specified. +type NamedInstallStrategy struct { + StrategyName string + StrategySpecRaw json.RawMessage +} + +// StatusDescriptor describes a field in a status block of a CRD so that OLM can consume it +type StatusDescriptor struct { + Path string + DisplayName string + Description string + XDescriptors []string + Value *json.RawMessage +} + +// SpecDescriptor describes a field in a spec block of a CRD so that OLM can consume it +type SpecDescriptor struct { + Path string + DisplayName string + Description string + XDescriptors []string + Value *json.RawMessage +} + +// ActionDescriptor describes a declarative action that can be performed on a custom resource instance +type ActionDescriptor struct { + Path string + DisplayName string + Description string + XDescriptors []string + Value *json.RawMessage +} + +// CRDDescription provides details to OLM about the CRDs +type CRDDescription struct { + Name string + Version string + Kind string + DisplayName string + Description string + Resources []APIResourceReference + StatusDescriptors []StatusDescriptor + SpecDescriptors []SpecDescriptor + ActionDescriptor []ActionDescriptor +} + +// APIServiceDescription provides details to OLM about apis provided via aggregation +type APIServiceDescription struct { + Name string + Group string + Version string + Kind string + DeploymentName string + ContainerPort int32 + DisplayName string + Description string + Resources []APIResourceReference + StatusDescriptors []StatusDescriptor + SpecDescriptors []SpecDescriptor + ActionDescriptor []ActionDescriptor +} + +// APIResourceReference is a Kubernetes resource type used by a custom resource +type APIResourceReference struct { + Name string + Kind string + Version string +} + +// GetName returns the name of an APIService as derived from its group and version. +func (d APIServiceDescription) GetName() string { + return fmt.Sprintf("%s.%s", d.Version, d.Group) +} + +// CustomResourceDefinitions declares all of the CRDs managed or required by +// an operator being ran by ClusterServiceVersion. +// +// If the CRD is present in the Owned list, it is implicitly required. +type CustomResourceDefinitions struct { + Owned []CRDDescription + Required []CRDDescription +} + +// APIServiceDefinitions declares all of the extension apis managed or required by +// an operator being ran by ClusterServiceVersion. +type APIServiceDefinitions struct { + Owned []APIServiceDescription + Required []APIServiceDescription +} + +// ClusterServiceVersionSpec declarations tell OLM how to install an operator +// that can manage apps for a given version. +type ClusterServiceVersionSpec struct { + InstallStrategy NamedInstallStrategy + Version version.OperatorVersion + Maturity string + CustomResourceDefinitions CustomResourceDefinitions + APIServiceDefinitions APIServiceDefinitions + NativeAPIs []metav1.GroupVersionKind + MinKubeVersion string + DisplayName string + Description string + Keywords []string + Maintainers []Maintainer + Provider AppLink + Links []AppLink + Icon []Icon + + // InstallModes specify supported installation types + // +optional + InstallModes []InstallMode + + // The name of a CSV this one replaces. Should match the `metadata.Name` field of the old CSV. + // +optional + Replaces string + + // Map of string keys and values that can be used to organize and categorize + // (scope and select) objects. + // +optional + Labels map[string]string + + // Annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. + // +optional + Annotations map[string]string + + // Label selector for related resources. + // +optional + Selector *metav1.LabelSelector +} + +type Maintainer struct { + Name string + Email string +} + +type AppLink struct { + Name string + URL string +} + +type Icon struct { + Data string + MediaType string +} + +// ClusterServiceVersionPhase is a label for the condition of a ClusterServiceVersion at the current time. +type ClusterServiceVersionPhase string + +// These are the valid phases of ClusterServiceVersion +const ( + CSVPhaseNone = "" + // CSVPhasePending means the csv has been accepted by the system, but the install strategy has not been attempted. + // This is likely because there are unmet requirements. + CSVPhasePending ClusterServiceVersionPhase = "Pending" + // CSVPhaseInstallReady means that the requirements are met but the install strategy has not been run. + CSVPhaseInstallReady ClusterServiceVersionPhase = "InstallReady" + // CSVPhaseInstalling means that the install strategy has been initiated but not completed. + CSVPhaseInstalling ClusterServiceVersionPhase = "Installing" + // CSVPhaseSucceeded means that the resources in the CSV were created successfully. + CSVPhaseSucceeded ClusterServiceVersionPhase = "Succeeded" + // CSVPhaseFailed means that the install strategy could not be successfully completed. + CSVPhaseFailed ClusterServiceVersionPhase = "Failed" + // CSVPhaseUnknown means that for some reason the state of the csv could not be obtained. + CSVPhaseUnknown ClusterServiceVersionPhase = "Unknown" + // CSVPhaseReplacing means that a newer CSV has been created and the csv's resources will be transitioned to a new owner. + CSVPhaseReplacing ClusterServiceVersionPhase = "Replacing" + // CSVPhaseDeleting means that a CSV has been replaced by a new one and will be checked for safety before being deleted + CSVPhaseDeleting ClusterServiceVersionPhase = "Deleting" + // CSVPhaseAny matches all other phases in CSV queries + CSVPhaseAny ClusterServiceVersionPhase = "" +) + +// ConditionReason is a camelcased reason for the state transition +type ConditionReason string + +const ( + CSVReasonRequirementsUnknown ConditionReason = "RequirementsUnknown" + CSVReasonRequirementsNotMet ConditionReason = "RequirementsNotMet" + CSVReasonRequirementsMet ConditionReason = "AllRequirementsMet" + CSVReasonOwnerConflict ConditionReason = "OwnerConflict" + CSVReasonComponentFailed ConditionReason = "InstallComponentFailed" + CSVReasonInvalidStrategy ConditionReason = "InvalidInstallStrategy" + CSVReasonWaiting ConditionReason = "InstallWaiting" + CSVReasonInstallSuccessful ConditionReason = "InstallSucceeded" + CSVReasonInstallCheckFailed ConditionReason = "InstallCheckFailed" + CSVReasonComponentUnhealthy ConditionReason = "ComponentUnhealthy" + CSVReasonBeingReplaced ConditionReason = "BeingReplaced" + CSVReasonReplaced ConditionReason = "Replaced" + CSVReasonNeedsReinstall ConditionReason = "NeedsReinstall" + CSVReasonNeedsCertRotation ConditionReason = "NeedsCertRotation" + CSVReasonAPIServiceResourceIssue ConditionReason = "APIServiceResourceIssue" + CSVReasonAPIServiceResourcesNeedReinstall ConditionReason = "APIServiceResourcesNeedReinstall" + CSVReasonAPIServiceInstallFailed ConditionReason = "APIServiceInstallFailed" + CSVReasonCopied ConditionReason = "Copied" + CSVReasonInvalidInstallModes ConditionReason = "InvalidInstallModes" + CSVReasonNoTargetNamespaces ConditionReason = "NoTargetNamespaces" + CSVReasonUnsupportedOperatorGroup ConditionReason = "UnsupportedOperatorGroup" + CSVReasonNoOperatorGroup ConditionReason = "NoOperatorGroup" + CSVReasonTooManyOperatorGroups ConditionReason = "TooManyOperatorGroups" + CSVReasonInterOperatorGroupOwnerConflict ConditionReason = "InterOperatorGroupOwnerConflict" + CSVReasonCannotModifyStaticOperatorGroupProvidedAPIs ConditionReason = "CannotModifyStaticOperatorGroupProvidedAPIs" +) + +// Conditions appear in the status as a record of state transitions on the ClusterServiceVersion +type ClusterServiceVersionCondition struct { + // Condition of the ClusterServiceVersion + Phase ClusterServiceVersionPhase + // A human readable message indicating details about why the ClusterServiceVersion is in this condition. + // +optional + Message string + // A brief CamelCase message indicating details about why the ClusterServiceVersion is in this state. + // e.g. 'RequirementsNotMet' + // +optional + Reason ConditionReason + // Last time we updated the status + // +optional + LastUpdateTime metav1.Time + // Last time the status transitioned from one status to another. + // +optional + LastTransitionTime metav1.Time +} + +// OwnsCRD determines whether the current CSV owns a paritcular CRD. +func (csv ClusterServiceVersion) OwnsCRD(name string) bool { + for _, desc := range csv.Spec.CustomResourceDefinitions.Owned { + if desc.Name == name { + return true + } + } + + return false +} + +// OwnsAPIService determines whether the current CSV owns a paritcular APIService. +func (csv ClusterServiceVersion) OwnsAPIService(name string) bool { + for _, desc := range csv.Spec.APIServiceDefinitions.Owned { + apiServiceName := fmt.Sprintf("%s.%s", desc.Version, desc.Group) + if apiServiceName == name { + return true + } + } + + return false +} + +// StatusReason is a camelcased reason for the status of a RequirementStatus or DependentStatus +type StatusReason string + +const ( + RequirementStatusReasonPresent StatusReason = "Present" + RequirementStatusReasonNotPresent StatusReason = "NotPresent" + RequirementStatusReasonPresentNotSatisfied StatusReason = "PresentNotSatisfied" + // The CRD is present but the Established condition is False (not available) + RequirementStatusReasonNotAvailable StatusReason = "PresentNotAvailable" + DependentStatusReasonSatisfied StatusReason = "Satisfied" + DependentStatusReasonNotSatisfied StatusReason = "NotSatisfied" +) + +// DependentStatus is the status for a dependent requirement (to prevent infinite nesting) +type DependentStatus struct { + Group string + Version string + Kind string + Status StatusReason + UUID string + Message string +} + +type RequirementStatus struct { + Group string + Version string + Kind string + Name string + Status StatusReason + Message string + UUID string + Dependents []DependentStatus +} + +// ClusterServiceVersionStatus represents information about the status of a pod. Status may trail the actual +// state of a system. +type ClusterServiceVersionStatus struct { + // Current condition of the ClusterServiceVersion + Phase ClusterServiceVersionPhase + // A human readable message indicating details about why the ClusterServiceVersion is in this condition. + // +optional + Message string + // A brief CamelCase message indicating details about why the ClusterServiceVersion is in this state. + // e.g. 'RequirementsNotMet' + // +optional + Reason ConditionReason + // Last time we updated the status + // +optional + LastUpdateTime metav1.Time + // Last time the status transitioned from one status to another. + // +optional + LastTransitionTime metav1.Time + // List of conditions, a history of state transitions + Conditions []ClusterServiceVersionCondition + // The status of each requirement for this CSV + RequirementStatus []RequirementStatus + // Last time the owned APIService certs were updated + // +optional + CertsLastUpdated metav1.Time + // Time the owned APIService certs will rotate next + // +optional + CertsRotateAt metav1.Time +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient + +// ClusterServiceVersion is a Custom Resource of type `ClusterServiceVersionSpec`. +type ClusterServiceVersion struct { + metav1.TypeMeta + metav1.ObjectMeta + + Spec ClusterServiceVersionSpec + Status ClusterServiceVersionStatus +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterServiceVersionList represents a list of ClusterServiceVersions. +type ClusterServiceVersionList struct { + metav1.TypeMeta + metav1.ListMeta + + Items []ClusterServiceVersion +} + +// GetAllCRDDescriptions returns a deduplicated set of CRDDescriptions that is +// the union of the owned and required CRDDescriptions. +// +// Descriptions with the same name prefer the value in Owned. +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetAllCRDDescriptions() []CRDDescription { + set := make(map[string]CRDDescription) + for _, required := range csv.Spec.CustomResourceDefinitions.Required { + set[required.Name] = required + } + + for _, owned := range csv.Spec.CustomResourceDefinitions.Owned { + set[owned.Name] = owned + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]CRDDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} + +// GetAllAPIServiceDescriptions returns a deduplicated set of APIServiceDescriptions that is +// the union of the owned and required APIServiceDescriptions. +// +// Descriptions with the same name prefer the value in Owned. +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetAllAPIServiceDescriptions() []APIServiceDescription { + set := make(map[string]APIServiceDescription) + for _, required := range csv.Spec.APIServiceDefinitions.Required { + name := fmt.Sprintf("%s.%s", required.Version, required.Group) + set[name] = required + } + + for _, owned := range csv.Spec.APIServiceDefinitions.Owned { + name := fmt.Sprintf("%s.%s", owned.Version, owned.Group) + set[name] = owned + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]APIServiceDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} + +// GetRequiredAPIServiceDescriptions returns a deduplicated set of required APIServiceDescriptions +// with the intersection of required and owned removed +// Equivalent to the set subtraction required - owned +// +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetRequiredAPIServiceDescriptions() []APIServiceDescription { + set := make(map[string]APIServiceDescription) + for _, required := range csv.Spec.APIServiceDefinitions.Required { + name := fmt.Sprintf("%s.%s", required.Version, required.Group) + set[name] = required + } + + // Remove any shared owned from the set + for _, owned := range csv.Spec.APIServiceDefinitions.Owned { + name := fmt.Sprintf("%s.%s", owned.Version, owned.Group) + if _, ok := set[name]; ok { + delete(set, name) + } + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]APIServiceDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} + +// GetOwnedAPIServiceDescriptions returns a deduplicated set of owned APIServiceDescriptions +// +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetOwnedAPIServiceDescriptions() []APIServiceDescription { + set := make(map[string]APIServiceDescription) + for _, owned := range csv.Spec.APIServiceDefinitions.Owned { + name := owned.GetName() + set[name] = owned + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]APIServiceDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/doc.go new file mode 100644 index 0000000000..bc8a343494 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/doc.go @@ -0,0 +1,5 @@ +// +k8s:deepcopy-gen=package +// +groupName=operators.coreos.com + +// Package operators contains all resource types of the operators.coreos.com API group. +package operators diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/install/install.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/install/install.go new file mode 100644 index 0000000000..9d7b7b4c5f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/install/install.go @@ -0,0 +1,18 @@ +package install + +import ( + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" +) + +// Install registers the API group and adds all of its types to the given scheme. +func Install(scheme *runtime.Scheme) { + utilruntime.Must(operators.AddToScheme(scheme)) + utilruntime.Must(v1alpha1.AddToScheme(scheme)) + utilruntime.Must(v1.AddToScheme(scheme)) + utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion, v1alpha1.SchemeGroupVersion)) +} \ No newline at end of file diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/installplan_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/installplan_types.go new file mode 100644 index 0000000000..045f48d371 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/installplan_types.go @@ -0,0 +1,248 @@ +package operators + +import ( + "errors" + "fmt" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// InstallPlanKind is the PascalCase name of an InstallPlan's kind. +const InstallPlanKind = "InstallPlan" + +// Approval is the user approval policy for an InstallPlan. +type Approval string + +const ( + ApprovalAutomatic Approval = "Automatic" + ApprovalManual Approval = "Manual" +) + +// InstallPlanSpec defines a set of Application resources to be installed +type InstallPlanSpec struct { + CatalogSource string + CatalogSourceNamespace string + ClusterServiceVersionNames []string + Approval Approval + Approved bool +} + +// InstallPlanPhase is the current status of a InstallPlan as a whole. +type InstallPlanPhase string + +const ( + InstallPlanPhaseNone InstallPlanPhase = "" + InstallPlanPhasePlanning InstallPlanPhase = "Planning" + InstallPlanPhaseRequiresApproval InstallPlanPhase = "RequiresApproval" + InstallPlanPhaseInstalling InstallPlanPhase = "Installing" + InstallPlanPhaseComplete InstallPlanPhase = "Complete" + InstallPlanPhaseFailed InstallPlanPhase = "Failed" +) + +// InstallPlanConditionType describes the state of an InstallPlan at a certain point as a whole. +type InstallPlanConditionType string + +const ( + InstallPlanResolved InstallPlanConditionType = "Resolved" + InstallPlanInstalled InstallPlanConditionType = "Installed" +) + +// ConditionReason is a camelcased reason for the state transition. +type InstallPlanConditionReason string + +const ( + InstallPlanReasonPlanUnknown InstallPlanConditionReason = "PlanUnknown" + InstallPlanReasonInstallCheckFailed InstallPlanConditionReason = "InstallCheckFailed" + InstallPlanReasonDependencyConflict InstallPlanConditionReason = "DependenciesConflict" + InstallPlanReasonComponentFailed InstallPlanConditionReason = "InstallComponentFailed" +) + +// StepStatus is the current status of a particular resource an in +// InstallPlan +type StepStatus string + +const ( + StepStatusUnknown StepStatus = "Unknown" + StepStatusNotPresent StepStatus = "NotPresent" + StepStatusPresent StepStatus = "Present" + StepStatusCreated StepStatus = "Created" +) + +// ErrInvalidInstallPlan is the error returned by functions that operate on +// InstallPlans when the InstallPlan does not contain totally valid data. +var ErrInvalidInstallPlan = errors.New("the InstallPlan contains invalid data") + +// InstallPlanStatus represents the information about the status of +// steps required to complete installation. +// +// Status may trail the actual state of a system. +type InstallPlanStatus struct { + Phase InstallPlanPhase + Conditions []InstallPlanCondition + CatalogSources []string + Plan []*Step +} + +// InstallPlanCondition represents the overall status of the execution of +// an InstallPlan. +type InstallPlanCondition struct { + Type InstallPlanConditionType + Status corev1.ConditionStatus // True, False, or Unknown + LastUpdateTime metav1.Time + LastTransitionTime metav1.Time + Reason InstallPlanConditionReason + Message string +} + +// allow overwriting `now` function for deterministic tests +var now = metav1.Now + +// GetCondition returns the InstallPlanCondition of the given type if it exists in the InstallPlanStatus' Conditions. +// Returns a condition of the given type with a ConditionStatus of "Unknown" if not found. +func (s InstallPlanStatus) GetCondition(conditionType InstallPlanConditionType) InstallPlanCondition { + for _, cond := range s.Conditions { + if cond.Type == conditionType { + return cond + } + } + + return InstallPlanCondition{ + Type: conditionType, + Status: corev1.ConditionUnknown, + } +} + +// SetCondition adds or updates a condition, using `Type` as merge key. +func (s *InstallPlanStatus) SetCondition(cond InstallPlanCondition) InstallPlanCondition { + for i, existing := range s.Conditions { + if existing.Type != cond.Type { + continue + } + if existing.Status == cond.Status { + cond.LastTransitionTime = existing.LastTransitionTime + } + s.Conditions[i] = cond + return cond + } + s.Conditions = append(s.Conditions, cond) + return cond +} + +func ConditionFailed(cond InstallPlanConditionType, reason InstallPlanConditionReason, message string, now *metav1.Time) InstallPlanCondition { + return InstallPlanCondition{ + Type: cond, + Status: corev1.ConditionFalse, + Reason: reason, + Message: message, + LastUpdateTime: *now, + LastTransitionTime: *now, + } +} + +func ConditionMet(cond InstallPlanConditionType, now *metav1.Time) InstallPlanCondition { + return InstallPlanCondition{ + Type: cond, + Status: corev1.ConditionTrue, + LastUpdateTime: *now, + LastTransitionTime: *now, + } +} + +// Step represents the status of an individual step in an InstallPlan. +type Step struct { + Resolving string + Resource StepResource + Status StepStatus +} + +// ManifestsMatch returns true if the CSV manifests in the StepResources of the given list of steps +// matches those in the InstallPlanStatus. +func (s *InstallPlanStatus) CSVManifestsMatch(steps []*Step) bool { + if s.Plan == nil && steps == nil { + return true + } + if s.Plan == nil || steps == nil { + return false + } + + manifests := make(map[string]struct{}) + for _, step := range s.Plan { + resource := step.Resource + if resource.Kind != ClusterServiceVersionKind { + continue + } + manifests[resource.Manifest] = struct{}{} + } + + for _, step := range steps { + resource := step.Resource + if resource.Kind != ClusterServiceVersionKind { + continue + } + if _, ok := manifests[resource.Manifest]; !ok { + return false + } + delete(manifests, resource.Manifest) + } + + if len(manifests) == 0 { + return true + } + + return false +} + +func (s *Step) String() string { + return fmt.Sprintf("%s: %s (%s)", s.Resolving, s.Resource, s.Status) +} + +// StepResource represents the status of a resource to be tracked by an +// InstallPlan. +type StepResource struct { + CatalogSource string + CatalogSourceNamespace string + Group string + Version string + Kind string + Name string + Manifest string +} + +func (r StepResource) String() string { + return fmt.Sprintf("%s[%s/%s/%s (%s/%s)]", r.Name, r.Group, r.Version, r.Kind, r.CatalogSource, r.CatalogSourceNamespace) +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient + +// InstallPlan defines the installation of a set of operators. +type InstallPlan struct { + metav1.TypeMeta + metav1.ObjectMeta + + Spec InstallPlanSpec + Status InstallPlanStatus +} + +// EnsureCatalogSource ensures that a CatalogSource is present in the Status +// block of an InstallPlan. +func (p *InstallPlan) EnsureCatalogSource(sourceName string) { + for _, srcName := range p.Status.CatalogSources { + if srcName == sourceName { + return + } + } + + p.Status.CatalogSources = append(p.Status.CatalogSources, sourceName) +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InstallPlanList is a list of InstallPlan resources. +type InstallPlanList struct { + metav1.TypeMeta + metav1.ListMeta + + Items []InstallPlan +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/operatorgroup_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/operatorgroup_types.go new file mode 100644 index 0000000000..b102d9ca1d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/operatorgroup_types.go @@ -0,0 +1,75 @@ +package operators + +import ( + "sort" + "strings" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// OperatorGroupKind is the PascalCase name of an OperatorGroup's kind. +const OperatorGroupKind = "OperatorGroup" + +const ( + OperatorGroupAnnotationKey = "olm.operatorGroup" + OperatorGroupNamespaceAnnotationKey = "olm.operatorNamespace" + OperatorGroupTargetsAnnotationKey = "olm.targetNamespaces" + OperatorGroupProvidedAPIsAnnotationKey = "olm.providedAPIs" +) + +// OperatorGroupSpec is the spec for an OperatorGroup resource. +type OperatorGroupSpec struct { + // Selector selects the OperatorGroup's target namespaces. + // +optional + Selector *metav1.LabelSelector + + // TargetNamespaces is an explicit set of namespaces to target. + // If it is set, Selector is ignored. + // +optional + TargetNamespaces []string + + // ServiceAccount to bind OperatorGroup roles to. + ServiceAccount corev1.ServiceAccount + + // Static tells OLM not to update the OperatorGroup's providedAPIs annotation + // +optional + StaticProvidedAPIs bool +} + +// OperatorGroupStatus is the status for an OperatorGroupResource. +type OperatorGroupStatus struct { + // Namespaces is the set of target namespaces for the OperatorGroup. + Namespaces []string + + // LastUpdated is a timestamp of the last time the OperatorGroup's status was Updated. + LastUpdated metav1.Time +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient + +// OperatorGroup is the unit of multitenancy for OLM managed operators. +// It constrains the installation of operators in its namespace to a specified set of target namespaces. +type OperatorGroup struct { + metav1.TypeMeta + metav1.ObjectMeta + + Spec OperatorGroupSpec + Status OperatorGroupStatus +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// OperatorGroupList is a list of OperatorGroup resources. +type OperatorGroupList struct { + metav1.TypeMeta + metav1.ListMeta + + Items []OperatorGroup +} + +func (o *OperatorGroup) BuildTargetNamespaces() string { + sort.Strings(o.Status.Namespaces) + return strings.Join(o.Status.Namespaces, ",") +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/reference/reference.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/reference/reference.go new file mode 100644 index 0000000000..1157820c19 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/reference/reference.go @@ -0,0 +1,22 @@ +package reference + +import ( + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime" + ref "k8s.io/client-go/tools/reference" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/install" +) + +var scheme = runtime.NewScheme() + +func init() { + // Register all OLM types with the scheme + install.Install(scheme) +} + +// GetReference returns an ObjectReference for the given object. +// The objects dynamic type must be an OLM type. +func GetReference(obj runtime.Object) (*corev1.ObjectReference, error) { + return ref.GetReference(scheme, obj) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/reference/reference_test.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/reference/reference_test.go new file mode 100644 index 0000000000..b83e7f5d3f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/reference/reference_test.go @@ -0,0 +1,295 @@ +package reference + +import ( + "fmt" + "reflect" + "testing" + + "github.com/stretchr/testify/require" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" + v1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1" + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" +) + +func TestGetReference(t *testing.T) { + type args struct { + obj runtime.Object + } + type want struct { + ref *corev1.ObjectReference + err error + } + tests := []struct { + name string + args args + want want + }{ + { + name: "Nil/Error", + args: args{obj: nil}, + want: want{ + ref: nil, + err: fmt.Errorf("can't reference a nil object"), + }, + }, + { + name: "v1/Pod/NotRegistered/Error", + args: args{&corev1.Pod{}}, + want: want{ + ref: nil, + err: runtime.NewNotRegisteredErrForType(scheme.Name(), reflect.TypeOf(corev1.Pod{})), + }, + }, + { + name: "v1alpha1/ClusterServiceVersion", + args: args{ + &v1alpha1.ClusterServiceVersion{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns", + Name: "csv", + UID: types.UID("uid"), + SelfLink: buildSelfLink(v1alpha1.SchemeGroupVersion.String(), "clusterserviceversions", "ns", "csv"), + }, + }, + }, + want: want{ + ref: &corev1.ObjectReference{ + Namespace: "ns", + Name: "csv", + UID: types.UID("uid"), + Kind: v1alpha1.ClusterServiceVersionKind, + APIVersion: v1alpha1.SchemeGroupVersion.String(), + }, + err: nil, + }, + }, + { + name: "v1alpha1/InstallPlan", + args: args{ + &v1alpha1.InstallPlan{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns", + Name: "ip", + UID: types.UID("uid"), + SelfLink: buildSelfLink(v1alpha1.SchemeGroupVersion.String(), "installplans", "ns", "ip"), + }, + }, + }, + want: want{ + ref: &corev1.ObjectReference{ + Namespace: "ns", + Name: "ip", + UID: types.UID("uid"), + Kind: v1alpha1.InstallPlanKind, + APIVersion: v1alpha1.SchemeGroupVersion.String(), + }, + err: nil, + }, + }, + { + name: "v1alpha1/Subscription", + args: args{ + &v1alpha1.Subscription{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns", + Name: "sub", + UID: types.UID("uid"), + SelfLink: buildSelfLink(v1alpha1.SchemeGroupVersion.String(), "subscriptions", "ns", "sub"), + }, + }, + }, + want: want{ + ref: &corev1.ObjectReference{ + Namespace: "ns", + Name: "sub", + UID: types.UID("uid"), + Kind: v1alpha1.SubscriptionKind, + APIVersion: v1alpha1.SchemeGroupVersion.String(), + }, + err: nil, + }, + }, + { + name: "v1alpha1/CatalogSource", + args: args{ + &v1alpha1.CatalogSource{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns", + Name: "catsrc", + UID: types.UID("uid"), + SelfLink: buildSelfLink(v1alpha1.SchemeGroupVersion.String(), "catalogsources", "ns", "catsrc"), + }, + }, + }, + want: want{ + ref: &corev1.ObjectReference{ + Namespace: "ns", + Name: "catsrc", + UID: types.UID("uid"), + Kind: v1alpha1.CatalogSourceKind, + APIVersion: v1alpha1.SchemeGroupVersion.String(), + }, + err: nil, + }, + }, + { + name: "v1/OperatorGroup", + args: args{ + &v1.OperatorGroup{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns", + Name: "og", + UID: types.UID("uid"), + SelfLink: buildSelfLink(v1.SchemeGroupVersion.String(), "operatorgroups", "ns", "og"), + }, + }, + }, + want: want{ + ref: &corev1.ObjectReference{ + Namespace: "ns", + Name: "og", + UID: types.UID("uid"), + Kind: v1.OperatorGroupKind, + APIVersion: v1.SchemeGroupVersion.String(), + }, + err: nil, + }, + }, + { + name: "internalversion/ClusterServiceVersion", + args: args{ + &operators.ClusterServiceVersion{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns", + Name: "csv", + UID: types.UID("uid"), + SelfLink: buildSelfLink(operators.SchemeGroupVersion.String(), "clusterserviceversions", "ns", "csv"), + }, + }, + }, + want: want{ + ref: &corev1.ObjectReference{ + Namespace: "ns", + Name: "csv", + UID: types.UID("uid"), + Kind: operators.ClusterServiceVersionKind, + APIVersion: operators.SchemeGroupVersion.String(), + }, + err: nil, + }, + }, + { + name: "internalversion/InstallPlan", + args: args{ + &v1alpha1.InstallPlan{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns", + Name: "ip", + UID: types.UID("uid"), + SelfLink: buildSelfLink(operators.SchemeGroupVersion.String(), "installplans", "ns", "ip"), + }, + }, + }, + want: want{ + ref: &corev1.ObjectReference{ + Namespace: "ns", + Name: "ip", + UID: types.UID("uid"), + Kind: operators.InstallPlanKind, + APIVersion: operators.SchemeGroupVersion.String(), + }, + err: nil, + }, + }, + { + name: "internalversion/Subscription", + args: args{ + &v1alpha1.Subscription{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns", + Name: "sub", + UID: types.UID("uid"), + SelfLink: buildSelfLink(operators.SchemeGroupVersion.String(), "subscriptions", "ns", "sub"), + }, + }, + }, + want: want{ + ref: &corev1.ObjectReference{ + Namespace: "ns", + Name: "sub", + UID: types.UID("uid"), + Kind: operators.SubscriptionKind, + APIVersion: operators.SchemeGroupVersion.String(), + }, + err: nil, + }, + }, + { + name: "internalversion/CatalogSource", + args: args{ + &v1alpha1.CatalogSource{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns", + Name: "catsrc", + UID: types.UID("uid"), + SelfLink: buildSelfLink(operators.SchemeGroupVersion.String(), "catalogsources", "ns", "catsrc"), + }, + }, + }, + want: want{ + ref: &corev1.ObjectReference{ + Namespace: "ns", + Name: "catsrc", + UID: types.UID("uid"), + Kind: operators.CatalogSourceKind, + APIVersion: operators.SchemeGroupVersion.String(), + }, + err: nil, + }, + }, + { + name: "internalversion/OperatorGroup", + args: args{ + &v1.OperatorGroup{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns", + Name: "og", + UID: types.UID("uid"), + SelfLink: buildSelfLink(operators.SchemeGroupVersion.String(), "operatorgroups", "ns", "og"), + }, + }, + }, + want: want{ + ref: &corev1.ObjectReference{ + Namespace: "ns", + Name: "og", + UID: types.UID("uid"), + Kind: operators.OperatorGroupKind, + APIVersion: operators.SchemeGroupVersion.String(), + }, + err: nil, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ref, err := GetReference(tt.args.obj) + require.Equal(t, tt.want.err, err) + require.Equal(t, tt.want.ref, ref) + }) + } +} + +// buildSelfLink returns a selfLink. +func buildSelfLink(groupVersion, plural, namespace, name string) string { + if namespace == metav1.NamespaceAll { + return fmt.Sprintf("/apis/%s/%s/%s", groupVersion, plural, name) + } + return fmt.Sprintf("/apis/%s/namespaces/%s/%s/%s", groupVersion, namespace, plural, name) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/register.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/register.go new file mode 100644 index 0000000000..784b040264 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/register.go @@ -0,0 +1,50 @@ +package operators + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + // GroupName is the group name used in this package. + GroupName = "operators.coreos.com" + // GroupVersion is the group version used in this package. + GroupVersion = runtime.APIVersionInternal +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder initializes a scheme builder + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme is a global function that registers this API group & version to a scheme + AddToScheme = SchemeBuilder.AddToScheme +) + +// addKnownTypes adds the list of known types to Scheme +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &CatalogSource{}, + &CatalogSourceList{}, + &InstallPlan{}, + &InstallPlanList{}, + &Subscription{}, + &SubscriptionList{}, + &ClusterServiceVersion{}, + &ClusterServiceVersionList{}, + &OperatorGroup{}, + &OperatorGroupList{}, + ) + return nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/subscription_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/subscription_types.go new file mode 100644 index 0000000000..b32a727661 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/subscription_types.go @@ -0,0 +1,264 @@ +package operators + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// SubscriptionKind is the PascalCase name of a Subscription's kind. +const SubscriptionKind = "Subscription" + +// SubscriptionState tracks when updates are available, installing, or service is up to date +type SubscriptionState string + +const ( + SubscriptionStateNone = "" + SubscriptionStateFailed = "UpgradeFailed" + SubscriptionStateUpgradeAvailable = "UpgradeAvailable" + SubscriptionStateUpgradePending = "UpgradePending" + SubscriptionStateAtLatest = "AtLatestKnown" +) + +const ( + SubscriptionReasonInvalidCatalog ConditionReason = "InvalidCatalog" + SubscriptionReasonUpgradeSucceeded ConditionReason = "UpgradeSucceeded" +) + +// SubscriptionSpec defines an Application that can be installed +type SubscriptionSpec struct { + CatalogSource string + CatalogSourceNamespace string + Package string + Channel string + StartingCSV string + InstallPlanApproval Approval +} + +// SubscriptionConditionType indicates an explicit state condition about a Subscription in "abnormal-true" +// polarity form (see https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties). +type SubscriptionConditionType string + +const ( + // SubscriptionCatalogSourcesUnhealthy indicates that some or all of the CatalogSources to be used in resolution are unhealthy. + SubscriptionCatalogSourcesUnhealthy SubscriptionConditionType = "CatalogSourcesUnhealthy" + + // SubscriptionInstallPlanMissing indicates that a Subscription's InstallPlan is missing. + SubscriptionInstallPlanMissing SubscriptionConditionType = "InstallPlanMissing" + + // SubscriptionInstallPlanPending indicates that a Subscription's InstallPlan is pending installation. + SubscriptionInstallPlanPending SubscriptionConditionType = "InstallPlanPending" + + // SubscriptionInstallPlanFailed indicates that the installation of a Subscription's InstallPlan has failed. + SubscriptionInstallPlanFailed SubscriptionConditionType = "InstallPlanFailed" +) + +const ( + // NoCatalogSourcesFound is a reason string for Subscriptions with unhealthy CatalogSources due to none being available. + NoCatalogSourcesFound = "NoCatalogSourcesFound" + + // AllCatalogSourcesHealthy is a reason string for Subscriptions that transitioned due to all CatalogSources being healthy. + AllCatalogSourcesHealthy = "AllCatalogSourcesHealthy" + + // CatalogSourcesAdded is a reason string for Subscriptions that transitioned due to CatalogSources being added. + CatalogSourcesAdded = "CatalogSourcesAdded" + + // CatalogSourcesUpdated is a reason string for Subscriptions that transitioned due to CatalogSource being updated. + CatalogSourcesUpdated = "CatalogSourcesUpdated" + + // CatalogSourcesDeleted is a reason string for Subscriptions that transitioned due to CatalogSources being removed. + CatalogSourcesDeleted = "CatalogSourcesDeleted" + + // UnhealthyCatalogSourceFound is a reason string for Subscriptions that transitioned because an unhealthy CatalogSource was found. + UnhealthyCatalogSourceFound = "UnhealthyCatalogSourceFound" + + // ReferencedInstallPlanNotFound is a reason string for Subscriptions that transitioned due to a referenced InstallPlan not being found. + ReferencedInstallPlanNotFound = "ReferencedInstallPlanNotFound" + + // InstallPlanNotYetReconciled is a reason string for Subscriptions that transitioned due to a referenced InstallPlan not being reconciled yet. + InstallPlanNotYetReconciled = "InstallPlanNotYetReconciled" + + // InstallPlanFailed is a reason string for Subscriptions that transitioned due to a referenced InstallPlan failing without setting an explicit failure condition. + InstallPlanFailed = "InstallPlanFailed" +) + +// SubscriptionCondition represents the latest available observations of a Subscription's state. +type SubscriptionCondition struct { + // Type is the type of Subscription condition. + Type SubscriptionConditionType + + // Status is the status of the condition, one of True, False, Unknown. + Status corev1.ConditionStatus + + // Reason is a one-word CamelCase reason for the condition's last transition. + // +optional + Reason string + + // Message is a human-readable message indicating details about last transition. + // +optional + Message string + + // LastHeartbeatTime is the last time we got an update on a given condition + // +optional + LastHeartbeatTime *metav1.Time + + // LastTransitionTime is the last time the condition transit from one status to another + // +optional + LastTransitionTime *metav1.Time +} + +// Equals returns true if a SubscriptionCondition equals the one given, false otherwise. +// Equality is determined by the equality of the type, status, reason, and message fields ONLY. +func (s SubscriptionCondition) Equals(condition SubscriptionCondition) bool { + return s.Type == condition.Type && s.Status == condition.Status && s.Reason == condition.Reason && s.Message == condition.Message +} + +type SubscriptionStatus struct { + // CurrentCSV is the CSV the Subscription is progressing to. + // +optional + CurrentCSV string + + // InstalledCSV is the CSV currently installed by the Subscription. + // +optional + InstalledCSV string + + // Install is a reference to the latest InstallPlan generated for the Subscription. + // DEPRECATED: InstallPlanRef + // +optional + Install *InstallPlanReference + + // State represents the current state of the Subscription + // +optional + State SubscriptionState + + // Reason is the reason the Subscription was transitioned to its current state. + // +optional + Reason ConditionReason + + // InstallPlanRef is a reference to the latest InstallPlan that contains the Subscription's current CSV. + // +optional + InstallPlanRef *corev1.ObjectReference + + // CatalogHealth contains the Subscription's view of its relevant CatalogSources' status. + // It is used to determine SubscriptionStatusConditions related to CatalogSources. + // +optional + CatalogHealth []SubscriptionCatalogHealth + + // Conditions is a list of the latest available observations about a Subscription's current state. + // +optional + Conditions []SubscriptionCondition `hash:"set"` + + // LastUpdated represents the last time that the Subscription status was updated. + LastUpdated metav1.Time +} + +// GetCondition returns the SubscriptionCondition of the given type if it exists in the SubscriptionStatus' Conditions. +// Returns a condition of the given type with a ConditionStatus of "Unknown" if not found. +func (s SubscriptionStatus) GetCondition(conditionType SubscriptionConditionType) SubscriptionCondition { + for _, cond := range s.Conditions { + if cond.Type == conditionType { + return cond + } + } + + return SubscriptionCondition{ + Type: conditionType, + Status: corev1.ConditionUnknown, + } +} + +// SetCondition sets the given SubscriptionCondition in the SubscriptionStatus' Conditions. +func (s *SubscriptionStatus) SetCondition(condition SubscriptionCondition) { + for i, cond := range s.Conditions { + if cond.Type == condition.Type { + s.Conditions[i] = condition + return + } + } + + s.Conditions = append(s.Conditions, condition) +} + +// RemoveConditions removes any conditions of the given types from the SubscriptionStatus' Conditions. +func (s *SubscriptionStatus) RemoveConditions(remove ...SubscriptionConditionType) { + exclusions := map[SubscriptionConditionType]struct{}{} + for _, r := range remove { + exclusions[r] = struct{}{} + } + + var filtered []SubscriptionCondition + for _, cond := range s.Conditions { + if _, ok := exclusions[cond.Type]; ok { + // Skip excluded condition types + continue + } + filtered = append(filtered, cond) + } + + s.Conditions = filtered +} + +type InstallPlanReference struct { + APIVersion string + Kind string + Name string + UID types.UID +} + +// SubscriptionCatalogHealth describes the health of a CatalogSource the Subscription knows about. +type SubscriptionCatalogHealth struct { + // CatalogSourceRef is a reference to a CatalogSource. + CatalogSourceRef *corev1.ObjectReference + + // LastUpdated represents the last time that the CatalogSourceHealth changed + LastUpdated *metav1.Time + + // Healthy is true if the CatalogSource is healthy; false otherwise. + Healthy bool +} + +// Equals returns true if a SubscriptionCatalogHealth equals the one given, false otherwise. +// Equality is based SOLEY on health and UID. +func (s SubscriptionCatalogHealth) Equals(health SubscriptionCatalogHealth) bool { + return s.Healthy == health.Healthy && s.CatalogSourceRef.UID == health.CatalogSourceRef.UID +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient + +// Subscription keeps operators up to date by tracking changes to Catalogs. +type Subscription struct { + metav1.TypeMeta + metav1.ObjectMeta + + Spec *SubscriptionSpec + Status SubscriptionStatus +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// SubscriptionList is a list of Subscription resources. +type SubscriptionList struct { + metav1.TypeMeta + metav1.ListMeta + + Items []Subscription +} + +// GetInstallPlanApproval gets the configured install plan approval or the default +func (s *Subscription) GetInstallPlanApproval() Approval { + if s.Spec.InstallPlanApproval == ApprovalManual { + return ApprovalManual + } + return ApprovalAutomatic +} + +// NewInstallPlanReference returns an InstallPlanReference for the given ObjectReference. +func NewInstallPlanReference(ref *corev1.ObjectReference) *InstallPlanReference { + return &InstallPlanReference{ + APIVersion: ref.APIVersion, + Kind: ref.Kind, + Name: ref.Name, + UID: ref.UID, + } +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/doc.go new file mode 100644 index 0000000000..9dcbd4d16a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/doc.go @@ -0,0 +1,6 @@ +// +k8s:deepcopy-gen=package +// +k8s:conversion-gen=github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators +// +groupName=operators.coreos.com + +// Package v1 contains resources types for version v1 of the operators.coreos.com API group. +package v1 diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/operatorgroup_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/operatorgroup_types.go new file mode 100644 index 0000000000..bc1abfab0c --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/operatorgroup_types.go @@ -0,0 +1,74 @@ +package v1 + +import ( + "sort" + "strings" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + OperatorGroupAnnotationKey = "olm.operatorGroup" + OperatorGroupNamespaceAnnotationKey = "olm.operatorNamespace" + OperatorGroupTargetsAnnotationKey = "olm.targetNamespaces" + OperatorGroupProvidedAPIsAnnotationKey = "olm.providedAPIs" + + OperatorGroupKind = "OperatorGroup" +) + +// OperatorGroupSpec is the spec for an OperatorGroup resource. +type OperatorGroupSpec struct { + // Selector selects the OperatorGroup's target namespaces. + // +optional + Selector *metav1.LabelSelector `json:"selector,omitempty"` + + // TargetNamespaces is an explicit set of namespaces to target. + // If it is set, Selector is ignored. + // +optional + TargetNamespaces []string `json:"targetNamespaces,omitempty"` + + // ServiceAccount to bind OperatorGroup roles to. + ServiceAccount corev1.ServiceAccount `json:"serviceAccount,omitempty"` + + // Static tells OLM not to update the OperatorGroup's providedAPIs annotation + // +optional + StaticProvidedAPIs bool `json:"staticProvidedAPIs,omitempty"` +} + +// OperatorGroupStatus is the status for an OperatorGroupResource. +type OperatorGroupStatus struct { + // Namespaces is the set of target namespaces for the OperatorGroup. + Namespaces []string `json:"namespaces,omitempty"` + + // LastUpdated is a timestamp of the last time the OperatorGroup's status was Updated. + LastUpdated metav1.Time `json:"lastUpdated"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient + +// OperatorGroup is the unit of multitenancy for OLM managed operators. +// It constrains the installation of operators in its namespace to a specified set of target namespaces. +type OperatorGroup struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec OperatorGroupSpec `json:"spec"` + Status OperatorGroupStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// OperatorGroupList is a list of OperatorGroup resources. +type OperatorGroupList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []OperatorGroup `json:"items"` +} + +func (o *OperatorGroup) BuildTargetNamespaces() string { + sort.Strings(o.Status.Namespaces) + return strings.Join(o.Status.Namespaces, ",") +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/register.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/register.go new file mode 100644 index 0000000000..a2dc95cd98 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/register.go @@ -0,0 +1,49 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" +) + +const ( + // GroupName is the group name used in this package. + GroupName = operators.GroupName + // GroupVersion is the group version used in this package. + GroupVersion = "v1" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder initializes a scheme builder + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme is a global function that registers this API group & version to a scheme + AddToScheme = SchemeBuilder.AddToScheme + + // localSchemeBuilder is expected by generated conversion functions + localSchemeBuilder = &SchemeBuilder +) + +// addKnownTypes adds the list of known types to Scheme +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &OperatorGroup{}, + &OperatorGroupList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/zz_generated.conversion.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/zz_generated.conversion.go new file mode 100644 index 0000000000..64c4b9e21d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/zz_generated.conversion.go @@ -0,0 +1,182 @@ +// +build !ignore_autogenerated + +/* +Copyright 2019 Red Hat, Inc. + +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. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1 + +import ( + unsafe "unsafe" + + operators "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*OperatorGroup)(nil), (*operators.OperatorGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_OperatorGroup_To_operators_OperatorGroup(a.(*OperatorGroup), b.(*operators.OperatorGroup), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.OperatorGroup)(nil), (*OperatorGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_OperatorGroup_To_v1_OperatorGroup(a.(*operators.OperatorGroup), b.(*OperatorGroup), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OperatorGroupList)(nil), (*operators.OperatorGroupList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_OperatorGroupList_To_operators_OperatorGroupList(a.(*OperatorGroupList), b.(*operators.OperatorGroupList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.OperatorGroupList)(nil), (*OperatorGroupList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_OperatorGroupList_To_v1_OperatorGroupList(a.(*operators.OperatorGroupList), b.(*OperatorGroupList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OperatorGroupSpec)(nil), (*operators.OperatorGroupSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_OperatorGroupSpec_To_operators_OperatorGroupSpec(a.(*OperatorGroupSpec), b.(*operators.OperatorGroupSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.OperatorGroupSpec)(nil), (*OperatorGroupSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_OperatorGroupSpec_To_v1_OperatorGroupSpec(a.(*operators.OperatorGroupSpec), b.(*OperatorGroupSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OperatorGroupStatus)(nil), (*operators.OperatorGroupStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_OperatorGroupStatus_To_operators_OperatorGroupStatus(a.(*OperatorGroupStatus), b.(*operators.OperatorGroupStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.OperatorGroupStatus)(nil), (*OperatorGroupStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_OperatorGroupStatus_To_v1_OperatorGroupStatus(a.(*operators.OperatorGroupStatus), b.(*OperatorGroupStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1_OperatorGroup_To_operators_OperatorGroup(in *OperatorGroup, out *operators.OperatorGroup, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1_OperatorGroupSpec_To_operators_OperatorGroupSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1_OperatorGroupStatus_To_operators_OperatorGroupStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1_OperatorGroup_To_operators_OperatorGroup is an autogenerated conversion function. +func Convert_v1_OperatorGroup_To_operators_OperatorGroup(in *OperatorGroup, out *operators.OperatorGroup, s conversion.Scope) error { + return autoConvert_v1_OperatorGroup_To_operators_OperatorGroup(in, out, s) +} + +func autoConvert_operators_OperatorGroup_To_v1_OperatorGroup(in *operators.OperatorGroup, out *OperatorGroup, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_operators_OperatorGroupSpec_To_v1_OperatorGroupSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_operators_OperatorGroupStatus_To_v1_OperatorGroupStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_operators_OperatorGroup_To_v1_OperatorGroup is an autogenerated conversion function. +func Convert_operators_OperatorGroup_To_v1_OperatorGroup(in *operators.OperatorGroup, out *OperatorGroup, s conversion.Scope) error { + return autoConvert_operators_OperatorGroup_To_v1_OperatorGroup(in, out, s) +} + +func autoConvert_v1_OperatorGroupList_To_operators_OperatorGroupList(in *OperatorGroupList, out *operators.OperatorGroupList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]operators.OperatorGroup)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1_OperatorGroupList_To_operators_OperatorGroupList is an autogenerated conversion function. +func Convert_v1_OperatorGroupList_To_operators_OperatorGroupList(in *OperatorGroupList, out *operators.OperatorGroupList, s conversion.Scope) error { + return autoConvert_v1_OperatorGroupList_To_operators_OperatorGroupList(in, out, s) +} + +func autoConvert_operators_OperatorGroupList_To_v1_OperatorGroupList(in *operators.OperatorGroupList, out *OperatorGroupList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]OperatorGroup)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_operators_OperatorGroupList_To_v1_OperatorGroupList is an autogenerated conversion function. +func Convert_operators_OperatorGroupList_To_v1_OperatorGroupList(in *operators.OperatorGroupList, out *OperatorGroupList, s conversion.Scope) error { + return autoConvert_operators_OperatorGroupList_To_v1_OperatorGroupList(in, out, s) +} + +func autoConvert_v1_OperatorGroupSpec_To_operators_OperatorGroupSpec(in *OperatorGroupSpec, out *operators.OperatorGroupSpec, s conversion.Scope) error { + out.Selector = (*metav1.LabelSelector)(unsafe.Pointer(in.Selector)) + out.TargetNamespaces = *(*[]string)(unsafe.Pointer(&in.TargetNamespaces)) + out.ServiceAccount = in.ServiceAccount + out.StaticProvidedAPIs = in.StaticProvidedAPIs + return nil +} + +// Convert_v1_OperatorGroupSpec_To_operators_OperatorGroupSpec is an autogenerated conversion function. +func Convert_v1_OperatorGroupSpec_To_operators_OperatorGroupSpec(in *OperatorGroupSpec, out *operators.OperatorGroupSpec, s conversion.Scope) error { + return autoConvert_v1_OperatorGroupSpec_To_operators_OperatorGroupSpec(in, out, s) +} + +func autoConvert_operators_OperatorGroupSpec_To_v1_OperatorGroupSpec(in *operators.OperatorGroupSpec, out *OperatorGroupSpec, s conversion.Scope) error { + out.Selector = (*metav1.LabelSelector)(unsafe.Pointer(in.Selector)) + out.TargetNamespaces = *(*[]string)(unsafe.Pointer(&in.TargetNamespaces)) + out.ServiceAccount = in.ServiceAccount + out.StaticProvidedAPIs = in.StaticProvidedAPIs + return nil +} + +// Convert_operators_OperatorGroupSpec_To_v1_OperatorGroupSpec is an autogenerated conversion function. +func Convert_operators_OperatorGroupSpec_To_v1_OperatorGroupSpec(in *operators.OperatorGroupSpec, out *OperatorGroupSpec, s conversion.Scope) error { + return autoConvert_operators_OperatorGroupSpec_To_v1_OperatorGroupSpec(in, out, s) +} + +func autoConvert_v1_OperatorGroupStatus_To_operators_OperatorGroupStatus(in *OperatorGroupStatus, out *operators.OperatorGroupStatus, s conversion.Scope) error { + out.Namespaces = *(*[]string)(unsafe.Pointer(&in.Namespaces)) + out.LastUpdated = in.LastUpdated + return nil +} + +// Convert_v1_OperatorGroupStatus_To_operators_OperatorGroupStatus is an autogenerated conversion function. +func Convert_v1_OperatorGroupStatus_To_operators_OperatorGroupStatus(in *OperatorGroupStatus, out *operators.OperatorGroupStatus, s conversion.Scope) error { + return autoConvert_v1_OperatorGroupStatus_To_operators_OperatorGroupStatus(in, out, s) +} + +func autoConvert_operators_OperatorGroupStatus_To_v1_OperatorGroupStatus(in *operators.OperatorGroupStatus, out *OperatorGroupStatus, s conversion.Scope) error { + out.Namespaces = *(*[]string)(unsafe.Pointer(&in.Namespaces)) + out.LastUpdated = in.LastUpdated + return nil +} + +// Convert_operators_OperatorGroupStatus_To_v1_OperatorGroupStatus is an autogenerated conversion function. +func Convert_operators_OperatorGroupStatus_To_v1_OperatorGroupStatus(in *operators.OperatorGroupStatus, out *OperatorGroupStatus, s conversion.Scope) error { + return autoConvert_operators_OperatorGroupStatus_To_v1_OperatorGroupStatus(in, out, s) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/zz_generated.deepcopy.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..7097508a6b --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1/zz_generated.deepcopy.go @@ -0,0 +1,136 @@ +// +build !ignore_autogenerated + +/* +Copyright 2019 Red Hat, Inc. + +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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorGroup) DeepCopyInto(out *OperatorGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorGroup. +func (in *OperatorGroup) DeepCopy() *OperatorGroup { + if in == nil { + return nil + } + out := new(OperatorGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OperatorGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorGroupList) DeepCopyInto(out *OperatorGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OperatorGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorGroupList. +func (in *OperatorGroupList) DeepCopy() *OperatorGroupList { + if in == nil { + return nil + } + out := new(OperatorGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OperatorGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorGroupSpec) DeepCopyInto(out *OperatorGroupSpec) { + *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.TargetNamespaces != nil { + in, out := &in.TargetNamespaces, &out.TargetNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + in.ServiceAccount.DeepCopyInto(&out.ServiceAccount) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorGroupSpec. +func (in *OperatorGroupSpec) DeepCopy() *OperatorGroupSpec { + if in == nil { + return nil + } + out := new(OperatorGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorGroupStatus) DeepCopyInto(out *OperatorGroupStatus) { + *out = *in + if in.Namespaces != nil { + in, out := &in.Namespaces, &out.Namespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + in.LastUpdated.DeepCopyInto(&out.LastUpdated) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorGroupStatus. +func (in *OperatorGroupStatus) DeepCopy() *OperatorGroupStatus { + if in == nil { + return nil + } + out := new(OperatorGroupStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/catalogsource_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/catalogsource_types.go new file mode 100644 index 0000000000..893249a97f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/catalogsource_types.go @@ -0,0 +1,117 @@ +package v1alpha1 + +import ( + "fmt" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +const ( + CatalogSourceCRDAPIVersion = GroupName + "/" + GroupVersion + CatalogSourceKind = "CatalogSource" +) + +// SourceType indicates the type of backing store for a CatalogSource +type SourceType string + +const ( + // SourceTypeInternal (deprecated) specifies a CatalogSource of type SourceTypeConfigmap + SourceTypeInternal SourceType = "internal" + + // SourceTypeConfigmap specifies a CatalogSource that generates a configmap-server registry + SourceTypeConfigmap SourceType = "configmap" + + // SourceTypeGrpc specifies a CatalogSource that can use an operator registry image to generate a + // registry-server or connect to a pre-existing registry at an address. + SourceTypeGrpc SourceType = "grpc" +) + +type CatalogSourceSpec struct { + // SourceType is the type of source + SourceType SourceType `json:"sourceType"` + + // ConfigMap is the name of the ConfigMap to be used to back a configmap-server registry. + // Only used when SourceType = SourceTypeConfigmap or SourceTypeInternal. + // +Optional + ConfigMap string `json:"configMap,omitempty"` + + // Address is a host that OLM can use to connect to a pre-existing registry. + // Format: : + // Only used when SourceType = SourceTypeGrpc. + // Ignored when the Image field is set. + // +Optional + Address string `json:"address,omitempty"` + + // Image is an operator-registry container image to instantiate a registry-server with. + // Only used when SourceType = SourceTypeGrpc. + // If present, the address field is ignored. + // +Optional + Image string `json:"image,omitempty"` + + // Secrets represent set of secrets that can be used to access the contents of the catalog. + // It is best to keep this list small, since each will need to be tried for every catalog entry. + // +Optional + Secrets []string `json:"secrets,omitempty"` + + // Metadata + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + Publisher string `json:"publisher,omitempty"` + Icon Icon `json:"icon,omitempty"` +} + +type RegistryServiceStatus struct { + Protocol string `json:"protocol,omitempty"` + ServiceName string `json:"serviceName,omitempty"` + ServiceNamespace string `json:"serviceNamespace,omitempty"` + Port string `json:"port,omitempty"` + CreatedAt metav1.Time `json:"createdAt,omitempty"` +} + +func (s *RegistryServiceStatus) Address() string { + return fmt.Sprintf("%s.%s.svc.cluster.local:%s", s.ServiceName, s.ServiceNamespace, s.Port) +} + +type CatalogSourceStatus struct { + ConfigMapResource *ConfigMapResourceReference `json:"configMapReference,omitempty"` + RegistryServiceStatus *RegistryServiceStatus `json:"registryService,omitempty"` + LastSync metav1.Time `json:"lastSync,omitempty"` +} + +type ConfigMapResourceReference struct { + Name string `json:"name"` + Namespace string `json:"namespace"` + + UID types.UID `json:"uid,omitempty"` + ResourceVersion string `json:"resourceVersion,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient + +// CatalogSource is a repository of CSVs, CRDs, and operator packages. +type CatalogSource struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec CatalogSourceSpec `json:"spec"` + Status CatalogSourceStatus `json:"status"` +} + +func (c *CatalogSource) Address() string { + if c.Spec.Address != "" { + return c.Spec.Address + } + return c.Status.RegistryServiceStatus.Address() +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// CatalogSourceList is a repository of CSVs, CRDs, and operator packages. +type CatalogSourceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []CatalogSource `json:"items"` +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion.go new file mode 100644 index 0000000000..9dd6f56f8d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion.go @@ -0,0 +1,208 @@ +package v1alpha1 + +import ( + "fmt" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/record" +) + +const ( + CopiedLabelKey = "olm.copiedFrom" + + // ConditionsLengthLimit is the maximum length of Status.Conditions of a + // given ClusterServiceVersion object. The oldest condition(s) are removed + // from the list as it grows over time to keep it at limit. + ConditionsLengthLimit = 20 +) + +// obsoleteReasons are the set of reasons that mean a CSV should no longer be processed as active +var obsoleteReasons = map[ConditionReason]struct{}{ + CSVReasonReplaced: {}, + CSVReasonBeingReplaced: {}, +} + +// uncopiableReasons are the set of reasons that should prevent a CSV from being copied to target namespaces +var uncopiableReasons = map[ConditionReason]struct{}{ + CSVReasonCopied: {}, + CSVReasonInvalidInstallModes: {}, + CSVReasonNoTargetNamespaces: {}, + CSVReasonUnsupportedOperatorGroup: {}, + CSVReasonNoOperatorGroup: {}, + CSVReasonTooManyOperatorGroups: {}, + CSVReasonInterOperatorGroupOwnerConflict: {}, + CSVReasonCannotModifyStaticOperatorGroupProvidedAPIs: {}, +} + +// safeToAnnotateOperatorGroupReasons are the set of reasons that it's safe to attempt to update the operatorgroup +// annotations +var safeToAnnotateOperatorGroupReasons = map[ConditionReason]struct{}{ + CSVReasonOwnerConflict: {}, + CSVReasonInstallSuccessful: {}, + CSVReasonInvalidInstallModes: {}, + CSVReasonNoTargetNamespaces: {}, + CSVReasonUnsupportedOperatorGroup: {}, + CSVReasonNoOperatorGroup: {}, + CSVReasonTooManyOperatorGroups: {}, + CSVReasonInterOperatorGroupOwnerConflict: {}, + CSVReasonCannotModifyStaticOperatorGroupProvidedAPIs: {}, +} + +// SetPhaseWithEventIfChanged emits a Kubernetes event with details of a phase change and sets the current phase if phase, reason, or message would changed +func (c *ClusterServiceVersion) SetPhaseWithEventIfChanged(phase ClusterServiceVersionPhase, reason ConditionReason, message string, now metav1.Time, recorder record.EventRecorder) { + if c.Status.Phase == phase && c.Status.Reason == reason && c.Status.Message == message { + return + } + + c.SetPhaseWithEvent(phase, reason, message, now, recorder) +} + +// SetPhaseWithEvent generates a Kubernetes event with details about the phase change and sets the current phase +func (c *ClusterServiceVersion) SetPhaseWithEvent(phase ClusterServiceVersionPhase, reason ConditionReason, message string, now metav1.Time, recorder record.EventRecorder) { + var eventtype string + if phase == CSVPhaseFailed { + eventtype = v1.EventTypeWarning + } else { + eventtype = v1.EventTypeNormal + } + go recorder.Event(c, eventtype, string(reason), message) + c.SetPhase(phase, reason, message, now) +} + +// SetPhase sets the current phase and adds a condition if necessary +func (c *ClusterServiceVersion) SetPhase(phase ClusterServiceVersionPhase, reason ConditionReason, message string, now metav1.Time) { + newCondition := func() ClusterServiceVersionCondition { + return ClusterServiceVersionCondition{ + Phase: c.Status.Phase, + LastTransitionTime: c.Status.LastTransitionTime, + LastUpdateTime: c.Status.LastUpdateTime, + Message: message, + Reason: reason, + } + } + + defer c.TrimConditionsIfLimitExceeded() + + c.Status.LastUpdateTime = now + if c.Status.Phase != phase { + c.Status.Phase = phase + c.Status.LastTransitionTime = now + } + c.Status.Message = message + c.Status.Reason = reason + if len(c.Status.Conditions) == 0 { + c.Status.Conditions = append(c.Status.Conditions, newCondition()) + return + } + + previousCondition := c.Status.Conditions[len(c.Status.Conditions)-1] + if previousCondition.Phase != c.Status.Phase || previousCondition.Reason != c.Status.Reason { + c.Status.Conditions = append(c.Status.Conditions, newCondition()) + } +} + +// SetRequirementStatus adds the status of all requirements to the CSV status +func (c *ClusterServiceVersion) SetRequirementStatus(statuses []RequirementStatus) { + c.Status.RequirementStatus = statuses +} + +// IsObsolete returns if this CSV is being replaced or is marked for deletion +func (c *ClusterServiceVersion) IsObsolete() bool { + for _, condition := range c.Status.Conditions { + _, ok := obsoleteReasons[condition.Reason] + if ok { + return true + } + } + return false +} + +// IsCopied returns true if the CSV has been copied and false otherwise. +func (c *ClusterServiceVersion) IsCopied() bool { + operatorNamespace, ok := c.GetAnnotations()[OperatorGroupNamespaceAnnotationKey] + if c.Status.Reason == CSVReasonCopied || ok && c.GetNamespace() != operatorNamespace { + return true + } + + if labels := c.GetLabels(); labels != nil { + if _, ok := labels[CopiedLabelKey]; ok { + return true + } + } + return false +} + +func (c *ClusterServiceVersion) IsUncopiable() bool { + if c.Status.Phase == CSVPhaseNone { + return true + } + _, ok := uncopiableReasons[c.Status.Reason] + return ok +} + +func (c *ClusterServiceVersion) IsSafeToUpdateOperatorGroupAnnotations() bool { + _, ok := safeToAnnotateOperatorGroupReasons[c.Status.Reason] + return ok +} + +// NewInstallModeSet returns an InstallModeSet instantiated from the given list of InstallModes. +// If the given list is not a set, an error is returned. +func NewInstallModeSet(modes []InstallMode) (InstallModeSet, error) { + set := InstallModeSet{} + for _, mode := range modes { + if _, exists := set[mode.Type]; exists { + return nil, fmt.Errorf("InstallMode list contains duplicates, cannot make set: %v", modes) + } + set[mode.Type] = mode.Supported + } + + return set, nil +} + +// Supports returns an error if the InstallModeSet does not support configuration for +// the given operatorNamespace and list of target namespaces. +func (set InstallModeSet) Supports(operatorNamespace string, namespaces []string) error { + numNamespaces := len(namespaces) + switch { + case numNamespaces == 0: + return fmt.Errorf("operatorgroup has invalid selected namespaces, cannot configure to watch zero namespaces") + case numNamespaces == 1: + switch namespaces[0] { + case operatorNamespace: + if !set[InstallModeTypeOwnNamespace] { + return fmt.Errorf("%s InstallModeType not supported, cannot configure to watch own namespace", InstallModeTypeOwnNamespace) + } + case v1.NamespaceAll: + if !set[InstallModeTypeAllNamespaces] { + return fmt.Errorf("%s InstallModeType not supported, cannot configure to watch all namespaces", InstallModeTypeAllNamespaces) + } + default: + if !set[InstallModeTypeSingleNamespace] { + return fmt.Errorf("%s InstallModeType not supported, cannot configure to watch one namespace", InstallModeTypeSingleNamespace) + } + } + case numNamespaces > 1 && !set[InstallModeTypeMultiNamespace]: + return fmt.Errorf("%s InstallModeType not supported, cannot configure to watch %d namespaces", InstallModeTypeMultiNamespace, numNamespaces) + case numNamespaces > 1: + for _, namespace := range namespaces { + if namespace == operatorNamespace && !set[InstallModeTypeOwnNamespace] { + return fmt.Errorf("%s InstallModeType not supported, cannot configure to watch own namespace", InstallModeTypeOwnNamespace) + } + if namespace == v1.NamespaceAll { + return fmt.Errorf("operatorgroup has invalid selected namespaces, NamespaceAll found when |selected namespaces| > 1") + } + } + } + + return nil +} + +func (c *ClusterServiceVersion) TrimConditionsIfLimitExceeded() { + if len(c.Status.Conditions) <= ConditionsLengthLimit { + return + } + + firstIndex := len(c.Status.Conditions) - ConditionsLengthLimit + c.Status.Conditions = c.Status.Conditions[firstIndex:len(c.Status.Conditions)] +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_test.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_test.go new file mode 100644 index 0000000000..3561a6d06c --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_test.go @@ -0,0 +1,376 @@ +package v1alpha1 + +import ( + "fmt" + "testing" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + corev1 "k8s.io/api/core/v1" +) + +func TestSetRequirementStatus(t *testing.T) { + csv := ClusterServiceVersion{} + status := []RequirementStatus{{Group: "test", Version: "test", Kind: "Test", Name: "test", Status: "test", UUID: "test"}} + csv.SetRequirementStatus(status) + require.Equal(t, csv.Status.RequirementStatus, status) +} + +func TestSetPhase(t *testing.T) { + tests := []struct { + currentPhase ClusterServiceVersionPhase + currentConditions []ClusterServiceVersionCondition + inPhase ClusterServiceVersionPhase + outPhase ClusterServiceVersionPhase + description string + }{ + { + currentPhase: "", + currentConditions: []ClusterServiceVersionCondition{}, + inPhase: CSVPhasePending, + outPhase: CSVPhasePending, + description: "NoPhase", + }, + { + currentPhase: CSVPhasePending, + currentConditions: []ClusterServiceVersionCondition{{Phase: CSVPhasePending}}, + inPhase: CSVPhasePending, + outPhase: CSVPhasePending, + description: "SamePhase", + }, + { + currentPhase: CSVPhasePending, + currentConditions: []ClusterServiceVersionCondition{{Phase: CSVPhasePending}}, + inPhase: CSVPhaseInstalling, + outPhase: CSVPhaseInstalling, + description: "DifferentPhase", + }, + } + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + csv := ClusterServiceVersion{ + Status: ClusterServiceVersionStatus{ + Phase: tt.currentPhase, + Conditions: tt.currentConditions, + }, + } + csv.SetPhase(tt.inPhase, "test", "test", metav1.Now()) + require.EqualValues(t, tt.outPhase, csv.Status.Phase) + }) + } +} + +func TestIsObsolete(t *testing.T) { + tests := []struct { + currentPhase ClusterServiceVersionPhase + currentConditions []ClusterServiceVersionCondition + out bool + description string + }{ + { + currentPhase: "", + currentConditions: []ClusterServiceVersionCondition{}, + out: false, + description: "NoPhase", + }, + { + currentPhase: CSVPhasePending, + currentConditions: []ClusterServiceVersionCondition{{Phase: CSVPhasePending}}, + out: false, + description: "Pending", + }, + { + currentPhase: CSVPhaseReplacing, + currentConditions: []ClusterServiceVersionCondition{{Phase: CSVPhaseReplacing, Reason: CSVReasonBeingReplaced}}, + out: true, + description: "Replacing", + }, + { + currentPhase: CSVPhaseDeleting, + currentConditions: []ClusterServiceVersionCondition{{Phase: CSVPhaseDeleting, Reason: CSVReasonReplaced}}, + out: true, + description: "CSVPhaseDeleting", + }, + } + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + csv := ClusterServiceVersion{ + Status: ClusterServiceVersionStatus{ + Phase: tt.currentPhase, + Conditions: tt.currentConditions, + }, + } + require.Equal(t, csv.IsObsolete(), tt.out) + }) + } +} + +func TestSupports(t *testing.T) { + tests := []struct { + description string + installModeSet InstallModeSet + operatorNamespace string + namespaces []string + expectedErr error + }{ + { + description: "NoNamespaces", + installModeSet: InstallModeSet{ + InstallModeTypeOwnNamespace: true, + InstallModeTypeSingleNamespace: true, + InstallModeTypeMultiNamespace: true, + InstallModeTypeAllNamespaces: true, + }, + operatorNamespace: "operators", + namespaces: []string{}, + expectedErr: fmt.Errorf("operatorgroup has invalid selected namespaces, cannot configure to watch zero namespaces"), + }, + { + description: "OwnNamespace/OperatorNamespace/Supported", + installModeSet: InstallModeSet{ + InstallModeTypeOwnNamespace: true, + InstallModeTypeSingleNamespace: false, + InstallModeTypeMultiNamespace: false, + InstallModeTypeAllNamespaces: false, + }, + operatorNamespace: "operators", + namespaces: []string{"operators"}, + expectedErr: nil, + }, + { + description: "SingleNamespace/OtherNamespace/Supported", + installModeSet: InstallModeSet{ + InstallModeTypeOwnNamespace: false, + InstallModeTypeSingleNamespace: true, + InstallModeTypeMultiNamespace: false, + InstallModeTypeAllNamespaces: false, + }, + operatorNamespace: "operators", + namespaces: []string{"ns-0"}, + expectedErr: nil, + }, + { + description: "MultiNamespace/OtherNamespaces/Supported", + installModeSet: InstallModeSet{ + InstallModeTypeOwnNamespace: false, + InstallModeTypeSingleNamespace: false, + InstallModeTypeMultiNamespace: true, + InstallModeTypeAllNamespaces: false, + }, + operatorNamespace: "operators", + namespaces: []string{"ns-0", "ns-2"}, + expectedErr: nil, + }, + { + description: "AllNamespaces/NamespaceAll/Supported", + installModeSet: InstallModeSet{ + InstallModeTypeOwnNamespace: false, + InstallModeTypeSingleNamespace: false, + InstallModeTypeMultiNamespace: false, + InstallModeTypeAllNamespaces: true, + }, + operatorNamespace: "operators", + namespaces: []string{""}, + expectedErr: nil, + }, + { + description: "OwnNamespace/OperatorNamespace/Unsupported", + installModeSet: InstallModeSet{ + InstallModeTypeOwnNamespace: false, + InstallModeTypeSingleNamespace: true, + InstallModeTypeMultiNamespace: true, + InstallModeTypeAllNamespaces: true, + }, + operatorNamespace: "operators", + namespaces: []string{"operators"}, + expectedErr: fmt.Errorf("%s InstallModeType not supported, cannot configure to watch own namespace", InstallModeTypeOwnNamespace), + }, + { + description: "OwnNamespace/IncludesOperatorNamespace/Unsupported", + installModeSet: InstallModeSet{ + InstallModeTypeOwnNamespace: false, + InstallModeTypeSingleNamespace: true, + InstallModeTypeMultiNamespace: true, + InstallModeTypeAllNamespaces: true, + }, + operatorNamespace: "operators", + namespaces: []string{"ns-0", "operators"}, + expectedErr: fmt.Errorf("%s InstallModeType not supported, cannot configure to watch own namespace", InstallModeTypeOwnNamespace), + }, + { + description: "MultiNamespace/OtherNamespaces/Unsupported", + installModeSet: InstallModeSet{ + InstallModeTypeOwnNamespace: true, + InstallModeTypeSingleNamespace: true, + InstallModeTypeMultiNamespace: false, + InstallModeTypeAllNamespaces: true, + }, + operatorNamespace: "operators", + namespaces: []string{"ns-0", "ns-1"}, + expectedErr: fmt.Errorf("%s InstallModeType not supported, cannot configure to watch 2 namespaces", InstallModeTypeMultiNamespace), + }, + { + description: "SingleNamespace/OtherNamespace/Unsupported", + installModeSet: InstallModeSet{ + InstallModeTypeOwnNamespace: true, + InstallModeTypeSingleNamespace: false, + InstallModeTypeMultiNamespace: true, + InstallModeTypeAllNamespaces: true, + }, + operatorNamespace: "operators", + namespaces: []string{"ns-0"}, + expectedErr: fmt.Errorf("%s InstallModeType not supported, cannot configure to watch one namespace", InstallModeTypeSingleNamespace), + }, + { + description: "AllNamespaces/NamespaceAll/Unsupported", + installModeSet: InstallModeSet{ + InstallModeTypeOwnNamespace: true, + InstallModeTypeSingleNamespace: true, + InstallModeTypeMultiNamespace: true, + InstallModeTypeAllNamespaces: false, + }, + operatorNamespace: "operators", + namespaces: []string{""}, + expectedErr: fmt.Errorf("%s InstallModeType not supported, cannot configure to watch all namespaces", InstallModeTypeAllNamespaces), + }, + { + description: "AllNamespaces/IncludingNamespaceAll/Unsupported", + installModeSet: InstallModeSet{ + InstallModeTypeOwnNamespace: true, + InstallModeTypeSingleNamespace: true, + InstallModeTypeMultiNamespace: true, + InstallModeTypeAllNamespaces: true, + }, + operatorNamespace: "operators", + namespaces: []string{"", "ns-0"}, + expectedErr: fmt.Errorf("operatorgroup has invalid selected namespaces, NamespaceAll found when |selected namespaces| > 1"), + }, + { + description: "NoNamespaces/EmptyInstallModeSet/Unsupported", + installModeSet: InstallModeSet{}, + operatorNamespace: "", + namespaces: []string{}, + expectedErr: fmt.Errorf("operatorgroup has invalid selected namespaces, cannot configure to watch zero namespaces"), + }, + { + description: "MultiNamespace/OtherNamespaces/EmptyInstallModeSet/Unsupported", + installModeSet: InstallModeSet{}, + operatorNamespace: "operators", + namespaces: []string{"ns-0", "ns-1"}, + expectedErr: fmt.Errorf("%s InstallModeType not supported, cannot configure to watch 2 namespaces", InstallModeTypeMultiNamespace), + }, + { + description: "SingleNamespace/OtherNamespace/EmptyInstallModeSet/Unsupported", + installModeSet: InstallModeSet{}, + operatorNamespace: "operators", + namespaces: []string{"ns-0"}, + expectedErr: fmt.Errorf("%s InstallModeType not supported, cannot configure to watch one namespace", InstallModeTypeSingleNamespace), + }, + { + description: "AllNamespaces/NamespaceAll/EmptyInstallModeSet/Unsupported", + installModeSet: InstallModeSet{}, + operatorNamespace: "operators", + namespaces: []string{corev1.NamespaceAll}, + expectedErr: fmt.Errorf("%s InstallModeType not supported, cannot configure to watch all namespaces", InstallModeTypeAllNamespaces), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + err := tt.installModeSet.Supports(tt.operatorNamespace, tt.namespaces) + require.Equal(t, tt.expectedErr, err) + }) + } +} + +func TestSetPhaseWithConditions(t *testing.T) { + tests := []struct { + description string + limit int + currentLength int + startIndex int + }{ + { + // The original list is already at limit (length == limit). + // We expect the oldest element ( item at 0 index) to be removed. + description: "TestSetPhaseWithConditionsLengthAtLimit", + limit: ConditionsLengthLimit, + currentLength: ConditionsLengthLimit, + + // The first element from the original list should be dropped from + // the new list. + startIndex: 1, + }, + { + // The original list is 1 length away from limit. + // We don't expect the list to be trimmed. + description: "TestSetPhaseWithConditionsLengthBelowLimit", + limit: ConditionsLengthLimit, + currentLength: ConditionsLengthLimit - 1, + + // Everything in the original list should be preserved. + startIndex: 0, + }, + { + // The original list has N more element(s) than allowed limit. + // We expect (N + 1) oldest elements to be deleted to keep the list + // at limit. + description: "TestSetPhaseWithConditionsLimitExceeded", + limit: ConditionsLengthLimit, + currentLength: ConditionsLengthLimit + 10, + + // The first 11 (N=10 plus 1 to make room for the newly added + // condition) elements from the original list should be dropped. + startIndex: 11, + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + csv := ClusterServiceVersion{} + csv.Status.Conditions = helperNewConditions(tt.currentLength) + + now := metav1.Now() + + oldConditionsWant := csv.Status.Conditions[tt.startIndex:] + lastAddedConditionWant := ClusterServiceVersionCondition{ + Phase: ClusterServiceVersionPhase("Pending"), + LastTransitionTime: now, + LastUpdateTime: now, + Message: "message", + Reason: ConditionReason("reason"), + } + + csv.SetPhase("Pending", "reason", "message", now) + + conditionsGot := csv.Status.Conditions + assert.Equal(t, tt.limit, len(conditionsGot)) + + oldConditionsGot := conditionsGot[0 : len(conditionsGot)-1] + assert.EqualValues(t, oldConditionsWant, oldConditionsGot) + + lastAddedConditionGot := conditionsGot[len(conditionsGot)-1] + assert.Equal(t, lastAddedConditionWant, lastAddedConditionGot) + }) + } +} + +func helperNewConditions(count int) []ClusterServiceVersionCondition { + conditions := make([]ClusterServiceVersionCondition, 0) + + for i := 1; i <= count; i++ { + now := metav1.Now() + condition := ClusterServiceVersionCondition{ + Phase: ClusterServiceVersionPhase(fmt.Sprintf("phase-%d", i)), + LastTransitionTime: now, + LastUpdateTime: now, + Message: fmt.Sprintf("message-%d", i), + Reason: ConditionReason(fmt.Sprintf("reason-%d", i)), + } + conditions = append(conditions, condition) + } + + return conditions +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go new file mode 100644 index 0000000000..c55b6af800 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go @@ -0,0 +1,500 @@ +package v1alpha1 + +import ( + "encoding/json" + "fmt" + "sort" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/version" +) + +const ( + ClusterServiceVersionAPIVersion = GroupName + "/" + GroupVersion + ClusterServiceVersionKind = "ClusterServiceVersion" + OperatorGroupNamespaceAnnotationKey = "olm.operatorNamespace" +) + +// InstallModeType is a supported type of install mode for CSV installation +type InstallModeType string + +const ( + // InstallModeTypeOwnNamespace indicates that the operator can be a member of an `OperatorGroup` that selects its own namespace. + InstallModeTypeOwnNamespace InstallModeType = "OwnNamespace" + // InstallModeTypeSingleNamespace indicates that the operator can be a member of an `OperatorGroup` that selects one namespace. + InstallModeTypeSingleNamespace InstallModeType = "SingleNamespace" + // InstallModeTypeMultiNamespace indicates that the operator can be a member of an `OperatorGroup` that selects more than one namespace. + InstallModeTypeMultiNamespace InstallModeType = "MultiNamespace" + // InstallModeTypeAllNamespaces indicates that the operator can be a member of an `OperatorGroup` that selects all namespaces (target namespace set is the empty string ""). + InstallModeTypeAllNamespaces InstallModeType = "AllNamespaces" +) + +// InstallMode associates an InstallModeType with a flag representing if the CSV supports it +// +k8s:openapi-gen=true +type InstallMode struct { + Type InstallModeType `json:"type"` + Supported bool `json:"supported"` +} + +// InstallModeSet is a mapping of unique InstallModeTypes to whether they are supported. +type InstallModeSet map[InstallModeType]bool + +// NamedInstallStrategy represents the block of an ClusterServiceVersion resource +// where the install strategy is specified. +type NamedInstallStrategy struct { + StrategyName string `json:"strategy"` + StrategySpecRaw json.RawMessage `json:"spec,omitempty"` +} + +// StatusDescriptor describes a field in a status block of a CRD so that OLM can consume it +// +k8s:openapi-gen=true +type StatusDescriptor struct { + Path string `json:"path"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + XDescriptors []string `json:"x-descriptors,omitempty"` + Value *json.RawMessage `json:"value,omitempty"` +} + +// SpecDescriptor describes a field in a spec block of a CRD so that OLM can consume it +// +k8s:openapi-gen=true +type SpecDescriptor struct { + Path string `json:"path"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + XDescriptors []string `json:"x-descriptors,omitempty"` + Value *json.RawMessage `json:"value,omitempty"` +} + +// ActionDescriptor describes a declarative action that can be performed on a custom resource instance +// +k8s:openapi-gen=true +type ActionDescriptor struct { + Path string `json:"path"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + XDescriptors []string `json:"x-descriptors,omitempty"` + Value *json.RawMessage `json:"value,omitempty"` +} + +// CRDDescription provides details to OLM about the CRDs +// +k8s:openapi-gen=true +type CRDDescription struct { + Name string `json:"name"` + Version string `json:"version"` + Kind string `json:"kind"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + Resources []APIResourceReference `json:"resources,omitempty"` + StatusDescriptors []StatusDescriptor `json:"statusDescriptors,omitempty"` + SpecDescriptors []SpecDescriptor `json:"specDescriptors,omitempty"` + ActionDescriptor []ActionDescriptor `json:"actionDescriptors,omitempty"` +} + +// APIServiceDescription provides details to OLM about apis provided via aggregation +// +k8s:openapi-gen=true +type APIServiceDescription struct { + Name string `json:"name"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + DeploymentName string `json:"deploymentName,omitempty"` + ContainerPort int32 `json:"containerPort,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + Resources []APIResourceReference `json:"resources,omitempty"` + StatusDescriptors []StatusDescriptor `json:"statusDescriptors,omitempty"` + SpecDescriptors []SpecDescriptor `json:"specDescriptors,omitempty"` + ActionDescriptor []ActionDescriptor `json:"actionDescriptors,omitempty"` +} + +// APIResourceReference is a Kubernetes resource type used by a custom resource +// +k8s:openapi-gen=true +type APIResourceReference struct { + Name string `json:"name"` + Kind string `json:"kind"` + Version string `json:"version"` +} + +// GetName returns the name of an APIService as derived from its group and version. +func (d APIServiceDescription) GetName() string { + return fmt.Sprintf("%s.%s", d.Version, d.Group) +} + +// CustomResourceDefinitions declares all of the CRDs managed or required by +// an operator being ran by ClusterServiceVersion. +// +// If the CRD is present in the Owned list, it is implicitly required. +// +k8s:openapi-gen=true +type CustomResourceDefinitions struct { + Owned []CRDDescription `json:"owned,omitempty"` + Required []CRDDescription `json:"required,omitempty"` +} + +// APIServiceDefinitions declares all of the extension apis managed or required by +// an operator being ran by ClusterServiceVersion. +// +k8s:openapi-gen=true +type APIServiceDefinitions struct { + Owned []APIServiceDescription `json:"owned,omitempty"` + Required []APIServiceDescription `json:"required,omitempty"` +} + +// ClusterServiceVersionSpec declarations tell OLM how to install an operator +// that can manage apps for a given version. +type ClusterServiceVersionSpec struct { + InstallStrategy NamedInstallStrategy `json:"install"` + Version version.OperatorVersion `json:"version,omitempty"` + Maturity string `json:"maturity,omitempty"` + CustomResourceDefinitions CustomResourceDefinitions `json:"customresourcedefinitions,omitempty"` + APIServiceDefinitions APIServiceDefinitions `json:"apiservicedefinitions,omitempty"` + NativeAPIs []metav1.GroupVersionKind `json:"nativeAPIs,omitempty"` + MinKubeVersion string `json:"minKubeVersion,omitempty"` + DisplayName string `json:"displayName"` + Description string `json:"description,omitempty"` + Keywords []string `json:"keywords,omitempty"` + Maintainers []Maintainer `json:"maintainers,omitempty"` + Provider AppLink `json:"provider,omitempty"` + Links []AppLink `json:"links,omitempty"` + Icon []Icon `json:"icon,omitempty"` + + // InstallModes specify supported installation types + // +optional + InstallModes []InstallMode `json:"installModes,omitempty"` + + // The name of a CSV this one replaces. Should match the `metadata.Name` field of the old CSV. + // +optional + Replaces string `json:"replaces,omitempty"` + + // Map of string keys and values that can be used to organize and categorize + // (scope and select) objects. + // +optional + Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,11,rep,name=labels"` + + // Annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. + // +optional + Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"` + + // Label selector for related resources. + // +optional + Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"` +} + +type Maintainer struct { + Name string `json:"name,omitempty"` + Email string `json:"email,omitempty"` +} + +type AppLink struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` +} + +type Icon struct { + Data string `json:"base64data"` + MediaType string `json:"mediatype"` +} + +// ClusterServiceVersionPhase is a label for the condition of a ClusterServiceVersion at the current time. +type ClusterServiceVersionPhase string + +// These are the valid phases of ClusterServiceVersion +const ( + CSVPhaseNone = "" + // CSVPhasePending means the csv has been accepted by the system, but the install strategy has not been attempted. + // This is likely because there are unmet requirements. + CSVPhasePending ClusterServiceVersionPhase = "Pending" + // CSVPhaseInstallReady means that the requirements are met but the install strategy has not been run. + CSVPhaseInstallReady ClusterServiceVersionPhase = "InstallReady" + // CSVPhaseInstalling means that the install strategy has been initiated but not completed. + CSVPhaseInstalling ClusterServiceVersionPhase = "Installing" + // CSVPhaseSucceeded means that the resources in the CSV were created successfully. + CSVPhaseSucceeded ClusterServiceVersionPhase = "Succeeded" + // CSVPhaseFailed means that the install strategy could not be successfully completed. + CSVPhaseFailed ClusterServiceVersionPhase = "Failed" + // CSVPhaseUnknown means that for some reason the state of the csv could not be obtained. + CSVPhaseUnknown ClusterServiceVersionPhase = "Unknown" + // CSVPhaseReplacing means that a newer CSV has been created and the csv's resources will be transitioned to a new owner. + CSVPhaseReplacing ClusterServiceVersionPhase = "Replacing" + // CSVPhaseDeleting means that a CSV has been replaced by a new one and will be checked for safety before being deleted + CSVPhaseDeleting ClusterServiceVersionPhase = "Deleting" + // CSVPhaseAny matches all other phases in CSV queries + CSVPhaseAny ClusterServiceVersionPhase = "" +) + +// ConditionReason is a camelcased reason for the state transition +type ConditionReason string + +const ( + CSVReasonRequirementsUnknown ConditionReason = "RequirementsUnknown" + CSVReasonRequirementsNotMet ConditionReason = "RequirementsNotMet" + CSVReasonRequirementsMet ConditionReason = "AllRequirementsMet" + CSVReasonOwnerConflict ConditionReason = "OwnerConflict" + CSVReasonComponentFailed ConditionReason = "InstallComponentFailed" + CSVReasonInvalidStrategy ConditionReason = "InvalidInstallStrategy" + CSVReasonWaiting ConditionReason = "InstallWaiting" + CSVReasonInstallSuccessful ConditionReason = "InstallSucceeded" + CSVReasonInstallCheckFailed ConditionReason = "InstallCheckFailed" + CSVReasonComponentUnhealthy ConditionReason = "ComponentUnhealthy" + CSVReasonBeingReplaced ConditionReason = "BeingReplaced" + CSVReasonReplaced ConditionReason = "Replaced" + CSVReasonNeedsReinstall ConditionReason = "NeedsReinstall" + CSVReasonNeedsCertRotation ConditionReason = "NeedsCertRotation" + CSVReasonAPIServiceResourceIssue ConditionReason = "APIServiceResourceIssue" + CSVReasonAPIServiceResourcesNeedReinstall ConditionReason = "APIServiceResourcesNeedReinstall" + CSVReasonAPIServiceInstallFailed ConditionReason = "APIServiceInstallFailed" + CSVReasonCopied ConditionReason = "Copied" + CSVReasonInvalidInstallModes ConditionReason = "InvalidInstallModes" + CSVReasonNoTargetNamespaces ConditionReason = "NoTargetNamespaces" + CSVReasonUnsupportedOperatorGroup ConditionReason = "UnsupportedOperatorGroup" + CSVReasonNoOperatorGroup ConditionReason = "NoOperatorGroup" + CSVReasonTooManyOperatorGroups ConditionReason = "TooManyOperatorGroups" + CSVReasonInterOperatorGroupOwnerConflict ConditionReason = "InterOperatorGroupOwnerConflict" + CSVReasonCannotModifyStaticOperatorGroupProvidedAPIs ConditionReason = "CannotModifyStaticOperatorGroupProvidedAPIs" +) + +// Conditions appear in the status as a record of state transitions on the ClusterServiceVersion +type ClusterServiceVersionCondition struct { + // Condition of the ClusterServiceVersion + Phase ClusterServiceVersionPhase `json:"phase,omitempty"` + // A human readable message indicating details about why the ClusterServiceVersion is in this condition. + // +optional + Message string `json:"message,omitempty"` + // A brief CamelCase message indicating details about why the ClusterServiceVersion is in this state. + // e.g. 'RequirementsNotMet' + // +optional + Reason ConditionReason `json:"reason,omitempty"` + // Last time we updated the status + // +optional + LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` + // Last time the status transitioned from one status to another. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// OwnsCRD determines whether the current CSV owns a paritcular CRD. +func (csv ClusterServiceVersion) OwnsCRD(name string) bool { + for _, desc := range csv.Spec.CustomResourceDefinitions.Owned { + if desc.Name == name { + return true + } + } + + return false +} + +// OwnsAPIService determines whether the current CSV owns a paritcular APIService. +func (csv ClusterServiceVersion) OwnsAPIService(name string) bool { + for _, desc := range csv.Spec.APIServiceDefinitions.Owned { + apiServiceName := fmt.Sprintf("%s.%s", desc.Version, desc.Group) + if apiServiceName == name { + return true + } + } + + return false +} + +// StatusReason is a camelcased reason for the status of a RequirementStatus or DependentStatus +type StatusReason string + +const ( + RequirementStatusReasonPresent StatusReason = "Present" + RequirementStatusReasonNotPresent StatusReason = "NotPresent" + RequirementStatusReasonPresentNotSatisfied StatusReason = "PresentNotSatisfied" + // The CRD is present but the Established condition is False (not available) + RequirementStatusReasonNotAvailable StatusReason = "PresentNotAvailable" + DependentStatusReasonSatisfied StatusReason = "Satisfied" + DependentStatusReasonNotSatisfied StatusReason = "NotSatisfied" +) + +// DependentStatus is the status for a dependent requirement (to prevent infinite nesting) +type DependentStatus struct { + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Status StatusReason `json:"status"` + UUID string `json:"uuid,omitempty"` + Message string `json:"message,omitempty"` +} + +type RequirementStatus struct { + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Status StatusReason `json:"status"` + Message string `json:"message"` + UUID string `json:"uuid,omitempty"` + Dependents []DependentStatus `json:"dependents,omitempty"` +} + +// ClusterServiceVersionStatus represents information about the status of a pod. Status may trail the actual +// state of a system. +type ClusterServiceVersionStatus struct { + // Current condition of the ClusterServiceVersion + Phase ClusterServiceVersionPhase `json:"phase,omitempty"` + // A human readable message indicating details about why the ClusterServiceVersion is in this condition. + // +optional + Message string `json:"message,omitempty"` + // A brief CamelCase message indicating details about why the ClusterServiceVersion is in this state. + // e.g. 'RequirementsNotMet' + // +optional + Reason ConditionReason `json:"reason,omitempty"` + // Last time we updated the status + // +optional + LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` + // Last time the status transitioned from one status to another. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + // List of conditions, a history of state transitions + Conditions []ClusterServiceVersionCondition `json:"conditions,omitempty"` + // The status of each requirement for this CSV + RequirementStatus []RequirementStatus `json:"requirementStatus,omitempty"` + // Last time the owned APIService certs were updated + // +optional + CertsLastUpdated metav1.Time `json:"certsLastUpdated,omitempty"` + // Time the owned APIService certs will rotate next + // +optional + CertsRotateAt metav1.Time `json:"certsRotateAt,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient + +// ClusterServiceVersion is a Custom Resource of type `ClusterServiceVersionSpec`. +type ClusterServiceVersion struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec ClusterServiceVersionSpec `json:"spec"` + Status ClusterServiceVersionStatus `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterServiceVersionList represents a list of ClusterServiceVersions. +type ClusterServiceVersionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []ClusterServiceVersion `json:"items"` +} + +// GetAllCRDDescriptions returns a deduplicated set of CRDDescriptions that is +// the union of the owned and required CRDDescriptions. +// +// Descriptions with the same name prefer the value in Owned. +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetAllCRDDescriptions() []CRDDescription { + set := make(map[string]CRDDescription) + for _, required := range csv.Spec.CustomResourceDefinitions.Required { + set[required.Name] = required + } + + for _, owned := range csv.Spec.CustomResourceDefinitions.Owned { + set[owned.Name] = owned + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]CRDDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} + +// GetAllAPIServiceDescriptions returns a deduplicated set of APIServiceDescriptions that is +// the union of the owned and required APIServiceDescriptions. +// +// Descriptions with the same name prefer the value in Owned. +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetAllAPIServiceDescriptions() []APIServiceDescription { + set := make(map[string]APIServiceDescription) + for _, required := range csv.Spec.APIServiceDefinitions.Required { + name := fmt.Sprintf("%s.%s", required.Version, required.Group) + set[name] = required + } + + for _, owned := range csv.Spec.APIServiceDefinitions.Owned { + name := fmt.Sprintf("%s.%s", owned.Version, owned.Group) + set[name] = owned + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]APIServiceDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} + +// GetRequiredAPIServiceDescriptions returns a deduplicated set of required APIServiceDescriptions +// with the intersection of required and owned removed +// Equivalent to the set subtraction required - owned +// +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetRequiredAPIServiceDescriptions() []APIServiceDescription { + set := make(map[string]APIServiceDescription) + for _, required := range csv.Spec.APIServiceDefinitions.Required { + name := fmt.Sprintf("%s.%s", required.Version, required.Group) + set[name] = required + } + + // Remove any shared owned from the set + for _, owned := range csv.Spec.APIServiceDefinitions.Owned { + name := fmt.Sprintf("%s.%s", owned.Version, owned.Group) + if _, ok := set[name]; ok { + delete(set, name) + } + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]APIServiceDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} + +// GetOwnedAPIServiceDescriptions returns a deduplicated set of owned APIServiceDescriptions +// +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetOwnedAPIServiceDescriptions() []APIServiceDescription { + set := make(map[string]APIServiceDescription) + for _, owned := range csv.Spec.APIServiceDefinitions.Owned { + name := owned.GetName() + set[name] = owned + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]APIServiceDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/doc.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/doc.go new file mode 100644 index 0000000000..3938a475ee --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/doc.go @@ -0,0 +1,6 @@ +// +k8s:deepcopy-gen=package +// +k8s:conversion-gen=github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators +// +groupName=operators.coreos.com + +// Package v1alpha1 contains resources types for version v1alpha1 of the operators.coreos.com API group. +package v1alpha1 diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/installplan_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/installplan_types.go new file mode 100644 index 0000000000..8bbe7eb3d8 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/installplan_types.go @@ -0,0 +1,251 @@ +package v1alpha1 + +import ( + "errors" + "fmt" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + InstallPlanKind = "InstallPlan" + InstallPlanAPIVersion = GroupName + "/" + GroupVersion +) + +// Approval is the user approval policy for an InstallPlan. +type Approval string + +const ( + ApprovalAutomatic Approval = "Automatic" + ApprovalManual Approval = "Manual" +) + +// InstallPlanSpec defines a set of Application resources to be installed +type InstallPlanSpec struct { + CatalogSource string `json:"source"` + CatalogSourceNamespace string `json:"sourceNamespace"` + ClusterServiceVersionNames []string `json:"clusterServiceVersionNames"` + Approval Approval `json:"approval"` + Approved bool `json:"approved"` +} + +// InstallPlanPhase is the current status of a InstallPlan as a whole. +type InstallPlanPhase string + +const ( + InstallPlanPhaseNone InstallPlanPhase = "" + InstallPlanPhasePlanning InstallPlanPhase = "Planning" + InstallPlanPhaseRequiresApproval InstallPlanPhase = "RequiresApproval" + InstallPlanPhaseInstalling InstallPlanPhase = "Installing" + InstallPlanPhaseComplete InstallPlanPhase = "Complete" + InstallPlanPhaseFailed InstallPlanPhase = "Failed" +) + +// InstallPlanConditionType describes the state of an InstallPlan at a certain point as a whole. +type InstallPlanConditionType string + +const ( + InstallPlanResolved InstallPlanConditionType = "Resolved" + InstallPlanInstalled InstallPlanConditionType = "Installed" +) + +// ConditionReason is a camelcased reason for the state transition. +type InstallPlanConditionReason string + +const ( + InstallPlanReasonPlanUnknown InstallPlanConditionReason = "PlanUnknown" + InstallPlanReasonInstallCheckFailed InstallPlanConditionReason = "InstallCheckFailed" + InstallPlanReasonDependencyConflict InstallPlanConditionReason = "DependenciesConflict" + InstallPlanReasonComponentFailed InstallPlanConditionReason = "InstallComponentFailed" +) + +// StepStatus is the current status of a particular resource an in +// InstallPlan +type StepStatus string + +const ( + StepStatusUnknown StepStatus = "Unknown" + StepStatusNotPresent StepStatus = "NotPresent" + StepStatusPresent StepStatus = "Present" + StepStatusCreated StepStatus = "Created" +) + +// ErrInvalidInstallPlan is the error returned by functions that operate on +// InstallPlans when the InstallPlan does not contain totally valid data. +var ErrInvalidInstallPlan = errors.New("the InstallPlan contains invalid data") + +// InstallPlanStatus represents the information about the status of +// steps required to complete installation. +// +// Status may trail the actual state of a system. +type InstallPlanStatus struct { + Phase InstallPlanPhase `json:"phase"` + Conditions []InstallPlanCondition `json:"conditions,omitempty"` + CatalogSources []string `json:"catalogSources"` + Plan []*Step `json:"plan,omitempty"` +} + +// InstallPlanCondition represents the overall status of the execution of +// an InstallPlan. +type InstallPlanCondition struct { + Type InstallPlanConditionType `json:"type,omitempty"` + Status corev1.ConditionStatus `json:"status,omitempty"` // True, False, or Unknown + LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + Reason InstallPlanConditionReason `json:"reason,omitempty"` + Message string `json:"message,omitempty"` +} + +// allow overwriting `now` function for deterministic tests +var now = metav1.Now + +// GetCondition returns the InstallPlanCondition of the given type if it exists in the InstallPlanStatus' Conditions. +// Returns a condition of the given type with a ConditionStatus of "Unknown" if not found. +func (s InstallPlanStatus) GetCondition(conditionType InstallPlanConditionType) InstallPlanCondition { + for _, cond := range s.Conditions { + if cond.Type == conditionType { + return cond + } + } + + return InstallPlanCondition{ + Type: conditionType, + Status: corev1.ConditionUnknown, + } +} + +// SetCondition adds or updates a condition, using `Type` as merge key. +func (s *InstallPlanStatus) SetCondition(cond InstallPlanCondition) InstallPlanCondition { + for i, existing := range s.Conditions { + if existing.Type != cond.Type { + continue + } + if existing.Status == cond.Status { + cond.LastTransitionTime = existing.LastTransitionTime + } + s.Conditions[i] = cond + return cond + } + s.Conditions = append(s.Conditions, cond) + return cond +} + + +func ConditionFailed(cond InstallPlanConditionType, reason InstallPlanConditionReason, message string, now *metav1.Time) InstallPlanCondition { + return InstallPlanCondition{ + Type: cond, + Status: corev1.ConditionFalse, + Reason: reason, + Message: message, + LastUpdateTime: *now, + LastTransitionTime: *now, + } +} + +func ConditionMet(cond InstallPlanConditionType, now *metav1.Time) InstallPlanCondition { + return InstallPlanCondition{ + Type: cond, + Status: corev1.ConditionTrue, + LastUpdateTime: *now, + LastTransitionTime: *now, + } +} + +// Step represents the status of an individual step in an InstallPlan. +type Step struct { + Resolving string `json:"resolving"` + Resource StepResource `json:"resource"` + Status StepStatus `json:"status"` +} + +// ManifestsMatch returns true if the CSV manifests in the StepResources of the given list of steps +// matches those in the InstallPlanStatus. +func (s *InstallPlanStatus) CSVManifestsMatch(steps []*Step) bool { + if s.Plan == nil && steps == nil { + return true + } + if s.Plan == nil || steps == nil { + return false + } + + manifests := make(map[string]struct{}) + for _, step := range s.Plan { + resource := step.Resource + if resource.Kind != ClusterServiceVersionKind { + continue + } + manifests[resource.Manifest] = struct{}{} + } + + for _, step := range steps { + resource := step.Resource + if resource.Kind != ClusterServiceVersionKind { + continue + } + if _, ok := manifests[resource.Manifest]; !ok { + return false + } + delete(manifests, resource.Manifest) + } + + if len(manifests) == 0 { + return true + } + + return false +} + +func (s *Step) String() string { + return fmt.Sprintf("%s: %s (%s)", s.Resolving, s.Resource, s.Status) +} + +// StepResource represents the status of a resource to be tracked by an +// InstallPlan. +type StepResource struct { + CatalogSource string `json:"sourceName"` + CatalogSourceNamespace string `json:"sourceNamespace"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Manifest string `json:"manifest,omitempty"` +} + +func (r StepResource) String() string { + return fmt.Sprintf("%s[%s/%s/%s (%s/%s)]", r.Name, r.Group, r.Version, r.Kind, r.CatalogSource, r.CatalogSourceNamespace) +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient + +// InstallPlan defines the installation of a set of operators. +type InstallPlan struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec InstallPlanSpec `json:"spec"` + Status InstallPlanStatus `json:"status"` +} + +// EnsureCatalogSource ensures that a CatalogSource is present in the Status +// block of an InstallPlan. +func (p *InstallPlan) EnsureCatalogSource(sourceName string) { + for _, srcName := range p.Status.CatalogSources { + if srcName == sourceName { + return + } + } + + p.Status.CatalogSources = append(p.Status.CatalogSources, sourceName) +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InstallPlanList is a list of InstallPlan resources. +type InstallPlanList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []InstallPlan `json:"items"` +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/register.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/register.go new file mode 100644 index 0000000000..fbd1ef6afd --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/register.go @@ -0,0 +1,55 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" +) + +const ( + // GroupName is the group name used in this package. + GroupName = operators.GroupName + // GroupVersion is the group version used in this package. + GroupVersion = "v1alpha1" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder initializes a scheme builder + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme is a global function that registers this API group & version to a scheme + AddToScheme = SchemeBuilder.AddToScheme + + // localSchemeBuilder is expected by generated conversion functions + localSchemeBuilder = &SchemeBuilder +) + +// addKnownTypes adds the list of known types to Scheme +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &CatalogSource{}, + &CatalogSourceList{}, + &InstallPlan{}, + &InstallPlanList{}, + &Subscription{}, + &SubscriptionList{}, + &ClusterServiceVersion{}, + &ClusterServiceVersionList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/subscription_types.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/subscription_types.go new file mode 100644 index 0000000000..8d2a4809b5 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/subscription_types.go @@ -0,0 +1,266 @@ +package v1alpha1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +const ( + SubscriptionKind = "Subscription" + SubscriptionCRDAPIVersion = GroupName + "/" + GroupVersion +) + +// SubscriptionState tracks when updates are available, installing, or service is up to date +type SubscriptionState string + +const ( + SubscriptionStateNone = "" + SubscriptionStateFailed = "UpgradeFailed" + SubscriptionStateUpgradeAvailable = "UpgradeAvailable" + SubscriptionStateUpgradePending = "UpgradePending" + SubscriptionStateAtLatest = "AtLatestKnown" +) + +const ( + SubscriptionReasonInvalidCatalog ConditionReason = "InvalidCatalog" + SubscriptionReasonUpgradeSucceeded ConditionReason = "UpgradeSucceeded" +) + +// SubscriptionSpec defines an Application that can be installed +type SubscriptionSpec struct { + CatalogSource string `json:"source"` + CatalogSourceNamespace string `json:"sourceNamespace"` + Package string `json:"name"` + Channel string `json:"channel,omitempty"` + StartingCSV string `json:"startingCSV,omitempty"` + InstallPlanApproval Approval `json:"installPlanApproval,omitempty"` +} + +// SubscriptionConditionType indicates an explicit state condition about a Subscription in "abnormal-true" +// polarity form (see https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties). +type SubscriptionConditionType string + +const ( + // SubscriptionCatalogSourcesUnhealthy indicates that some or all of the CatalogSources to be used in resolution are unhealthy. + SubscriptionCatalogSourcesUnhealthy SubscriptionConditionType = "CatalogSourcesUnhealthy" + + // SubscriptionInstallPlanMissing indicates that a Subscription's InstallPlan is missing. + SubscriptionInstallPlanMissing SubscriptionConditionType = "InstallPlanMissing" + + // SubscriptionInstallPlanPending indicates that a Subscription's InstallPlan is pending installation. + SubscriptionInstallPlanPending SubscriptionConditionType = "InstallPlanPending" + + // SubscriptionInstallPlanFailed indicates that the installation of a Subscription's InstallPlan has failed. + SubscriptionInstallPlanFailed SubscriptionConditionType = "InstallPlanFailed" +) + +const ( + // NoCatalogSourcesFound is a reason string for Subscriptions with unhealthy CatalogSources due to none being available. + NoCatalogSourcesFound = "NoCatalogSourcesFound" + + // AllCatalogSourcesHealthy is a reason string for Subscriptions that transitioned due to all CatalogSources being healthy. + AllCatalogSourcesHealthy = "AllCatalogSourcesHealthy" + + // CatalogSourcesAdded is a reason string for Subscriptions that transitioned due to CatalogSources being added. + CatalogSourcesAdded = "CatalogSourcesAdded" + + // CatalogSourcesUpdated is a reason string for Subscriptions that transitioned due to CatalogSource being updated. + CatalogSourcesUpdated = "CatalogSourcesUpdated" + + // CatalogSourcesDeleted is a reason string for Subscriptions that transitioned due to CatalogSources being removed. + CatalogSourcesDeleted = "CatalogSourcesDeleted" + + // UnhealthyCatalogSourceFound is a reason string for Subscriptions that transitioned because an unhealthy CatalogSource was found. + UnhealthyCatalogSourceFound = "UnhealthyCatalogSourceFound" + + // ReferencedInstallPlanNotFound is a reason string for Subscriptions that transitioned due to a referenced InstallPlan not being found. + ReferencedInstallPlanNotFound = "ReferencedInstallPlanNotFound" + + // InstallPlanNotYetReconciled is a reason string for Subscriptions that transitioned due to a referenced InstallPlan not being reconciled yet. + InstallPlanNotYetReconciled = "InstallPlanNotYetReconciled" + + // InstallPlanFailed is a reason string for Subscriptions that transitioned due to a referenced InstallPlan failing without setting an explicit failure condition. + InstallPlanFailed = "InstallPlanFailed" +) + +// SubscriptionCondition represents the latest available observations of a Subscription's state. +type SubscriptionCondition struct { + // Type is the type of Subscription condition. + Type SubscriptionConditionType `json:"type" description:"type of Subscription condition"` + + // Status is the status of the condition, one of True, False, Unknown. + Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"` + + // Reason is a one-word CamelCase reason for the condition's last transition. + // +optional + Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"` + + // Message is a human-readable message indicating details about last transition. + // +optional + Message string `json:"message,omitempty" description:"human-readable message indicating details about last transition"` + + // LastHeartbeatTime is the last time we got an update on a given condition + // +optional + LastHeartbeatTime *metav1.Time `json:"lastHeartbeatTime,omitempty" description:"last time we got an update on a given condition"` + + // LastTransitionTime is the last time the condition transit from one status to another + // +optional + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another" hash:"ignore"` +} + +// Equals returns true if a SubscriptionCondition equals the one given, false otherwise. +// Equality is determined by the equality of the type, status, reason, and message fields ONLY. +func (s SubscriptionCondition) Equals(condition SubscriptionCondition) bool { + return s.Type == condition.Type && s.Status == condition.Status && s.Reason == condition.Reason && s.Message == condition.Message +} + +type SubscriptionStatus struct { + // CurrentCSV is the CSV the Subscription is progressing to. + // +optional + CurrentCSV string `json:"currentCSV,omitempty"` + + // InstalledCSV is the CSV currently installed by the Subscription. + // +optional + InstalledCSV string `json:"installedCSV,omitempty"` + + // Install is a reference to the latest InstallPlan generated for the Subscription. + // DEPRECATED: InstallPlanRef + // +optional + Install *InstallPlanReference `json:"installplan,omitempty"` + + // State represents the current state of the Subscription + // +optional + State SubscriptionState `json:"state,omitempty"` + + // Reason is the reason the Subscription was transitioned to its current state. + // +optional + Reason ConditionReason `json:"reason,omitempty"` + + // InstallPlanRef is a reference to the latest InstallPlan that contains the Subscription's current CSV. + // +optional + InstallPlanRef *corev1.ObjectReference `json:"installPlanRef,omitempty"` + + // CatalogHealth contains the Subscription's view of its relevant CatalogSources' status. + // It is used to determine SubscriptionStatusConditions related to CatalogSources. + // +optional + CatalogHealth []SubscriptionCatalogHealth `json:"catalogHealth,omitempty"` + + // Conditions is a list of the latest available observations about a Subscription's current state. + // +optional + Conditions []SubscriptionCondition `json:"conditions,omitempty" hash:"set"` + + // LastUpdated represents the last time that the Subscription status was updated. + LastUpdated metav1.Time `json:"lastUpdated"` +} + +// GetCondition returns the SubscriptionCondition of the given type if it exists in the SubscriptionStatus' Conditions. +// Returns a condition of the given type with a ConditionStatus of "Unknown" if not found. +func (s SubscriptionStatus) GetCondition(conditionType SubscriptionConditionType) SubscriptionCondition { + for _, cond := range s.Conditions { + if cond.Type == conditionType { + return cond + } + } + + return SubscriptionCondition{ + Type: conditionType, + Status: corev1.ConditionUnknown, + } +} + +// SetCondition sets the given SubscriptionCondition in the SubscriptionStatus' Conditions. +func (s *SubscriptionStatus) SetCondition(condition SubscriptionCondition) { + for i, cond := range s.Conditions { + if cond.Type == condition.Type { + s.Conditions[i] = condition + return + } + } + + s.Conditions = append(s.Conditions, condition) +} + +// RemoveConditions removes any conditions of the given types from the SubscriptionStatus' Conditions. +func (s *SubscriptionStatus) RemoveConditions(remove ...SubscriptionConditionType) { + exclusions := map[SubscriptionConditionType]struct{}{} + for _, r := range remove { + exclusions[r] = struct{}{} + } + + var filtered []SubscriptionCondition + for _, cond := range s.Conditions { + if _, ok := exclusions[cond.Type]; ok { + // Skip excluded condition types + continue + } + filtered = append(filtered, cond) + } + + s.Conditions = filtered +} + +type InstallPlanReference struct { + APIVersion string `json:"apiVersion"` + Kind string `json:"kind"` + Name string `json:"name"` + UID types.UID `json:"uuid"` +} + +// SubscriptionCatalogHealth describes the health of a CatalogSource the Subscription knows about. +type SubscriptionCatalogHealth struct { + // CatalogSourceRef is a reference to a CatalogSource. + CatalogSourceRef *corev1.ObjectReference `json:"catalogSourceRef"` + + // LastUpdated represents the last time that the CatalogSourceHealth changed + LastUpdated *metav1.Time `json:"lastUpdated"` + + // Healthy is true if the CatalogSource is healthy; false otherwise. + Healthy bool `json:"healthy"` +} + +// Equals returns true if a SubscriptionCatalogHealth equals the one given, false otherwise. +// Equality is based SOLEY on health and UID. +func (s SubscriptionCatalogHealth) Equals(health SubscriptionCatalogHealth) bool { + return s.Healthy == health.Healthy && s.CatalogSourceRef.UID == health.CatalogSourceRef.UID +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient + +// Subscription keeps operators up to date by tracking changes to Catalogs. +type Subscription struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec *SubscriptionSpec `json:"spec"` + Status SubscriptionStatus `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// SubscriptionList is a list of Subscription resources. +type SubscriptionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []Subscription `json:"items"` +} + +// GetInstallPlanApproval gets the configured install plan approval or the default +func (s *Subscription) GetInstallPlanApproval() Approval { + if s.Spec.InstallPlanApproval == ApprovalManual { + return ApprovalManual + } + return ApprovalAutomatic +} + +// NewInstallPlanReference returns an InstallPlanReference for the given ObjectReference. +func NewInstallPlanReference(ref *corev1.ObjectReference) *InstallPlanReference { + return &InstallPlanReference{ + APIVersion: ref.APIVersion, + Kind: ref.Kind, + Name: ref.Name, + UID: ref.UID, + } +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/types_test.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/types_test.go new file mode 100644 index 0000000000..52fe622a5c --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/types_test.go @@ -0,0 +1,104 @@ +package v1alpha1 + +import ( + "sort" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGetAllCRDDescriptions(t *testing.T) { + var table = []struct { + owned []string + required []string + expected []string + }{ + {nil, nil, nil}, + {[]string{}, []string{}, []string{}}, + {[]string{"owned"}, []string{}, []string{"owned"}}, + {[]string{}, []string{"required"}, []string{"required"}}, + {[]string{"owned"}, []string{"required"}, []string{"owned", "required"}}, + {[]string{"first", "second"}, []string{"first", "second"}, []string{"first", "second"}}, + {[]string{"first", "second", "third"}, []string{"second", "third", "fourth"}, []string{"first", "second", "third", "fourth"}}, + } + + for _, tt := range table { + // Build a list of owned CRDDescription used in the CSV. + ownedDescriptions := make([]CRDDescription, 0) + for _, crdName := range tt.owned { + ownedDescriptions = append(ownedDescriptions, CRDDescription{ + Name: crdName, + }) + } + + // Build a list of owned CRDDescription used in the CSV. + requiredDescriptions := make([]CRDDescription, 0) + for _, crdName := range tt.required { + requiredDescriptions = append(requiredDescriptions, CRDDescription{ + Name: crdName, + }) + } + + // Build a list of expected CRDDescriptions. + expectedDescriptions := make([]CRDDescription, 0) + sort.StringSlice(tt.expected).Sort() + for _, expectedName := range tt.expected { + expectedDescriptions = append(expectedDescriptions, CRDDescription{ + Name: expectedName, + }) + } + + // Create a blank CSV with the owned descriptions. + csv := ClusterServiceVersion{ + Spec: ClusterServiceVersionSpec{ + CustomResourceDefinitions: CustomResourceDefinitions{ + Owned: ownedDescriptions, + Required: requiredDescriptions, + }, + }, + } + + // Call GetAllCRDDescriptions and ensure the result is as expected. + require.Equal(t, expectedDescriptions, csv.GetAllCRDDescriptions()) + } +} + +func TestOwnsCRD(t *testing.T) { + var table = []struct { + ownedCRDNames []string + crdName string + expected bool + }{ + {nil, "", false}, + {nil, "querty", false}, + {[]string{}, "", false}, + {[]string{}, "querty", false}, + {[]string{"owned"}, "owned", true}, + {[]string{"owned"}, "notOwned", false}, + {[]string{"first", "second"}, "first", true}, + {[]string{"first", "second"}, "second", true}, + {[]string{"first", "second"}, "third", false}, + } + + for _, tt := range table { + // Build a list of CRDDescription used in the CSV. + var ownedDescriptions []CRDDescription + for _, crdName := range tt.ownedCRDNames { + ownedDescriptions = append(ownedDescriptions, CRDDescription{ + Name: crdName, + }) + } + + // Create a blank CSV with the owned descriptions. + csv := ClusterServiceVersion{ + Spec: ClusterServiceVersionSpec{ + CustomResourceDefinitions: CustomResourceDefinitions{ + Owned: ownedDescriptions, + }, + }, + } + + // Call OwnsCRD and ensure the result is as expected. + require.Equal(t, tt.expected, csv.OwnsCRD(tt.crdName)) + } +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.conversion.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.conversion.go new file mode 100644 index 0000000000..179cd4c99c --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,1603 @@ +// +build !ignore_autogenerated + +/* +Copyright 2019 Red Hat, Inc. + +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. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + json "encoding/json" + unsafe "unsafe" + + operators "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators" + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + types "k8s.io/apimachinery/pkg/types" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*APIResourceReference)(nil), (*operators.APIResourceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_APIResourceReference_To_operators_APIResourceReference(a.(*APIResourceReference), b.(*operators.APIResourceReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.APIResourceReference)(nil), (*APIResourceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_APIResourceReference_To_v1alpha1_APIResourceReference(a.(*operators.APIResourceReference), b.(*APIResourceReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*APIServiceDefinitions)(nil), (*operators.APIServiceDefinitions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_APIServiceDefinitions_To_operators_APIServiceDefinitions(a.(*APIServiceDefinitions), b.(*operators.APIServiceDefinitions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.APIServiceDefinitions)(nil), (*APIServiceDefinitions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_APIServiceDefinitions_To_v1alpha1_APIServiceDefinitions(a.(*operators.APIServiceDefinitions), b.(*APIServiceDefinitions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*APIServiceDescription)(nil), (*operators.APIServiceDescription)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_APIServiceDescription_To_operators_APIServiceDescription(a.(*APIServiceDescription), b.(*operators.APIServiceDescription), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.APIServiceDescription)(nil), (*APIServiceDescription)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_APIServiceDescription_To_v1alpha1_APIServiceDescription(a.(*operators.APIServiceDescription), b.(*APIServiceDescription), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ActionDescriptor)(nil), (*operators.ActionDescriptor)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ActionDescriptor_To_operators_ActionDescriptor(a.(*ActionDescriptor), b.(*operators.ActionDescriptor), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.ActionDescriptor)(nil), (*ActionDescriptor)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_ActionDescriptor_To_v1alpha1_ActionDescriptor(a.(*operators.ActionDescriptor), b.(*ActionDescriptor), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AppLink)(nil), (*operators.AppLink)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AppLink_To_operators_AppLink(a.(*AppLink), b.(*operators.AppLink), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.AppLink)(nil), (*AppLink)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_AppLink_To_v1alpha1_AppLink(a.(*operators.AppLink), b.(*AppLink), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*CRDDescription)(nil), (*operators.CRDDescription)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CRDDescription_To_operators_CRDDescription(a.(*CRDDescription), b.(*operators.CRDDescription), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.CRDDescription)(nil), (*CRDDescription)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_CRDDescription_To_v1alpha1_CRDDescription(a.(*operators.CRDDescription), b.(*CRDDescription), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*CatalogSource)(nil), (*operators.CatalogSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CatalogSource_To_operators_CatalogSource(a.(*CatalogSource), b.(*operators.CatalogSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.CatalogSource)(nil), (*CatalogSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_CatalogSource_To_v1alpha1_CatalogSource(a.(*operators.CatalogSource), b.(*CatalogSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*CatalogSourceList)(nil), (*operators.CatalogSourceList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CatalogSourceList_To_operators_CatalogSourceList(a.(*CatalogSourceList), b.(*operators.CatalogSourceList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.CatalogSourceList)(nil), (*CatalogSourceList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_CatalogSourceList_To_v1alpha1_CatalogSourceList(a.(*operators.CatalogSourceList), b.(*CatalogSourceList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*CatalogSourceSpec)(nil), (*operators.CatalogSourceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CatalogSourceSpec_To_operators_CatalogSourceSpec(a.(*CatalogSourceSpec), b.(*operators.CatalogSourceSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.CatalogSourceSpec)(nil), (*CatalogSourceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_CatalogSourceSpec_To_v1alpha1_CatalogSourceSpec(a.(*operators.CatalogSourceSpec), b.(*CatalogSourceSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*CatalogSourceStatus)(nil), (*operators.CatalogSourceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CatalogSourceStatus_To_operators_CatalogSourceStatus(a.(*CatalogSourceStatus), b.(*operators.CatalogSourceStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.CatalogSourceStatus)(nil), (*CatalogSourceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_CatalogSourceStatus_To_v1alpha1_CatalogSourceStatus(a.(*operators.CatalogSourceStatus), b.(*CatalogSourceStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterServiceVersion)(nil), (*operators.ClusterServiceVersion)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClusterServiceVersion_To_operators_ClusterServiceVersion(a.(*ClusterServiceVersion), b.(*operators.ClusterServiceVersion), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.ClusterServiceVersion)(nil), (*ClusterServiceVersion)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_ClusterServiceVersion_To_v1alpha1_ClusterServiceVersion(a.(*operators.ClusterServiceVersion), b.(*ClusterServiceVersion), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterServiceVersionCondition)(nil), (*operators.ClusterServiceVersionCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClusterServiceVersionCondition_To_operators_ClusterServiceVersionCondition(a.(*ClusterServiceVersionCondition), b.(*operators.ClusterServiceVersionCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.ClusterServiceVersionCondition)(nil), (*ClusterServiceVersionCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_ClusterServiceVersionCondition_To_v1alpha1_ClusterServiceVersionCondition(a.(*operators.ClusterServiceVersionCondition), b.(*ClusterServiceVersionCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterServiceVersionList)(nil), (*operators.ClusterServiceVersionList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClusterServiceVersionList_To_operators_ClusterServiceVersionList(a.(*ClusterServiceVersionList), b.(*operators.ClusterServiceVersionList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.ClusterServiceVersionList)(nil), (*ClusterServiceVersionList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_ClusterServiceVersionList_To_v1alpha1_ClusterServiceVersionList(a.(*operators.ClusterServiceVersionList), b.(*ClusterServiceVersionList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterServiceVersionSpec)(nil), (*operators.ClusterServiceVersionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClusterServiceVersionSpec_To_operators_ClusterServiceVersionSpec(a.(*ClusterServiceVersionSpec), b.(*operators.ClusterServiceVersionSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.ClusterServiceVersionSpec)(nil), (*ClusterServiceVersionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_ClusterServiceVersionSpec_To_v1alpha1_ClusterServiceVersionSpec(a.(*operators.ClusterServiceVersionSpec), b.(*ClusterServiceVersionSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterServiceVersionStatus)(nil), (*operators.ClusterServiceVersionStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClusterServiceVersionStatus_To_operators_ClusterServiceVersionStatus(a.(*ClusterServiceVersionStatus), b.(*operators.ClusterServiceVersionStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.ClusterServiceVersionStatus)(nil), (*ClusterServiceVersionStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_ClusterServiceVersionStatus_To_v1alpha1_ClusterServiceVersionStatus(a.(*operators.ClusterServiceVersionStatus), b.(*ClusterServiceVersionStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ConfigMapResourceReference)(nil), (*operators.ConfigMapResourceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ConfigMapResourceReference_To_operators_ConfigMapResourceReference(a.(*ConfigMapResourceReference), b.(*operators.ConfigMapResourceReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.ConfigMapResourceReference)(nil), (*ConfigMapResourceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_ConfigMapResourceReference_To_v1alpha1_ConfigMapResourceReference(a.(*operators.ConfigMapResourceReference), b.(*ConfigMapResourceReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*CustomResourceDefinitions)(nil), (*operators.CustomResourceDefinitions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_CustomResourceDefinitions_To_operators_CustomResourceDefinitions(a.(*CustomResourceDefinitions), b.(*operators.CustomResourceDefinitions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.CustomResourceDefinitions)(nil), (*CustomResourceDefinitions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_CustomResourceDefinitions_To_v1alpha1_CustomResourceDefinitions(a.(*operators.CustomResourceDefinitions), b.(*CustomResourceDefinitions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DependentStatus)(nil), (*operators.DependentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DependentStatus_To_operators_DependentStatus(a.(*DependentStatus), b.(*operators.DependentStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.DependentStatus)(nil), (*DependentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_DependentStatus_To_v1alpha1_DependentStatus(a.(*operators.DependentStatus), b.(*DependentStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Icon)(nil), (*operators.Icon)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Icon_To_operators_Icon(a.(*Icon), b.(*operators.Icon), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.Icon)(nil), (*Icon)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_Icon_To_v1alpha1_Icon(a.(*operators.Icon), b.(*Icon), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallMode)(nil), (*operators.InstallMode)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallMode_To_operators_InstallMode(a.(*InstallMode), b.(*operators.InstallMode), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.InstallMode)(nil), (*InstallMode)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_InstallMode_To_v1alpha1_InstallMode(a.(*operators.InstallMode), b.(*InstallMode), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallPlan)(nil), (*operators.InstallPlan)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallPlan_To_operators_InstallPlan(a.(*InstallPlan), b.(*operators.InstallPlan), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.InstallPlan)(nil), (*InstallPlan)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_InstallPlan_To_v1alpha1_InstallPlan(a.(*operators.InstallPlan), b.(*InstallPlan), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallPlanCondition)(nil), (*operators.InstallPlanCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallPlanCondition_To_operators_InstallPlanCondition(a.(*InstallPlanCondition), b.(*operators.InstallPlanCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.InstallPlanCondition)(nil), (*InstallPlanCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_InstallPlanCondition_To_v1alpha1_InstallPlanCondition(a.(*operators.InstallPlanCondition), b.(*InstallPlanCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallPlanList)(nil), (*operators.InstallPlanList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallPlanList_To_operators_InstallPlanList(a.(*InstallPlanList), b.(*operators.InstallPlanList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.InstallPlanList)(nil), (*InstallPlanList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_InstallPlanList_To_v1alpha1_InstallPlanList(a.(*operators.InstallPlanList), b.(*InstallPlanList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallPlanReference)(nil), (*operators.InstallPlanReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallPlanReference_To_operators_InstallPlanReference(a.(*InstallPlanReference), b.(*operators.InstallPlanReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.InstallPlanReference)(nil), (*InstallPlanReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_InstallPlanReference_To_v1alpha1_InstallPlanReference(a.(*operators.InstallPlanReference), b.(*InstallPlanReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallPlanSpec)(nil), (*operators.InstallPlanSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallPlanSpec_To_operators_InstallPlanSpec(a.(*InstallPlanSpec), b.(*operators.InstallPlanSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.InstallPlanSpec)(nil), (*InstallPlanSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_InstallPlanSpec_To_v1alpha1_InstallPlanSpec(a.(*operators.InstallPlanSpec), b.(*InstallPlanSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstallPlanStatus)(nil), (*operators.InstallPlanStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_InstallPlanStatus_To_operators_InstallPlanStatus(a.(*InstallPlanStatus), b.(*operators.InstallPlanStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.InstallPlanStatus)(nil), (*InstallPlanStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_InstallPlanStatus_To_v1alpha1_InstallPlanStatus(a.(*operators.InstallPlanStatus), b.(*InstallPlanStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Maintainer)(nil), (*operators.Maintainer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Maintainer_To_operators_Maintainer(a.(*Maintainer), b.(*operators.Maintainer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.Maintainer)(nil), (*Maintainer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_Maintainer_To_v1alpha1_Maintainer(a.(*operators.Maintainer), b.(*Maintainer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NamedInstallStrategy)(nil), (*operators.NamedInstallStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NamedInstallStrategy_To_operators_NamedInstallStrategy(a.(*NamedInstallStrategy), b.(*operators.NamedInstallStrategy), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.NamedInstallStrategy)(nil), (*NamedInstallStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_NamedInstallStrategy_To_v1alpha1_NamedInstallStrategy(a.(*operators.NamedInstallStrategy), b.(*NamedInstallStrategy), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RegistryServiceStatus)(nil), (*operators.RegistryServiceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RegistryServiceStatus_To_operators_RegistryServiceStatus(a.(*RegistryServiceStatus), b.(*operators.RegistryServiceStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.RegistryServiceStatus)(nil), (*RegistryServiceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_RegistryServiceStatus_To_v1alpha1_RegistryServiceStatus(a.(*operators.RegistryServiceStatus), b.(*RegistryServiceStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RequirementStatus)(nil), (*operators.RequirementStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RequirementStatus_To_operators_RequirementStatus(a.(*RequirementStatus), b.(*operators.RequirementStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.RequirementStatus)(nil), (*RequirementStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_RequirementStatus_To_v1alpha1_RequirementStatus(a.(*operators.RequirementStatus), b.(*RequirementStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SpecDescriptor)(nil), (*operators.SpecDescriptor)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SpecDescriptor_To_operators_SpecDescriptor(a.(*SpecDescriptor), b.(*operators.SpecDescriptor), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.SpecDescriptor)(nil), (*SpecDescriptor)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_SpecDescriptor_To_v1alpha1_SpecDescriptor(a.(*operators.SpecDescriptor), b.(*SpecDescriptor), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*StatusDescriptor)(nil), (*operators.StatusDescriptor)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_StatusDescriptor_To_operators_StatusDescriptor(a.(*StatusDescriptor), b.(*operators.StatusDescriptor), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.StatusDescriptor)(nil), (*StatusDescriptor)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_StatusDescriptor_To_v1alpha1_StatusDescriptor(a.(*operators.StatusDescriptor), b.(*StatusDescriptor), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Step)(nil), (*operators.Step)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Step_To_operators_Step(a.(*Step), b.(*operators.Step), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.Step)(nil), (*Step)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_Step_To_v1alpha1_Step(a.(*operators.Step), b.(*Step), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*StepResource)(nil), (*operators.StepResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_StepResource_To_operators_StepResource(a.(*StepResource), b.(*operators.StepResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.StepResource)(nil), (*StepResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_StepResource_To_v1alpha1_StepResource(a.(*operators.StepResource), b.(*StepResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Subscription)(nil), (*operators.Subscription)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Subscription_To_operators_Subscription(a.(*Subscription), b.(*operators.Subscription), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.Subscription)(nil), (*Subscription)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_Subscription_To_v1alpha1_Subscription(a.(*operators.Subscription), b.(*Subscription), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SubscriptionCatalogHealth)(nil), (*operators.SubscriptionCatalogHealth)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SubscriptionCatalogHealth_To_operators_SubscriptionCatalogHealth(a.(*SubscriptionCatalogHealth), b.(*operators.SubscriptionCatalogHealth), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.SubscriptionCatalogHealth)(nil), (*SubscriptionCatalogHealth)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_SubscriptionCatalogHealth_To_v1alpha1_SubscriptionCatalogHealth(a.(*operators.SubscriptionCatalogHealth), b.(*SubscriptionCatalogHealth), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SubscriptionCondition)(nil), (*operators.SubscriptionCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SubscriptionCondition_To_operators_SubscriptionCondition(a.(*SubscriptionCondition), b.(*operators.SubscriptionCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.SubscriptionCondition)(nil), (*SubscriptionCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_SubscriptionCondition_To_v1alpha1_SubscriptionCondition(a.(*operators.SubscriptionCondition), b.(*SubscriptionCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SubscriptionList)(nil), (*operators.SubscriptionList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SubscriptionList_To_operators_SubscriptionList(a.(*SubscriptionList), b.(*operators.SubscriptionList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.SubscriptionList)(nil), (*SubscriptionList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_SubscriptionList_To_v1alpha1_SubscriptionList(a.(*operators.SubscriptionList), b.(*SubscriptionList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SubscriptionSpec)(nil), (*operators.SubscriptionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SubscriptionSpec_To_operators_SubscriptionSpec(a.(*SubscriptionSpec), b.(*operators.SubscriptionSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.SubscriptionSpec)(nil), (*SubscriptionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_SubscriptionSpec_To_v1alpha1_SubscriptionSpec(a.(*operators.SubscriptionSpec), b.(*SubscriptionSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SubscriptionStatus)(nil), (*operators.SubscriptionStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SubscriptionStatus_To_operators_SubscriptionStatus(a.(*SubscriptionStatus), b.(*operators.SubscriptionStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*operators.SubscriptionStatus)(nil), (*SubscriptionStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_operators_SubscriptionStatus_To_v1alpha1_SubscriptionStatus(a.(*operators.SubscriptionStatus), b.(*SubscriptionStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_APIResourceReference_To_operators_APIResourceReference(in *APIResourceReference, out *operators.APIResourceReference, s conversion.Scope) error { + out.Name = in.Name + out.Kind = in.Kind + out.Version = in.Version + return nil +} + +// Convert_v1alpha1_APIResourceReference_To_operators_APIResourceReference is an autogenerated conversion function. +func Convert_v1alpha1_APIResourceReference_To_operators_APIResourceReference(in *APIResourceReference, out *operators.APIResourceReference, s conversion.Scope) error { + return autoConvert_v1alpha1_APIResourceReference_To_operators_APIResourceReference(in, out, s) +} + +func autoConvert_operators_APIResourceReference_To_v1alpha1_APIResourceReference(in *operators.APIResourceReference, out *APIResourceReference, s conversion.Scope) error { + out.Name = in.Name + out.Kind = in.Kind + out.Version = in.Version + return nil +} + +// Convert_operators_APIResourceReference_To_v1alpha1_APIResourceReference is an autogenerated conversion function. +func Convert_operators_APIResourceReference_To_v1alpha1_APIResourceReference(in *operators.APIResourceReference, out *APIResourceReference, s conversion.Scope) error { + return autoConvert_operators_APIResourceReference_To_v1alpha1_APIResourceReference(in, out, s) +} + +func autoConvert_v1alpha1_APIServiceDefinitions_To_operators_APIServiceDefinitions(in *APIServiceDefinitions, out *operators.APIServiceDefinitions, s conversion.Scope) error { + out.Owned = *(*[]operators.APIServiceDescription)(unsafe.Pointer(&in.Owned)) + out.Required = *(*[]operators.APIServiceDescription)(unsafe.Pointer(&in.Required)) + return nil +} + +// Convert_v1alpha1_APIServiceDefinitions_To_operators_APIServiceDefinitions is an autogenerated conversion function. +func Convert_v1alpha1_APIServiceDefinitions_To_operators_APIServiceDefinitions(in *APIServiceDefinitions, out *operators.APIServiceDefinitions, s conversion.Scope) error { + return autoConvert_v1alpha1_APIServiceDefinitions_To_operators_APIServiceDefinitions(in, out, s) +} + +func autoConvert_operators_APIServiceDefinitions_To_v1alpha1_APIServiceDefinitions(in *operators.APIServiceDefinitions, out *APIServiceDefinitions, s conversion.Scope) error { + out.Owned = *(*[]APIServiceDescription)(unsafe.Pointer(&in.Owned)) + out.Required = *(*[]APIServiceDescription)(unsafe.Pointer(&in.Required)) + return nil +} + +// Convert_operators_APIServiceDefinitions_To_v1alpha1_APIServiceDefinitions is an autogenerated conversion function. +func Convert_operators_APIServiceDefinitions_To_v1alpha1_APIServiceDefinitions(in *operators.APIServiceDefinitions, out *APIServiceDefinitions, s conversion.Scope) error { + return autoConvert_operators_APIServiceDefinitions_To_v1alpha1_APIServiceDefinitions(in, out, s) +} + +func autoConvert_v1alpha1_APIServiceDescription_To_operators_APIServiceDescription(in *APIServiceDescription, out *operators.APIServiceDescription, s conversion.Scope) error { + out.Name = in.Name + out.Group = in.Group + out.Version = in.Version + out.Kind = in.Kind + out.DeploymentName = in.DeploymentName + out.ContainerPort = in.ContainerPort + out.DisplayName = in.DisplayName + out.Description = in.Description + out.Resources = *(*[]operators.APIResourceReference)(unsafe.Pointer(&in.Resources)) + out.StatusDescriptors = *(*[]operators.StatusDescriptor)(unsafe.Pointer(&in.StatusDescriptors)) + out.SpecDescriptors = *(*[]operators.SpecDescriptor)(unsafe.Pointer(&in.SpecDescriptors)) + out.ActionDescriptor = *(*[]operators.ActionDescriptor)(unsafe.Pointer(&in.ActionDescriptor)) + return nil +} + +// Convert_v1alpha1_APIServiceDescription_To_operators_APIServiceDescription is an autogenerated conversion function. +func Convert_v1alpha1_APIServiceDescription_To_operators_APIServiceDescription(in *APIServiceDescription, out *operators.APIServiceDescription, s conversion.Scope) error { + return autoConvert_v1alpha1_APIServiceDescription_To_operators_APIServiceDescription(in, out, s) +} + +func autoConvert_operators_APIServiceDescription_To_v1alpha1_APIServiceDescription(in *operators.APIServiceDescription, out *APIServiceDescription, s conversion.Scope) error { + out.Name = in.Name + out.Group = in.Group + out.Version = in.Version + out.Kind = in.Kind + out.DeploymentName = in.DeploymentName + out.ContainerPort = in.ContainerPort + out.DisplayName = in.DisplayName + out.Description = in.Description + out.Resources = *(*[]APIResourceReference)(unsafe.Pointer(&in.Resources)) + out.StatusDescriptors = *(*[]StatusDescriptor)(unsafe.Pointer(&in.StatusDescriptors)) + out.SpecDescriptors = *(*[]SpecDescriptor)(unsafe.Pointer(&in.SpecDescriptors)) + out.ActionDescriptor = *(*[]ActionDescriptor)(unsafe.Pointer(&in.ActionDescriptor)) + return nil +} + +// Convert_operators_APIServiceDescription_To_v1alpha1_APIServiceDescription is an autogenerated conversion function. +func Convert_operators_APIServiceDescription_To_v1alpha1_APIServiceDescription(in *operators.APIServiceDescription, out *APIServiceDescription, s conversion.Scope) error { + return autoConvert_operators_APIServiceDescription_To_v1alpha1_APIServiceDescription(in, out, s) +} + +func autoConvert_v1alpha1_ActionDescriptor_To_operators_ActionDescriptor(in *ActionDescriptor, out *operators.ActionDescriptor, s conversion.Scope) error { + out.Path = in.Path + out.DisplayName = in.DisplayName + out.Description = in.Description + out.XDescriptors = *(*[]string)(unsafe.Pointer(&in.XDescriptors)) + out.Value = (*json.RawMessage)(unsafe.Pointer(in.Value)) + return nil +} + +// Convert_v1alpha1_ActionDescriptor_To_operators_ActionDescriptor is an autogenerated conversion function. +func Convert_v1alpha1_ActionDescriptor_To_operators_ActionDescriptor(in *ActionDescriptor, out *operators.ActionDescriptor, s conversion.Scope) error { + return autoConvert_v1alpha1_ActionDescriptor_To_operators_ActionDescriptor(in, out, s) +} + +func autoConvert_operators_ActionDescriptor_To_v1alpha1_ActionDescriptor(in *operators.ActionDescriptor, out *ActionDescriptor, s conversion.Scope) error { + out.Path = in.Path + out.DisplayName = in.DisplayName + out.Description = in.Description + out.XDescriptors = *(*[]string)(unsafe.Pointer(&in.XDescriptors)) + out.Value = (*json.RawMessage)(unsafe.Pointer(in.Value)) + return nil +} + +// Convert_operators_ActionDescriptor_To_v1alpha1_ActionDescriptor is an autogenerated conversion function. +func Convert_operators_ActionDescriptor_To_v1alpha1_ActionDescriptor(in *operators.ActionDescriptor, out *ActionDescriptor, s conversion.Scope) error { + return autoConvert_operators_ActionDescriptor_To_v1alpha1_ActionDescriptor(in, out, s) +} + +func autoConvert_v1alpha1_AppLink_To_operators_AppLink(in *AppLink, out *operators.AppLink, s conversion.Scope) error { + out.Name = in.Name + out.URL = in.URL + return nil +} + +// Convert_v1alpha1_AppLink_To_operators_AppLink is an autogenerated conversion function. +func Convert_v1alpha1_AppLink_To_operators_AppLink(in *AppLink, out *operators.AppLink, s conversion.Scope) error { + return autoConvert_v1alpha1_AppLink_To_operators_AppLink(in, out, s) +} + +func autoConvert_operators_AppLink_To_v1alpha1_AppLink(in *operators.AppLink, out *AppLink, s conversion.Scope) error { + out.Name = in.Name + out.URL = in.URL + return nil +} + +// Convert_operators_AppLink_To_v1alpha1_AppLink is an autogenerated conversion function. +func Convert_operators_AppLink_To_v1alpha1_AppLink(in *operators.AppLink, out *AppLink, s conversion.Scope) error { + return autoConvert_operators_AppLink_To_v1alpha1_AppLink(in, out, s) +} + +func autoConvert_v1alpha1_CRDDescription_To_operators_CRDDescription(in *CRDDescription, out *operators.CRDDescription, s conversion.Scope) error { + out.Name = in.Name + out.Version = in.Version + out.Kind = in.Kind + out.DisplayName = in.DisplayName + out.Description = in.Description + out.Resources = *(*[]operators.APIResourceReference)(unsafe.Pointer(&in.Resources)) + out.StatusDescriptors = *(*[]operators.StatusDescriptor)(unsafe.Pointer(&in.StatusDescriptors)) + out.SpecDescriptors = *(*[]operators.SpecDescriptor)(unsafe.Pointer(&in.SpecDescriptors)) + out.ActionDescriptor = *(*[]operators.ActionDescriptor)(unsafe.Pointer(&in.ActionDescriptor)) + return nil +} + +// Convert_v1alpha1_CRDDescription_To_operators_CRDDescription is an autogenerated conversion function. +func Convert_v1alpha1_CRDDescription_To_operators_CRDDescription(in *CRDDescription, out *operators.CRDDescription, s conversion.Scope) error { + return autoConvert_v1alpha1_CRDDescription_To_operators_CRDDescription(in, out, s) +} + +func autoConvert_operators_CRDDescription_To_v1alpha1_CRDDescription(in *operators.CRDDescription, out *CRDDescription, s conversion.Scope) error { + out.Name = in.Name + out.Version = in.Version + out.Kind = in.Kind + out.DisplayName = in.DisplayName + out.Description = in.Description + out.Resources = *(*[]APIResourceReference)(unsafe.Pointer(&in.Resources)) + out.StatusDescriptors = *(*[]StatusDescriptor)(unsafe.Pointer(&in.StatusDescriptors)) + out.SpecDescriptors = *(*[]SpecDescriptor)(unsafe.Pointer(&in.SpecDescriptors)) + out.ActionDescriptor = *(*[]ActionDescriptor)(unsafe.Pointer(&in.ActionDescriptor)) + return nil +} + +// Convert_operators_CRDDescription_To_v1alpha1_CRDDescription is an autogenerated conversion function. +func Convert_operators_CRDDescription_To_v1alpha1_CRDDescription(in *operators.CRDDescription, out *CRDDescription, s conversion.Scope) error { + return autoConvert_operators_CRDDescription_To_v1alpha1_CRDDescription(in, out, s) +} + +func autoConvert_v1alpha1_CatalogSource_To_operators_CatalogSource(in *CatalogSource, out *operators.CatalogSource, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_CatalogSourceSpec_To_operators_CatalogSourceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_CatalogSourceStatus_To_operators_CatalogSourceStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_CatalogSource_To_operators_CatalogSource is an autogenerated conversion function. +func Convert_v1alpha1_CatalogSource_To_operators_CatalogSource(in *CatalogSource, out *operators.CatalogSource, s conversion.Scope) error { + return autoConvert_v1alpha1_CatalogSource_To_operators_CatalogSource(in, out, s) +} + +func autoConvert_operators_CatalogSource_To_v1alpha1_CatalogSource(in *operators.CatalogSource, out *CatalogSource, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_operators_CatalogSourceSpec_To_v1alpha1_CatalogSourceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_operators_CatalogSourceStatus_To_v1alpha1_CatalogSourceStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_operators_CatalogSource_To_v1alpha1_CatalogSource is an autogenerated conversion function. +func Convert_operators_CatalogSource_To_v1alpha1_CatalogSource(in *operators.CatalogSource, out *CatalogSource, s conversion.Scope) error { + return autoConvert_operators_CatalogSource_To_v1alpha1_CatalogSource(in, out, s) +} + +func autoConvert_v1alpha1_CatalogSourceList_To_operators_CatalogSourceList(in *CatalogSourceList, out *operators.CatalogSourceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]operators.CatalogSource)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_CatalogSourceList_To_operators_CatalogSourceList is an autogenerated conversion function. +func Convert_v1alpha1_CatalogSourceList_To_operators_CatalogSourceList(in *CatalogSourceList, out *operators.CatalogSourceList, s conversion.Scope) error { + return autoConvert_v1alpha1_CatalogSourceList_To_operators_CatalogSourceList(in, out, s) +} + +func autoConvert_operators_CatalogSourceList_To_v1alpha1_CatalogSourceList(in *operators.CatalogSourceList, out *CatalogSourceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]CatalogSource)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_operators_CatalogSourceList_To_v1alpha1_CatalogSourceList is an autogenerated conversion function. +func Convert_operators_CatalogSourceList_To_v1alpha1_CatalogSourceList(in *operators.CatalogSourceList, out *CatalogSourceList, s conversion.Scope) error { + return autoConvert_operators_CatalogSourceList_To_v1alpha1_CatalogSourceList(in, out, s) +} + +func autoConvert_v1alpha1_CatalogSourceSpec_To_operators_CatalogSourceSpec(in *CatalogSourceSpec, out *operators.CatalogSourceSpec, s conversion.Scope) error { + out.SourceType = operators.SourceType(in.SourceType) + out.ConfigMap = in.ConfigMap + out.Address = in.Address + out.Image = in.Image + out.Secrets = *(*[]string)(unsafe.Pointer(&in.Secrets)) + out.DisplayName = in.DisplayName + out.Description = in.Description + out.Publisher = in.Publisher + if err := Convert_v1alpha1_Icon_To_operators_Icon(&in.Icon, &out.Icon, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_CatalogSourceSpec_To_operators_CatalogSourceSpec is an autogenerated conversion function. +func Convert_v1alpha1_CatalogSourceSpec_To_operators_CatalogSourceSpec(in *CatalogSourceSpec, out *operators.CatalogSourceSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_CatalogSourceSpec_To_operators_CatalogSourceSpec(in, out, s) +} + +func autoConvert_operators_CatalogSourceSpec_To_v1alpha1_CatalogSourceSpec(in *operators.CatalogSourceSpec, out *CatalogSourceSpec, s conversion.Scope) error { + out.SourceType = SourceType(in.SourceType) + out.ConfigMap = in.ConfigMap + out.Address = in.Address + out.Image = in.Image + out.Secrets = *(*[]string)(unsafe.Pointer(&in.Secrets)) + out.DisplayName = in.DisplayName + out.Description = in.Description + out.Publisher = in.Publisher + if err := Convert_operators_Icon_To_v1alpha1_Icon(&in.Icon, &out.Icon, s); err != nil { + return err + } + return nil +} + +// Convert_operators_CatalogSourceSpec_To_v1alpha1_CatalogSourceSpec is an autogenerated conversion function. +func Convert_operators_CatalogSourceSpec_To_v1alpha1_CatalogSourceSpec(in *operators.CatalogSourceSpec, out *CatalogSourceSpec, s conversion.Scope) error { + return autoConvert_operators_CatalogSourceSpec_To_v1alpha1_CatalogSourceSpec(in, out, s) +} + +func autoConvert_v1alpha1_CatalogSourceStatus_To_operators_CatalogSourceStatus(in *CatalogSourceStatus, out *operators.CatalogSourceStatus, s conversion.Scope) error { + out.ConfigMapResource = (*operators.ConfigMapResourceReference)(unsafe.Pointer(in.ConfigMapResource)) + out.RegistryServiceStatus = (*operators.RegistryServiceStatus)(unsafe.Pointer(in.RegistryServiceStatus)) + out.LastSync = in.LastSync + return nil +} + +// Convert_v1alpha1_CatalogSourceStatus_To_operators_CatalogSourceStatus is an autogenerated conversion function. +func Convert_v1alpha1_CatalogSourceStatus_To_operators_CatalogSourceStatus(in *CatalogSourceStatus, out *operators.CatalogSourceStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_CatalogSourceStatus_To_operators_CatalogSourceStatus(in, out, s) +} + +func autoConvert_operators_CatalogSourceStatus_To_v1alpha1_CatalogSourceStatus(in *operators.CatalogSourceStatus, out *CatalogSourceStatus, s conversion.Scope) error { + out.ConfigMapResource = (*ConfigMapResourceReference)(unsafe.Pointer(in.ConfigMapResource)) + out.RegistryServiceStatus = (*RegistryServiceStatus)(unsafe.Pointer(in.RegistryServiceStatus)) + out.LastSync = in.LastSync + return nil +} + +// Convert_operators_CatalogSourceStatus_To_v1alpha1_CatalogSourceStatus is an autogenerated conversion function. +func Convert_operators_CatalogSourceStatus_To_v1alpha1_CatalogSourceStatus(in *operators.CatalogSourceStatus, out *CatalogSourceStatus, s conversion.Scope) error { + return autoConvert_operators_CatalogSourceStatus_To_v1alpha1_CatalogSourceStatus(in, out, s) +} + +func autoConvert_v1alpha1_ClusterServiceVersion_To_operators_ClusterServiceVersion(in *ClusterServiceVersion, out *operators.ClusterServiceVersion, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_ClusterServiceVersionSpec_To_operators_ClusterServiceVersionSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ClusterServiceVersionStatus_To_operators_ClusterServiceVersionStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ClusterServiceVersion_To_operators_ClusterServiceVersion is an autogenerated conversion function. +func Convert_v1alpha1_ClusterServiceVersion_To_operators_ClusterServiceVersion(in *ClusterServiceVersion, out *operators.ClusterServiceVersion, s conversion.Scope) error { + return autoConvert_v1alpha1_ClusterServiceVersion_To_operators_ClusterServiceVersion(in, out, s) +} + +func autoConvert_operators_ClusterServiceVersion_To_v1alpha1_ClusterServiceVersion(in *operators.ClusterServiceVersion, out *ClusterServiceVersion, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_operators_ClusterServiceVersionSpec_To_v1alpha1_ClusterServiceVersionSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_operators_ClusterServiceVersionStatus_To_v1alpha1_ClusterServiceVersionStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_operators_ClusterServiceVersion_To_v1alpha1_ClusterServiceVersion is an autogenerated conversion function. +func Convert_operators_ClusterServiceVersion_To_v1alpha1_ClusterServiceVersion(in *operators.ClusterServiceVersion, out *ClusterServiceVersion, s conversion.Scope) error { + return autoConvert_operators_ClusterServiceVersion_To_v1alpha1_ClusterServiceVersion(in, out, s) +} + +func autoConvert_v1alpha1_ClusterServiceVersionCondition_To_operators_ClusterServiceVersionCondition(in *ClusterServiceVersionCondition, out *operators.ClusterServiceVersionCondition, s conversion.Scope) error { + out.Phase = operators.ClusterServiceVersionPhase(in.Phase) + out.Message = in.Message + out.Reason = operators.ConditionReason(in.Reason) + out.LastUpdateTime = in.LastUpdateTime + out.LastTransitionTime = in.LastTransitionTime + return nil +} + +// Convert_v1alpha1_ClusterServiceVersionCondition_To_operators_ClusterServiceVersionCondition is an autogenerated conversion function. +func Convert_v1alpha1_ClusterServiceVersionCondition_To_operators_ClusterServiceVersionCondition(in *ClusterServiceVersionCondition, out *operators.ClusterServiceVersionCondition, s conversion.Scope) error { + return autoConvert_v1alpha1_ClusterServiceVersionCondition_To_operators_ClusterServiceVersionCondition(in, out, s) +} + +func autoConvert_operators_ClusterServiceVersionCondition_To_v1alpha1_ClusterServiceVersionCondition(in *operators.ClusterServiceVersionCondition, out *ClusterServiceVersionCondition, s conversion.Scope) error { + out.Phase = ClusterServiceVersionPhase(in.Phase) + out.Message = in.Message + out.Reason = ConditionReason(in.Reason) + out.LastUpdateTime = in.LastUpdateTime + out.LastTransitionTime = in.LastTransitionTime + return nil +} + +// Convert_operators_ClusterServiceVersionCondition_To_v1alpha1_ClusterServiceVersionCondition is an autogenerated conversion function. +func Convert_operators_ClusterServiceVersionCondition_To_v1alpha1_ClusterServiceVersionCondition(in *operators.ClusterServiceVersionCondition, out *ClusterServiceVersionCondition, s conversion.Scope) error { + return autoConvert_operators_ClusterServiceVersionCondition_To_v1alpha1_ClusterServiceVersionCondition(in, out, s) +} + +func autoConvert_v1alpha1_ClusterServiceVersionList_To_operators_ClusterServiceVersionList(in *ClusterServiceVersionList, out *operators.ClusterServiceVersionList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]operators.ClusterServiceVersion)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_ClusterServiceVersionList_To_operators_ClusterServiceVersionList is an autogenerated conversion function. +func Convert_v1alpha1_ClusterServiceVersionList_To_operators_ClusterServiceVersionList(in *ClusterServiceVersionList, out *operators.ClusterServiceVersionList, s conversion.Scope) error { + return autoConvert_v1alpha1_ClusterServiceVersionList_To_operators_ClusterServiceVersionList(in, out, s) +} + +func autoConvert_operators_ClusterServiceVersionList_To_v1alpha1_ClusterServiceVersionList(in *operators.ClusterServiceVersionList, out *ClusterServiceVersionList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]ClusterServiceVersion)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_operators_ClusterServiceVersionList_To_v1alpha1_ClusterServiceVersionList is an autogenerated conversion function. +func Convert_operators_ClusterServiceVersionList_To_v1alpha1_ClusterServiceVersionList(in *operators.ClusterServiceVersionList, out *ClusterServiceVersionList, s conversion.Scope) error { + return autoConvert_operators_ClusterServiceVersionList_To_v1alpha1_ClusterServiceVersionList(in, out, s) +} + +func autoConvert_v1alpha1_ClusterServiceVersionSpec_To_operators_ClusterServiceVersionSpec(in *ClusterServiceVersionSpec, out *operators.ClusterServiceVersionSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_NamedInstallStrategy_To_operators_NamedInstallStrategy(&in.InstallStrategy, &out.InstallStrategy, s); err != nil { + return err + } + out.Version = in.Version + out.Maturity = in.Maturity + if err := Convert_v1alpha1_CustomResourceDefinitions_To_operators_CustomResourceDefinitions(&in.CustomResourceDefinitions, &out.CustomResourceDefinitions, s); err != nil { + return err + } + if err := Convert_v1alpha1_APIServiceDefinitions_To_operators_APIServiceDefinitions(&in.APIServiceDefinitions, &out.APIServiceDefinitions, s); err != nil { + return err + } + out.NativeAPIs = *(*[]v1.GroupVersionKind)(unsafe.Pointer(&in.NativeAPIs)) + out.MinKubeVersion = in.MinKubeVersion + out.DisplayName = in.DisplayName + out.Description = in.Description + out.Keywords = *(*[]string)(unsafe.Pointer(&in.Keywords)) + out.Maintainers = *(*[]operators.Maintainer)(unsafe.Pointer(&in.Maintainers)) + if err := Convert_v1alpha1_AppLink_To_operators_AppLink(&in.Provider, &out.Provider, s); err != nil { + return err + } + out.Links = *(*[]operators.AppLink)(unsafe.Pointer(&in.Links)) + out.Icon = *(*[]operators.Icon)(unsafe.Pointer(&in.Icon)) + out.InstallModes = *(*[]operators.InstallMode)(unsafe.Pointer(&in.InstallModes)) + out.Replaces = in.Replaces + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) + return nil +} + +// Convert_v1alpha1_ClusterServiceVersionSpec_To_operators_ClusterServiceVersionSpec is an autogenerated conversion function. +func Convert_v1alpha1_ClusterServiceVersionSpec_To_operators_ClusterServiceVersionSpec(in *ClusterServiceVersionSpec, out *operators.ClusterServiceVersionSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ClusterServiceVersionSpec_To_operators_ClusterServiceVersionSpec(in, out, s) +} + +func autoConvert_operators_ClusterServiceVersionSpec_To_v1alpha1_ClusterServiceVersionSpec(in *operators.ClusterServiceVersionSpec, out *ClusterServiceVersionSpec, s conversion.Scope) error { + if err := Convert_operators_NamedInstallStrategy_To_v1alpha1_NamedInstallStrategy(&in.InstallStrategy, &out.InstallStrategy, s); err != nil { + return err + } + out.Version = in.Version + out.Maturity = in.Maturity + if err := Convert_operators_CustomResourceDefinitions_To_v1alpha1_CustomResourceDefinitions(&in.CustomResourceDefinitions, &out.CustomResourceDefinitions, s); err != nil { + return err + } + if err := Convert_operators_APIServiceDefinitions_To_v1alpha1_APIServiceDefinitions(&in.APIServiceDefinitions, &out.APIServiceDefinitions, s); err != nil { + return err + } + out.NativeAPIs = *(*[]v1.GroupVersionKind)(unsafe.Pointer(&in.NativeAPIs)) + out.MinKubeVersion = in.MinKubeVersion + out.DisplayName = in.DisplayName + out.Description = in.Description + out.Keywords = *(*[]string)(unsafe.Pointer(&in.Keywords)) + out.Maintainers = *(*[]Maintainer)(unsafe.Pointer(&in.Maintainers)) + if err := Convert_operators_AppLink_To_v1alpha1_AppLink(&in.Provider, &out.Provider, s); err != nil { + return err + } + out.Links = *(*[]AppLink)(unsafe.Pointer(&in.Links)) + out.Icon = *(*[]Icon)(unsafe.Pointer(&in.Icon)) + out.InstallModes = *(*[]InstallMode)(unsafe.Pointer(&in.InstallModes)) + out.Replaces = in.Replaces + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) + return nil +} + +// Convert_operators_ClusterServiceVersionSpec_To_v1alpha1_ClusterServiceVersionSpec is an autogenerated conversion function. +func Convert_operators_ClusterServiceVersionSpec_To_v1alpha1_ClusterServiceVersionSpec(in *operators.ClusterServiceVersionSpec, out *ClusterServiceVersionSpec, s conversion.Scope) error { + return autoConvert_operators_ClusterServiceVersionSpec_To_v1alpha1_ClusterServiceVersionSpec(in, out, s) +} + +func autoConvert_v1alpha1_ClusterServiceVersionStatus_To_operators_ClusterServiceVersionStatus(in *ClusterServiceVersionStatus, out *operators.ClusterServiceVersionStatus, s conversion.Scope) error { + out.Phase = operators.ClusterServiceVersionPhase(in.Phase) + out.Message = in.Message + out.Reason = operators.ConditionReason(in.Reason) + out.LastUpdateTime = in.LastUpdateTime + out.LastTransitionTime = in.LastTransitionTime + out.Conditions = *(*[]operators.ClusterServiceVersionCondition)(unsafe.Pointer(&in.Conditions)) + out.RequirementStatus = *(*[]operators.RequirementStatus)(unsafe.Pointer(&in.RequirementStatus)) + out.CertsLastUpdated = in.CertsLastUpdated + out.CertsRotateAt = in.CertsRotateAt + return nil +} + +// Convert_v1alpha1_ClusterServiceVersionStatus_To_operators_ClusterServiceVersionStatus is an autogenerated conversion function. +func Convert_v1alpha1_ClusterServiceVersionStatus_To_operators_ClusterServiceVersionStatus(in *ClusterServiceVersionStatus, out *operators.ClusterServiceVersionStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ClusterServiceVersionStatus_To_operators_ClusterServiceVersionStatus(in, out, s) +} + +func autoConvert_operators_ClusterServiceVersionStatus_To_v1alpha1_ClusterServiceVersionStatus(in *operators.ClusterServiceVersionStatus, out *ClusterServiceVersionStatus, s conversion.Scope) error { + out.Phase = ClusterServiceVersionPhase(in.Phase) + out.Message = in.Message + out.Reason = ConditionReason(in.Reason) + out.LastUpdateTime = in.LastUpdateTime + out.LastTransitionTime = in.LastTransitionTime + out.Conditions = *(*[]ClusterServiceVersionCondition)(unsafe.Pointer(&in.Conditions)) + out.RequirementStatus = *(*[]RequirementStatus)(unsafe.Pointer(&in.RequirementStatus)) + out.CertsLastUpdated = in.CertsLastUpdated + out.CertsRotateAt = in.CertsRotateAt + return nil +} + +// Convert_operators_ClusterServiceVersionStatus_To_v1alpha1_ClusterServiceVersionStatus is an autogenerated conversion function. +func Convert_operators_ClusterServiceVersionStatus_To_v1alpha1_ClusterServiceVersionStatus(in *operators.ClusterServiceVersionStatus, out *ClusterServiceVersionStatus, s conversion.Scope) error { + return autoConvert_operators_ClusterServiceVersionStatus_To_v1alpha1_ClusterServiceVersionStatus(in, out, s) +} + +func autoConvert_v1alpha1_ConfigMapResourceReference_To_operators_ConfigMapResourceReference(in *ConfigMapResourceReference, out *operators.ConfigMapResourceReference, s conversion.Scope) error { + out.Name = in.Name + out.Namespace = in.Namespace + out.UID = types.UID(in.UID) + out.ResourceVersion = in.ResourceVersion + return nil +} + +// Convert_v1alpha1_ConfigMapResourceReference_To_operators_ConfigMapResourceReference is an autogenerated conversion function. +func Convert_v1alpha1_ConfigMapResourceReference_To_operators_ConfigMapResourceReference(in *ConfigMapResourceReference, out *operators.ConfigMapResourceReference, s conversion.Scope) error { + return autoConvert_v1alpha1_ConfigMapResourceReference_To_operators_ConfigMapResourceReference(in, out, s) +} + +func autoConvert_operators_ConfigMapResourceReference_To_v1alpha1_ConfigMapResourceReference(in *operators.ConfigMapResourceReference, out *ConfigMapResourceReference, s conversion.Scope) error { + out.Name = in.Name + out.Namespace = in.Namespace + out.UID = types.UID(in.UID) + out.ResourceVersion = in.ResourceVersion + return nil +} + +// Convert_operators_ConfigMapResourceReference_To_v1alpha1_ConfigMapResourceReference is an autogenerated conversion function. +func Convert_operators_ConfigMapResourceReference_To_v1alpha1_ConfigMapResourceReference(in *operators.ConfigMapResourceReference, out *ConfigMapResourceReference, s conversion.Scope) error { + return autoConvert_operators_ConfigMapResourceReference_To_v1alpha1_ConfigMapResourceReference(in, out, s) +} + +func autoConvert_v1alpha1_CustomResourceDefinitions_To_operators_CustomResourceDefinitions(in *CustomResourceDefinitions, out *operators.CustomResourceDefinitions, s conversion.Scope) error { + out.Owned = *(*[]operators.CRDDescription)(unsafe.Pointer(&in.Owned)) + out.Required = *(*[]operators.CRDDescription)(unsafe.Pointer(&in.Required)) + return nil +} + +// Convert_v1alpha1_CustomResourceDefinitions_To_operators_CustomResourceDefinitions is an autogenerated conversion function. +func Convert_v1alpha1_CustomResourceDefinitions_To_operators_CustomResourceDefinitions(in *CustomResourceDefinitions, out *operators.CustomResourceDefinitions, s conversion.Scope) error { + return autoConvert_v1alpha1_CustomResourceDefinitions_To_operators_CustomResourceDefinitions(in, out, s) +} + +func autoConvert_operators_CustomResourceDefinitions_To_v1alpha1_CustomResourceDefinitions(in *operators.CustomResourceDefinitions, out *CustomResourceDefinitions, s conversion.Scope) error { + out.Owned = *(*[]CRDDescription)(unsafe.Pointer(&in.Owned)) + out.Required = *(*[]CRDDescription)(unsafe.Pointer(&in.Required)) + return nil +} + +// Convert_operators_CustomResourceDefinitions_To_v1alpha1_CustomResourceDefinitions is an autogenerated conversion function. +func Convert_operators_CustomResourceDefinitions_To_v1alpha1_CustomResourceDefinitions(in *operators.CustomResourceDefinitions, out *CustomResourceDefinitions, s conversion.Scope) error { + return autoConvert_operators_CustomResourceDefinitions_To_v1alpha1_CustomResourceDefinitions(in, out, s) +} + +func autoConvert_v1alpha1_DependentStatus_To_operators_DependentStatus(in *DependentStatus, out *operators.DependentStatus, s conversion.Scope) error { + out.Group = in.Group + out.Version = in.Version + out.Kind = in.Kind + out.Status = operators.StatusReason(in.Status) + out.UUID = in.UUID + out.Message = in.Message + return nil +} + +// Convert_v1alpha1_DependentStatus_To_operators_DependentStatus is an autogenerated conversion function. +func Convert_v1alpha1_DependentStatus_To_operators_DependentStatus(in *DependentStatus, out *operators.DependentStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_DependentStatus_To_operators_DependentStatus(in, out, s) +} + +func autoConvert_operators_DependentStatus_To_v1alpha1_DependentStatus(in *operators.DependentStatus, out *DependentStatus, s conversion.Scope) error { + out.Group = in.Group + out.Version = in.Version + out.Kind = in.Kind + out.Status = StatusReason(in.Status) + out.UUID = in.UUID + out.Message = in.Message + return nil +} + +// Convert_operators_DependentStatus_To_v1alpha1_DependentStatus is an autogenerated conversion function. +func Convert_operators_DependentStatus_To_v1alpha1_DependentStatus(in *operators.DependentStatus, out *DependentStatus, s conversion.Scope) error { + return autoConvert_operators_DependentStatus_To_v1alpha1_DependentStatus(in, out, s) +} + +func autoConvert_v1alpha1_Icon_To_operators_Icon(in *Icon, out *operators.Icon, s conversion.Scope) error { + out.Data = in.Data + out.MediaType = in.MediaType + return nil +} + +// Convert_v1alpha1_Icon_To_operators_Icon is an autogenerated conversion function. +func Convert_v1alpha1_Icon_To_operators_Icon(in *Icon, out *operators.Icon, s conversion.Scope) error { + return autoConvert_v1alpha1_Icon_To_operators_Icon(in, out, s) +} + +func autoConvert_operators_Icon_To_v1alpha1_Icon(in *operators.Icon, out *Icon, s conversion.Scope) error { + out.Data = in.Data + out.MediaType = in.MediaType + return nil +} + +// Convert_operators_Icon_To_v1alpha1_Icon is an autogenerated conversion function. +func Convert_operators_Icon_To_v1alpha1_Icon(in *operators.Icon, out *Icon, s conversion.Scope) error { + return autoConvert_operators_Icon_To_v1alpha1_Icon(in, out, s) +} + +func autoConvert_v1alpha1_InstallMode_To_operators_InstallMode(in *InstallMode, out *operators.InstallMode, s conversion.Scope) error { + out.Type = operators.InstallModeType(in.Type) + out.Supported = in.Supported + return nil +} + +// Convert_v1alpha1_InstallMode_To_operators_InstallMode is an autogenerated conversion function. +func Convert_v1alpha1_InstallMode_To_operators_InstallMode(in *InstallMode, out *operators.InstallMode, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallMode_To_operators_InstallMode(in, out, s) +} + +func autoConvert_operators_InstallMode_To_v1alpha1_InstallMode(in *operators.InstallMode, out *InstallMode, s conversion.Scope) error { + out.Type = InstallModeType(in.Type) + out.Supported = in.Supported + return nil +} + +// Convert_operators_InstallMode_To_v1alpha1_InstallMode is an autogenerated conversion function. +func Convert_operators_InstallMode_To_v1alpha1_InstallMode(in *operators.InstallMode, out *InstallMode, s conversion.Scope) error { + return autoConvert_operators_InstallMode_To_v1alpha1_InstallMode(in, out, s) +} + +func autoConvert_v1alpha1_InstallPlan_To_operators_InstallPlan(in *InstallPlan, out *operators.InstallPlan, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_InstallPlanSpec_To_operators_InstallPlanSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_InstallPlanStatus_To_operators_InstallPlanStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_InstallPlan_To_operators_InstallPlan is an autogenerated conversion function. +func Convert_v1alpha1_InstallPlan_To_operators_InstallPlan(in *InstallPlan, out *operators.InstallPlan, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallPlan_To_operators_InstallPlan(in, out, s) +} + +func autoConvert_operators_InstallPlan_To_v1alpha1_InstallPlan(in *operators.InstallPlan, out *InstallPlan, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_operators_InstallPlanSpec_To_v1alpha1_InstallPlanSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_operators_InstallPlanStatus_To_v1alpha1_InstallPlanStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_operators_InstallPlan_To_v1alpha1_InstallPlan is an autogenerated conversion function. +func Convert_operators_InstallPlan_To_v1alpha1_InstallPlan(in *operators.InstallPlan, out *InstallPlan, s conversion.Scope) error { + return autoConvert_operators_InstallPlan_To_v1alpha1_InstallPlan(in, out, s) +} + +func autoConvert_v1alpha1_InstallPlanCondition_To_operators_InstallPlanCondition(in *InstallPlanCondition, out *operators.InstallPlanCondition, s conversion.Scope) error { + out.Type = operators.InstallPlanConditionType(in.Type) + out.Status = corev1.ConditionStatus(in.Status) + out.LastUpdateTime = in.LastUpdateTime + out.LastTransitionTime = in.LastTransitionTime + out.Reason = operators.InstallPlanConditionReason(in.Reason) + out.Message = in.Message + return nil +} + +// Convert_v1alpha1_InstallPlanCondition_To_operators_InstallPlanCondition is an autogenerated conversion function. +func Convert_v1alpha1_InstallPlanCondition_To_operators_InstallPlanCondition(in *InstallPlanCondition, out *operators.InstallPlanCondition, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallPlanCondition_To_operators_InstallPlanCondition(in, out, s) +} + +func autoConvert_operators_InstallPlanCondition_To_v1alpha1_InstallPlanCondition(in *operators.InstallPlanCondition, out *InstallPlanCondition, s conversion.Scope) error { + out.Type = InstallPlanConditionType(in.Type) + out.Status = corev1.ConditionStatus(in.Status) + out.LastUpdateTime = in.LastUpdateTime + out.LastTransitionTime = in.LastTransitionTime + out.Reason = InstallPlanConditionReason(in.Reason) + out.Message = in.Message + return nil +} + +// Convert_operators_InstallPlanCondition_To_v1alpha1_InstallPlanCondition is an autogenerated conversion function. +func Convert_operators_InstallPlanCondition_To_v1alpha1_InstallPlanCondition(in *operators.InstallPlanCondition, out *InstallPlanCondition, s conversion.Scope) error { + return autoConvert_operators_InstallPlanCondition_To_v1alpha1_InstallPlanCondition(in, out, s) +} + +func autoConvert_v1alpha1_InstallPlanList_To_operators_InstallPlanList(in *InstallPlanList, out *operators.InstallPlanList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]operators.InstallPlan)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_InstallPlanList_To_operators_InstallPlanList is an autogenerated conversion function. +func Convert_v1alpha1_InstallPlanList_To_operators_InstallPlanList(in *InstallPlanList, out *operators.InstallPlanList, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallPlanList_To_operators_InstallPlanList(in, out, s) +} + +func autoConvert_operators_InstallPlanList_To_v1alpha1_InstallPlanList(in *operators.InstallPlanList, out *InstallPlanList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]InstallPlan)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_operators_InstallPlanList_To_v1alpha1_InstallPlanList is an autogenerated conversion function. +func Convert_operators_InstallPlanList_To_v1alpha1_InstallPlanList(in *operators.InstallPlanList, out *InstallPlanList, s conversion.Scope) error { + return autoConvert_operators_InstallPlanList_To_v1alpha1_InstallPlanList(in, out, s) +} + +func autoConvert_v1alpha1_InstallPlanReference_To_operators_InstallPlanReference(in *InstallPlanReference, out *operators.InstallPlanReference, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Kind = in.Kind + out.Name = in.Name + out.UID = types.UID(in.UID) + return nil +} + +// Convert_v1alpha1_InstallPlanReference_To_operators_InstallPlanReference is an autogenerated conversion function. +func Convert_v1alpha1_InstallPlanReference_To_operators_InstallPlanReference(in *InstallPlanReference, out *operators.InstallPlanReference, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallPlanReference_To_operators_InstallPlanReference(in, out, s) +} + +func autoConvert_operators_InstallPlanReference_To_v1alpha1_InstallPlanReference(in *operators.InstallPlanReference, out *InstallPlanReference, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Kind = in.Kind + out.Name = in.Name + out.UID = types.UID(in.UID) + return nil +} + +// Convert_operators_InstallPlanReference_To_v1alpha1_InstallPlanReference is an autogenerated conversion function. +func Convert_operators_InstallPlanReference_To_v1alpha1_InstallPlanReference(in *operators.InstallPlanReference, out *InstallPlanReference, s conversion.Scope) error { + return autoConvert_operators_InstallPlanReference_To_v1alpha1_InstallPlanReference(in, out, s) +} + +func autoConvert_v1alpha1_InstallPlanSpec_To_operators_InstallPlanSpec(in *InstallPlanSpec, out *operators.InstallPlanSpec, s conversion.Scope) error { + out.CatalogSource = in.CatalogSource + out.CatalogSourceNamespace = in.CatalogSourceNamespace + out.ClusterServiceVersionNames = *(*[]string)(unsafe.Pointer(&in.ClusterServiceVersionNames)) + out.Approval = operators.Approval(in.Approval) + out.Approved = in.Approved + return nil +} + +// Convert_v1alpha1_InstallPlanSpec_To_operators_InstallPlanSpec is an autogenerated conversion function. +func Convert_v1alpha1_InstallPlanSpec_To_operators_InstallPlanSpec(in *InstallPlanSpec, out *operators.InstallPlanSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallPlanSpec_To_operators_InstallPlanSpec(in, out, s) +} + +func autoConvert_operators_InstallPlanSpec_To_v1alpha1_InstallPlanSpec(in *operators.InstallPlanSpec, out *InstallPlanSpec, s conversion.Scope) error { + out.CatalogSource = in.CatalogSource + out.CatalogSourceNamespace = in.CatalogSourceNamespace + out.ClusterServiceVersionNames = *(*[]string)(unsafe.Pointer(&in.ClusterServiceVersionNames)) + out.Approval = Approval(in.Approval) + out.Approved = in.Approved + return nil +} + +// Convert_operators_InstallPlanSpec_To_v1alpha1_InstallPlanSpec is an autogenerated conversion function. +func Convert_operators_InstallPlanSpec_To_v1alpha1_InstallPlanSpec(in *operators.InstallPlanSpec, out *InstallPlanSpec, s conversion.Scope) error { + return autoConvert_operators_InstallPlanSpec_To_v1alpha1_InstallPlanSpec(in, out, s) +} + +func autoConvert_v1alpha1_InstallPlanStatus_To_operators_InstallPlanStatus(in *InstallPlanStatus, out *operators.InstallPlanStatus, s conversion.Scope) error { + out.Phase = operators.InstallPlanPhase(in.Phase) + out.Conditions = *(*[]operators.InstallPlanCondition)(unsafe.Pointer(&in.Conditions)) + out.CatalogSources = *(*[]string)(unsafe.Pointer(&in.CatalogSources)) + out.Plan = *(*[]*operators.Step)(unsafe.Pointer(&in.Plan)) + return nil +} + +// Convert_v1alpha1_InstallPlanStatus_To_operators_InstallPlanStatus is an autogenerated conversion function. +func Convert_v1alpha1_InstallPlanStatus_To_operators_InstallPlanStatus(in *InstallPlanStatus, out *operators.InstallPlanStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_InstallPlanStatus_To_operators_InstallPlanStatus(in, out, s) +} + +func autoConvert_operators_InstallPlanStatus_To_v1alpha1_InstallPlanStatus(in *operators.InstallPlanStatus, out *InstallPlanStatus, s conversion.Scope) error { + out.Phase = InstallPlanPhase(in.Phase) + out.Conditions = *(*[]InstallPlanCondition)(unsafe.Pointer(&in.Conditions)) + out.CatalogSources = *(*[]string)(unsafe.Pointer(&in.CatalogSources)) + out.Plan = *(*[]*Step)(unsafe.Pointer(&in.Plan)) + return nil +} + +// Convert_operators_InstallPlanStatus_To_v1alpha1_InstallPlanStatus is an autogenerated conversion function. +func Convert_operators_InstallPlanStatus_To_v1alpha1_InstallPlanStatus(in *operators.InstallPlanStatus, out *InstallPlanStatus, s conversion.Scope) error { + return autoConvert_operators_InstallPlanStatus_To_v1alpha1_InstallPlanStatus(in, out, s) +} + +func autoConvert_v1alpha1_Maintainer_To_operators_Maintainer(in *Maintainer, out *operators.Maintainer, s conversion.Scope) error { + out.Name = in.Name + out.Email = in.Email + return nil +} + +// Convert_v1alpha1_Maintainer_To_operators_Maintainer is an autogenerated conversion function. +func Convert_v1alpha1_Maintainer_To_operators_Maintainer(in *Maintainer, out *operators.Maintainer, s conversion.Scope) error { + return autoConvert_v1alpha1_Maintainer_To_operators_Maintainer(in, out, s) +} + +func autoConvert_operators_Maintainer_To_v1alpha1_Maintainer(in *operators.Maintainer, out *Maintainer, s conversion.Scope) error { + out.Name = in.Name + out.Email = in.Email + return nil +} + +// Convert_operators_Maintainer_To_v1alpha1_Maintainer is an autogenerated conversion function. +func Convert_operators_Maintainer_To_v1alpha1_Maintainer(in *operators.Maintainer, out *Maintainer, s conversion.Scope) error { + return autoConvert_operators_Maintainer_To_v1alpha1_Maintainer(in, out, s) +} + +func autoConvert_v1alpha1_NamedInstallStrategy_To_operators_NamedInstallStrategy(in *NamedInstallStrategy, out *operators.NamedInstallStrategy, s conversion.Scope) error { + out.StrategyName = in.StrategyName + out.StrategySpecRaw = *(*json.RawMessage)(unsafe.Pointer(&in.StrategySpecRaw)) + return nil +} + +// Convert_v1alpha1_NamedInstallStrategy_To_operators_NamedInstallStrategy is an autogenerated conversion function. +func Convert_v1alpha1_NamedInstallStrategy_To_operators_NamedInstallStrategy(in *NamedInstallStrategy, out *operators.NamedInstallStrategy, s conversion.Scope) error { + return autoConvert_v1alpha1_NamedInstallStrategy_To_operators_NamedInstallStrategy(in, out, s) +} + +func autoConvert_operators_NamedInstallStrategy_To_v1alpha1_NamedInstallStrategy(in *operators.NamedInstallStrategy, out *NamedInstallStrategy, s conversion.Scope) error { + out.StrategyName = in.StrategyName + out.StrategySpecRaw = *(*json.RawMessage)(unsafe.Pointer(&in.StrategySpecRaw)) + return nil +} + +// Convert_operators_NamedInstallStrategy_To_v1alpha1_NamedInstallStrategy is an autogenerated conversion function. +func Convert_operators_NamedInstallStrategy_To_v1alpha1_NamedInstallStrategy(in *operators.NamedInstallStrategy, out *NamedInstallStrategy, s conversion.Scope) error { + return autoConvert_operators_NamedInstallStrategy_To_v1alpha1_NamedInstallStrategy(in, out, s) +} + +func autoConvert_v1alpha1_RegistryServiceStatus_To_operators_RegistryServiceStatus(in *RegistryServiceStatus, out *operators.RegistryServiceStatus, s conversion.Scope) error { + out.Protocol = in.Protocol + out.ServiceName = in.ServiceName + out.ServiceNamespace = in.ServiceNamespace + out.Port = in.Port + out.CreatedAt = in.CreatedAt + return nil +} + +// Convert_v1alpha1_RegistryServiceStatus_To_operators_RegistryServiceStatus is an autogenerated conversion function. +func Convert_v1alpha1_RegistryServiceStatus_To_operators_RegistryServiceStatus(in *RegistryServiceStatus, out *operators.RegistryServiceStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_RegistryServiceStatus_To_operators_RegistryServiceStatus(in, out, s) +} + +func autoConvert_operators_RegistryServiceStatus_To_v1alpha1_RegistryServiceStatus(in *operators.RegistryServiceStatus, out *RegistryServiceStatus, s conversion.Scope) error { + out.Protocol = in.Protocol + out.ServiceName = in.ServiceName + out.ServiceNamespace = in.ServiceNamespace + out.Port = in.Port + out.CreatedAt = in.CreatedAt + return nil +} + +// Convert_operators_RegistryServiceStatus_To_v1alpha1_RegistryServiceStatus is an autogenerated conversion function. +func Convert_operators_RegistryServiceStatus_To_v1alpha1_RegistryServiceStatus(in *operators.RegistryServiceStatus, out *RegistryServiceStatus, s conversion.Scope) error { + return autoConvert_operators_RegistryServiceStatus_To_v1alpha1_RegistryServiceStatus(in, out, s) +} + +func autoConvert_v1alpha1_RequirementStatus_To_operators_RequirementStatus(in *RequirementStatus, out *operators.RequirementStatus, s conversion.Scope) error { + out.Group = in.Group + out.Version = in.Version + out.Kind = in.Kind + out.Name = in.Name + out.Status = operators.StatusReason(in.Status) + out.Message = in.Message + out.UUID = in.UUID + out.Dependents = *(*[]operators.DependentStatus)(unsafe.Pointer(&in.Dependents)) + return nil +} + +// Convert_v1alpha1_RequirementStatus_To_operators_RequirementStatus is an autogenerated conversion function. +func Convert_v1alpha1_RequirementStatus_To_operators_RequirementStatus(in *RequirementStatus, out *operators.RequirementStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_RequirementStatus_To_operators_RequirementStatus(in, out, s) +} + +func autoConvert_operators_RequirementStatus_To_v1alpha1_RequirementStatus(in *operators.RequirementStatus, out *RequirementStatus, s conversion.Scope) error { + out.Group = in.Group + out.Version = in.Version + out.Kind = in.Kind + out.Name = in.Name + out.Status = StatusReason(in.Status) + out.Message = in.Message + out.UUID = in.UUID + out.Dependents = *(*[]DependentStatus)(unsafe.Pointer(&in.Dependents)) + return nil +} + +// Convert_operators_RequirementStatus_To_v1alpha1_RequirementStatus is an autogenerated conversion function. +func Convert_operators_RequirementStatus_To_v1alpha1_RequirementStatus(in *operators.RequirementStatus, out *RequirementStatus, s conversion.Scope) error { + return autoConvert_operators_RequirementStatus_To_v1alpha1_RequirementStatus(in, out, s) +} + +func autoConvert_v1alpha1_SpecDescriptor_To_operators_SpecDescriptor(in *SpecDescriptor, out *operators.SpecDescriptor, s conversion.Scope) error { + out.Path = in.Path + out.DisplayName = in.DisplayName + out.Description = in.Description + out.XDescriptors = *(*[]string)(unsafe.Pointer(&in.XDescriptors)) + out.Value = (*json.RawMessage)(unsafe.Pointer(in.Value)) + return nil +} + +// Convert_v1alpha1_SpecDescriptor_To_operators_SpecDescriptor is an autogenerated conversion function. +func Convert_v1alpha1_SpecDescriptor_To_operators_SpecDescriptor(in *SpecDescriptor, out *operators.SpecDescriptor, s conversion.Scope) error { + return autoConvert_v1alpha1_SpecDescriptor_To_operators_SpecDescriptor(in, out, s) +} + +func autoConvert_operators_SpecDescriptor_To_v1alpha1_SpecDescriptor(in *operators.SpecDescriptor, out *SpecDescriptor, s conversion.Scope) error { + out.Path = in.Path + out.DisplayName = in.DisplayName + out.Description = in.Description + out.XDescriptors = *(*[]string)(unsafe.Pointer(&in.XDescriptors)) + out.Value = (*json.RawMessage)(unsafe.Pointer(in.Value)) + return nil +} + +// Convert_operators_SpecDescriptor_To_v1alpha1_SpecDescriptor is an autogenerated conversion function. +func Convert_operators_SpecDescriptor_To_v1alpha1_SpecDescriptor(in *operators.SpecDescriptor, out *SpecDescriptor, s conversion.Scope) error { + return autoConvert_operators_SpecDescriptor_To_v1alpha1_SpecDescriptor(in, out, s) +} + +func autoConvert_v1alpha1_StatusDescriptor_To_operators_StatusDescriptor(in *StatusDescriptor, out *operators.StatusDescriptor, s conversion.Scope) error { + out.Path = in.Path + out.DisplayName = in.DisplayName + out.Description = in.Description + out.XDescriptors = *(*[]string)(unsafe.Pointer(&in.XDescriptors)) + out.Value = (*json.RawMessage)(unsafe.Pointer(in.Value)) + return nil +} + +// Convert_v1alpha1_StatusDescriptor_To_operators_StatusDescriptor is an autogenerated conversion function. +func Convert_v1alpha1_StatusDescriptor_To_operators_StatusDescriptor(in *StatusDescriptor, out *operators.StatusDescriptor, s conversion.Scope) error { + return autoConvert_v1alpha1_StatusDescriptor_To_operators_StatusDescriptor(in, out, s) +} + +func autoConvert_operators_StatusDescriptor_To_v1alpha1_StatusDescriptor(in *operators.StatusDescriptor, out *StatusDescriptor, s conversion.Scope) error { + out.Path = in.Path + out.DisplayName = in.DisplayName + out.Description = in.Description + out.XDescriptors = *(*[]string)(unsafe.Pointer(&in.XDescriptors)) + out.Value = (*json.RawMessage)(unsafe.Pointer(in.Value)) + return nil +} + +// Convert_operators_StatusDescriptor_To_v1alpha1_StatusDescriptor is an autogenerated conversion function. +func Convert_operators_StatusDescriptor_To_v1alpha1_StatusDescriptor(in *operators.StatusDescriptor, out *StatusDescriptor, s conversion.Scope) error { + return autoConvert_operators_StatusDescriptor_To_v1alpha1_StatusDescriptor(in, out, s) +} + +func autoConvert_v1alpha1_Step_To_operators_Step(in *Step, out *operators.Step, s conversion.Scope) error { + out.Resolving = in.Resolving + if err := Convert_v1alpha1_StepResource_To_operators_StepResource(&in.Resource, &out.Resource, s); err != nil { + return err + } + out.Status = operators.StepStatus(in.Status) + return nil +} + +// Convert_v1alpha1_Step_To_operators_Step is an autogenerated conversion function. +func Convert_v1alpha1_Step_To_operators_Step(in *Step, out *operators.Step, s conversion.Scope) error { + return autoConvert_v1alpha1_Step_To_operators_Step(in, out, s) +} + +func autoConvert_operators_Step_To_v1alpha1_Step(in *operators.Step, out *Step, s conversion.Scope) error { + out.Resolving = in.Resolving + if err := Convert_operators_StepResource_To_v1alpha1_StepResource(&in.Resource, &out.Resource, s); err != nil { + return err + } + out.Status = StepStatus(in.Status) + return nil +} + +// Convert_operators_Step_To_v1alpha1_Step is an autogenerated conversion function. +func Convert_operators_Step_To_v1alpha1_Step(in *operators.Step, out *Step, s conversion.Scope) error { + return autoConvert_operators_Step_To_v1alpha1_Step(in, out, s) +} + +func autoConvert_v1alpha1_StepResource_To_operators_StepResource(in *StepResource, out *operators.StepResource, s conversion.Scope) error { + out.CatalogSource = in.CatalogSource + out.CatalogSourceNamespace = in.CatalogSourceNamespace + out.Group = in.Group + out.Version = in.Version + out.Kind = in.Kind + out.Name = in.Name + out.Manifest = in.Manifest + return nil +} + +// Convert_v1alpha1_StepResource_To_operators_StepResource is an autogenerated conversion function. +func Convert_v1alpha1_StepResource_To_operators_StepResource(in *StepResource, out *operators.StepResource, s conversion.Scope) error { + return autoConvert_v1alpha1_StepResource_To_operators_StepResource(in, out, s) +} + +func autoConvert_operators_StepResource_To_v1alpha1_StepResource(in *operators.StepResource, out *StepResource, s conversion.Scope) error { + out.CatalogSource = in.CatalogSource + out.CatalogSourceNamespace = in.CatalogSourceNamespace + out.Group = in.Group + out.Version = in.Version + out.Kind = in.Kind + out.Name = in.Name + out.Manifest = in.Manifest + return nil +} + +// Convert_operators_StepResource_To_v1alpha1_StepResource is an autogenerated conversion function. +func Convert_operators_StepResource_To_v1alpha1_StepResource(in *operators.StepResource, out *StepResource, s conversion.Scope) error { + return autoConvert_operators_StepResource_To_v1alpha1_StepResource(in, out, s) +} + +func autoConvert_v1alpha1_Subscription_To_operators_Subscription(in *Subscription, out *operators.Subscription, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Spec = (*operators.SubscriptionSpec)(unsafe.Pointer(in.Spec)) + if err := Convert_v1alpha1_SubscriptionStatus_To_operators_SubscriptionStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Subscription_To_operators_Subscription is an autogenerated conversion function. +func Convert_v1alpha1_Subscription_To_operators_Subscription(in *Subscription, out *operators.Subscription, s conversion.Scope) error { + return autoConvert_v1alpha1_Subscription_To_operators_Subscription(in, out, s) +} + +func autoConvert_operators_Subscription_To_v1alpha1_Subscription(in *operators.Subscription, out *Subscription, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Spec = (*SubscriptionSpec)(unsafe.Pointer(in.Spec)) + if err := Convert_operators_SubscriptionStatus_To_v1alpha1_SubscriptionStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_operators_Subscription_To_v1alpha1_Subscription is an autogenerated conversion function. +func Convert_operators_Subscription_To_v1alpha1_Subscription(in *operators.Subscription, out *Subscription, s conversion.Scope) error { + return autoConvert_operators_Subscription_To_v1alpha1_Subscription(in, out, s) +} + +func autoConvert_v1alpha1_SubscriptionCatalogHealth_To_operators_SubscriptionCatalogHealth(in *SubscriptionCatalogHealth, out *operators.SubscriptionCatalogHealth, s conversion.Scope) error { + out.CatalogSourceRef = (*corev1.ObjectReference)(unsafe.Pointer(in.CatalogSourceRef)) + out.LastUpdated = (*v1.Time)(unsafe.Pointer(in.LastUpdated)) + out.Healthy = in.Healthy + return nil +} + +// Convert_v1alpha1_SubscriptionCatalogHealth_To_operators_SubscriptionCatalogHealth is an autogenerated conversion function. +func Convert_v1alpha1_SubscriptionCatalogHealth_To_operators_SubscriptionCatalogHealth(in *SubscriptionCatalogHealth, out *operators.SubscriptionCatalogHealth, s conversion.Scope) error { + return autoConvert_v1alpha1_SubscriptionCatalogHealth_To_operators_SubscriptionCatalogHealth(in, out, s) +} + +func autoConvert_operators_SubscriptionCatalogHealth_To_v1alpha1_SubscriptionCatalogHealth(in *operators.SubscriptionCatalogHealth, out *SubscriptionCatalogHealth, s conversion.Scope) error { + out.CatalogSourceRef = (*corev1.ObjectReference)(unsafe.Pointer(in.CatalogSourceRef)) + out.LastUpdated = (*v1.Time)(unsafe.Pointer(in.LastUpdated)) + out.Healthy = in.Healthy + return nil +} + +// Convert_operators_SubscriptionCatalogHealth_To_v1alpha1_SubscriptionCatalogHealth is an autogenerated conversion function. +func Convert_operators_SubscriptionCatalogHealth_To_v1alpha1_SubscriptionCatalogHealth(in *operators.SubscriptionCatalogHealth, out *SubscriptionCatalogHealth, s conversion.Scope) error { + return autoConvert_operators_SubscriptionCatalogHealth_To_v1alpha1_SubscriptionCatalogHealth(in, out, s) +} + +func autoConvert_v1alpha1_SubscriptionCondition_To_operators_SubscriptionCondition(in *SubscriptionCondition, out *operators.SubscriptionCondition, s conversion.Scope) error { + out.Type = operators.SubscriptionConditionType(in.Type) + out.Status = corev1.ConditionStatus(in.Status) + out.Reason = in.Reason + out.Message = in.Message + out.LastHeartbeatTime = (*v1.Time)(unsafe.Pointer(in.LastHeartbeatTime)) + out.LastTransitionTime = (*v1.Time)(unsafe.Pointer(in.LastTransitionTime)) + return nil +} + +// Convert_v1alpha1_SubscriptionCondition_To_operators_SubscriptionCondition is an autogenerated conversion function. +func Convert_v1alpha1_SubscriptionCondition_To_operators_SubscriptionCondition(in *SubscriptionCondition, out *operators.SubscriptionCondition, s conversion.Scope) error { + return autoConvert_v1alpha1_SubscriptionCondition_To_operators_SubscriptionCondition(in, out, s) +} + +func autoConvert_operators_SubscriptionCondition_To_v1alpha1_SubscriptionCondition(in *operators.SubscriptionCondition, out *SubscriptionCondition, s conversion.Scope) error { + out.Type = SubscriptionConditionType(in.Type) + out.Status = corev1.ConditionStatus(in.Status) + out.Reason = in.Reason + out.Message = in.Message + out.LastHeartbeatTime = (*v1.Time)(unsafe.Pointer(in.LastHeartbeatTime)) + out.LastTransitionTime = (*v1.Time)(unsafe.Pointer(in.LastTransitionTime)) + return nil +} + +// Convert_operators_SubscriptionCondition_To_v1alpha1_SubscriptionCondition is an autogenerated conversion function. +func Convert_operators_SubscriptionCondition_To_v1alpha1_SubscriptionCondition(in *operators.SubscriptionCondition, out *SubscriptionCondition, s conversion.Scope) error { + return autoConvert_operators_SubscriptionCondition_To_v1alpha1_SubscriptionCondition(in, out, s) +} + +func autoConvert_v1alpha1_SubscriptionList_To_operators_SubscriptionList(in *SubscriptionList, out *operators.SubscriptionList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]operators.Subscription)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_SubscriptionList_To_operators_SubscriptionList is an autogenerated conversion function. +func Convert_v1alpha1_SubscriptionList_To_operators_SubscriptionList(in *SubscriptionList, out *operators.SubscriptionList, s conversion.Scope) error { + return autoConvert_v1alpha1_SubscriptionList_To_operators_SubscriptionList(in, out, s) +} + +func autoConvert_operators_SubscriptionList_To_v1alpha1_SubscriptionList(in *operators.SubscriptionList, out *SubscriptionList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Subscription)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_operators_SubscriptionList_To_v1alpha1_SubscriptionList is an autogenerated conversion function. +func Convert_operators_SubscriptionList_To_v1alpha1_SubscriptionList(in *operators.SubscriptionList, out *SubscriptionList, s conversion.Scope) error { + return autoConvert_operators_SubscriptionList_To_v1alpha1_SubscriptionList(in, out, s) +} + +func autoConvert_v1alpha1_SubscriptionSpec_To_operators_SubscriptionSpec(in *SubscriptionSpec, out *operators.SubscriptionSpec, s conversion.Scope) error { + out.CatalogSource = in.CatalogSource + out.CatalogSourceNamespace = in.CatalogSourceNamespace + out.Package = in.Package + out.Channel = in.Channel + out.StartingCSV = in.StartingCSV + out.InstallPlanApproval = operators.Approval(in.InstallPlanApproval) + return nil +} + +// Convert_v1alpha1_SubscriptionSpec_To_operators_SubscriptionSpec is an autogenerated conversion function. +func Convert_v1alpha1_SubscriptionSpec_To_operators_SubscriptionSpec(in *SubscriptionSpec, out *operators.SubscriptionSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_SubscriptionSpec_To_operators_SubscriptionSpec(in, out, s) +} + +func autoConvert_operators_SubscriptionSpec_To_v1alpha1_SubscriptionSpec(in *operators.SubscriptionSpec, out *SubscriptionSpec, s conversion.Scope) error { + out.CatalogSource = in.CatalogSource + out.CatalogSourceNamespace = in.CatalogSourceNamespace + out.Package = in.Package + out.Channel = in.Channel + out.StartingCSV = in.StartingCSV + out.InstallPlanApproval = Approval(in.InstallPlanApproval) + return nil +} + +// Convert_operators_SubscriptionSpec_To_v1alpha1_SubscriptionSpec is an autogenerated conversion function. +func Convert_operators_SubscriptionSpec_To_v1alpha1_SubscriptionSpec(in *operators.SubscriptionSpec, out *SubscriptionSpec, s conversion.Scope) error { + return autoConvert_operators_SubscriptionSpec_To_v1alpha1_SubscriptionSpec(in, out, s) +} + +func autoConvert_v1alpha1_SubscriptionStatus_To_operators_SubscriptionStatus(in *SubscriptionStatus, out *operators.SubscriptionStatus, s conversion.Scope) error { + out.CurrentCSV = in.CurrentCSV + out.InstalledCSV = in.InstalledCSV + out.Install = (*operators.InstallPlanReference)(unsafe.Pointer(in.Install)) + out.State = operators.SubscriptionState(in.State) + out.Reason = operators.ConditionReason(in.Reason) + out.InstallPlanRef = (*corev1.ObjectReference)(unsafe.Pointer(in.InstallPlanRef)) + out.CatalogHealth = *(*[]operators.SubscriptionCatalogHealth)(unsafe.Pointer(&in.CatalogHealth)) + out.Conditions = *(*[]operators.SubscriptionCondition)(unsafe.Pointer(&in.Conditions)) + out.LastUpdated = in.LastUpdated + return nil +} + +// Convert_v1alpha1_SubscriptionStatus_To_operators_SubscriptionStatus is an autogenerated conversion function. +func Convert_v1alpha1_SubscriptionStatus_To_operators_SubscriptionStatus(in *SubscriptionStatus, out *operators.SubscriptionStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_SubscriptionStatus_To_operators_SubscriptionStatus(in, out, s) +} + +func autoConvert_operators_SubscriptionStatus_To_v1alpha1_SubscriptionStatus(in *operators.SubscriptionStatus, out *SubscriptionStatus, s conversion.Scope) error { + out.CurrentCSV = in.CurrentCSV + out.InstalledCSV = in.InstalledCSV + out.Install = (*InstallPlanReference)(unsafe.Pointer(in.Install)) + out.State = SubscriptionState(in.State) + out.Reason = ConditionReason(in.Reason) + out.InstallPlanRef = (*corev1.ObjectReference)(unsafe.Pointer(in.InstallPlanRef)) + out.CatalogHealth = *(*[]SubscriptionCatalogHealth)(unsafe.Pointer(&in.CatalogHealth)) + out.Conditions = *(*[]SubscriptionCondition)(unsafe.Pointer(&in.Conditions)) + out.LastUpdated = in.LastUpdated + return nil +} + +// Convert_operators_SubscriptionStatus_To_v1alpha1_SubscriptionStatus is an autogenerated conversion function. +func Convert_operators_SubscriptionStatus_To_v1alpha1_SubscriptionStatus(in *operators.SubscriptionStatus, out *SubscriptionStatus, s conversion.Scope) error { + return autoConvert_operators_SubscriptionStatus_To_v1alpha1_SubscriptionStatus(in, out, s) +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..ad6546e79f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,1108 @@ +// +build !ignore_autogenerated + +/* +Copyright 2019 Red Hat, Inc. + +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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + json "encoding/json" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIResourceReference) DeepCopyInto(out *APIResourceReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceReference. +func (in *APIResourceReference) DeepCopy() *APIResourceReference { + if in == nil { + return nil + } + out := new(APIResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServiceDefinitions) DeepCopyInto(out *APIServiceDefinitions) { + *out = *in + if in.Owned != nil { + in, out := &in.Owned, &out.Owned + *out = make([]APIServiceDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Required != nil { + in, out := &in.Required, &out.Required + *out = make([]APIServiceDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceDefinitions. +func (in *APIServiceDefinitions) DeepCopy() *APIServiceDefinitions { + if in == nil { + return nil + } + out := new(APIServiceDefinitions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServiceDescription) DeepCopyInto(out *APIServiceDescription) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]APIResourceReference, len(*in)) + copy(*out, *in) + } + if in.StatusDescriptors != nil { + in, out := &in.StatusDescriptors, &out.StatusDescriptors + *out = make([]StatusDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SpecDescriptors != nil { + in, out := &in.SpecDescriptors, &out.SpecDescriptors + *out = make([]SpecDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ActionDescriptor != nil { + in, out := &in.ActionDescriptor, &out.ActionDescriptor + *out = make([]ActionDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceDescription. +func (in *APIServiceDescription) DeepCopy() *APIServiceDescription { + if in == nil { + return nil + } + out := new(APIServiceDescription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ActionDescriptor) DeepCopyInto(out *ActionDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(json.RawMessage) + if **in != nil { + in, out := *in, *out + *out = make([]byte, len(*in)) + copy(*out, *in) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ActionDescriptor. +func (in *ActionDescriptor) DeepCopy() *ActionDescriptor { + if in == nil { + return nil + } + out := new(ActionDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AppLink) DeepCopyInto(out *AppLink) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppLink. +func (in *AppLink) DeepCopy() *AppLink { + if in == nil { + return nil + } + out := new(AppLink) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CRDDescription) DeepCopyInto(out *CRDDescription) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]APIResourceReference, len(*in)) + copy(*out, *in) + } + if in.StatusDescriptors != nil { + in, out := &in.StatusDescriptors, &out.StatusDescriptors + *out = make([]StatusDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SpecDescriptors != nil { + in, out := &in.SpecDescriptors, &out.SpecDescriptors + *out = make([]SpecDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ActionDescriptor != nil { + in, out := &in.ActionDescriptor, &out.ActionDescriptor + *out = make([]ActionDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CRDDescription. +func (in *CRDDescription) DeepCopy() *CRDDescription { + if in == nil { + return nil + } + out := new(CRDDescription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSource) DeepCopyInto(out *CatalogSource) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSource. +func (in *CatalogSource) DeepCopy() *CatalogSource { + if in == nil { + return nil + } + out := new(CatalogSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CatalogSource) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSourceList) DeepCopyInto(out *CatalogSourceList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CatalogSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceList. +func (in *CatalogSourceList) DeepCopy() *CatalogSourceList { + if in == nil { + return nil + } + out := new(CatalogSourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CatalogSourceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSourceSpec) DeepCopyInto(out *CatalogSourceSpec) { + *out = *in + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]string, len(*in)) + copy(*out, *in) + } + out.Icon = in.Icon + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceSpec. +func (in *CatalogSourceSpec) DeepCopy() *CatalogSourceSpec { + if in == nil { + return nil + } + out := new(CatalogSourceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSourceStatus) DeepCopyInto(out *CatalogSourceStatus) { + *out = *in + if in.ConfigMapResource != nil { + in, out := &in.ConfigMapResource, &out.ConfigMapResource + *out = new(ConfigMapResourceReference) + **out = **in + } + if in.RegistryServiceStatus != nil { + in, out := &in.RegistryServiceStatus, &out.RegistryServiceStatus + *out = new(RegistryServiceStatus) + (*in).DeepCopyInto(*out) + } + in.LastSync.DeepCopyInto(&out.LastSync) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceStatus. +func (in *CatalogSourceStatus) DeepCopy() *CatalogSourceStatus { + if in == nil { + return nil + } + out := new(CatalogSourceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersion) DeepCopyInto(out *ClusterServiceVersion) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersion. +func (in *ClusterServiceVersion) DeepCopy() *ClusterServiceVersion { + if in == nil { + return nil + } + out := new(ClusterServiceVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterServiceVersion) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionCondition) DeepCopyInto(out *ClusterServiceVersionCondition) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionCondition. +func (in *ClusterServiceVersionCondition) DeepCopy() *ClusterServiceVersionCondition { + if in == nil { + return nil + } + out := new(ClusterServiceVersionCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionList) DeepCopyInto(out *ClusterServiceVersionList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterServiceVersion, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionList. +func (in *ClusterServiceVersionList) DeepCopy() *ClusterServiceVersionList { + if in == nil { + return nil + } + out := new(ClusterServiceVersionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterServiceVersionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionSpec) DeepCopyInto(out *ClusterServiceVersionSpec) { + *out = *in + in.InstallStrategy.DeepCopyInto(&out.InstallStrategy) + in.Version.DeepCopyInto(&out.Version) + in.CustomResourceDefinitions.DeepCopyInto(&out.CustomResourceDefinitions) + in.APIServiceDefinitions.DeepCopyInto(&out.APIServiceDefinitions) + if in.NativeAPIs != nil { + in, out := &in.NativeAPIs, &out.NativeAPIs + *out = make([]v1.GroupVersionKind, len(*in)) + copy(*out, *in) + } + if in.Keywords != nil { + in, out := &in.Keywords, &out.Keywords + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Maintainers != nil { + in, out := &in.Maintainers, &out.Maintainers + *out = make([]Maintainer, len(*in)) + copy(*out, *in) + } + out.Provider = in.Provider + if in.Links != nil { + in, out := &in.Links, &out.Links + *out = make([]AppLink, len(*in)) + copy(*out, *in) + } + if in.Icon != nil { + in, out := &in.Icon, &out.Icon + *out = make([]Icon, len(*in)) + copy(*out, *in) + } + if in.InstallModes != nil { + in, out := &in.InstallModes, &out.InstallModes + *out = make([]InstallMode, len(*in)) + copy(*out, *in) + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionSpec. +func (in *ClusterServiceVersionSpec) DeepCopy() *ClusterServiceVersionSpec { + if in == nil { + return nil + } + out := new(ClusterServiceVersionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionStatus) DeepCopyInto(out *ClusterServiceVersionStatus) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]ClusterServiceVersionCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RequirementStatus != nil { + in, out := &in.RequirementStatus, &out.RequirementStatus + *out = make([]RequirementStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.CertsLastUpdated.DeepCopyInto(&out.CertsLastUpdated) + in.CertsRotateAt.DeepCopyInto(&out.CertsRotateAt) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionStatus. +func (in *ClusterServiceVersionStatus) DeepCopy() *ClusterServiceVersionStatus { + if in == nil { + return nil + } + out := new(ClusterServiceVersionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConfigMapResourceReference) DeepCopyInto(out *ConfigMapResourceReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapResourceReference. +func (in *ConfigMapResourceReference) DeepCopy() *ConfigMapResourceReference { + if in == nil { + return nil + } + out := new(ConfigMapResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomResourceDefinitions) DeepCopyInto(out *CustomResourceDefinitions) { + *out = *in + if in.Owned != nil { + in, out := &in.Owned, &out.Owned + *out = make([]CRDDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Required != nil { + in, out := &in.Required, &out.Required + *out = make([]CRDDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceDefinitions. +func (in *CustomResourceDefinitions) DeepCopy() *CustomResourceDefinitions { + if in == nil { + return nil + } + out := new(CustomResourceDefinitions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DependentStatus) DeepCopyInto(out *DependentStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DependentStatus. +func (in *DependentStatus) DeepCopy() *DependentStatus { + if in == nil { + return nil + } + out := new(DependentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Icon) DeepCopyInto(out *Icon) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Icon. +func (in *Icon) DeepCopy() *Icon { + if in == nil { + return nil + } + out := new(Icon) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallMode) DeepCopyInto(out *InstallMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallMode. +func (in *InstallMode) DeepCopy() *InstallMode { + if in == nil { + return nil + } + out := new(InstallMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in InstallModeSet) DeepCopyInto(out *InstallModeSet) { + { + in := &in + *out = make(InstallModeSet, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallModeSet. +func (in InstallModeSet) DeepCopy() InstallModeSet { + if in == nil { + return nil + } + out := new(InstallModeSet) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlan) DeepCopyInto(out *InstallPlan) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlan. +func (in *InstallPlan) DeepCopy() *InstallPlan { + if in == nil { + return nil + } + out := new(InstallPlan) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallPlan) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanCondition) DeepCopyInto(out *InstallPlanCondition) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanCondition. +func (in *InstallPlanCondition) DeepCopy() *InstallPlanCondition { + if in == nil { + return nil + } + out := new(InstallPlanCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanList) DeepCopyInto(out *InstallPlanList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]InstallPlan, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanList. +func (in *InstallPlanList) DeepCopy() *InstallPlanList { + if in == nil { + return nil + } + out := new(InstallPlanList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallPlanList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanReference) DeepCopyInto(out *InstallPlanReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanReference. +func (in *InstallPlanReference) DeepCopy() *InstallPlanReference { + if in == nil { + return nil + } + out := new(InstallPlanReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanSpec) DeepCopyInto(out *InstallPlanSpec) { + *out = *in + if in.ClusterServiceVersionNames != nil { + in, out := &in.ClusterServiceVersionNames, &out.ClusterServiceVersionNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanSpec. +func (in *InstallPlanSpec) DeepCopy() *InstallPlanSpec { + if in == nil { + return nil + } + out := new(InstallPlanSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanStatus) DeepCopyInto(out *InstallPlanStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]InstallPlanCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CatalogSources != nil { + in, out := &in.CatalogSources, &out.CatalogSources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Plan != nil { + in, out := &in.Plan, &out.Plan + *out = make([]*Step, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Step) + **out = **in + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanStatus. +func (in *InstallPlanStatus) DeepCopy() *InstallPlanStatus { + if in == nil { + return nil + } + out := new(InstallPlanStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Maintainer) DeepCopyInto(out *Maintainer) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Maintainer. +func (in *Maintainer) DeepCopy() *Maintainer { + if in == nil { + return nil + } + out := new(Maintainer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NamedInstallStrategy) DeepCopyInto(out *NamedInstallStrategy) { + *out = *in + if in.StrategySpecRaw != nil { + in, out := &in.StrategySpecRaw, &out.StrategySpecRaw + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedInstallStrategy. +func (in *NamedInstallStrategy) DeepCopy() *NamedInstallStrategy { + if in == nil { + return nil + } + out := new(NamedInstallStrategy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegistryServiceStatus) DeepCopyInto(out *RegistryServiceStatus) { + *out = *in + in.CreatedAt.DeepCopyInto(&out.CreatedAt) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryServiceStatus. +func (in *RegistryServiceStatus) DeepCopy() *RegistryServiceStatus { + if in == nil { + return nil + } + out := new(RegistryServiceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RequirementStatus) DeepCopyInto(out *RequirementStatus) { + *out = *in + if in.Dependents != nil { + in, out := &in.Dependents, &out.Dependents + *out = make([]DependentStatus, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequirementStatus. +func (in *RequirementStatus) DeepCopy() *RequirementStatus { + if in == nil { + return nil + } + out := new(RequirementStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpecDescriptor) DeepCopyInto(out *SpecDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(json.RawMessage) + if **in != nil { + in, out := *in, *out + *out = make([]byte, len(*in)) + copy(*out, *in) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpecDescriptor. +func (in *SpecDescriptor) DeepCopy() *SpecDescriptor { + if in == nil { + return nil + } + out := new(SpecDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StatusDescriptor) DeepCopyInto(out *StatusDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(json.RawMessage) + if **in != nil { + in, out := *in, *out + *out = make([]byte, len(*in)) + copy(*out, *in) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatusDescriptor. +func (in *StatusDescriptor) DeepCopy() *StatusDescriptor { + if in == nil { + return nil + } + out := new(StatusDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Step) DeepCopyInto(out *Step) { + *out = *in + out.Resource = in.Resource + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Step. +func (in *Step) DeepCopy() *Step { + if in == nil { + return nil + } + out := new(Step) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StepResource) DeepCopyInto(out *StepResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StepResource. +func (in *StepResource) DeepCopy() *StepResource { + if in == nil { + return nil + } + out := new(StepResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Subscription) DeepCopyInto(out *Subscription) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Spec != nil { + in, out := &in.Spec, &out.Spec + *out = new(SubscriptionSpec) + **out = **in + } + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subscription. +func (in *Subscription) DeepCopy() *Subscription { + if in == nil { + return nil + } + out := new(Subscription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Subscription) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionCatalogHealth) DeepCopyInto(out *SubscriptionCatalogHealth) { + *out = *in + if in.CatalogSourceRef != nil { + in, out := &in.CatalogSourceRef, &out.CatalogSourceRef + *out = new(corev1.ObjectReference) + **out = **in + } + if in.LastUpdated != nil { + in, out := &in.LastUpdated, &out.LastUpdated + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionCatalogHealth. +func (in *SubscriptionCatalogHealth) DeepCopy() *SubscriptionCatalogHealth { + if in == nil { + return nil + } + out := new(SubscriptionCatalogHealth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionCondition) DeepCopyInto(out *SubscriptionCondition) { + *out = *in + if in.LastHeartbeatTime != nil { + in, out := &in.LastHeartbeatTime, &out.LastHeartbeatTime + *out = (*in).DeepCopy() + } + if in.LastTransitionTime != nil { + in, out := &in.LastTransitionTime, &out.LastTransitionTime + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionCondition. +func (in *SubscriptionCondition) DeepCopy() *SubscriptionCondition { + if in == nil { + return nil + } + out := new(SubscriptionCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionList) DeepCopyInto(out *SubscriptionList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Subscription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionList. +func (in *SubscriptionList) DeepCopy() *SubscriptionList { + if in == nil { + return nil + } + out := new(SubscriptionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SubscriptionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionSpec) DeepCopyInto(out *SubscriptionSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionSpec. +func (in *SubscriptionSpec) DeepCopy() *SubscriptionSpec { + if in == nil { + return nil + } + out := new(SubscriptionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionStatus) DeepCopyInto(out *SubscriptionStatus) { + *out = *in + if in.Install != nil { + in, out := &in.Install, &out.Install + *out = new(InstallPlanReference) + **out = **in + } + if in.InstallPlanRef != nil { + in, out := &in.InstallPlanRef, &out.InstallPlanRef + *out = new(corev1.ObjectReference) + **out = **in + } + if in.CatalogHealth != nil { + in, out := &in.CatalogHealth, &out.CatalogHealth + *out = make([]SubscriptionCatalogHealth, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]SubscriptionCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.LastUpdated.DeepCopyInto(&out.LastUpdated) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionStatus. +func (in *SubscriptionStatus) DeepCopy() *SubscriptionStatus { + if in == nil { + return nil + } + out := new(SubscriptionStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/zz_generated.deepcopy.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/zz_generated.deepcopy.go new file mode 100644 index 0000000000..04342b256a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/zz_generated.deepcopy.go @@ -0,0 +1,1218 @@ +// +build !ignore_autogenerated + +/* +Copyright 2019 Red Hat, Inc. + +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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package operators + +import ( + json "encoding/json" + + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIResourceReference) DeepCopyInto(out *APIResourceReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceReference. +func (in *APIResourceReference) DeepCopy() *APIResourceReference { + if in == nil { + return nil + } + out := new(APIResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServiceDefinitions) DeepCopyInto(out *APIServiceDefinitions) { + *out = *in + if in.Owned != nil { + in, out := &in.Owned, &out.Owned + *out = make([]APIServiceDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Required != nil { + in, out := &in.Required, &out.Required + *out = make([]APIServiceDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceDefinitions. +func (in *APIServiceDefinitions) DeepCopy() *APIServiceDefinitions { + if in == nil { + return nil + } + out := new(APIServiceDefinitions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServiceDescription) DeepCopyInto(out *APIServiceDescription) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]APIResourceReference, len(*in)) + copy(*out, *in) + } + if in.StatusDescriptors != nil { + in, out := &in.StatusDescriptors, &out.StatusDescriptors + *out = make([]StatusDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SpecDescriptors != nil { + in, out := &in.SpecDescriptors, &out.SpecDescriptors + *out = make([]SpecDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ActionDescriptor != nil { + in, out := &in.ActionDescriptor, &out.ActionDescriptor + *out = make([]ActionDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceDescription. +func (in *APIServiceDescription) DeepCopy() *APIServiceDescription { + if in == nil { + return nil + } + out := new(APIServiceDescription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ActionDescriptor) DeepCopyInto(out *ActionDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(json.RawMessage) + if **in != nil { + in, out := *in, *out + *out = make([]byte, len(*in)) + copy(*out, *in) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ActionDescriptor. +func (in *ActionDescriptor) DeepCopy() *ActionDescriptor { + if in == nil { + return nil + } + out := new(ActionDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AppLink) DeepCopyInto(out *AppLink) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppLink. +func (in *AppLink) DeepCopy() *AppLink { + if in == nil { + return nil + } + out := new(AppLink) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CRDDescription) DeepCopyInto(out *CRDDescription) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]APIResourceReference, len(*in)) + copy(*out, *in) + } + if in.StatusDescriptors != nil { + in, out := &in.StatusDescriptors, &out.StatusDescriptors + *out = make([]StatusDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SpecDescriptors != nil { + in, out := &in.SpecDescriptors, &out.SpecDescriptors + *out = make([]SpecDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ActionDescriptor != nil { + in, out := &in.ActionDescriptor, &out.ActionDescriptor + *out = make([]ActionDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CRDDescription. +func (in *CRDDescription) DeepCopy() *CRDDescription { + if in == nil { + return nil + } + out := new(CRDDescription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSource) DeepCopyInto(out *CatalogSource) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSource. +func (in *CatalogSource) DeepCopy() *CatalogSource { + if in == nil { + return nil + } + out := new(CatalogSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CatalogSource) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSourceList) DeepCopyInto(out *CatalogSourceList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CatalogSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceList. +func (in *CatalogSourceList) DeepCopy() *CatalogSourceList { + if in == nil { + return nil + } + out := new(CatalogSourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CatalogSourceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSourceSpec) DeepCopyInto(out *CatalogSourceSpec) { + *out = *in + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]string, len(*in)) + copy(*out, *in) + } + out.Icon = in.Icon + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceSpec. +func (in *CatalogSourceSpec) DeepCopy() *CatalogSourceSpec { + if in == nil { + return nil + } + out := new(CatalogSourceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSourceStatus) DeepCopyInto(out *CatalogSourceStatus) { + *out = *in + if in.ConfigMapResource != nil { + in, out := &in.ConfigMapResource, &out.ConfigMapResource + *out = new(ConfigMapResourceReference) + **out = **in + } + if in.RegistryServiceStatus != nil { + in, out := &in.RegistryServiceStatus, &out.RegistryServiceStatus + *out = new(RegistryServiceStatus) + (*in).DeepCopyInto(*out) + } + in.LastSync.DeepCopyInto(&out.LastSync) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceStatus. +func (in *CatalogSourceStatus) DeepCopy() *CatalogSourceStatus { + if in == nil { + return nil + } + out := new(CatalogSourceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersion) DeepCopyInto(out *ClusterServiceVersion) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersion. +func (in *ClusterServiceVersion) DeepCopy() *ClusterServiceVersion { + if in == nil { + return nil + } + out := new(ClusterServiceVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterServiceVersion) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionCondition) DeepCopyInto(out *ClusterServiceVersionCondition) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionCondition. +func (in *ClusterServiceVersionCondition) DeepCopy() *ClusterServiceVersionCondition { + if in == nil { + return nil + } + out := new(ClusterServiceVersionCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionList) DeepCopyInto(out *ClusterServiceVersionList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterServiceVersion, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionList. +func (in *ClusterServiceVersionList) DeepCopy() *ClusterServiceVersionList { + if in == nil { + return nil + } + out := new(ClusterServiceVersionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterServiceVersionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionSpec) DeepCopyInto(out *ClusterServiceVersionSpec) { + *out = *in + in.InstallStrategy.DeepCopyInto(&out.InstallStrategy) + in.Version.DeepCopyInto(&out.Version) + in.CustomResourceDefinitions.DeepCopyInto(&out.CustomResourceDefinitions) + in.APIServiceDefinitions.DeepCopyInto(&out.APIServiceDefinitions) + if in.NativeAPIs != nil { + in, out := &in.NativeAPIs, &out.NativeAPIs + *out = make([]v1.GroupVersionKind, len(*in)) + copy(*out, *in) + } + if in.Keywords != nil { + in, out := &in.Keywords, &out.Keywords + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Maintainers != nil { + in, out := &in.Maintainers, &out.Maintainers + *out = make([]Maintainer, len(*in)) + copy(*out, *in) + } + out.Provider = in.Provider + if in.Links != nil { + in, out := &in.Links, &out.Links + *out = make([]AppLink, len(*in)) + copy(*out, *in) + } + if in.Icon != nil { + in, out := &in.Icon, &out.Icon + *out = make([]Icon, len(*in)) + copy(*out, *in) + } + if in.InstallModes != nil { + in, out := &in.InstallModes, &out.InstallModes + *out = make([]InstallMode, len(*in)) + copy(*out, *in) + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionSpec. +func (in *ClusterServiceVersionSpec) DeepCopy() *ClusterServiceVersionSpec { + if in == nil { + return nil + } + out := new(ClusterServiceVersionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionStatus) DeepCopyInto(out *ClusterServiceVersionStatus) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]ClusterServiceVersionCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RequirementStatus != nil { + in, out := &in.RequirementStatus, &out.RequirementStatus + *out = make([]RequirementStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.CertsLastUpdated.DeepCopyInto(&out.CertsLastUpdated) + in.CertsRotateAt.DeepCopyInto(&out.CertsRotateAt) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionStatus. +func (in *ClusterServiceVersionStatus) DeepCopy() *ClusterServiceVersionStatus { + if in == nil { + return nil + } + out := new(ClusterServiceVersionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConfigMapResourceReference) DeepCopyInto(out *ConfigMapResourceReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapResourceReference. +func (in *ConfigMapResourceReference) DeepCopy() *ConfigMapResourceReference { + if in == nil { + return nil + } + out := new(ConfigMapResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomResourceDefinitions) DeepCopyInto(out *CustomResourceDefinitions) { + *out = *in + if in.Owned != nil { + in, out := &in.Owned, &out.Owned + *out = make([]CRDDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Required != nil { + in, out := &in.Required, &out.Required + *out = make([]CRDDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceDefinitions. +func (in *CustomResourceDefinitions) DeepCopy() *CustomResourceDefinitions { + if in == nil { + return nil + } + out := new(CustomResourceDefinitions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DependentStatus) DeepCopyInto(out *DependentStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DependentStatus. +func (in *DependentStatus) DeepCopy() *DependentStatus { + if in == nil { + return nil + } + out := new(DependentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Icon) DeepCopyInto(out *Icon) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Icon. +func (in *Icon) DeepCopy() *Icon { + if in == nil { + return nil + } + out := new(Icon) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallMode) DeepCopyInto(out *InstallMode) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallMode. +func (in *InstallMode) DeepCopy() *InstallMode { + if in == nil { + return nil + } + out := new(InstallMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in InstallModeSet) DeepCopyInto(out *InstallModeSet) { + { + in := &in + *out = make(InstallModeSet, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallModeSet. +func (in InstallModeSet) DeepCopy() InstallModeSet { + if in == nil { + return nil + } + out := new(InstallModeSet) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlan) DeepCopyInto(out *InstallPlan) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlan. +func (in *InstallPlan) DeepCopy() *InstallPlan { + if in == nil { + return nil + } + out := new(InstallPlan) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallPlan) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanCondition) DeepCopyInto(out *InstallPlanCondition) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanCondition. +func (in *InstallPlanCondition) DeepCopy() *InstallPlanCondition { + if in == nil { + return nil + } + out := new(InstallPlanCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanList) DeepCopyInto(out *InstallPlanList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]InstallPlan, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanList. +func (in *InstallPlanList) DeepCopy() *InstallPlanList { + if in == nil { + return nil + } + out := new(InstallPlanList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallPlanList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanReference) DeepCopyInto(out *InstallPlanReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanReference. +func (in *InstallPlanReference) DeepCopy() *InstallPlanReference { + if in == nil { + return nil + } + out := new(InstallPlanReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanSpec) DeepCopyInto(out *InstallPlanSpec) { + *out = *in + if in.ClusterServiceVersionNames != nil { + in, out := &in.ClusterServiceVersionNames, &out.ClusterServiceVersionNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanSpec. +func (in *InstallPlanSpec) DeepCopy() *InstallPlanSpec { + if in == nil { + return nil + } + out := new(InstallPlanSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanStatus) DeepCopyInto(out *InstallPlanStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]InstallPlanCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CatalogSources != nil { + in, out := &in.CatalogSources, &out.CatalogSources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Plan != nil { + in, out := &in.Plan, &out.Plan + *out = make([]*Step, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Step) + **out = **in + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanStatus. +func (in *InstallPlanStatus) DeepCopy() *InstallPlanStatus { + if in == nil { + return nil + } + out := new(InstallPlanStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Maintainer) DeepCopyInto(out *Maintainer) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Maintainer. +func (in *Maintainer) DeepCopy() *Maintainer { + if in == nil { + return nil + } + out := new(Maintainer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NamedInstallStrategy) DeepCopyInto(out *NamedInstallStrategy) { + *out = *in + if in.StrategySpecRaw != nil { + in, out := &in.StrategySpecRaw, &out.StrategySpecRaw + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedInstallStrategy. +func (in *NamedInstallStrategy) DeepCopy() *NamedInstallStrategy { + if in == nil { + return nil + } + out := new(NamedInstallStrategy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorGroup) DeepCopyInto(out *OperatorGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorGroup. +func (in *OperatorGroup) DeepCopy() *OperatorGroup { + if in == nil { + return nil + } + out := new(OperatorGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OperatorGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorGroupList) DeepCopyInto(out *OperatorGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OperatorGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorGroupList. +func (in *OperatorGroupList) DeepCopy() *OperatorGroupList { + if in == nil { + return nil + } + out := new(OperatorGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OperatorGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorGroupSpec) DeepCopyInto(out *OperatorGroupSpec) { + *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.TargetNamespaces != nil { + in, out := &in.TargetNamespaces, &out.TargetNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + in.ServiceAccount.DeepCopyInto(&out.ServiceAccount) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorGroupSpec. +func (in *OperatorGroupSpec) DeepCopy() *OperatorGroupSpec { + if in == nil { + return nil + } + out := new(OperatorGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorGroupStatus) DeepCopyInto(out *OperatorGroupStatus) { + *out = *in + if in.Namespaces != nil { + in, out := &in.Namespaces, &out.Namespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + in.LastUpdated.DeepCopyInto(&out.LastUpdated) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorGroupStatus. +func (in *OperatorGroupStatus) DeepCopy() *OperatorGroupStatus { + if in == nil { + return nil + } + out := new(OperatorGroupStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegistryServiceStatus) DeepCopyInto(out *RegistryServiceStatus) { + *out = *in + in.CreatedAt.DeepCopyInto(&out.CreatedAt) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryServiceStatus. +func (in *RegistryServiceStatus) DeepCopy() *RegistryServiceStatus { + if in == nil { + return nil + } + out := new(RegistryServiceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RequirementStatus) DeepCopyInto(out *RequirementStatus) { + *out = *in + if in.Dependents != nil { + in, out := &in.Dependents, &out.Dependents + *out = make([]DependentStatus, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequirementStatus. +func (in *RequirementStatus) DeepCopy() *RequirementStatus { + if in == nil { + return nil + } + out := new(RequirementStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpecDescriptor) DeepCopyInto(out *SpecDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(json.RawMessage) + if **in != nil { + in, out := *in, *out + *out = make([]byte, len(*in)) + copy(*out, *in) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpecDescriptor. +func (in *SpecDescriptor) DeepCopy() *SpecDescriptor { + if in == nil { + return nil + } + out := new(SpecDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StatusDescriptor) DeepCopyInto(out *StatusDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(json.RawMessage) + if **in != nil { + in, out := *in, *out + *out = make([]byte, len(*in)) + copy(*out, *in) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatusDescriptor. +func (in *StatusDescriptor) DeepCopy() *StatusDescriptor { + if in == nil { + return nil + } + out := new(StatusDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Step) DeepCopyInto(out *Step) { + *out = *in + out.Resource = in.Resource + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Step. +func (in *Step) DeepCopy() *Step { + if in == nil { + return nil + } + out := new(Step) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StepResource) DeepCopyInto(out *StepResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StepResource. +func (in *StepResource) DeepCopy() *StepResource { + if in == nil { + return nil + } + out := new(StepResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Subscription) DeepCopyInto(out *Subscription) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Spec != nil { + in, out := &in.Spec, &out.Spec + *out = new(SubscriptionSpec) + **out = **in + } + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subscription. +func (in *Subscription) DeepCopy() *Subscription { + if in == nil { + return nil + } + out := new(Subscription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Subscription) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionCatalogHealth) DeepCopyInto(out *SubscriptionCatalogHealth) { + *out = *in + if in.CatalogSourceRef != nil { + in, out := &in.CatalogSourceRef, &out.CatalogSourceRef + *out = new(corev1.ObjectReference) + **out = **in + } + if in.LastUpdated != nil { + in, out := &in.LastUpdated, &out.LastUpdated + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionCatalogHealth. +func (in *SubscriptionCatalogHealth) DeepCopy() *SubscriptionCatalogHealth { + if in == nil { + return nil + } + out := new(SubscriptionCatalogHealth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionCondition) DeepCopyInto(out *SubscriptionCondition) { + *out = *in + if in.LastHeartbeatTime != nil { + in, out := &in.LastHeartbeatTime, &out.LastHeartbeatTime + *out = (*in).DeepCopy() + } + if in.LastTransitionTime != nil { + in, out := &in.LastTransitionTime, &out.LastTransitionTime + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionCondition. +func (in *SubscriptionCondition) DeepCopy() *SubscriptionCondition { + if in == nil { + return nil + } + out := new(SubscriptionCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionList) DeepCopyInto(out *SubscriptionList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Subscription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionList. +func (in *SubscriptionList) DeepCopy() *SubscriptionList { + if in == nil { + return nil + } + out := new(SubscriptionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SubscriptionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionSpec) DeepCopyInto(out *SubscriptionSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionSpec. +func (in *SubscriptionSpec) DeepCopy() *SubscriptionSpec { + if in == nil { + return nil + } + out := new(SubscriptionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionStatus) DeepCopyInto(out *SubscriptionStatus) { + *out = *in + if in.Install != nil { + in, out := &in.Install, &out.Install + *out = new(InstallPlanReference) + **out = **in + } + if in.InstallPlanRef != nil { + in, out := &in.InstallPlanRef, &out.InstallPlanRef + *out = new(corev1.ObjectReference) + **out = **in + } + if in.CatalogHealth != nil { + in, out := &in.CatalogHealth, &out.CatalogHealth + *out = make([]SubscriptionCatalogHealth, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]SubscriptionCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.LastUpdated.DeepCopyInto(&out.LastUpdated) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionStatus. +func (in *SubscriptionStatus) DeepCopy() *SubscriptionStatus { + if in == nil { + return nil + } + out := new(SubscriptionStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/version/version.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/version/version.go new file mode 100644 index 0000000000..51e1fac659 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/version/version.go @@ -0,0 +1,66 @@ +package version + +import ( + "encoding/json" + + "github.com/blang/semver" +) + +// +k8s:openapi-gen=true +// OperatorVersion is a wrapper around semver.Version which supports correct +// marshaling to YAML and JSON. +type OperatorVersion struct { + semver.Version +} + +// DeepCopyInto creates a deep-copy of the Version value. +func (v *OperatorVersion) DeepCopyInto(out *OperatorVersion) { + out.Major = v.Major + out.Minor = v.Minor + out.Patch = v.Patch + + if v.Pre != nil { + pre := make([]semver.PRVersion, len(v.Pre)) + copy(pre, v.Pre) + out.Pre = pre + } + + if v.Build != nil { + build := make([]string, len(v.Build)) + copy(build, v.Build) + out.Build = build + } +} + +// MarshalJSON implements the encoding/json.Marshaler interface. +func (v OperatorVersion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.String()) +} + +// UnmarshalJSON implements the encoding/json.Unmarshaler interface. +func (v *OperatorVersion) UnmarshalJSON(data []byte) (err error) { + var versionString string + + if err = json.Unmarshal(data, &versionString); err != nil { + return + } + + version := semver.Version{} + version, err = semver.ParseTolerant(versionString) + if err != nil { + return err + } + v.Version = version + return +} + +// OpenAPISchemaType is used by the kube-openapi generator when constructing +// the OpenAPI spec of this type. +// +// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators +func (_ OperatorVersion) OpenAPISchemaType() []string { return []string{"string"} } + +// OpenAPISchemaFormat is used by the kube-openapi generator when constructing +// the OpenAPI spec of this type. +// "semver" is not a standard openapi format but tooling may use the value regardless +func (_ OperatorVersion) OpenAPISchemaFormat() string { return "semver" } diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/version/version_test.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/version/version_test.go new file mode 100644 index 0000000000..e6c14f7b48 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/version/version_test.go @@ -0,0 +1,77 @@ +package version + +import ( + "encoding/json" + "testing" + + "github.com/blang/semver" + "github.com/stretchr/testify/require" +) + +func TestOperatorVersionMarshal(t *testing.T) { + tests := []struct { + name string + in OperatorVersion + out []byte + err error + }{ + { + name: "MMP", + in: OperatorVersion{semver.MustParse("1.2.3")}, + out: []byte(`"1.2.3"`), + }, + { + name: "empty", + in: OperatorVersion{semver.Version{}}, + out: []byte(`"0.0.0"`), + }, + { + name: "with-timestamp", + in: OperatorVersion{semver.MustParse("1.2.3-1556715351")}, + out: []byte(`"1.2.3-1556715351"`), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + m, err := tt.in.MarshalJSON() + require.Equal(t, tt.out, m, string(m)) + require.Equal(t, tt.err, err) + }) + } +} + +func TestOperatorVersionUnmarshal(t *testing.T) { + type TestStruct struct { + Version OperatorVersion `json:"v"` + } + tests := []struct { + name string + in []byte + out TestStruct + err error + }{ + { + name: "MMP", + in: []byte(`{"v": "1.2.3"}`), + out: TestStruct{Version: OperatorVersion{semver.MustParse("1.2.3")}}, + }, + { + name: "empty", + in: []byte(`{"v": "0.0.0"}`), + out: TestStruct{Version: OperatorVersion{semver.Version{Major: 0, Minor: 0, Patch: 0}}}, + }, + { + name: "with-timestamp", + in: []byte(`{"v": "1.2.3-1556715351"}`), + out: TestStruct{OperatorVersion{semver.MustParse("1.2.3-1556715351")}}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + s := TestStruct{} + err := json.Unmarshal(tt.in, &s) + require.Equal(t, tt.out, s) + require.Equal(t, tt.err, err) + }) + } +}