diff --git a/charts/redhat/ruby-imagestreams/OWNERS b/charts/redhat/redhat-ruby-imagestreams/OWNERS similarity index 100% rename from charts/redhat/ruby-imagestreams/OWNERS rename to charts/redhat/redhat-ruby-imagestreams/OWNERS diff --git a/charts/redhat/ruby-imagestreams/src/Chart.yaml b/charts/redhat/redhat-ruby-imagestreams/src/Chart.yaml similarity index 94% rename from charts/redhat/ruby-imagestreams/src/Chart.yaml rename to charts/redhat/redhat-ruby-imagestreams/src/Chart.yaml index 85e20ff..3cd4a51 100644 --- a/charts/redhat/ruby-imagestreams/src/Chart.yaml +++ b/charts/redhat/redhat-ruby-imagestreams/src/Chart.yaml @@ -7,7 +7,7 @@ annotations: apiVersion: v2 appVersion: 0.0.3 kubeVersion: '>=1.20.0' -name: ruby-imagestreams +name: redhat-ruby-imagestreams tags: builder,ruby sources: - https://github.com/sclorg/helm-charts diff --git a/charts/redhat/ruby-imagestreams/src/templates/ruby-imagestream.yaml b/charts/redhat/redhat-ruby-imagestreams/src/templates/ruby-imagestream.yaml similarity index 100% rename from charts/redhat/ruby-imagestreams/src/templates/ruby-imagestream.yaml rename to charts/redhat/redhat-ruby-imagestreams/src/templates/ruby-imagestream.yaml diff --git a/charts/redhat/ruby-rails-application/OWNERS b/charts/redhat/redhat-ruby-rails-application/OWNERS similarity index 100% rename from charts/redhat/ruby-rails-application/OWNERS rename to charts/redhat/redhat-ruby-rails-application/OWNERS diff --git a/charts/redhat/ruby-rails-application/src/Chart.yaml b/charts/redhat/redhat-ruby-rails-application/src/Chart.yaml similarity index 89% rename from charts/redhat/ruby-rails-application/src/Chart.yaml rename to charts/redhat/redhat-ruby-rails-application/src/Chart.yaml index 2ad423c..4abca26 100644 --- a/charts/redhat/ruby-rails-application/src/Chart.yaml +++ b/charts/redhat/redhat-ruby-rails-application/src/Chart.yaml @@ -1,14 +1,14 @@ description: This content is experimental, do not use it in production. An example Rails application with no database. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/rails-ex/blob/master/README.md. -name: ruby-rails-application +name: redhat-ruby-rails-application tags: quickstart,ruby,rails -version: 0.0.1 +version: 0.0.2 kubeVersion: '>=1.20.0' annotations: charts.openshift.io/name: Red Hat Apache Rails application with no database (experimental) charts.openshift.io/provider: Red Hat charts.openshift.io/providerType: redhat apiVersion: v2 -appVersion: 0.0.1 +appVersion: 0.0.2 sources: - https://github.com/sclorg/helm-charts diff --git a/charts/redhat/ruby-rails-application/src/templates/buildconfig.yaml b/charts/redhat/redhat-ruby-rails-application/src/templates/buildconfig.yaml similarity index 100% rename from charts/redhat/ruby-rails-application/src/templates/buildconfig.yaml rename to charts/redhat/redhat-ruby-rails-application/src/templates/buildconfig.yaml diff --git a/charts/redhat/ruby-rails-application/src/templates/deployment.yaml b/charts/redhat/redhat-ruby-rails-application/src/templates/deployment.yaml similarity index 83% rename from charts/redhat/ruby-rails-application/src/templates/deployment.yaml rename to charts/redhat/redhat-ruby-rails-application/src/templates/deployment.yaml index a78ee89..e141ad5 100644 --- a/charts/redhat/ruby-rails-application/src/templates/deployment.yaml +++ b/charts/redhat/redhat-ruby-rails-application/src/templates/deployment.yaml @@ -3,6 +3,7 @@ kind: Deployment metadata: annotations: description: Defines how to deploy the application server + {{ if not .Values.registry.enabled }} image.openshift.io/triggers: |- [ { @@ -13,6 +14,7 @@ metadata: "fieldPath": "spec.template.spec.containers[0].image" } ] + {{ end }} template.alpha.openshift.io/wait-for-ready: "true" labels: app: rails-example @@ -35,7 +37,11 @@ spec: - env: - name: RAILS_ENV value: {{ .Values.rails_env }} - image: "{{ .Values.name }}:latest" + {{ if .Values.registry.enabled }} + image: "{{ .Values.registry.name }}/{{ .Values.registry.namespace }}/{{ .Values.name }}:latest" + {{ else }} + image: " " + {{ end }} livenessProbe: httpGet: path: / diff --git a/charts/redhat/ruby-rails-application/src/templates/imagestream.yaml b/charts/redhat/redhat-ruby-rails-application/src/templates/imagestream.yaml similarity index 100% rename from charts/redhat/ruby-rails-application/src/templates/imagestream.yaml rename to charts/redhat/redhat-ruby-rails-application/src/templates/imagestream.yaml diff --git a/charts/redhat/ruby-rails-application/src/templates/route.yaml b/charts/redhat/redhat-ruby-rails-application/src/templates/route.yaml similarity index 100% rename from charts/redhat/ruby-rails-application/src/templates/route.yaml rename to charts/redhat/redhat-ruby-rails-application/src/templates/route.yaml diff --git a/charts/redhat/ruby-rails-application/src/templates/service.yaml b/charts/redhat/redhat-ruby-rails-application/src/templates/service.yaml similarity index 100% rename from charts/redhat/ruby-rails-application/src/templates/service.yaml rename to charts/redhat/redhat-ruby-rails-application/src/templates/service.yaml diff --git a/charts/redhat/ruby-rails-application/src/templates/tests/test-ruby-rails-connection.yaml b/charts/redhat/redhat-ruby-rails-application/src/templates/tests/test-ruby-rails-connection.yaml similarity index 100% rename from charts/redhat/ruby-rails-application/src/templates/tests/test-ruby-rails-connection.yaml rename to charts/redhat/redhat-ruby-rails-application/src/templates/tests/test-ruby-rails-connection.yaml diff --git a/charts/redhat/ruby-rails-application/src/values.schema.json b/charts/redhat/redhat-ruby-rails-application/src/values.schema.json similarity index 74% rename from charts/redhat/ruby-rails-application/src/values.schema.json rename to charts/redhat/redhat-ruby-rails-application/src/values.schema.json index d67cc18..c3f40de 100644 --- a/charts/redhat/ruby-rails-application/src/values.schema.json +++ b/charts/redhat/redhat-ruby-rails-application/src/values.schema.json @@ -53,6 +53,26 @@ "rubygem_mirror": { "type": "string", "description": "The custom RubyGems mirror URL." + }, + "registry": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "name": { + "type": "string", + "description": "The name of registry that will be used for pushing built image." + }, + "namespace": { + "type": "string", + "description": "The namespace of registry that will be used for pushing built image." + }, + "push_secret": { + "type": "string", + "description": "The push secret to push image to registry." + } + } } } } diff --git a/charts/redhat/ruby-rails-application/src/values.yaml b/charts/redhat/redhat-ruby-rails-application/src/values.yaml similarity index 87% rename from charts/redhat/ruby-rails-application/src/values.yaml rename to charts/redhat/redhat-ruby-rails-application/src/values.yaml index 898838d..3e05cee 100644 --- a/charts/redhat/ruby-rails-application/src/values.yaml +++ b/charts/redhat/redhat-ruby-rails-application/src/values.yaml @@ -10,3 +10,8 @@ rubygem_mirror: "" # TODO: must define a default value for .rubygem_mirror secret_key_base: "" # TODO: must define a default value for .secret_key_base source_repository_ref: "master" # TODO: must define a default value for .source_repository_ref source_repository_url: https://github.com/sclorg/rails-ex.git +registry: + enabled: false + name: "quay.io" + namespace: "something" + push_secret: "" \ No newline at end of file diff --git a/tests/test_ruby_imagestreams.py b/tests/test_ruby_imagestreams.py index 8e15b1b..2c5708d 100644 --- a/tests/test_ruby_imagestreams.py +++ b/tests/test_ruby_imagestreams.py @@ -9,7 +9,7 @@ @pytest.fixture(scope="module") def helm_api(request): - helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="ruby-imagestreams", tarball_dir=test_dir) + helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="redhat-ruby-imagestreams", tarball_dir=test_dir) print(request) # app_name = os.path.basename(request.param) yield helm_api diff --git a/tests/test_ruby_rails_application.py b/tests/test_ruby_rails_application.py index 7f2ebd1..9a1f4e4 100644 --- a/tests/test_ruby_rails_application.py +++ b/tests/test_ruby_rails_application.py @@ -8,10 +8,10 @@ test_dir = Path(os.path.abspath(os.path.dirname(__file__))) -class TestHelmCakePHPTemplate: +class TestHelmRubyExTemplate: def setup_method(self): - package_name = "ruby-rails-application" + package_name = "redhat-ruby-rails-application" path = test_dir / "../charts/redhat" self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir) @@ -32,21 +32,24 @@ def teardown_method(self): def test_curl_connection(self, version, branch): if self.hc_api.oc_api.shared_cluster: pytest.skip("Do NOT test on shared cluster") - self.hc_api.package_name = "ruby-imagestreams" + self.hc_api.package_name = "redhat-ruby-imagestreams" assert self.hc_api.helm_package() assert self.hc_api.helm_installation() - self.hc_api.package_name = "ruby-rails-application" + self.hc_api.package_name = "redhat-ruby-rails-application" assert self.hc_api.helm_package() + pod_name = f"rails-{version.replace(".", "")}" assert self.hc_api.helm_installation( values={ "ruby_version": f"{version}", "source_repository_ref": f"{branch}", - "namespace": self.hc_api.namespace + "source_repository_url": "https://github.com/sclorg/rails-ex.git", + "namespace": self.hc_api.namespace, + "name": pod_name, } ) - assert self.hc_api.is_s2i_pod_running(pod_name_prefix="rails-example", timeout=300) + assert self.hc_api.is_s2i_pod_running(pod_name_prefix=pod_name, timeout=480) assert self.hc_api.test_helm_curl_output( - route_name="rails-example", + route_name=pod_name, expected_str="Welcome to your Rails application" ) @@ -62,17 +65,22 @@ def test_curl_connection(self, version, branch): ], ) def test_by_helm_test(self, version, branch): - self.hc_api.package_name = "ruby-imagestreams" + if self.hc_api.oc_api.shared_cluster: + pytest.skip("Do NOT test on shared cluster") + self.hc_api.package_name = "redhat-ruby-imagestreams" assert self.hc_api.helm_package() assert self.hc_api.helm_installation() - self.hc_api.package_name = "ruby-rails-application" + self.hc_api.package_name = "redhat-ruby-rails-application" assert self.hc_api.helm_package() + pod_name = f"rails-{version.replace(".", "")}" assert self.hc_api.helm_installation( values={ "ruby_version": f"{version}", "source_repository_ref": f"{branch}", - "namespace": self.hc_api.namespace + "source_repository_url": "https://github.com/sclorg/rails-ex.git", + "namespace": self.hc_api.namespace, + "name": pod_name, } ) - assert self.hc_api.is_s2i_pod_running(pod_name_prefix="rails-example", timeout=300) + assert self.hc_api.is_s2i_pod_running(pod_name_prefix=pod_name, timeout=480) assert self.hc_api.test_helm_chart(expected_str=["Welcome to your Rails application"])