summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorTiger <twatson@gitlab.com>2019-02-07 15:56:08 +1100
committerTiger <twatson@gitlab.com>2019-02-08 10:05:05 +1100
commit73e5d3a2693d0469fdad925c398b6c464803c4b3 (patch)
tree16c20ef1d87b437e5a62ef041cb02772e489942b /app
parent2cea4fd067e2b78600b93202e0e71b58bccbe3d1 (diff)
downloadgitlab-ce-73e5d3a2693d0469fdad925c398b6c464803c4b3.tar.gz
Validate kubernetes cluster CA certificate55447-validate-k8s-ca-cert
No certificate is still accepted, but if one is provided it must be valid. Only run validation if the certificate has changed to avoid making existing records invalid.
Diffstat (limited to 'app')
-rw-r--r--app/models/clusters/platforms/kubernetes.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb
index 8f3424db295..ed6bbfb4c64 100644
--- a/app/models/clusters/platforms/kubernetes.rb
+++ b/app/models/clusters/platforms/kubernetes.rb
@@ -43,6 +43,7 @@ module Clusters
# We expect to be `active?` only when enabled and cluster is created (the api_url is assigned)
validates :api_url, url: true, presence: true
validates :token, presence: true
+ validates :ca_cert, certificate: true, allow_blank: true, if: :ca_cert_changed?
validate :prevent_modification, on: :update