From 7c2688f9f4ad0811f58d2f4447c606b6ee5532ec Mon Sep 17 00:00:00 2001 From: Andrew Block Date: Mon, 16 Dec 2019 10:24:50 -0600 Subject: [PATCH] WIP: Corrected multiple issues found during testing (#114) * Corrected multiple issues found during testing * Added instructions around customizing images * Corrected image version --- README.md | 20 +++++++++++++++++-- docs/storage.md | 2 +- .../redhatcop/v1alpha1/quayecosystem_types.go | 2 +- .../v1alpha1/zz_generated.openapi.go | 2 +- .../quayecosystem/provisioning/provision.go | 6 +++--- 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3abcd9c2c..2bbe6aabf 100644 --- a/README.md +++ b/README.md @@ -446,6 +446,22 @@ Each of the following components expose a set of similar properties that can be As referenced in prior sections, an Image Pull Secret can specify the name of the secret containing credentials to an image from a protected registry using the property `imagePullSecret`. +### Image + +There may be a desire to make use of an alternate image or source location for each of the components in the Quay ecosystem. The most common use case is to to make use of an image registry that contains all of the needed images instead of being sourced from the public internet. Each component has a property called `image` where the location of the related image can be referenced from. + +The following is an example of how a customized image location can be specified: + +``` +apiVersion: redhatcop.redhat.io/v1alpha1 +kind: QuayEcosystem +metadata: + name: example-quayecosystem +spec: + quay: + image: myregistry.example.com/quay/quay:v3.1.0 +``` + ### Compute Resources [Compute Resources](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#resource-requests-and-limits-of-pod-and-container) such as memory and CPU can be specified in the same form as any other value in a `PodTemplate`. CPU and Memory values for _Requests_ and _Limits_ can be specified under a property called `resources`. @@ -510,7 +526,7 @@ spec: quay: imagePullSecretName: redhat-pull-secret nodeSelector: - node-role.kubernetes.io/infra=true + node-role.kubernetes.io/infra: true ``` ### Deployment Strategy @@ -597,4 +613,4 @@ image: quay.io/redhat/quay:vX.X.X Once saved, the operator will automatically apply the upgrade. -_Note_: If you used a different name than `QuayEcosystem` for the custom resource to deploy your Quay ecosystem, you will have to replace the name to fit the proper value \ No newline at end of file +_Note_: If you used a different name than `QuayEcosystem` for the custom resource to deploy your Quay ecosystem, you will have to replace the name to fit the proper value diff --git a/docs/storage.md b/docs/storage.md index 69f3d279c..f6b5242df 100644 --- a/docs/storage.md +++ b/docs/storage.md @@ -105,7 +105,7 @@ spec: quay: imagePullSecretName: redhat-pull-secret registryStorage: - persistentVolumeAccessMode: + persistentVolumeAccessModes: - ReadWriteOnce persistentVolumeSize: 10Gi ``` diff --git a/pkg/apis/redhatcop/v1alpha1/quayecosystem_types.go b/pkg/apis/redhatcop/v1alpha1/quayecosystem_types.go index 7cef657a2..45a53a4ff 100644 --- a/pkg/apis/redhatcop/v1alpha1/quayecosystem_types.go +++ b/pkg/apis/redhatcop/v1alpha1/quayecosystem_types.go @@ -240,7 +240,7 @@ type RegistryBackendSource struct { // RegistryStorage defines the configurations to support persistent storage // +k8s:openapi-gen=true type RegistryStorage struct { - // +listType=atomic + // +listType=set PersistentVolumeAccessModes []corev1.PersistentVolumeAccessMode `json:"persistentVolumeAccessModes,omitempty,name=persistentVolumeAccessModes"` PersistentVolumeSize string `json:"persistentVolumeSize,omitempty,name=volumeSize"` PersistentVolumeStorageClassName string `json:"persistentVolumeStorageClassName,omitempty,name=storageClassName"` diff --git a/pkg/apis/redhatcop/v1alpha1/zz_generated.openapi.go b/pkg/apis/redhatcop/v1alpha1/zz_generated.openapi.go index 234556927..84b971d67 100644 --- a/pkg/apis/redhatcop/v1alpha1/zz_generated.openapi.go +++ b/pkg/apis/redhatcop/v1alpha1/zz_generated.openapi.go @@ -1242,7 +1242,7 @@ func schema_pkg_apis_redhatcop_v1alpha1_RegistryStorage(ref common.ReferenceCall "persistentVolumeAccessModes": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ - "x-kubernetes-list-type": "atomic", + "x-kubernetes-list-type": "set", }, }, SchemaProps: spec.SchemaProps{ diff --git a/pkg/controller/quayecosystem/provisioning/provision.go b/pkg/controller/quayecosystem/provisioning/provision.go index b4444cf70..f638491b6 100644 --- a/pkg/controller/quayecosystem/provisioning/provision.go +++ b/pkg/controller/quayecosystem/provisioning/provision.go @@ -349,7 +349,7 @@ func (r *ReconcileQuayEcosystemConfiguration) coreClairResourceDeployment(metaOb } // Database (PostgreSQL/MySQL) - if utils.IsZeroOfUnderlyingType(r.quayConfiguration.QuayEcosystem.Spec.Quay.Database.Server) { + if utils.IsZeroOfUnderlyingType(r.quayConfiguration.QuayEcosystem.Spec.Clair.Database.Server) { createClairDatabaseResult, err := r.createClairDatabase(metaObject) @@ -475,7 +475,7 @@ func (r *ReconcileQuayEcosystemConfiguration) configurePostgreSQL(meta metav1.Ob podName = postgresqlPodsItems[0].Name - success, stdout, stderr := k8sutils.ExecIntoPod(r.k8sclient, podName, fmt.Sprintf("echo \"SELECT * FROM pg_available_extensions\" | /opt/rh/rh-postgresql96/root/usr/bin/psql -d %s", r.quayConfiguration.QuayDatabase.Database), "", r.quayConfiguration.QuayEcosystem.Namespace) + success, stdout, stderr := k8sutils.ExecIntoPod(r.k8sclient, podName, fmt.Sprintf("echo \"SELECT * FROM pg_available_extensions\" | $(which psql) -d %s", r.quayConfiguration.QuayDatabase.Database), "", r.quayConfiguration.QuayEcosystem.Namespace) if !success { return fmt.Errorf("Failed to Exec into Postgresql Pod: %s", stderr) @@ -485,7 +485,7 @@ func (r *ReconcileQuayEcosystemConfiguration) configurePostgreSQL(meta metav1.Ob return nil } - success, stdout, stderr = k8sutils.ExecIntoPod(r.k8sclient, podName, fmt.Sprintf("echo \"CREATE EXTENSION pg_trgm\" | /opt/rh/rh-postgresql96/root/usr/bin/psql -d %s", r.quayConfiguration.QuayDatabase.Database), "", r.quayConfiguration.QuayEcosystem.Namespace) + success, stdout, stderr = k8sutils.ExecIntoPod(r.k8sclient, podName, fmt.Sprintf("echo \"CREATE EXTENSION pg_trgm\" | $(which psql) -d %s", r.quayConfiguration.QuayDatabase.Database), "", r.quayConfiguration.QuayEcosystem.Namespace) if !success { return fmt.Errorf("Failed to add pg_trim extension: %s", stderr)