|
1 | 1 | package nomad
|
2 | 2 |
|
3 | 3 | import (
|
| 4 | + "fmt" |
4 | 5 | "net/http"
|
5 | 6 | "sort"
|
6 | 7 | "strconv"
|
@@ -45,6 +46,13 @@ func (s *ServiceRegistration) Upsert(
|
45 | 46 | }
|
46 | 47 | defer metrics.MeasureSince([]string{"nomad", "service_registration", "upsert"}, time.Now())
|
47 | 48 |
|
| 49 | + // Nomad service registrations can only be used once all servers, in the |
| 50 | + // local region, have been upgraded to 1.3.0 or greater. |
| 51 | + if !ServersMeetMinimumVersion(s.srv.Members(), s.srv.Region(), minNomadServiceRegistrationVersion, false) { |
| 52 | + return fmt.Errorf("all servers should be running version %v or later to use the Nomad service provider", |
| 53 | + minNomadServiceRegistrationVersion) |
| 54 | + } |
| 55 | + |
48 | 56 | // This endpoint is only callable by nodes in the cluster. Therefore,
|
49 | 57 | // perform a node lookup using the secret ID to confirm the caller is a
|
50 | 58 | // known node.
|
@@ -100,6 +108,13 @@ func (s *ServiceRegistration) DeleteByID(
|
100 | 108 | }
|
101 | 109 | defer metrics.MeasureSince([]string{"nomad", "service_registration", "delete_id"}, time.Now())
|
102 | 110 |
|
| 111 | + // Nomad service registrations can only be used once all servers, in the |
| 112 | + // local region, have been upgraded to 1.3.0 or greater. |
| 113 | + if !ServersMeetMinimumVersion(s.srv.Members(), s.srv.Region(), minNomadServiceRegistrationVersion, false) { |
| 114 | + return fmt.Errorf("all servers should be running version %v or later to use the Nomad service provider", |
| 115 | + minNomadServiceRegistrationVersion) |
| 116 | + } |
| 117 | + |
103 | 118 | // Perform the ACL token resolution.
|
104 | 119 | aclObj, err := s.srv.ResolveToken(args.AuthToken)
|
105 | 120 |
|
|
0 commit comments