github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/caas/specs/v3.go (about) 1 // Copyright 2020 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package specs 5 6 import ( 7 "github.com/juju/errors" 8 ) 9 10 // PodSpecV3 defines the data values used to configure 11 // a pod on the CAAS substrate for version 3. 12 type PodSpecV3 struct { 13 podSpecBase `json:",inline" yaml:",inline"` 14 ServiceAccount *PrimeServiceAccountSpecV3 `json:"serviceAccount,omitempty" yaml:"serviceAccount,omitempty"` 15 } 16 17 // Version3 defines the version number for pod spec version 3. 18 const Version3 Version = 3 19 20 // Validate returns an error if the spec is not valid. 21 func (spec *PodSpecV3) Validate() error { 22 if err := spec.podSpecBase.Validate(Version3); err != nil { 23 return errors.Trace(err) 24 } 25 if spec.ServiceAccount != nil { 26 return errors.Trace(spec.ServiceAccount.Validate()) 27 } 28 return nil 29 }