diff options
author | Tiger <twatson@gitlab.com> | 2019-02-07 07:56:08 +0300 |
---|---|---|
committer | Tiger <twatson@gitlab.com> | 2019-02-08 02:05:05 +0300 |
commit | 73e5d3a2693d0469fdad925c398b6c464803c4b3 (patch) | |
tree | 16c20ef1d87b437e5a62ef041cb02772e489942b /app/models/clusters/platforms | |
parent | 2cea4fd067e2b78600b93202e0e71b58bccbe3d1 (diff) |
Validate kubernetes cluster CA certificate
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/models/clusters/platforms')
-rw-r--r-- | app/models/clusters/platforms/kubernetes.rb | 1 |
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 |