Documentation
¶
Overview ¶
Package livekeys serves the design-key list (features.design_preview) from a file the process re-reads while it runs, so turning a key on or off needs no pod restart. In the cluster the file is a ConfigMap mounted as a directory (deploy/helm/rivolt, liveKeys.designPreview), changed only by a reviewed commit that Argo CD syncs; kubelet refreshes the mount and the poll here picks the change up.
File format: one line, design_preview=a,b,c. An empty value is valid and means every key off. A zero-byte file, a file without the line, or a key outside [a-z0-9_] is rejected as a whole and the last good list stays; a pod never falls back to "all off" because of a bad file.
A pod that starts with no good list to keep follows two rules. An ABSENT file (the ConfigMap is missing) uses RIVOLT_DESIGN_PREVIEW, the start-up fallback. A PRESENT but invalid file never does: running pods serve the last good file list and the env may lag it, so the pod reports source "invalid" and Ready() false (the pod stays out of the Service, a roll stalls) until the file is fixed; the next poll recovers it.
Index ¶
Constants ¶
const ( SourceFile = "file" // the list came from the mounted file SourceEnv = "env" // booted without a good file; the list is RIVOLT_DESIGN_PREVIEW (the migration fallback), until the file is good SourceNone = "none" // no file configured (or an explicit empty env) and no env list: empty list // SourceInvalid: the pod has no good list and must not serve an empty one as if intended: the file is present but invalid, or it is // absent and there is no env fallback. Ready() is false until a good file arrives. SourceInvalid = "invalid" )
Sources reported on rivolt_live_keys_info.
const PollInterval = 10 * time.Second
PollInterval is how often the file is re-read. The path is read afresh each time, so kubelet's ..data symlink swap is followed.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds the current list. Keys is safe for any number of concurrent readers.
func New ¶
New builds the store and loads once, before the caller serves anything. path may be empty (no file configured): the list is then env, source "env" or "none". env is the raw RIVOLT_DESIGN_PREVIEW value; a bad env list is an error the caller treats as fatal, so it never drops silently.
func (*Store) Collectors ¶
func (s *Store) Collectors() []prometheus.Collector
Collectors are the store's metrics, to register once.
func (*Store) Ready ¶ added in v1.3.2
Ready is false while the pod has no good list (source "invalid"); the readiness probe follows it on every reload.
func (*Store) Reload ¶
func (s *Store) Reload()
Reload reads the file once (the poll). See reloadFile.