From 021a9bf9631508f7399104d6ba95d2b686e10026 Mon Sep 17 00:00:00 2001 From: GitLab Development Date: Wed, 27 Nov 2019 19:29:29 +0000 Subject: [PATCH] Upgrade to knative 0.8.1 --- app/models/clusters/applications/knative.rb | 2 +- changelogs/unreleased/knative-0-8-update.yml | 5 ++ .../serverless/functions_controller_spec.rb | 16 ++++++ .../clusters/applications/knative_spec.rb | 2 +- spec/support/helpers/kubernetes_helpers.rb | 54 ++++++++++++++++++- 5 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/knative-0-8-update.yml diff --git a/app/models/clusters/applications/knative.rb b/app/models/clusters/applications/knative.rb index 6ad086211fb9a8..bca0b09a3f63e9 100644 --- a/app/models/clusters/applications/knative.rb +++ b/app/models/clusters/applications/knative.rb @@ -3,7 +3,7 @@ module Clusters module Applications class Knative < ApplicationRecord - VERSION = '0.7.0' + VERSION = '0.8.1' REPOSITORY = 'https://storage.googleapis.com/triggermesh-charts' METRICS_CONFIG = 'https://storage.googleapis.com/triggermesh-charts/istio-metrics.yaml' FETCH_IP_ADDRESS_DELAY = 30.seconds diff --git a/changelogs/unreleased/knative-0-8-update.yml b/changelogs/unreleased/knative-0-8-update.yml new file mode 100644 index 00000000000000..24ed1d0e9a7a4f --- /dev/null +++ b/changelogs/unreleased/knative-0-8-update.yml @@ -0,0 +1,5 @@ +--- +title: Update Knative to 0.8.1 +merge_request: +author: cab105 +type: added diff --git a/spec/controllers/projects/serverless/functions_controller_spec.rb b/spec/controllers/projects/serverless/functions_controller_spec.rb index 73fb0fad646a15..55b9fa08b00acd 100644 --- a/spec/controllers/projects/serverless/functions_controller_spec.rb +++ b/spec/controllers/projects/serverless/functions_controller_spec.rb @@ -149,6 +149,14 @@ def params(opts = {}) include_examples 'GET #show with valid data' end + + context 'on Knative 0.8.1' do + before do + prepare_knative_stubs(knative_08_service(knative_stub_options)) + end + + include_examples 'GET #show with valid data' + end end end @@ -210,6 +218,14 @@ def params(opts = {}) include_examples 'GET #index with data' end + + context 'on Knative 0.8.1' do + before do + prepare_knative_stubs(knative_08_service(knative_stub_options)) + end + + include_examples 'GET #index with data' + end end def prepare_knative_stubs(knative_service) diff --git a/spec/models/clusters/applications/knative_spec.rb b/spec/models/clusters/applications/knative_spec.rb index f1ce447a0d8c33..8262833bac6eeb 100644 --- a/spec/models/clusters/applications/knative_spec.rb +++ b/spec/models/clusters/applications/knative_spec.rb @@ -119,7 +119,7 @@ subject { knative.install_command } it 'is initialized with latest version' do - expect(subject.version).to eq('0.7.0') + expect(subject.version).to eq('0.8.1') end it_behaves_like 'a command' diff --git a/spec/support/helpers/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb index 677aef57661e18..95656747382791 100644 --- a/spec/support/helpers/kubernetes_helpers.rb +++ b/spec/support/helpers/kubernetes_helpers.rb @@ -322,7 +322,7 @@ def kube_knative_pods_body(name, namespace) def kube_knative_services_body(**options) { "kind" => "List", - "items" => [knative_07_service(options)] + "items" => [knative_08_service(options)] } end @@ -510,6 +510,58 @@ def knative_07_service(name: 'kubetest', namespace: 'default', domain: 'example. "podcount" => 0 } end + # noinspection RubyStringKeysInHashInspection + def knative_08_service(name: 'kubetest', namespace: 'default', domain: 'example.com', description: 'a knative service', environment: 'production') + { "apiVersion" => "serving.knative.dev/v1alpha1", + "kind" => "Service", + "metadata" => + { "annotations" => + { "serving.knative.dev/creator" => "system:serviceaccount:#{namespace}:#{namespace}-service-account", + "serving.knative.dev/lastModifier" => "system:serviceaccount:#{namespace}:#{namespace}-service-account" }, + "creationTimestamp" => "2019-10-22T21:19:13Z", + "generation" => 1, + "labels" => { "service" => name }, + "name" => name, + "namespace" => namespace, + "resourceVersion" => "289726", + "selfLink" => "/apis/serving.knative.dev/v1alpha1/namespaces/#{namespace}/services/#{name}", + "uid" => "988349fa-f511-11e9-9ea1-42010a80005e" }, + "spec" => { + "template" => { + "metadata" => { + "annotations" => { "Description" => description }, + "creationTimestamp" => "2019-10-22T21:19:12Z", + "labels" => { "service" => name } + }, + "spec" => { + "containers" => [{ + "env" => + [{ "name" => "timestamp", "value" => "2019-10-22 21:19:12" }], + "image" => "image_name", + "name" => "user-container", + "resources" => {} + }], + "timeoutSeconds" => 300 + } + }, + "traffic" => [{ "latestRevision" => true, "percent" => 100 }] + }, + "status" => + { "address" => { "url" => "http://#{name}.#{namespace}.svc.cluster.local" }, + "conditions" => + [{ "lastTransitionTime" => "2019-10-22T21:20:15Z", "status" => "True", "type" => "ConfigurationsReady" }, + { "lastTransitionTime" => "2019-10-22T21:20:15Z", "status" => "True", "type" => "Ready" }, + { "lastTransitionTime" => "2019-10-22T21:20:15Z", "status" => "True", "type" => "RoutesReady" }], + "latestCreatedRevisionName" => "#{name}-92tsj", + "latestReadyRevisionName" => "#{name}-92tsj", + "observedGeneration" => 1, + "traffic" => [{ "latestRevision" => true, "percent" => 100, "revisionName" => "#{name}-92tsj" }], + "url" => "http://#{name}.#{namespace}.#{domain}" }, + "environment_scope" => environment, + "cluster_id" => 5, + "podcount" => 0 } + end + # noinspection RubyStringKeysInHashInspection def knative_05_service(name: 'kubetest', namespace: 'default', domain: 'example.com', description: 'a knative service', environment: 'production') { "apiVersion" => "serving.knative.dev/v1alpha1", -- GitLab