Skip to content

Canary Ingress UI RUN-AS-IF-FOSS

Andrew Fontaine requested to merge canary-ingress-ui into master

What does this MR do?

Allows users to set the canary ingress for Kubernetes deployments via the UI

For #218139 (closed)

Patch for static deploy board data
diff --git a/ee/app/serializers/clusters/environment_entity.rb b/ee/app/serializers/clusters/environment_entity.rb
index 1fd931674db..78e6195d0fe 100644
--- a/ee/app/serializers/clusters/environment_entity.rb
+++ b/ee/app/serializers/clusters/environment_entity.rb
@@ -16,7 +16,49 @@ class EnvironmentEntity < API::Entities::EnvironmentBasic
       project_logs_path(environment.project, environment_name: environment.name)
     end
 
-    expose :rollout_status, if: -> (*) { can_read_cluster_deployments? }, using: ::RolloutStatusEntity
+      expose :rollout_status, as: -> (*) do
+        payload = <<~EOS
+        {
+          "status": "found",
+          "has_legacy_app_label": false,
+          "instances": [
+            {
+              "status": "running",
+              "pod_name": "production-canary-bfb8f4c99-hnqq9",
+              "tooltip": "production-canary-bfb8f4c99-hnqq9 (Running)",
+              "track": "canary",
+              "stable": false
+            },
+            {
+              "status": "running",
+              "pod_name": "production-canary-bfb8f4c99-vhc4g",
+              "tooltip": "production-canary-bfb8f4c99-vhc4g (Running)",
+              "track": "canary",
+              "stable": false
+            },
+            {
+              "status": "running",
+              "pod_name": "production-7b9d8d7d7-64l9j",
+              "tooltip": "production-7b9d8d7d7-64l9j (Running)",
+              "track": "stable",
+              "stable": true
+            },
+            {
+              "status": "running",
+              "pod_name": "production-7b9d8d7d7-tc2cr",
+              "tooltip": "production-7b9d8d7d7-tc2cr (Running)",
+              "track": "stable",
+              "stable": true
+            }
+          ],
+          "completion": 100,
+          "is_completed": true,
+          "canary_ingress": { "canary_weight": 58 }
+        }
+        EOS
+
+        JSON.parse(payload)
+      end
 
     expose :updated_at
 
diff --git a/ee/app/serializers/ee/environment_entity.rb b/ee/app/serializers/ee/environment_entity.rb
index 69e6b5dd676..c8b8a18fd09 100644
--- a/ee/app/serializers/ee/environment_entity.rb
+++ b/ee/app/serializers/ee/environment_entity.rb
@@ -6,7 +6,49 @@ module EnvironmentEntity
     extend ::Gitlab::Utils::Override
 
     prepended do
-      expose :rollout_status, if: -> (*) { can_read_deploy_board? }, using: ::RolloutStatusEntity
+      expose :rollout_status do |env, options| 
+        payload = <<~EOS
+        {
+          "status": "found",
+          "has_legacy_app_label": false,
+          "instances": [
+            {
+              "status": "running",
+              "pod_name": "production-canary-bfb8f4c99-hnqq9",
+              "tooltip": "production-canary-bfb8f4c99-hnqq9 (Running)",
+              "track": "canary",
+              "stable": false
+            },
+            {
+              "status": "running",
+              "pod_name": "production-canary-bfb8f4c99-vhc4g",
+              "tooltip": "production-canary-bfb8f4c99-vhc4g (Running)",
+              "track": "canary",
+              "stable": false
+            },
+            {
+              "status": "running",
+              "pod_name": "production-7b9d8d7d7-64l9j",
+              "tooltip": "production-7b9d8d7d7-64l9j (Running)",
+              "track": "stable",
+              "stable": true
+            },
+            {
+              "status": "running",
+              "pod_name": "production-7b9d8d7d7-tc2cr",
+              "tooltip": "production-7b9d8d7d7-tc2cr (Running)",
+              "track": "stable",
+              "stable": true
+            }
+          ],
+          "completion": 100,
+          "is_completed": true,
+          "canary_ingress": { "canary_weight": 58 }
+        }
+        EOS
+
+        JSON.parse(payload)
+      end
       expose :has_opened_alert?, if: -> (*) { can_read_alert_management_alert? }, expose_nil: false, as: :has_opened_alert
     end

Screenshots (strongly suggested)

image

image

image

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Andrew Fontaine

Merge request reports

Loading