manager

package
v3.0.3+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2018 License: Apache-2.0 Imports: 18 Imported by: 18

Documentation

Index

Constants

View Source
const (
	StatusUp   = "UP"
	StatusDown = "DOWN"
)

Variables

View Source
var KeywordMapping = map[string]KeywordInfo{
	`ArtText`:       {`arttext-icon`, `dark-purple`, []string{`\.artx`}},
	`Atom`:          {`atom-icon`, `dark-green`, []string{`\.atom`}},
	`Bower`:         {`bower-icon`, `medium-orange`, []string{`bower[-_]components`, `\.(bowerrc|bower\.json|Bowerfile)`}},
	`Chef`:          {`chef-icon`, `dark-purple`, []string{`\.chef`}},
	`CircleCI`:      {`circleci-icon`, `dark-purple`, []string{`\.circleci`, `circle\.yml`}},
	`Docker`:        {`docker-icon`, `dark-blue`, []string{`docker`}},
	`Dropbox`:       {`dropbox-icon`, `medium-blue`, []string{`(Dropbox|\.dropbox\.cache)`}},
	`Emacs`:         {`emacs-icon`, `medium-purple`, []string{`\.emacs`}},
	`Framework`:     {`dylib-icon`, `medium-yellow`, []string{`\.framework`}},
	`Git`:           {`git-icon`, `medium-red`, []string{`\.git`, `git`}},
	`Github`:        {`fa-github`, `medium-orange`, []string{`\.github`}},
	`Gitlab`:        {`gitlab-icon`, `medium-orange`, []string{`\.gitlab`, `\.gitlab-ci\.yml`}},
	`Meteor`:        {`meteor-icon`, `dark-orange`, []string{`\.meteor`}},
	`Mercurial`:     {`hg-icon`, `dark-orange`, []string{`\.hg`, `mercurial`}},
	`Packet`:        {`package-icon`, `medium-green`, []string{`(bundle|paket)`}},
	`SVN`:           {`svn-icon`, `medium-yellow`, []string{`\.svn`, `subversion`}},
	`Textmate`:      {`textmate-icon`, `medium-green`, []string{`\.tmbundle`}},
	`Vagrant`:       {`vagrant-icon`, `medium-cyan`, []string{`\.vagrant`}},
	`Visual Studio`: {`vs-icon`, `medium-blue`, []string{`\.vscode`}},
	`Xcode`:         {`appstore-icon`, `medium-cyan`, []string{`\.xcodeproj`}},
	`Debian`:        {`debian-icon`, `medium-red`, []string{`[a-zA-Z0-9]+\.deb\s+`}},
	`Go`:            {`go-icon`, `medium-blue`, []string{`[a-zA-Z0-9]+\.go\s+`, `GOPATH`, `GOLANG`, `GOROOT`}},
	`Zimpl`:         {`zimpl-icon`, `medium-orange`, []string{`\.(zimpl|zmpl|zpl) `}},
	`Vue`:           {`vue-icon`, `light-green`, []string{`\.vue `}},
	`Ruby`:          {`ruby-icon`, `medium-red`, []string{`\.(rb|ru|ruby|erb|gemspec|god|mspec|pluginspec|podspec|rabl|rake|opal|rails) `}},
	`Rust`:          {`rust-icon`, `medium-maroon`, []string{`\.(rs|\.rlib)`}},
	`R`:             {`r-icon`, `medium-blue`, []string{`\.(r|Rprofile|rsx|rd) `}},
	`Python`:        {`python-icon`, `dark-blue`, []string{`\.(py|\.ipy|pep|py3|\.pyi) `}},
	`Perl`:          {`perl-icon`, `medium-blue`, []string{`\.(pl|perl|pm) `}},
	`Perl6`:         {`perl6-icon`, `medium-purple`, []string{`\.(pl6|p6l|p6m) `}},
	`PHP`:           {`php-icon`, `dark-blue`, []string{`\.php `}},
	`PHPUnit`:       {`phpunit-icon`, `medium-purple`, []string{`\.phpunit\.xml `}},
	`Objective-C`:   {`objc-icon`, `dark-red`, []string{`\.objc`}},
	`NPM`:           {`npm-icon`, `medium-red`, []string{`package\.json|\.npmignore|\.?npmrc|npm-debug\.log|npm-shrinkwrap\.json|package-lock\.json `}},
	`NodeJS`:        {`node-icon`, `medium-green`, []string{`\.(njs|nvmrc|node|node-version) `, `node_modules`}},
	`NGINX`:         {`nginx-icon`, `dark-green`, []string{`nginx\.conf`}},
	`MATLAB`:        {`matlab-icon`, `medium-yellow`, []string{`\.matlab`}},
	`Kotlin`:        {`kotlin-icon`, `dark-blue`, []string{`\.(kt|ktm|kts) `}},
	`Jenkins`:       {`jenkins-icon`, `medium-red`, []string{`Jenkinsfile`}},
	`Java`:          {`java-icon`, `medium-purple`, []string{`\.java `}},
	`Javascript`:    {`js-icon`, `medium-yellow`, []string{`\.(js|_js|jsb|jsm|jss|es6|es|mjs|sjs|ssjs|xsjs|dust) `}},
	`HTML`:          {`html5-icon`, `medium-orange`, []string{`\.html `}},
	`Gulp`:          {`gulp-icon`, `medium-red`, []string{`gulpfile\.js`, `gulpfile\.coffe`, `gulpfile\.babel\.js `}},
	`Erlang`:        {`erlang-icon`, `medium-red`, []string{`\.erl `}},
	`Dart`:          {`dart-icon`, `medium-cyan`, []string{`\.dart `}},
	`CoffeeScript`:  {`coffee-icon`, `medium-maroon`, []string{`\.coffee `}},
	`Clojure`:       {`clojure-icon`, `medium-cyan`, []string{`\.(clj|cl2|cljc|cljx|hic) `}},
	`ClojureScript`: {`cljs-icon`, `dark-cyan`, []string{`\.cljs `}},
	`CMake`:         {`cmake-icon`, `medium-green`, []string{`\.cmake `}},
	`C`:             {`c-icon`, `medium-blue`, []string{`\.(c|h) `}},
	`C++`:           {`cpp-icon`, `light-blue`, []string{`\.(cpp|hpp) `}},
	`C#`:            {`csharp-icon`, `darker-blue`, []string{`\.(csharp|cs) `}},
	`Ansible`:       {`ansible-icon`, `dark-blue`, []string{`\.(ansible|ansible\.yaml|ansible\.yml) `}},
	`Alpine Linux`:  {`alpine-icon`, `dark-blue`, []string{`\.APKBUILD `, ` apk `}},
}

KeywordMapping keywords, icons, colors, and extensions taken heavily from file-icons atom see https://github.com/file-icons/atom for their amazing work

Functions

func Keywords

func Keywords(s string) (keywords []string)

Keywords takes in any meta information strings and returns the keywordMapping key by testing the string against any regex in the KeywordMapping map

Types

type Command

type Command struct {
	Cmd      string
	Keywords []string
}

Command represents any command in the Dockerfile, using the commands keywords are parsed from the extensions

func (*Command) KeywordTags

func (c *Command) KeywordTags() string

KeywordTags returns space delimited list of keywords for the given tag

type Envelope

type Envelope struct {
	Events []Event
}

Envelope contains all grouped events sent by the registries. see https://docs.docker.com/registry/notifications/#envelope for more details

func (*Envelope) Process

func (e *Envelope) Process()

Process adds each individual event to the map of all events

type Event

type Event struct {
	ID        string `json:"id"`
	Timestamp string `json:"timestamp"`
	Action    string `json:"action"`
	Target    struct {
		MediaType  string `json:"mediaType"`
		Size       int    `json:"size"`
		Digest     string `json:"digest"`
		Length     int    `json:"length"`
		Repository string `json:"repository"`
		URL        string `json:"url"`
		Tag        string `json:"tag"`
	} `json:"target"`
	Request struct {
		ID        string `json:"id"`
		Addr      string `json:"addr"`
		Host      string `json:"host"`
		Method    string `json:"method"`
		Useragent string `json:"useragent"`
	} `json:"request"`
	Actor struct {
	} `json:"actor"`
	Source struct {
		Addr       string `json:"addr"`
		InstanceID string `json:"instanceID"`
	} `json:"source"`
}

Event contains all information for the given event (e.g pull/pushes to the registry) see https://docs.docker.com/registry/notifications/#events for more details

type Events

type Events struct {
	sync.Mutex
	Events map[string]map[string]Event
}

Events contains event information in the structure registry->event_id->event

var AllEvents Events

AllEvents contains all events received for each individual registry, to read or write from the list of events the mutex needs to be used to ensure consistency

type KeywordInfo

type KeywordInfo struct {
	Icon   string
	Color  string
	Regexp []string
}

KeywordInfo contains information used by the front end to build the label

type Registries

type Registries struct {
	Registries map[string]*Registry
	*viper.Viper
	sync.RWMutex
}

Registries contains a map of all active registries identified by their name, locked when necessary

var AllRegistries Registries

AllRegistries contains a list of added registries using their hostnames access granted via mutex locks/unlocks

func (*Registries) Add

func (rs *Registries) Add(r *Registry)

Add adds a created registry to the map of AllRegistries using the corresponding locks

func (*Registries) Edit

func (rs *Registries) Edit(new, old *Registry)

Edit updates the old registry with the new data

func (*Registries) LoadConfig

func (rs *Registries) LoadConfig(registriesFile string)

LoadConfig adds the registries parsed from the passed yaml file

func (*Registries) Remove

func (rs *Registries) Remove(r *Registry)

Remove removes a created registry from the map of AllRegistries using the corresponding locks

func (*Registries) WriteConfig

func (rs *Registries) WriteConfig() error

WriteConfig builds the config and writes from the map of registries

type Registry

type Registry struct {
	*client.Registry
	Repositories         map[string]*Repository
	TTL                  time.Duration
	Name                 string
	Username             string
	Password             string
	Host                 string
	Scheme               string
	Version              string
	Port                 int
	DockerhubIntegration bool
	SkipTLS              bool
	LastRefresh          time.Time

	History []RegistryHistory
	// contains filtered or unexported fields
}

Registry contains all information about the registry and its metadata

func NewRegistry

func NewRegistry(scheme, host, name, user, password string, port int, ttl time.Duration, skipTLS, dockerhubIntegration bool) (*Registry, error)

NewRegistry adds the new registry for viewing in the interface and sets up the go routine for automatic refreshes

func (*Registry) CalculateTagSize

func (r *Registry) CalculateTagSize(deserialized *manifestV2.DeserializedManifest) (size int64, err error)

CalculateTagSize returns the total number of tags across all repositories

func (*Registry) HistoryLayers

func (r *Registry) HistoryLayers() []int

func (*Registry) HistoryRepos

func (r *Registry) HistoryRepos() []int

func (*Registry) HistoryTags

func (r *Registry) HistoryTags() []int

func (*Registry) HistoryTimes

func (r *Registry) HistoryTimes() []time.Time

func (*Registry) IP

func (r *Registry) IP() string

IP returns the ip as a string

func (*Registry) LayerCount

func (r *Registry) LayerCount() int

LayerCount returns the total number of layers across all repositories

func (*Registry) Pulls

func (r *Registry) Pulls() (pulls int)

Pulls returns the number of pulls recorded by passing the forwarded registry events

func (*Registry) Pushes

func (r *Registry) Pushes() (pushes int)

Pushes returns the number of pushes recorded by passing the forwarded registry events

func (*Registry) Status

func (r *Registry) Status() string

Status returns the text representation of whether the registry is reachable

func (*Registry) TagCount

func (r *Registry) TagCount() (count int)

TagCount returns the total number of tags across all repositories

func (Registry) Update

func (r Registry) Update() Registry

Update is called with the configured TTL time for the given registry

type RegistryHistory

type RegistryHistory struct {
	Repositories int
	Layers       int
	Tags         int
	Time         time.Time
}

RegistryHistory maintains a list of data points at a regular interval for plotting in the UI

type Repository

type Repository struct {
	Name string
	Tags map[string]*Tag
}

func (*Repository) LastModified

func (r *Repository) LastModified() time.Time

LastModified returns the most recent time a tag was modified using the history field of each tag

func (*Repository) Size

func (r *Repository) Size() (size int64)

Size returns the deduplicated total byte size of all digests in the repo

type Tag

type Tag struct {
	*manifestV2.DeserializedManifest
	ID   string
	Name string
	*V1Compatibility
	Size int64
}

Tag contains all v1 compatibility and manifest information return by the registry

func (*Tag) LastModified

func (t *Tag) LastModified() (lastModified time.Time)

LastModified returns the latest last modified time using the history fields

type V1Compatibility

type V1Compatibility struct {
	Architecture string `json:"architecture"`
	Config       struct {
		Hostname     string      `json:"Hostname"`
		Domainname   string      `json:"Domainname"`
		User         string      `json:"User"`
		AttachStdin  bool        `json:"AttachStdin"`
		AttachStdout bool        `json:"AttachStdout"`
		AttachStderr bool        `json:"AttachStderr"`
		Tty          bool        `json:"Tty"`
		OpenStdin    bool        `json:"OpenStdin"`
		StdinOnce    bool        `json:"StdinOnce"`
		Env          []string    `json:"Env"`
		Cmd          []string    `json:"Cmd"`
		ArgsEscaped  bool        `json:"ArgsEscaped"`
		Image        string      `json:"Image"`
		Volumes      interface{} `json:"Volumes"`
		WorkingDir   string      `json:"WorkingDir"`
		Entrypoint   interface{} `json:"Entrypoint"`
		OnBuild      interface{} `json:"OnBuild"`
		Labels       struct {
		} `json:"Labels"`
	} `json:"config"`
	Container       string `json:"container"`
	ContainerConfig struct {
		Hostname     string      `json:"Hostname"`
		Domainname   string      `json:"Domainname"`
		User         string      `json:"User"`
		AttachStdin  bool        `json:"AttachStdin"`
		AttachStdout bool        `json:"AttachStdout"`
		AttachStderr bool        `json:"AttachStderr"`
		Tty          bool        `json:"Tty"`
		OpenStdin    bool        `json:"OpenStdin"`
		StdinOnce    bool        `json:"StdinOnce"`
		Env          []string    `json:"Env"`
		Cmd          []string    `json:"Cmd"`
		ArgsEscaped  bool        `json:"ArgsEscaped"`
		Image        string      `json:"Image"`
		Volumes      interface{} `json:"Volumes"`
		WorkingDir   string      `json:"WorkingDir"`
		Entrypoint   interface{} `json:"Entrypoint"`
		OnBuild      interface{} `json:"OnBuild"`
		Labels       struct {
		} `json:"Labels"`
	} `json:"container_config"`
	Created       time.Time `json:"created"`
	DockerVersion string    `json:"docker_version"`
	History       []struct {
		Created       time.Time                `json:"created"`
		Author        string                   `json:"author,omitempty"`
		CreatedBy     string                   `json:"created_by,omitempty"`
		Comment       string                   `json:"comment,omitempty"`
		EmptyLayer    bool                     `json:"empty_layer,omitempty"`
		ManifestLayer *distribution.Descriptor `json:"manifest_layer"`
		ShellType     string
		Commands      []Command
	} `json:"history"`
	Os     string `json:"os"`
	Rootfs struct {
		Type      string   `json:"type"`
		DiffIDs   []string `json:"diff_ids,omitempty"`
		BaseLayer string   `json:"base_layer,omitempty"`
	} `json:"rootfs"`
}

V1Compatibility contains meta information for when each layer contained its own configuration for each stage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL