From a097b7a590e4b8cf0daa70db3b33991eba3313a9 Mon Sep 17 00:00:00 2001 From: Prince Rachit Sinha Date: Sun, 30 Sep 2018 11:03:11 +0530 Subject: [PATCH 01/45] refactor(logs): Add reporter name to error logs. 1. Adding reporter name to logs improves tracing of error. 2. Capitalize first letter of error log. Fixes https://github.com/weaveworks/scope/issues/3306 Signed-off-by: Prince Rachit Sinha --- probe/probe.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/probe/probe.go b/probe/probe.go index b34f21cdec..ac9aee1951 100644 --- a/probe/probe.go +++ b/probe/probe.go @@ -148,7 +148,7 @@ func (p *Probe) tick() { err := ticker.Tick() metrics.MeasureSince([]string{ticker.Name(), "ticker"}, t) if err != nil { - log.Errorf("error doing ticker: %v", err) + log.Errorf("Error doing ticker: %v", err) } } } @@ -165,7 +165,7 @@ func (p *Probe) report() report.Report { } metrics.MeasureSince([]string{rep.Name(), "reporter"}, t) if err != nil { - log.Errorf("error generating report: %v", err) + log.Errorf("Error generating %s report: %v", rep.Name(), err) newReport = report.MakeReport() // empty is OK to merge } reports <- newReport @@ -190,7 +190,7 @@ func (p *Probe) tag(r report.Report) report.Report { } metrics.MeasureSince([]string{tagger.Name(), "tagger"}, t) if err != nil { - log.Errorf("error applying tagger: %v", err) + log.Errorf("Error applying tagger: %v", err) } } return r @@ -213,7 +213,7 @@ ForLoop: }) } if err := p.publisher.Publish(rpt); err != nil { - log.Infof("publish: %v", err) + log.Infof("Publish: %v", err) } } From 1e6a6a7bb40b1865ce18d6f345b4e69303f44624 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Thu, 4 Jul 2019 13:30:22 +0000 Subject: [PATCH 02/45] fix: handle errors reported by the conntrack package In particular, ENOBUFS which indicates data has been dropped. With this change the collector will restart, thus resynchronising with the OS. --- probe/endpoint/conntrack.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/probe/endpoint/conntrack.go b/probe/endpoint/conntrack.go index 155dfa41cf..92678878e0 100644 --- a/probe/endpoint/conntrack.go +++ b/probe/endpoint/conntrack.go @@ -147,6 +147,11 @@ func (c *conntrackWalker) run() { if !ok { return } + if f.Err != nil { + log.Errorf("conntrack event error: %v", f.Err) + stop() + return + } if c.relevant(f) { c.handleFlow(f) } From c1e110ac7b9add74dba5b2a9f5832df49d16871c Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 1 Jul 2019 16:56:50 +0000 Subject: [PATCH 03/45] fix: remove unused metric SpyDuration The call to register this metric was removed in #633 over three years ago. If it isn't registered then nobody can see the values. The measurement is duplicated by metrics added in #658. --- probe/endpoint/reporter.go | 15 --------------- probe/endpoint/reporter_linux.go | 6 ------ 2 files changed, 21 deletions(-) diff --git a/probe/endpoint/reporter.go b/probe/endpoint/reporter.go index 709dc0f411..c7a26a81c8 100644 --- a/probe/endpoint/reporter.go +++ b/probe/endpoint/reporter.go @@ -1,9 +1,6 @@ package endpoint import ( - "time" - - "github.com/prometheus/client_golang/prometheus" "github.com/weaveworks/scope/probe/endpoint/procspy" "github.com/weaveworks/scope/probe/process" "github.com/weaveworks/scope/report" @@ -31,17 +28,5 @@ type ReporterConfig struct { DNSSnooper *DNSSnooper } -// SpyDuration is an exported prometheus metric -var SpyDuration = prometheus.NewSummaryVec( - prometheus.SummaryOpts{ - Namespace: "scope", - Subsystem: "probe", - Name: "spy_duration_seconds", - Help: "Time in seconds spent spying on active connections.", - MaxAge: 10 * time.Second, // like statsd - }, - []string{}, -) - // Name of this reporter, for metrics gathering func (Reporter) Name() string { return "Endpoint" } diff --git a/probe/endpoint/reporter_linux.go b/probe/endpoint/reporter_linux.go index dd7444c2bd..e465cc9cc3 100644 --- a/probe/endpoint/reporter_linux.go +++ b/probe/endpoint/reporter_linux.go @@ -3,8 +3,6 @@ package endpoint import ( - "time" - "github.com/weaveworks/scope/report" ) @@ -39,10 +37,6 @@ func (r *Reporter) Stop() { // Report implements Reporter. func (r *Reporter) Report() (report.Report, error) { - defer func(begin time.Time) { - SpyDuration.WithLabelValues().Observe(time.Since(begin).Seconds()) - }(time.Now()) - rpt := report.MakeReport() r.connectionTracker.ReportConnections(&rpt) From 89363f5dcf1d22549577837101d930f915fe136a Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 15 May 2019 12:27:00 +0000 Subject: [PATCH 04/45] Defer metrics registration until we need it This avoids app-specific metrics appearing in the probe. --- app/multitenant/aws_collector.go | 5 ++++- app/multitenant/memcache_client.go | 5 ++++- app/multitenant/s3_client.go | 6 +++++- app/multitenant/sqs_control_router.go | 5 ++++- prog/app.go | 7 ++++++- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/multitenant/aws_collector.go b/app/multitenant/aws_collector.go index ab14816cb6..769679550a 100644 --- a/app/multitenant/aws_collector.go +++ b/app/multitenant/aws_collector.go @@ -76,7 +76,7 @@ var ( }, []string{"method", "status_code"}) ) -func init() { +func registerAWSCollectorMetrics() { prometheus.MustRegister(dynamoRequestDuration) prometheus.MustRegister(dynamoConsumedCapacity) prometheus.MustRegister(dynamoValueSize) @@ -86,6 +86,8 @@ func init() { prometheus.MustRegister(natsRequests) } +var registerAWSCollectorMetricsOnce sync.Once + // AWSCollector is a Collector which can also CreateTables type AWSCollector interface { app.Collector @@ -137,6 +139,7 @@ type watchKey struct { // NewAWSCollector the elastic reaper of souls // https://github.com/aws/aws-sdk-go/wiki/common-examples func NewAWSCollector(config AWSCollectorConfig) (AWSCollector, error) { + registerAWSCollectorMetricsOnce.Do(registerAWSCollectorMetrics) var nc *nats.Conn if config.NatsHost != "" { var err error diff --git a/app/multitenant/memcache_client.go b/app/multitenant/memcache_client.go index 5393c3141d..a4443c342b 100644 --- a/app/multitenant/memcache_client.go +++ b/app/multitenant/memcache_client.go @@ -39,12 +39,14 @@ var ( }, []string{"method", "status_code"}) ) -func init() { +func registerMemcacheClientMetrics() { prometheus.MustRegister(memcacheRequests) prometheus.MustRegister(memcacheHits) prometheus.MustRegister(memcacheRequestDuration) } +var registerMemcacheClientMetricsOnce sync.Once + // MemcacheClient is a memcache client that gets its server list from SRV // records, and periodically updates that ServerList. type MemcacheClient struct { @@ -72,6 +74,7 @@ type MemcacheConfig struct { // NewMemcacheClient creates a new MemcacheClient that gets its server list // from SRV and updates the server list on a regular basis. func NewMemcacheClient(config MemcacheConfig) *MemcacheClient { + registerMemcacheClientMetricsOnce.Do(registerMemcacheClientMetrics) var servers memcache.ServerList client := memcache.NewFromSelector(&servers) client.Timeout = config.Timeout diff --git a/app/multitenant/s3_client.go b/app/multitenant/s3_client.go index 586a28f9c8..ef67c981f4 100644 --- a/app/multitenant/s3_client.go +++ b/app/multitenant/s3_client.go @@ -2,6 +2,7 @@ package multitenant import ( "bytes" + "sync" "context" "github.com/aws/aws-sdk-go/aws" @@ -28,12 +29,15 @@ type S3Store struct { bucketName string } -func init() { +func registerS3ClientMetrics() { prometheus.MustRegister(s3RequestDuration) } +var registerS3ClientMetricsOnce sync.Once + // NewS3Client creates a new S3 client. func NewS3Client(config *aws.Config, bucketName string) S3Store { + registerS3ClientMetricsOnce.Do(registerS3ClientMetrics) return S3Store{ s3: s3.New(session.New(config)), bucketName: bucketName, diff --git a/app/multitenant/sqs_control_router.go b/app/multitenant/sqs_control_router.go index a9b17aead5..fdfcd6f7b2 100644 --- a/app/multitenant/sqs_control_router.go +++ b/app/multitenant/sqs_control_router.go @@ -30,10 +30,12 @@ var ( }, []string{"method", "status_code"}) ) -func init() { +func registerSQSMetrics() { prometheus.MustRegister(sqsRequestDuration) } +var registerSQSMetricsOnce sync.Once + // sqsControlRouter: // Creates a queue for every probe that connects to it, and a queue for // responses back to it. When it receives a request, posts it to the @@ -64,6 +66,7 @@ type sqsResponseMessage struct { // NewSQSControlRouter the harbinger of death func NewSQSControlRouter(config *aws.Config, userIDer UserIDer, prefix string, rpcTimeout time.Duration) app.ControlRouter { + registerSQSMetricsOnce.Do(registerSQSMetrics) result := &sqsControlRouter{ service: sqs.New(session.New(config)), responseQueueURL: nil, diff --git a/prog/app.go b/prog/app.go index 533f80eb7a..27050e8ec7 100644 --- a/prog/app.go +++ b/prog/app.go @@ -10,6 +10,7 @@ import ( "runtime" "strconv" "strings" + "sync" "time" "github.com/goji/httpauth" @@ -47,11 +48,13 @@ var ( }, []string{"method", "route", "status_code", "ws"}) ) -func init() { +func registerAppMetrics() { prometheus.MustRegister(requestDuration) billing.MustRegisterMetrics() } +var registerAppMetricsOnce sync.Once + // Router creates the mux for all the various app components. func router(collector app.Collector, controlRouter app.ControlRouter, pipeRouter app.PipeRouter, externalUI bool, capabilities map[string]bool, metricsGraphURL string) http.Handler { router := mux.NewRouter().SkipClean(true) @@ -209,6 +212,8 @@ func appMain(flags appFlags) { setLogFormatter(flags.logPrefix) runtime.SetBlockProfileRate(flags.blockProfileRate) + registerAppMetricsOnce.Do(registerAppMetrics) + traceCloser := tracing.NewFromEnv(fmt.Sprintf("scope-%s", flags.serviceName)) defer traceCloser.Close() From 3483765b34339800e39e148f312a676fd4ac39c6 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Thu, 4 Jul 2019 14:35:59 +0000 Subject: [PATCH 05/45] docs: Release 1.11.3 --- CHANGELOG.md | 9 +++++++++ examples/cri/deploy.yaml | 2 +- examples/cri/ds.yaml | 2 +- examples/docker/docker-compose-probe-v1.yml | 2 +- examples/docker/docker-compose-probe-v2.yml | 2 +- examples/k8s/deploy.yaml | 2 +- examples/k8s/ds.yaml | 2 +- examples/k8s/probe-deploy.yaml | 2 +- examples/mesos/minimesos.json | 2 +- site/installing.md | 4 ++-- 10 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4abc3ede3a..b20864146a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## Release 1.11.3 + +This is a bugfix release, which should improve some cases where +reports get bigger and bigger over time due to Scope not seeing +connections get closed. + +- Report the error and restart when something goes wrong in connection tracking + [#3648](https://github.com/weaveworks/scope/pull/3648) + ## Release 1.11.2 Minor update: diff --git a/examples/cri/deploy.yaml b/examples/cri/deploy.yaml index d9dd59b334..c8b878da76 100644 --- a/examples/cri/deploy.yaml +++ b/examples/cri/deploy.yaml @@ -25,7 +25,7 @@ spec: args: - '--no-probe' env: [] - image: weaveworks/scope:1.11.2 + image: weaveworks/scope:1.11.3 imagePullPolicy: IfNotPresent ports: - containerPort: 4040 diff --git a/examples/cri/ds.yaml b/examples/cri/ds.yaml index 6ac57a9ef5..2f249b238a 100644 --- a/examples/cri/ds.yaml +++ b/examples/cri/ds.yaml @@ -34,7 +34,7 @@ spec: fieldRef: apiVersion: v1 fieldPath: spec.nodeName - image: weaveworks/scope:1.11.2 + image: weaveworks/scope:1.11.3 imagePullPolicy: IfNotPresent securityContext: privileged: true diff --git a/examples/docker/docker-compose-probe-v1.yml b/examples/docker/docker-compose-probe-v1.yml index 7e0e674c8a..4ff61c2bdc 100644 --- a/examples/docker/docker-compose-probe-v1.yml +++ b/examples/docker/docker-compose-probe-v1.yml @@ -1,5 +1,5 @@ probe: - image: weaveworks/scope:1.11.2 + image: weaveworks/scope:1.11.3 net: "host" pid: "host" privileged: true diff --git a/examples/docker/docker-compose-probe-v2.yml b/examples/docker/docker-compose-probe-v2.yml index e924329d2e..2466239f90 100644 --- a/examples/docker/docker-compose-probe-v2.yml +++ b/examples/docker/docker-compose-probe-v2.yml @@ -1,7 +1,7 @@ version: '2' services: probe: - image: weaveworks/scope:1.11.2 + image: weaveworks/scope:1.11.3 network_mode: "host" pid: "host" privileged: true diff --git a/examples/k8s/deploy.yaml b/examples/k8s/deploy.yaml index 971006040d..471494c41b 100644 --- a/examples/k8s/deploy.yaml +++ b/examples/k8s/deploy.yaml @@ -28,7 +28,7 @@ spec: args: - '--no-probe' env: [] - image: weaveworks/scope:1.11.2 + image: weaveworks/scope:1.11.3 imagePullPolicy: IfNotPresent ports: - containerPort: 4040 diff --git a/examples/k8s/ds.yaml b/examples/k8s/ds.yaml index 5afe381e68..337848bf74 100644 --- a/examples/k8s/ds.yaml +++ b/examples/k8s/ds.yaml @@ -31,7 +31,7 @@ spec: - '--probe.docker.bridge=docker0' - '--probe.docker=true' - 'weave-scope-app.weave.svc.cluster.local.:80' - image: weaveworks/scope:1.11.2 + image: weaveworks/scope:1.11.3 imagePullPolicy: IfNotPresent resources: requests: diff --git a/examples/k8s/probe-deploy.yaml b/examples/k8s/probe-deploy.yaml index 7c0fb58c47..1469e489e5 100644 --- a/examples/k8s/probe-deploy.yaml +++ b/examples/k8s/probe-deploy.yaml @@ -35,7 +35,7 @@ spec: - 'weave-scope-app.weave.svc.cluster.local.:80' command: - /home/weave/scope - image: 'docker.io/weaveworks/scope:1.11.2' + image: 'docker.io/weaveworks/scope:1.11.3' imagePullPolicy: IfNotPresent resources: requests: diff --git a/examples/mesos/minimesos.json b/examples/mesos/minimesos.json index d5202c84a5..07143ef12b 100644 --- a/examples/mesos/minimesos.json +++ b/examples/mesos/minimesos.json @@ -12,7 +12,7 @@ "container": { "type": "DOCKER", "docker": { - "image": "weaveworks/scope:1.11.2", + "image": "weaveworks/scope:1.11.3", "network": "HOST", "privileged": true, "parameters": [ diff --git a/site/installing.md b/site/installing.md index a07cb5e21f..976d9dc770 100644 --- a/site/installing.md +++ b/site/installing.md @@ -112,7 +112,7 @@ After it’s been launched, open your browser to `http://localhost:4040`. **Docker Compose Format Version 1:** scope: - image: weaveworks/scope:1.11.2 + image: weaveworks/scope:1.11.3 net: "host" pid: "host" privileged: true @@ -128,7 +128,7 @@ After it’s been launched, open your browser to `http://localhost:4040`. version: '2' services: scope: - image: weaveworks/scope:1.11.2 + image: weaveworks/scope:1.11.3 network_mode: "host" pid: "host" privileged: true From 24dcb676cfb4447ffadbd2d3eaf0b234b96623a4 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 9 Jul 2019 12:18:01 +0000 Subject: [PATCH 06/45] docs: remove mention of long-deprecated boot2docker --- README.md | 3 +-- site/plugins.md | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe82541286..1b9cc7ddeb 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,7 @@ scope launch ``` This script downloads and runs a recent Scope image from Docker Hub. -Now, open your web browser to **http://localhost:4040**. (If you're using -boot2docker, replace localhost with the output of `boot2docker ip`.) +Now, open your web browser to **http://localhost:4040**. For instructions on installing Scope on [Kubernetes](https://www.weave.works/docs/scope/latest/installing/#k8s), [DCOS](https://www.weave.works/docs/scope/latest/installing/#dcos), or [ECS](https://www.weave.works/docs/scope/latest/installing/#ecs), see [the docs](https://www.weave.works/docs/scope/latest/introducing/). diff --git a/site/plugins.md b/site/plugins.md index daecbe6b0a..7cdd90cc12 100644 --- a/site/plugins.md +++ b/site/plugins.md @@ -34,7 +34,7 @@ Official Weave Scope plugins can be found at [Weaveworks Plugins](https://github * Number of HTTP requests per seconds. * Number of HTTP responses code per second (per code). ->**Note:** The HTTP Statistics plugin requires a [recent kernel version with ebpf support](https://github.com/iovisor/bcc/blob/master/INSTALL.md#kernel-configuration) and it will not compile on [dlite](https://github.com/nlf/dlite) or on boot2docker hosts. +>**Note:** The HTTP Statistics plugin requires a [recent kernel version with ebpf support](https://github.com/iovisor/bcc/blob/master/INSTALL.md#kernel-configuration) and it will not compile on [dlite](https://github.com/nlf/dlite) hosts. * [Traffic Control](https://github.com/weaveworks-plugins/scope-traffic-control): This plugin allows you to modify latency and packet loss for a specific container via controls from the container's detailed view in the Scope user interface. From 8e93cce5d650c5e0c3bc33f45cb4c5804f9f9bd2 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 9 Jul 2019 12:20:04 +0000 Subject: [PATCH 07/45] docs: help users to avoid opening their computer to the Internet --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1b9cc7ddeb..fc4f853492 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ If you would like to see your name added, let us know on Slack, or send a PR ple ## Getting Started +Ensure your computer is behind a firewall that blocks port 4040 then, + ```console sudo curl -L git.io/scope -o /usr/local/bin/scope sudo chmod a+x /usr/local/bin/scope From d956150706807d64060bff62d9d03be5d96ceff3 Mon Sep 17 00:00:00 2001 From: Samuel Date: Wed, 24 Jul 2019 03:12:13 -0700 Subject: [PATCH 08/45] bump_license --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 0eb9687b6f..812e0a0251 100644 --- a/LICENSE +++ b/LICENSE @@ -176,7 +176,7 @@ END OF TERMS AND CONDITIONS - Copyright 2014-2018 Weaveworks Ltd. + Copyright 2014-2019 Weaveworks Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From b22bde4a7d68c41a138a003d772c27d063075e2f Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 16 Jul 2019 16:23:34 +0000 Subject: [PATCH 09/45] fix(probe): Update tcptracer-bpf package to cure out-of-order events Avoid ebpf events out of order by adding offset to time. --- .../tcptracer-bpf/pkg/tracer/event.go | 12 +++++++-- .../weaveworks/tcptracer-bpf/tests/tracer.go | 27 ++++++++++++------- vendor/manifest | 2 +- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/vendor/github.com/weaveworks/tcptracer-bpf/pkg/tracer/event.go b/vendor/github.com/weaveworks/tcptracer-bpf/pkg/tracer/event.go index cd874297b0..2ee9a25076 100644 --- a/vendor/github.com/weaveworks/tcptracer-bpf/pkg/tracer/event.go +++ b/vendor/github.com/weaveworks/tcptracer-bpf/pkg/tracer/event.go @@ -1,3 +1,5 @@ +// +build linux + package tracer import ( @@ -37,9 +39,15 @@ func tcpV4ToGo(data *[]byte) (ret TcpV4) { return } +// Offset added to all timestamps, to hold back events so they are less +// likely to be reported out of order. Value is in nanoseconds. +var ( + TimestampOffset uint64 = 100000 +) + func tcpV4Timestamp(data *[]byte) uint64 { eventC := (*C.struct_tcp_ipv4_event_t)(unsafe.Pointer(&(*data)[0])) - return uint64(eventC.timestamp) + return uint64(eventC.timestamp) + TimestampOffset } func tcpV6ToGo(data *[]byte) (ret TcpV6) { @@ -72,5 +80,5 @@ func tcpV6ToGo(data *[]byte) (ret TcpV6) { func tcpV6Timestamp(data *[]byte) uint64 { eventC := (*C.struct_tcp_ipv6_event_t)(unsafe.Pointer(&(*data)[0])) - return uint64(eventC.timestamp) + return uint64(eventC.timestamp) + TimestampOffset } diff --git a/vendor/github.com/weaveworks/tcptracer-bpf/tests/tracer.go b/vendor/github.com/weaveworks/tcptracer-bpf/tests/tracer.go index fe7d9dac56..48dbb87275 100644 --- a/vendor/github.com/weaveworks/tcptracer-bpf/tests/tracer.go +++ b/vendor/github.com/weaveworks/tcptracer-bpf/tests/tracer.go @@ -11,6 +11,15 @@ import ( "github.com/weaveworks/tcptracer-bpf/pkg/tracer" ) +const ( + OK = iota + BAD_ARGUMENTS + TRACER_INSERT_FAILED + PROCESS_NOT_FOUND + TCP_EVENT_LATE + TCP_EVENTS_LOST +) + var watchFdInstallPids string type tcpEventTracer struct { @@ -29,7 +38,7 @@ func (t *tcpEventTracer) TCPEventV4(e tracer.TcpV4) { if t.lastTimestampV4 > e.Timestamp { fmt.Printf("ERROR: late event!\n") - os.Exit(1) + os.Exit(TCP_EVENT_LATE) } t.lastTimestampV4 = e.Timestamp @@ -41,7 +50,7 @@ func (t *tcpEventTracer) TCPEventV6(e tracer.TcpV6) { if t.lastTimestampV6 > e.Timestamp { fmt.Printf("ERROR: late event!\n") - os.Exit(1) + os.Exit(TCP_EVENT_LATE) } t.lastTimestampV6 = e.Timestamp @@ -49,12 +58,12 @@ func (t *tcpEventTracer) TCPEventV6(e tracer.TcpV6) { func (t *tcpEventTracer) LostV4(count uint64) { fmt.Printf("ERROR: lost %d events!\n", count) - os.Exit(1) + os.Exit(TCP_EVENTS_LOST) } func (t *tcpEventTracer) LostV6(count uint64) { fmt.Printf("ERROR: lost %d events!\n", count) - os.Exit(1) + os.Exit(TCP_EVENTS_LOST) } func init() { @@ -66,13 +75,13 @@ func init() { func main() { if flag.NArg() > 1 { flag.Usage() - os.Exit(1) + os.Exit(BAD_ARGUMENTS) } t, err := tracer.NewTracer(&tcpEventTracer{}) if err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) - os.Exit(1) + os.Exit(TRACER_INSERT_FAILED) } t.Start() @@ -85,14 +94,12 @@ func main() { pid, err := strconv.ParseUint(p, 10, 32) if err != nil { fmt.Fprintf(os.Stderr, "Invalid pid: %v\n", err) - os.Exit(1) + os.Exit(PROCESS_NOT_FOUND) } fmt.Printf("Monitor fdinstall events for pid %d\n", pid) t.AddFdInstallWatcher(uint32(pid)) } - - fmt.Printf("Ready\n") - + sig := make(chan os.Signal, 1) signal.Notify(sig, os.Interrupt, os.Kill) diff --git a/vendor/manifest b/vendor/manifest index 48600d8bb4..efde051d6e 100644 --- a/vendor/manifest +++ b/vendor/manifest @@ -2037,7 +2037,7 @@ "importpath": "github.com/weaveworks/tcptracer-bpf", "repository": "https://github.com/weaveworks/tcptracer-bpf", "vcs": "git", - "revision": "6dca783d10f7ba0c8fe707e5e210a8d3114af4c0", + "revision": "cd53e7c84baca8cc63cb689185b93a14b0169848", "branch": "master", "notests": true }, From 86bb9312d525f5908a3cc03281633759a90159b5 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 31 Jul 2019 13:20:31 +0000 Subject: [PATCH 10/45] Add another warning about exposing on the Internet --- site/installing.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/site/installing.md b/site/installing.md index 976d9dc770..4b9105776a 100644 --- a/site/installing.md +++ b/site/installing.md @@ -168,6 +168,11 @@ Allowable parameters for the launcher URL: The URL is: http://localhost:4040. +>**Note:** Do not expose the Scope service to the Internet, e.g. by + changing the type to NodePort or LoadBalancer. Scope allows anyone + with access to the user interface control over your hosts and + containers. + ### Kubernetes (local clone) A simple way to get Scope running in a Kubernetes setting is to From 2ebbb1cb10e190df7a6d1c9b5e4ed6a48bbfd73b Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 31 Jul 2019 13:21:40 +0000 Subject: [PATCH 11/45] Remove quay.io from release script --- bin/release | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/release b/bin/release index a4a95f9ef1..8ffdfaa50b 100755 --- a/bin/release +++ b/bin/release @@ -235,21 +235,19 @@ publish() { } tag_images() { - echo "== Tagging images for docker hub and quay.io as user $DOCKERHUB_USER" + echo "== Tagging images for docker hub as user $DOCKERHUB_USER" for IMAGE in "scope" "cloud-agent"; do $SUDO docker tag "$DOCKERHUB_USER/$IMAGE" "$DOCKERHUB_USER/$IMAGE:$VERSION" $SUDO docker tag "$DOCKERHUB_USER/$IMAGE:$VERSION" "$DOCKERHUB_USER/$IMAGE:latest_release" - $SUDO docker tag "$DOCKERHUB_USER/$IMAGE:$VERSION" "quay.io/$DOCKERHUB_USER/$IMAGE:$VERSION" done echo "** Docker images tagged" } push_images() { - echo "== Pushing images on docker hub and quay.io as user $DOCKERHUB_USER" + echo "== Pushing images on docker hub as user $DOCKERHUB_USER" for IMAGE in "scope" "cloud-agent"; do $SUDO docker push "$DOCKERHUB_USER/$IMAGE:$VERSION" $SUDO docker push "$DOCKERHUB_USER/$IMAGE:latest_release" - $SUDO docker push "quay.io/$DOCKERHUB_USER/$IMAGE:$VERSION" done echo "** Docker images pushed" } From bdbc50298ccd15ed77a6e19dce93ea79e067d3e4 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 31 Jul 2019 13:20:45 +0000 Subject: [PATCH 12/45] Bold the warning about exposing on the Internet --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc4f853492..30313e0e7e 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ If you would like to see your name added, let us know on Slack, or send a PR ple ## Getting Started -Ensure your computer is behind a firewall that blocks port 4040 then, +**Ensure your computer is behind a firewall that blocks port 4040** then, ```console sudo curl -L git.io/scope -o /usr/local/bin/scope From c3ff3cac5634ee0cb4fe4937413379c3e8a3b241 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 31 Jul 2019 14:08:05 +0000 Subject: [PATCH 13/45] Release 1.11.4 --- CHANGELOG.md | 17 +++++++++++++++++ examples/cri/deploy.yaml | 2 +- examples/cri/ds.yaml | 2 +- examples/docker/docker-compose-probe-v1.yml | 2 +- examples/docker/docker-compose-probe-v2.yml | 2 +- examples/k8s/deploy.yaml | 2 +- examples/k8s/ds.yaml | 2 +- examples/k8s/probe-deploy.yaml | 2 +- examples/mesos/minimesos.json | 2 +- site/installing.md | 4 ++-- 10 files changed, 27 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b20864146a..1018e02472 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +## Release 1.11.4 + +This release contains a few fixes, one of which should improve +resource usage on hosts that have a lot of TCP connections. + +- Improve eBPF connection tracker to reduce the number of times it + restarts and falls back to a less efficient mechanism. + [#3653](https://github.com/weaveworks/scope/pull/3653) +- Add reporter name to probe error logs. Thanks to @princerachit + [#3363](https://github.com/weaveworks/scope/pull/3363) +- Defer metrics registration until we need it + [#3605](https://github.com/weaveworks/scope/pull/3605) +- Remove unused metric SpyDuration + [#3646](https://github.com/weaveworks/scope/pull/3646) +- Remove quay.io from release script + [#3657](https://github.com/weaveworks/scope/pull/3657) + ## Release 1.11.3 This is a bugfix release, which should improve some cases where diff --git a/examples/cri/deploy.yaml b/examples/cri/deploy.yaml index c8b878da76..b4b778c43c 100644 --- a/examples/cri/deploy.yaml +++ b/examples/cri/deploy.yaml @@ -25,7 +25,7 @@ spec: args: - '--no-probe' env: [] - image: weaveworks/scope:1.11.3 + image: weaveworks/scope:1.11.4 imagePullPolicy: IfNotPresent ports: - containerPort: 4040 diff --git a/examples/cri/ds.yaml b/examples/cri/ds.yaml index 2f249b238a..28587b1b57 100644 --- a/examples/cri/ds.yaml +++ b/examples/cri/ds.yaml @@ -34,7 +34,7 @@ spec: fieldRef: apiVersion: v1 fieldPath: spec.nodeName - image: weaveworks/scope:1.11.3 + image: weaveworks/scope:1.11.4 imagePullPolicy: IfNotPresent securityContext: privileged: true diff --git a/examples/docker/docker-compose-probe-v1.yml b/examples/docker/docker-compose-probe-v1.yml index 4ff61c2bdc..4c459d3546 100644 --- a/examples/docker/docker-compose-probe-v1.yml +++ b/examples/docker/docker-compose-probe-v1.yml @@ -1,5 +1,5 @@ probe: - image: weaveworks/scope:1.11.3 + image: weaveworks/scope:1.11.4 net: "host" pid: "host" privileged: true diff --git a/examples/docker/docker-compose-probe-v2.yml b/examples/docker/docker-compose-probe-v2.yml index 2466239f90..9d84c710e8 100644 --- a/examples/docker/docker-compose-probe-v2.yml +++ b/examples/docker/docker-compose-probe-v2.yml @@ -1,7 +1,7 @@ version: '2' services: probe: - image: weaveworks/scope:1.11.3 + image: weaveworks/scope:1.11.4 network_mode: "host" pid: "host" privileged: true diff --git a/examples/k8s/deploy.yaml b/examples/k8s/deploy.yaml index 471494c41b..1d636b785b 100644 --- a/examples/k8s/deploy.yaml +++ b/examples/k8s/deploy.yaml @@ -28,7 +28,7 @@ spec: args: - '--no-probe' env: [] - image: weaveworks/scope:1.11.3 + image: weaveworks/scope:1.11.4 imagePullPolicy: IfNotPresent ports: - containerPort: 4040 diff --git a/examples/k8s/ds.yaml b/examples/k8s/ds.yaml index 337848bf74..580d1a9b7a 100644 --- a/examples/k8s/ds.yaml +++ b/examples/k8s/ds.yaml @@ -31,7 +31,7 @@ spec: - '--probe.docker.bridge=docker0' - '--probe.docker=true' - 'weave-scope-app.weave.svc.cluster.local.:80' - image: weaveworks/scope:1.11.3 + image: weaveworks/scope:1.11.4 imagePullPolicy: IfNotPresent resources: requests: diff --git a/examples/k8s/probe-deploy.yaml b/examples/k8s/probe-deploy.yaml index 1469e489e5..71df93f1b0 100644 --- a/examples/k8s/probe-deploy.yaml +++ b/examples/k8s/probe-deploy.yaml @@ -35,7 +35,7 @@ spec: - 'weave-scope-app.weave.svc.cluster.local.:80' command: - /home/weave/scope - image: 'docker.io/weaveworks/scope:1.11.3' + image: 'docker.io/weaveworks/scope:1.11.4' imagePullPolicy: IfNotPresent resources: requests: diff --git a/examples/mesos/minimesos.json b/examples/mesos/minimesos.json index 07143ef12b..b2d1b5a979 100644 --- a/examples/mesos/minimesos.json +++ b/examples/mesos/minimesos.json @@ -12,7 +12,7 @@ "container": { "type": "DOCKER", "docker": { - "image": "weaveworks/scope:1.11.3", + "image": "weaveworks/scope:1.11.4", "network": "HOST", "privileged": true, "parameters": [ diff --git a/site/installing.md b/site/installing.md index 976d9dc770..3ce81c4bb4 100644 --- a/site/installing.md +++ b/site/installing.md @@ -112,7 +112,7 @@ After it’s been launched, open your browser to `http://localhost:4040`. **Docker Compose Format Version 1:** scope: - image: weaveworks/scope:1.11.3 + image: weaveworks/scope:1.11.4 net: "host" pid: "host" privileged: true @@ -128,7 +128,7 @@ After it’s been launched, open your browser to `http://localhost:4040`. version: '2' services: scope: - image: weaveworks/scope:1.11.3 + image: weaveworks/scope:1.11.4 network_mode: "host" pid: "host" privileged: true From c377040a731dc20ab1219a52a6eff133583f04e6 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Thu, 22 Nov 2018 18:22:06 +0530 Subject: [PATCH 14/45] Update with latest changes * Add OpenEBS CRs clientset Signed-off-by: Akash Srivastava * Add SP and Disk Support Signed-off-by: Akash Srivastava * Add new sub-topology under Hosts Signed-off-by: Akash Srivastava * Update circle-ci from 1.0 to 2.0 Signed-off-by: Akash Srivastava * Fix unit tests in render and kubernetes Signed-off-by: Akash Srivastava * Update circle-ci config.yaml to install dependencies Signed-off-by: Akash Srivastava --- .circleci/config.yml | 94 +- app/api_topologies.go | 28 +- client/app/scripts/contrast-theme.js | 4 + probe/kubernetes/client.go | 41 + probe/kubernetes/disk.go | 39 + probe/kubernetes/pod.go | 54 + probe/kubernetes/reporter.go | 108 +- probe/kubernetes/reporter_test.go | 6 + probe/kubernetes/storagepoolclaim.go | 36 + render/detailed/node.go | 14 + render/detailed/node_test.go | 6 +- render/detailed/summary.go | 34 +- render/expected/expected.go | 44 - render/host.go | 33 + render/persistentvolume.go | 56 +- render/pod.go | 1 - render/selectors.go | 2 + render/storagerenderer.go | 45 + report/id.go | 12 + report/map_keys.go | 16 + report/report.go | 28 + .../maya/pkg/apis/openebs.io/register.go | 6 + .../pkg/apis/openebs.io/v1alpha1/cas_keys.go | 96 ++ .../pkg/apis/openebs.io/v1alpha1/cas_pool.go | 94 ++ .../apis/openebs.io/v1alpha1/cas_snapshot.go | 85 ++ .../apis/openebs.io/v1alpha1/cas_template.go | 124 ++ .../openebs.io/v1alpha1/cas_template_keys.go | 305 +++++ .../apis/openebs.io/v1alpha1/cas_volume.go | 170 +++ .../apis/openebs.io/v1alpha1/cstor_pool.go | 101 ++ .../apis/openebs.io/v1alpha1/cstor_volume.go | 73 ++ .../v1alpha1/cstor_volume_replica.go | 92 ++ .../openebs.io/v1alpha1/cstorvolume.proto | 30 + .../maya/pkg/apis/openebs.io/v1alpha1/disk.go | 81 ++ .../maya/pkg/apis/openebs.io/v1alpha1/doc.go | 5 + .../pkg/apis/openebs.io/v1alpha1/register.go | 55 + .../apis/openebs.io/v1alpha1/storage_pool.go | 58 + .../openebs.io/v1alpha1/storage_pool_claim.go | 66 + .../v1alpha1/zz_generated.deepcopy.go | 1094 +++++++++++++++++ .../client/clientset/versioned/clientset.go | 98 ++ .../pkg/client/clientset/versioned/doc.go | 20 + .../versioned/fake/clientset_generated.go | 82 ++ .../client/clientset/versioned/fake/doc.go | 20 + .../clientset/versioned/fake/register.go | 56 + .../client/clientset/versioned/scheme/doc.go | 20 + .../clientset/versioned/scheme/register.go | 56 + .../typed/openebs.io/v1alpha1/castemplate.go | 147 +++ .../typed/openebs.io/v1alpha1/cstorpool.go | 147 +++ .../typed/openebs.io/v1alpha1/cstorvolume.go | 157 +++ .../openebs.io/v1alpha1/cstorvolumereplica.go | 157 +++ .../typed/openebs.io/v1alpha1/disk.go | 147 +++ .../typed/openebs.io/v1alpha1/doc.go | 20 + .../typed/openebs.io/v1alpha1/fake/doc.go | 20 + .../v1alpha1/fake/fake_castemplate.go | 120 ++ .../v1alpha1/fake/fake_cstorpool.go | 120 ++ .../v1alpha1/fake/fake_cstorvolume.go | 128 ++ .../v1alpha1/fake/fake_cstorvolumereplica.go | 128 ++ .../openebs.io/v1alpha1/fake/fake_disk.go | 120 ++ .../v1alpha1/fake/fake_openebs.io_client.go | 68 + .../openebs.io/v1alpha1/fake/fake_runtask.go | 128 ++ .../v1alpha1/fake/fake_storagepool.go | 120 ++ .../v1alpha1/fake/fake_storagepoolclaim.go | 120 ++ .../v1alpha1/generated_expansion.go | 35 + .../openebs.io/v1alpha1/openebs.io_client.go | 125 ++ .../typed/openebs.io/v1alpha1/runtask.go | 157 +++ .../typed/openebs.io/v1alpha1/storagepool.go | 147 +++ .../openebs.io/v1alpha1/storagepoolclaim.go | 147 +++ .../informers/externalversions/factory.go | 180 +++ .../informers/externalversions/generic.go | 76 ++ .../internalinterfaces/factory_interfaces.go | 40 + .../externalversions/openebs.io/interface.go | 46 + .../openebs.io/v1alpha1/castemplate.go | 88 ++ .../openebs.io/v1alpha1/cstorpool.go | 88 ++ .../openebs.io/v1alpha1/cstorvolume.go | 89 ++ .../openebs.io/v1alpha1/cstorvolumereplica.go | 89 ++ .../openebs.io/v1alpha1/disk.go | 88 ++ .../openebs.io/v1alpha1/interface.go | 94 ++ .../openebs.io/v1alpha1/runtask.go | 89 ++ .../openebs.io/v1alpha1/storagepool.go | 88 ++ .../openebs.io/v1alpha1/storagepoolclaim.go | 88 ++ .../openebs.io/v1alpha1/castemplate.go | 65 + .../listers/openebs.io/v1alpha1/cstorpool.go | 65 + .../openebs.io/v1alpha1/cstorvolume.go | 94 ++ .../openebs.io/v1alpha1/cstorvolumereplica.go | 94 ++ .../listers/openebs.io/v1alpha1/disk.go | 65 + .../v1alpha1/expansion_generated.go | 63 + .../listers/openebs.io/v1alpha1/runtask.go | 94 ++ .../openebs.io/v1alpha1/storagepool.go | 65 + .../openebs.io/v1alpha1/storagepoolclaim.go | 65 + 88 files changed, 7723 insertions(+), 136 deletions(-) create mode 100644 client/app/scripts/contrast-theme.js create mode 100644 probe/kubernetes/disk.go create mode 100644 probe/kubernetes/storagepoolclaim.go create mode 100644 render/storagerenderer.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/register.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_keys.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_pool.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_snapshot.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_template.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_template_keys.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_volume.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_pool.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_volume.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_volume_replica.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstorvolume.proto create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/disk.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/doc.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool_claim.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/clientset.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/doc.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/clientset_generated.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/doc.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/register.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/doc.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/register.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/castemplate.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorpool.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolume.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolumereplica.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/disk.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/doc.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/doc.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_castemplate.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpool.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolume.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumereplica.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_disk.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_runtask.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepool.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepoolclaim.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/runtask.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepool.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepoolclaim.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/factory.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/interface.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/castemplate.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorpool.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolume.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolumereplica.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/disk.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/runtask.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepool.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepoolclaim.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/castemplate.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorpool.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolume.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolumereplica.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/disk.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/runtask.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepool.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepoolclaim.go diff --git a/.circleci/config.yml b/.circleci/config.yml index 50392b1660..6e60f66d04 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ defaults: &defaults client-defaults: &client-defaults working_directory: /home/weave/scope docker: - - image: weaveworks/scope-ui-build:master-c0b60a16 + - image: weaveworks/scope-ui-build:master-fda40b83 workflows: version: 2 @@ -31,10 +31,17 @@ workflows: - lint - unit-test - build - - deploy: + - deploy-stag: filters: branches: - only: master + only: staging + requires: + - client-test + - integration-tests + - deploy-prod: + filters: + branches: + only: production requires: - client-test - integration-tests @@ -51,6 +58,8 @@ jobs: parallelism: 1 steps: - checkout + + - run: COVERDIR=./coverage make BUILD_IN_CONTAINER=false CODECGEN_UID=23 tests - persist_to_workspace: root: . @@ -62,52 +71,26 @@ jobs: <<: *client-defaults steps: - checkout - - restore_cache: - name: Restoring Yarn Cache - key: yarn-cache-2-{{ checksum "client/yarn.lock" }} - - restore_cache: - name: Restoring client/node_modules - key: node-modules-{{ checksum "client/yarn.lock" }}-{{ checksum ".circleci/config.yml" }} - - run: cd client; yarn install - - save_cache: - name: Saving Yarn Cache - key: yarn-cache-2-{{ checksum "client/yarn.lock" }} - paths: - - "/home/weave/scope/.cache/yarn" - - save_cache: - name: Saving client/node_modules - # include the CI config in the checksum because it will change when the docker image changes - key: node-modules-{{ checksum "client/yarn.lock" }}-{{ checksum ".circleci/config.yml" }} - paths: - - "/home/weave/scope/client/node_modules" - - run: | - cd client - yarn run build - yarn run build-external - yarn run bundle + # Convoluted set of steps here to mimic Makefile actions of bind-mounting different dirs into container + - run: mv client/* /home/weave/ + - run: cd /home/weave; mkdir build ; yarn install; yarn run build ; mv build scope/client + - run: cd /home/weave; mkdir build-external; yarn install; yarn run build-external; mv build-external scope/client + - run: cd /home/weave; mkdir tmp ; yarn install; yarn run bundle ; mv tmp scope - persist_to_workspace: root: /home/weave/scope paths: - client/build/ - client/build-external/ - - client/bundle/weave-scope.tgz - + - tmp/weave-scope.tgz client-test: <<: *client-defaults steps: - checkout - - restore_cache: - name: Restoring Yarn Cache - key: yarn-cache-2-{{ checksum "client/yarn.lock" }} - - restore_cache: - name: Restoring client/node_modules - key: node-modules-{{ checksum "client/yarn.lock" }}-{{ checksum ".circleci/config.yml" }} - run: | - cd client - yarn install - yarn run lint - yarn test + mv client/app client/test /home/weave/ + cd /home/weave; yarn run lint + cd /home/weave; yarn test xplatform-build: <<: *defaults @@ -154,7 +137,7 @@ jobs: sudo apt-get update sudo apt-get install python-pip jq pv - run: mkdir $CIRCLE_ARTIFACTS - # kick off creation of test VMs + # kick off creation of test VM - run: test -z "$SECRET_PASSWORD" || bin/setup-circleci-secrets "$SECRET_PASSWORD" - run: test -z "$SECRET_PASSWORD" || (cd integration; ./gce.sh make_template) - run: test -z "$SECRET_PASSWORD" || (cd integration; ./gce.sh setup && eval $(./gce.sh hosts); ./setup.sh) @@ -174,7 +157,7 @@ jobs: - store_artifacts: path: /tmp/artifacts - deploy: + deploy-stag: <<: *defaults environment: IMAGES: scope cloud-agent @@ -191,14 +174,27 @@ jobs: test -z "${DOCKER_USER}" && exit 0 docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS for IMAGE in $IMAGES; do - test "${DOCKER_ORGANIZATION:-$DOCKER_USER}" = "weaveworks" || docker tag weaveworks/$IMAGE:latest ${DOCKER_ORGANIZATION:-$DOCKER_USER}/$IMAGE:latest - docker tag weaveworks/$IMAGE:latest ${DOCKER_ORGANIZATION:-$DOCKER_USER}/$IMAGE:$(./tools/image-tag) - docker push ${DOCKER_ORGANIZATION:-$DOCKER_USER}/$IMAGE:latest - docker push ${DOCKER_ORGANIZATION:-$DOCKER_USER}/$IMAGE:$(./tools/image-tag) + docker tag weaveworks/scope:latest openebs/scope:latest + docker push openebs/scope:latest done + + deploy-prod: + <<: *defaults + environment: + IMAGES: scope cloud-agent + steps: + - checkout + - setup_remote_docker + - attach_workspace: + at: . + - run: | + pip install awscli + docker load -i scope.tar + docker load -i cloud-agent.tar - run: | - test -z "${QUAY_USER}" && exit 0 - docker login -e '.' -u "$QUAY_USER" -p "$QUAY_PASSWORD" quay.io - docker tag weaveworks/scope:$(./tools/image-tag) "quay.io/${QUAY_ORGANIZATION}/scope:$(./tools/image-tag)" - docker push "quay.io/${QUAY_ORGANIZATION}/scope:$(./tools/image-tag)" - - run: test -z "${UI_BUCKET_KEY_ID}" || (make BUILD_IN_CONTAINER=false ui-upload ui-pkg-upload) + test -z "${DOCKER_USER}" && exit 0 + docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS + for IMAGE in $IMAGES; do + docker tag weaveworks/scope:latest openebs/scope:v1.11.$CIRCLE_BUILD_NUM + docker push openebs/scope:v1.11.$CIRCLE_BUILD_NUM + done diff --git a/app/api_topologies.go b/app/api_topologies.go index 136d6960f6..580c4edaa5 100644 --- a/app/api_topologies.go +++ b/app/api_topologies.go @@ -36,6 +36,8 @@ const ( ecsTasksID = "ecs-tasks" ecsServicesID = "ecs-services" swarmServicesID = "swarm-services" + poolsID = "pools" + volumesID = "volumes" ) var ( @@ -246,7 +248,7 @@ func MakeRegistry() *Registry { renderer: render.PodRenderer, Name: "Pods", Rank: 3, - Options: []APITopologyOptionGroup{snapshotFilter, storageFilter, unmanagedFilter}, + Options: []APITopologyOptionGroup{unmanagedFilter}, HideIfEmpty: true, }, APITopologyDesc{ @@ -295,11 +297,27 @@ func MakeRegistry() *Registry { Name: "Hosts", Rank: 4, }, + // APITopologyDesc{ + // id: weaveID, + // parent: hostsID, + // renderer: render.WeaveRenderer, + // Name: "Weave Net", + // }, APITopologyDesc{ - id: weaveID, - parent: hostsID, - renderer: render.WeaveRenderer, - Name: "Weave Net", + id: poolsID, + parent: hostsID, + renderer: render.KubernetesStorageRenderer, + Name: "Pools", + Options: []APITopologyOptionGroup{}, + HideIfEmpty: true, + }, + APITopologyDesc{ + id: volumesID, + parent: hostsID, + renderer: render.KubernetesVolumesRenderer, + Name: "Volumes", + Options: []APITopologyOptionGroup{snapshotFilter, unmanagedFilter}, + HideIfEmpty: true, }, ) diff --git a/client/app/scripts/contrast-theme.js b/client/app/scripts/contrast-theme.js new file mode 100644 index 0000000000..c8a3683ef2 --- /dev/null +++ b/client/app/scripts/contrast-theme.js @@ -0,0 +1,4 @@ +// import '../styles/contrast.scss'; + +// replacing contrast theme with main (normal) theme +import '../styles/main.scss'; diff --git a/probe/kubernetes/client.go b/probe/kubernetes/client.go index 352ba855d3..fa6f082fb4 100644 --- a/probe/kubernetes/client.go +++ b/probe/kubernetes/client.go @@ -14,6 +14,10 @@ import ( snapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" snapshot "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned" + + mayav1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + mayaclient "github.com/openebs/maya/pkg/client/clientset/versioned" + "github.com/pborman/uuid" log "github.com/sirupsen/logrus" apiappsv1 "k8s.io/api/apps/v1" @@ -56,6 +60,8 @@ type Client interface { WalkVolumeSnapshots(f func(VolumeSnapshot) error) error WalkVolumeSnapshotData(f func(VolumeSnapshotData) error) error WalkJobs(f func(Job) error) error + WalkDisks(f func(Disk) error) error + WalkStoragePoolClaims(f func(StoragePoolClaim) error) error WatchPods(f func(Event, Pod)) @@ -88,6 +94,7 @@ type client struct { quit chan struct{} client *kubernetes.Clientset snapshotClient *snapshot.Clientset + mayaClient *mayaclient.Clientset podStore cache.Store serviceStore cache.Store deploymentStore cache.Store @@ -102,6 +109,8 @@ type client struct { storageClassStore cache.Store volumeSnapshotStore cache.Store volumeSnapshotDataStore cache.Store + diskStore cache.Store + storagePoolClaimStore cache.Store podWatchesMutex sync.Mutex podWatches []func(Event, Pod) @@ -175,10 +184,16 @@ func NewClient(config ClientConfig) (Client, error) { return nil, err } + mc, err := mayaclient.NewForConfig(restConfig) + if err != nil { + return nil, err + } + result := &client{ quit: make(chan struct{}), client: c, snapshotClient: sc, + mayaClient: mc, } result.podStore = NewEventStore(result.triggerPodWatches, cache.MetaNamespaceKeyFunc) @@ -197,6 +212,8 @@ func NewClient(config ClientConfig) (Client, error) { result.storageClassStore = result.setupStore("storageclasses") result.volumeSnapshotStore = result.setupStore("volumesnapshots") result.volumeSnapshotDataStore = result.setupStore("volumesnapshotdatas") + result.diskStore = result.setupStore("disks") + result.storagePoolClaimStore = result.setupStore("storagepoolclaims") return result, nil } @@ -253,6 +270,10 @@ func (c *client) clientAndType(resource string) (rest.Interface, interface{}, er return c.snapshotClient.VolumesnapshotV1().RESTClient(), &snapshotv1.VolumeSnapshot{}, nil case "volumesnapshotdatas": return c.snapshotClient.VolumesnapshotV1().RESTClient(), &snapshotv1.VolumeSnapshotData{}, nil + case "disks": + return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.Disk{}, nil + case "storagepoolclaims": + return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.StoragePoolClaim{}, nil case "cronjobs": ok, err := c.isResourceSupported(c.client.BatchV1beta1().RESTClient().APIVersion(), resource) if err != nil { @@ -467,6 +488,26 @@ func (c *client) WalkJobs(f func(Job) error) error { return nil } +func (c *client) WalkDisks(f func(Disk) error) error { + for _, m := range c.diskStore.List() { + disk := m.(*mayav1alpha1.Disk) + if err := f(NewDisk(disk)); err != nil { + return err + } + } + return nil +} + +func (c *client) WalkStoragePoolClaims(f func(StoragePoolClaim) error) error { + for _, m := range c.storagePoolClaimStore.List() { + spc := m.(*mayav1alpha1.StoragePoolClaim) + if err := f(NewStoragePoolClaim(spc)); err != nil { + return err + } + } + return nil +} + func (c *client) CloneVolumeSnapshot(namespaceID, volumeSnapshotID, persistentVolumeClaimID, capacity string) error { var scName string var claimSize string diff --git a/probe/kubernetes/disk.go b/probe/kubernetes/disk.go new file mode 100644 index 0000000000..22591c1cc5 --- /dev/null +++ b/probe/kubernetes/disk.go @@ -0,0 +1,39 @@ +package kubernetes + +import ( + "strconv" + + maya1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "github.com/weaveworks/scope/report" +) + +// Disk represent NDM Disk interface +type Disk interface { + Meta + GetNode() report.Node +} + +// disk represents NDM Disks +type disk struct { + *maya1alpha1.Disk + Meta +} + +// NewDisk returns new Disk type +func NewDisk(p *maya1alpha1.Disk) Disk { + return &disk{Disk: p, Meta: meta{p.ObjectMeta}} +} + +// GetNode returns Disk as Node +func (p *disk) GetNode() report.Node { + return p.MetaNode(report.MakeDiskNodeID(p.UID())).WithLatests(map[string]string{ + NodeType: "Disk", + LogicalSectorSize: strconv.Itoa(int(p.Spec.Capacity.LogicalSectorSize)), + Storage: strconv.Itoa(int(p.Spec.Capacity.Storage / (1024 * 1024 * 1024))), + FirmwareRevision: p.Spec.Details.FirmwareRevision, + Model: p.Spec.Details.Model, + Serial: p.Spec.Details.Serial, + Vendor: p.Spec.Details.Vendor, + HostName: p.GetLabels()["kubernetes.io/hostname"], + }) +} diff --git a/probe/kubernetes/pod.go b/probe/kubernetes/pod.go index cc91548e27..22ab7161ac 100644 --- a/probe/kubernetes/pod.go +++ b/probe/kubernetes/pod.go @@ -22,6 +22,21 @@ const ( StateFailed = "Failed" ) +// Pod labels to get pv name, if it is a controller/target or replica pod +const ( + PersistentVolumeLabel = "openebs.io/persistent-volume" + VSMLabel = "vsm" + PVLabel = "openebs.io/pv" +) + +// Pod label to distinguish replica pod or cstor pool pod +const ( + AppLabel = "app" + AppValue = "cstor-pool" + ReplicaPodLabel = "openebs.io/replica" + JivaReplicaValue = "jiva-replica" +) + // Pod represents a Kubernetes pod type Pod interface { Meta @@ -31,6 +46,8 @@ type Pod interface { RestartCount() uint ContainerNames() []string VolumeClaimNames() []string + GetVolumeName() string + IsReplicaOrPoolPod() bool } type pod struct { @@ -77,6 +94,33 @@ func (p *pod) RestartCount() uint { return count } +func (p *pod) IsReplicaOrPoolPod() bool { + replicaPod, _ := p.GetLabels()[ReplicaPodLabel] + cstorPoolPod, _ := p.GetLabels()[AppLabel] + if replicaPod == JivaReplicaValue || cstorPoolPod == AppValue { + return true + } + return false +} + +func (p *pod) GetVolumeName() string { + if strings.Contains(p.GetName(), "-rep-") { + return "" + } + + var volumeName string + var ok bool + + if volumeName, ok = p.GetLabels()[VSMLabel]; ok { + return volumeName + } else if volumeName, ok = p.GetLabels()[PersistentVolumeLabel]; ok { + return volumeName + } else if volumeName, ok = p.GetLabels()[PVLabel]; ok { + return volumeName + } + return "" +} + func (p *pod) VolumeClaimNames() []string { var claimNames []string for _, volume := range p.Spec.Volumes { @@ -99,12 +143,22 @@ func (p *pod) GetNode(probeID string) report.Node { // PVC name consist of lower case alphanumeric characters, "-" or "." // and must start and end with an alphanumeric character. latests[VolumeClaim] = strings.Join(p.VolumeClaimNames(), report.ScopeDelim) + latests[VolumePod] = "true" } if p.Pod.Spec.HostNetwork { latests[IsInHostNetwork] = "true" } + if p.GetVolumeName() != "" { + latests[VolumeName] = p.GetVolumeName() + latests[VolumePod] = "true" + } + + if p.IsReplicaOrPoolPod() { + latests[VolumePod] = "true" + } + return p.MetaNode(report.MakePodNodeID(p.UID())).WithLatests(latests). WithParents(p.parents). WithLatestActiveControls(GetLogs, DeletePod, Describe) diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index ff20211055..7d366d0c22 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -16,25 +16,41 @@ import ( // These constants are keys used in node metadata const ( - IP = report.KubernetesIP - ObservedGeneration = report.KubernetesObservedGeneration - Replicas = report.KubernetesReplicas - DesiredReplicas = report.KubernetesDesiredReplicas - NodeType = report.KubernetesNodeType - Type = report.KubernetesType - Ports = report.KubernetesPorts - VolumeClaim = report.KubernetesVolumeClaim - StorageClassName = report.KubernetesStorageClassName - AccessModes = report.KubernetesAccessModes - ReclaimPolicy = report.KubernetesReclaimPolicy - Status = report.KubernetesStatus - Message = report.KubernetesMessage - VolumeName = report.KubernetesVolumeName - Provisioner = report.KubernetesProvisioner - StorageDriver = report.KubernetesStorageDriver - VolumeSnapshotName = report.KubernetesVolumeSnapshotName - SnapshotData = report.KubernetesSnapshotData - VolumeCapacity = report.KubernetesVolumeCapacity + IP = report.KubernetesIP + ObservedGeneration = report.KubernetesObservedGeneration + Replicas = report.KubernetesReplicas + DesiredReplicas = report.KubernetesDesiredReplicas + NodeType = report.KubernetesNodeType + Type = report.KubernetesType + Ports = report.KubernetesPorts + VolumeClaim = report.KubernetesVolumeClaim + StorageClassName = report.KubernetesStorageClassName + AccessModes = report.KubernetesAccessModes + ReclaimPolicy = report.KubernetesReclaimPolicy + Status = report.KubernetesStatus + Message = report.KubernetesMessage + VolumeName = report.KubernetesVolumeName + Provisioner = report.KubernetesProvisioner + StorageDriver = report.KubernetesStorageDriver + VolumeSnapshotName = report.KubernetesVolumeSnapshotName + SnapshotData = report.KubernetesSnapshotData + VolumeCapacity = report.KubernetesVolumeCapacity + Model = report.KubernetesModel + LogicalSectorSize = report.KubernetesLogicalSectorSize + Storage = report.KubernetesStorage + FirmwareRevision = report.KubernetesFirmwareRevision + Serial = report.KubernetesSerial + Vendor = report.KubernetesVendor + DiskList = report.KubernetesDiskList + MaxPools = report.KubernetesMaxPools + APIVersion = report.KubernetesAPIVersion + Value = report.KubernetesValue + StoragePoolClaimName = report.KubernetesStoragePoolClaimName + DiskName = report.KubernetesDiskName + PoolName = report.KubernetesPoolName + PoolClaim = report.KubernetesPoolClaim + HostName = report.KubernetesHostName + VolumePod = report.KubernetesVolumePod ) // Exposed for testing @@ -154,6 +170,23 @@ var ( } JobMetricTemplates = PodMetricTemplates + + DiskMetadataTemplates = report.MetadataTemplates{ + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + Model: {ID: Model, Label: "Model", From: report.FromLatest, Priority: 2}, + Serial: {ID: Serial, Label: "Serial", From: report.FromLatest, Priority: 3}, + Vendor: {ID: Vendor, Label: "Vendor", From: report.FromLatest, Priority: 4}, + FirmwareRevision: {ID: FirmwareRevision, Label: "Firmware Revision", From: report.FromLatest, Priority: 5}, + LogicalSectorSize: {ID: LogicalSectorSize, Label: "Logical Sector Size", From: report.FromLatest, Priority: 6}, + Storage: {ID: Storage, Label: "Capacity", From: report.FromLatest, Priority: 7}, + } + + StoragePoolClaimMetadataTemplates = report.MetadataTemplates{ + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + APIVersion: {ID: APIVersion, Label: "API Version", From: report.FromLatest, Priority: 2}, + Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 3}, + MaxPools: {ID: MaxPools, Label: "MaxPools", From: report.FromLatest, Priority: 4}, + } TableTemplates = report.TableTemplates{ LabelPrefix: { @@ -355,7 +388,14 @@ func (r *Reporter) Report() (report.Report, error) { if err != nil { return result, err } - + diskTopology, _, err := r.diskTopology() + if err != nil { + return result, err + } + storagePoolClaimTopology, _, err := r.storagePoolClaimTopology() + if err != nil { + return result, err + } result.Pod = result.Pod.Merge(podTopology) result.Service = result.Service.Merge(serviceTopology) result.DaemonSet = result.DaemonSet.Merge(daemonSetTopology) @@ -369,6 +409,8 @@ func (r *Reporter) Report() (report.Report, error) { result.VolumeSnapshot = result.VolumeSnapshot.Merge(volumeSnapshotTopology) result.VolumeSnapshotData = result.VolumeSnapshotData.Merge(volumeSnapshotDataTopology) result.Job = result.Job.Merge(jobTopology) + result.Disk = result.Disk.Merge(diskTopology) + result.StoragePoolClaim = result.StoragePoolClaim.Merge(storagePoolClaimTopology) return result, nil } @@ -556,6 +598,32 @@ func (r *Reporter) jobTopology() (report.Topology, []Job, error) { return result, jobs, err } +func (r *Reporter) diskTopology() (report.Topology, []Disk, error) { + disks := []Disk{} + result := report.MakeTopology(). + WithMetadataTemplates(DiskMetadataTemplates). + WithTableTemplates(TableTemplates) + err := r.client.WalkDisks(func(p Disk) error { + result.AddNode(p.GetNode()) + disks = append(disks, p) + return nil + }) + return result, disks, err +} + +func (r *Reporter) storagePoolClaimTopology() (report.Topology, []StoragePoolClaim, error) { + storagePoolClaims := []StoragePoolClaim{} + result := report.MakeTopology(). + WithMetadataTemplates(StoragePoolClaimMetadataTemplates). + WithTableTemplates(TableTemplates) + err := r.client.WalkStoragePoolClaims(func(p StoragePoolClaim) error { + result.AddNode(p.GetNode()) + storagePoolClaims = append(storagePoolClaims, p) + return nil + }) + return result, storagePoolClaims, err +} + type labelledChild interface { Labels() map[string]string AddParent(string, string) diff --git a/probe/kubernetes/reporter_test.go b/probe/kubernetes/reporter_test.go index d742fb79da..cd8002149a 100644 --- a/probe/kubernetes/reporter_test.go +++ b/probe/kubernetes/reporter_test.go @@ -175,6 +175,12 @@ func (c *mockClient) WalkVolumeSnapshotData(f func(kubernetes.VolumeSnapshotData func (c *mockClient) WalkJobs(f func(kubernetes.Job) error) error { return nil } +func (c *mockClient) WalkDisks(f func(kubernetes.Disk) error) error { + return nil +} +func (c *mockClient) WalkStoragePoolClaims(f func(kubernetes.StoragePoolClaim) error) error { + return nil +} func (*mockClient) WatchPods(func(kubernetes.Event, kubernetes.Pod)) {} func (c *mockClient) GetLogs(namespaceID, podName string, _ []string) (io.ReadCloser, error) { r, ok := c.logs[namespaceID+";"+podName] diff --git a/probe/kubernetes/storagepoolclaim.go b/probe/kubernetes/storagepoolclaim.go new file mode 100644 index 0000000000..83e389bf34 --- /dev/null +++ b/probe/kubernetes/storagepoolclaim.go @@ -0,0 +1,36 @@ +package kubernetes + +import ( + mayav1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + + "strconv" + + "github.com/weaveworks/scope/report" +) + +// StoragePoolClaim represent StoragePoolClaim interface +type StoragePoolClaim interface { + Meta + GetNode() report.Node +} + +// storagePoolClaim represent the StoragePoolClaims CRD of Kubernetes +type storagePoolClaim struct { + *mayav1alpha1.StoragePoolClaim + Meta +} + +// NewStoragePoolClaim returns new StoragePoolClaim type +func NewStoragePoolClaim(p *mayav1alpha1.StoragePoolClaim) StoragePoolClaim { + return &storagePoolClaim{StoragePoolClaim: p, Meta: meta{p.ObjectMeta}} +} + +// GetNode returns StoragePoolClaim as Node +func (p *storagePoolClaim) GetNode() report.Node { + return p.MetaNode(report.MakeStoragePoolClaimNodeID(p.UID())).WithLatests(map[string]string{ + NodeType: "Storage Pool Claim", + APIVersion: p.APIVersion, + MaxPools: strconv.Itoa(int(p.Spec.MaxPools)), + Status: p.Status.Phase, + }) +} diff --git a/render/detailed/node.go b/render/detailed/node.go index 7b8b291645..9442aae0da 100644 --- a/render/detailed/node.go +++ b/render/detailed/node.go @@ -223,6 +223,20 @@ var nodeSummaryGroupSpecs = []struct { Columns: []Column{}, }, }, + { + topologyID: report.Disk, + NodeSummaryGroup: NodeSummaryGroup{ + Label: "Disks", + Columns: []Column{}, + }, + }, + { + topologyID: report.VolumeSnapshot, + NodeSummaryGroup: NodeSummaryGroup{ + Label: "Volume Snapshots", + Columns: []Column{}, + }, + }, } func children(rc RenderContext, n report.Node) []NodeSummaryGroup { diff --git a/render/detailed/node_test.go b/render/detailed/node_test.go index 5e5f9e635f..fddb33b4c8 100644 --- a/render/detailed/node_test.go +++ b/render/detailed/node_test.go @@ -5,6 +5,7 @@ import ( "fmt" "testing" + "github.com/sirupsen/logrus" "github.com/weaveworks/common/test" "github.com/weaveworks/scope/probe/docker" "github.com/weaveworks/scope/probe/host" @@ -314,6 +315,7 @@ func TestMakeDetailedPodNode(t *testing.T) { } have := detailed.MakeNode("pods", detailed.RenderContext{Report: fixture.Report}, renderableNodes, renderableNode) + logrus.Infof("Have %+v", have.Metadata) containerNodeSummary := child(t, render.ContainerWithImageNameRenderer, fixture.ServerContainerNodeID) serverProcessNodeSummary := child(t, render.ProcessRenderer, fixture.ServerProcessNodeID) want := detailed.Node{ @@ -321,7 +323,7 @@ func TestMakeDetailedPodNode(t *testing.T) { BasicNodeSummary: detailed.BasicNodeSummary{ ID: id, Label: "pong-b", - LabelMinor: "1 container", + LabelMinor: "Pod of 1 container", Rank: "ping/pong-b", Shape: "heptagon", Tag: "", @@ -378,7 +380,7 @@ func TestMakeDetailedPodNode(t *testing.T) { ID: connectionID(fixture.ClientPodNodeID, ""), NodeID: fixture.ClientPodNodeID, Label: "pong-a", - LabelMinor: "1 container", + LabelMinor: "Pod of 1 container", Metadata: []report.MetadataRow{ { ID: "port", diff --git a/render/detailed/summary.go b/render/detailed/summary.go index 6f42f79f85..72ab0fa420 100644 --- a/render/detailed/summary.go +++ b/render/detailed/summary.go @@ -90,6 +90,8 @@ var renderers = map[string]func(BasicNodeSummary, report.Node) BasicNodeSummary{ report.StorageClass: storageClassNodeSummary, report.VolumeSnapshot: volumeSnapshotNodeSummary, report.VolumeSnapshotData: volumeSnapshotDataNodeSummary, + report.Disk: diskNodeSummary, + report.StoragePoolClaim: storagePoolClaimNodeSummary, } // For each report.Topology, map to a 'primary' API topology. This can then be used in a variety of places. @@ -108,11 +110,13 @@ var primaryAPITopology = map[string]string{ report.ECSService: "ecs-services", report.SwarmService: "swarm-services", report.Host: "hosts", - report.PersistentVolume: "pods", - report.PersistentVolumeClaim: "pods", - report.StorageClass: "pods", - report.VolumeSnapshot: "pods", - report.VolumeSnapshotData: "pods", + report.PersistentVolume: "volumes", + report.PersistentVolumeClaim: "volumes", + report.StorageClass: "volumes", + report.VolumeSnapshot: "volumes", + report.VolumeSnapshotData: "volumes", + report.Disk: "hosts", + report.StoragePoolClaim: "pools", } // MakeBasicNodeSummary returns a basic summary of a node, if @@ -314,7 +318,7 @@ func addKubernetesLabelAndRank(base BasicNodeSummary, n report.Node) BasicNodeSu func podNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { base = addKubernetesLabelAndRank(base, n) - base.LabelMinor = pluralize(n.Counters, report.Container, "container", "containers") + base.LabelMinor = "Pod of " + pluralize(n.Counters, report.Container, "container", "containers") return base } @@ -391,26 +395,44 @@ func weaveNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { func persistentVolumeNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "Persistent volume" return base } func persistentVolumeClaimNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "Persistent volume claim" return base } func storageClassNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "Storage class" return base } func volumeSnapshotNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "Volume snapshot" return base } func volumeSnapshotDataNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "Volume snapshot data" + return base +} + +func diskNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { + base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "Disk" + return base +} + +func storagePoolClaimNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { + base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "Storage pool claim" + base.Stack = true return base } diff --git a/render/expected/expected.go b/render/expected/expected.go index adac162bb9..977ceb666a 100644 --- a/render/expected/expected.go +++ b/render/expected/expected.go @@ -3,7 +3,6 @@ package expected import ( "github.com/weaveworks/scope/probe/docker" "github.com/weaveworks/scope/probe/host" - "github.com/weaveworks/scope/probe/kubernetes" "github.com/weaveworks/scope/probe/process" "github.com/weaveworks/scope/render" "github.com/weaveworks/scope/report" @@ -274,49 +273,6 @@ var ( RenderedContainers[fixture.ServerContainerNodeID], )), - fixture.PersistentVolumeClaimNodeID: persistentVolumeClaim(fixture.PersistentVolumeClaimNodeID, fixture.PersistentVolumeNodeID). - WithLatests(map[string]string{ - kubernetes.Name: "pvc-6124", - kubernetes.Namespace: "ping", - kubernetes.Status: "bound", - kubernetes.VolumeName: "pongvolume", - kubernetes.AccessModes: "ReadWriteOnce", - kubernetes.StorageClassName: "standard", - }).WithChild(report.MakeNode(fixture.PersistentVolumeNodeID).WithTopology(report.PersistentVolume)), - - fixture.PersistentVolumeNodeID: persistentVolume(fixture.PersistentVolumeNodeID, fixture.VolumeSnapshotNodeID). - WithLatests(map[string]string{ - kubernetes.Name: "pongvolume", - kubernetes.Namespace: "ping", - kubernetes.Status: "bound", - kubernetes.VolumeClaim: "pvc-6124", - kubernetes.AccessModes: "ReadWriteOnce", - kubernetes.StorageClassName: "standard", - kubernetes.StorageDriver: "iSCSI", - }).WithChild(report.MakeNode(fixture.VolumeSnapshotNodeID).WithTopology(report.VolumeSnapshot)), - - fixture.StorageClassNodeID: StorageClass(fixture.StorageClassNodeID, fixture.PersistentVolumeClaimNodeID). - WithLatests(map[string]string{ - kubernetes.Name: "standard", - kubernetes.Provisioner: "pong", - }).WithChild(report.MakeNode(fixture.PersistentVolumeClaimNodeID).WithTopology(report.PersistentVolumeClaim)), - - fixture.VolumeSnapshotNodeID: volumeSnapshot(fixture.VolumeSnapshotNodeID, fixture.VolumeSnapshotDataNodeID). - WithLatests(map[string]string{ - kubernetes.Name: "vs-1234", - kubernetes.Namespace: "ping", - kubernetes.VolumeClaim: "pvc-6124", - kubernetes.SnapshotData: "vsd-1234", - kubernetes.VolumeName: "pongvolume", - }).WithChild(report.MakeNode(fixture.VolumeSnapshotDataNodeID).WithTopology(report.VolumeSnapshotData)), - - fixture.VolumeSnapshotDataNodeID: volumeSnapshotData(fixture.VolumeSnapshotDataNodeID). - WithLatests(map[string]string{ - kubernetes.Name: "vsd-1234", - kubernetes.VolumeName: "pongvolume", - kubernetes.VolumeSnapshotName: "vs-1234", - }), - UnmanagedServerID: unmanagedServerNode, render.IncomingInternetID: theIncomingInternetNode(fixture.ServerPodNodeID), render.OutgoingInternetID: theOutgoingInternetNode, diff --git a/render/host.go b/render/host.go index 26a4c5cc74..12c155f816 100644 --- a/render/host.go +++ b/render/host.go @@ -1,6 +1,10 @@ package render import ( + "context" + "strings" + + "github.com/weaveworks/scope/probe/kubernetes" "github.com/weaveworks/scope/report" ) @@ -14,6 +18,7 @@ var HostRenderer = MakeReduce( CustomRenderer{RenderFunc: nodes2Hosts, Renderer: ContainerImageRenderer}, CustomRenderer{RenderFunc: nodes2Hosts, Renderer: PodRenderer}, MapEndpoints(endpoint2Host, report.Host), + DiskRenderer, ) // nodes2Hosts maps any Nodes to host Nodes. @@ -56,3 +61,31 @@ func endpoint2Host(n report.Node) string { } return "" } + +// DiskRenderer is a Renderer which produces a renderable NDM Disk +var DiskRenderer = diskRenderer{} + +//diskRenderer is a Renderer to render disk nodes. +type diskRenderer struct{} + +//Render will render the Disk and add Adjacency in host nodes i.e Host->Disk. +func (v diskRenderer) Render(ctx context.Context, rpt report.Report) Nodes { + nodes := make(report.Nodes) + for hostNodeID, h := range rpt.Host.Nodes { + hostName, _ := h.Latest.Lookup(report.HostNodeID) + if strings.Contains(hostName, ";") { + hostid := strings.Split(hostName, ";") + hostName = hostid[0] + for diskNode, d := range rpt.Disk.Nodes { + Label, _ := d.Latest.Lookup(kubernetes.HostName) + if strings.ToLower(hostName) == Label { + h.Adjacency = h.Adjacency.Add(d.ID) + h.Children = h.Children.Add(d) + } + nodes[diskNode] = d + } + nodes[hostNodeID] = h + } + } + return Nodes{Nodes: nodes} +} diff --git a/render/persistentvolume.go b/render/persistentvolume.go index 1785fdf788..03b2b1c881 100644 --- a/render/persistentvolume.go +++ b/render/persistentvolume.go @@ -14,8 +14,19 @@ var KubernetesVolumesRenderer = MakeReduce( VolumesRenderer, PodToVolumeRenderer, PVCToStorageClassRenderer, - PVToSnapshotRenderer, + PVToControllerRenderer, VolumeSnapshotRenderer, + SPToDiskRenderer, + MakeFilter( + func(n report.Node) bool { + value, _ := n.Latest.Lookup(kubernetes.VolumePod) + if value == "true" { + return true + } + return false + }, + PodRenderer, + ), ) // VolumesRenderer is a Renderer which produces a renderable kubernetes PV & PVC @@ -71,7 +82,9 @@ func (v podToVolumesRenderer) Render(ctx context.Context, rpt report.Report) Nod } } } - nodes[podID] = podNode + if found { + nodes[podID] = podNode + } } return Nodes{Nodes: nodes} } @@ -88,6 +101,7 @@ func (v pvcToStorageClassRenderer) Render(ctx context.Context, rpt report.Report nodes := make(report.Nodes) for scID, scNode := range rpt.StorageClass.Nodes { storageClass, _ := scNode.Latest.Lookup(kubernetes.Name) + spcNameFromValue, _ := scNode.Latest.Lookup(kubernetes.Value) for _, pvcNode := range rpt.PersistentVolumeClaim.Nodes { storageClassName, _ := pvcNode.Latest.Lookup(kubernetes.StorageClassName) if storageClassName == storageClass { @@ -95,22 +109,44 @@ func (v pvcToStorageClassRenderer) Render(ctx context.Context, rpt report.Report scNode.Children = scNode.Children.Add(pvcNode) } } + + // Expecting spcName from sc instead obtained a string i.e - name: StoragePoolClaim value: "spcName" . + // Hence we are spliting it to get spcName. + if strings.Contains(spcNameFromValue, "\"") { + storageValue := strings.Split(spcNameFromValue, "\"") + spcNameFromValue = storageValue[1] + for _, spcNode := range rpt.StoragePoolClaim.Nodes { + spcName, _ := spcNode.Latest.Lookup(kubernetes.Name) + if spcName == spcNameFromValue { + scNode.Adjacency = scNode.Adjacency.Add(spcNode.ID) + scNode.Children = scNode.Children.Add(spcNode) + } + } + } nodes[scID] = scNode } return Nodes{Nodes: nodes} } -//PVToSnapshotRenderer is a Renderer which produces a renderable kubernetes PV -var PVToSnapshotRenderer = pvToSnapshotRenderer{} +//PVToControllerRenderer is a Renderer which produces a renderable kubernetes PVC +var PVToControllerRenderer = pvToControllerRenderer{} -//pvToSnapshotRenderer is a Renderer to render PV & Snapshot. -type pvToSnapshotRenderer struct{} +//pvTocontrollerRenderer is a Renderer to render PV & Controller. +type pvToControllerRenderer struct{} -//Render renders the PV & Snapshot nodes with adjacency. -func (v pvToSnapshotRenderer) Render(ctx context.Context, rpt report.Report) Nodes { +//Render renders the PV & Controller nodes with adjacency. +func (v pvToControllerRenderer) Render(ctx context.Context, rpt report.Report) Nodes { nodes := make(report.Nodes) for pvNodeID, p := range rpt.PersistentVolume.Nodes { volumeName, _ := p.Latest.Lookup(kubernetes.Name) + for _, podNode := range rpt.Pod.Nodes { + podVolumeName, _ := podNode.Latest.Lookup(kubernetes.VolumeName) + if volumeName == podVolumeName { + p.Adjacency = p.Adjacency.Add(podNode.ID) + p.Children = p.Children.Add(podNode) + } + } + for _, volumeSnapshotNode := range rpt.VolumeSnapshot.Nodes { snapshotPVName, _ := volumeSnapshotNode.Latest.Lookup(kubernetes.VolumeName) if volumeName == snapshotPVName { @@ -118,7 +154,9 @@ func (v pvToSnapshotRenderer) Render(ctx context.Context, rpt report.Report) Nod p.Children = p.Children.Add(volumeSnapshotNode) } } - nodes[pvNodeID] = p + if p.ID != "" { + nodes[pvNodeID] = p + } } return Nodes{Nodes: nodes} } diff --git a/render/pod.go b/render/pod.go index 548f65a900..2155301199 100644 --- a/render/pod.go +++ b/render/pod.go @@ -67,7 +67,6 @@ var PodRenderer = Memoise(ConditionalRenderer(renderKubernetesTopologies, ), ), ConnectionJoin(MapPod2IP, report.Pod), - KubernetesVolumesRenderer, ), ), )) diff --git a/render/selectors.go b/render/selectors.go index f09c027be9..8e82ea0598 100644 --- a/render/selectors.go +++ b/render/selectors.go @@ -40,4 +40,6 @@ var ( SelectStorageClass = TopologySelector(report.StorageClass) SelectVolumeSnapshot = TopologySelector(report.VolumeSnapshot) SelectVolumeSnapshotData = TopologySelector(report.VolumeSnapshotData) + SelectDisk = TopologySelector(report.Disk) + SelectStoragePoolClaim = TopologySelector(report.StoragePoolClaim) ) diff --git a/render/storagerenderer.go b/render/storagerenderer.go new file mode 100644 index 0000000000..574f89a520 --- /dev/null +++ b/render/storagerenderer.go @@ -0,0 +1,45 @@ +package render + +import ( + "context" + + "github.com/weaveworks/scope/report" +) + +// KubernetesStorageRenderer is a Renderer which combines all Kubernetes +// storage components such as storage pools, storage pool claims and disks. +var KubernetesStorageRenderer = MakeReduce( + SPCToSPRenderer, + SPToDiskRenderer, +) + +// SPCToSPRenderer is a Renderer which produces a renderable kubernetes CRD SPC +var SPCToSPRenderer = spcToSpRenderer{} + +// spcToSpRenderer is a Renderer to render SPC & SP nodes. +type spcToSpRenderer struct{} + +// Render renders the SPC & SP nodes with adjacency. +// Here we are obtaining the spc name from sp and adjacency is created by matching it with spc name. +func (v spcToSpRenderer) Render(ctx context.Context, rpt report.Report) Nodes { + nodes := make(report.Nodes) + for spcID, spcNode := range rpt.StoragePoolClaim.Nodes { + nodes[spcID] = spcNode + } + return Nodes{Nodes: nodes} +} + +// SPToDiskRenderer is a Renderer which produces a renderable kubernetes CRD Disk +var SPToDiskRenderer = spToDiskRenderer{} + +// spToDiskRenderer is a Renderer to render SP & Disk . +type spToDiskRenderer struct{} + +// Render renders the SP & Disk nodes with adjacency. +func (v spToDiskRenderer) Render(ctx context.Context, rpt report.Report) Nodes { + nodes := make(report.Nodes) + for diskID, diskNode := range rpt.Disk.Nodes { + nodes[diskID] = diskNode + } + return Nodes{Nodes: nodes} +} diff --git a/report/id.go b/report/id.go index 78db8e43ca..c4e85d0b7e 100644 --- a/report/id.go +++ b/report/id.go @@ -193,6 +193,18 @@ var ( // ParseVolumeSnapshotDataNodeID parses a volume snapshot data node ID ParseVolumeSnapshotDataNodeID = parseSingleComponentID("volume_snapshot_data") + + // MakeDiskNodeID produces a disk node ID from its composite parts. + MakeDiskNodeID = makeSingleComponentID("disk") + + // ParseDiskNodeID parses a disk node ID + ParseDiskNodeID = parseSingleComponentID("disk") + + // MakeStoragePoolClaimNodeID produces a Stoage Pool Claim node ID from its composite parts. + MakeStoragePoolClaimNodeID = makeSingleComponentID("storage_pool_claim") + + // ParseStoragePoolClaimNodeID parses a Stoage Pool Claim node ID + ParseStoragePoolClaimNodeID = parseSingleComponentID("storage_pool_claim") ) // makeSingleComponentID makes a single-component node id encoder diff --git a/report/map_keys.go b/report/map_keys.go index 9e4eb3d643..af97727b70 100644 --- a/report/map_keys.go +++ b/report/map_keys.go @@ -89,6 +89,22 @@ const ( KubernetesCloneVolumeSnapshot = "kubernetes_clone_volume_snapshot" KubernetesDeleteVolumeSnapshot = "kubernetes_delete_volume_snapshot" KubernetesDescribe = "kubernetes_describe" + KubernetesModel = "kubernetes_model" + KubernetesLogicalSectorSize = "kubernetes_logical_sector_size" + KubernetesStorage = "kubernetes_storage" + KubernetesFirmwareRevision = "kubernetes_firmware_version" + KubernetesSerial = "kubernetes_serial" + KubernetesVendor = "kubernetes_vendor" + KubernetesDiskList = "kubernetes_disk_list" + KubernetesMaxPools = "kubernetes_max_pools" + KubernetesAPIVersion = "kubernetes_api_version" + KubernetesValue = "kubernetes_value" + KubernetesStoragePoolClaimName = "kubernetes_storage_pool_claim" + KubernetesDiskName = "kubernetes_disk_name" + KubernetesPoolName = "kubernetes_pool_name" + KubernetesPoolClaim = "kubernetes_pool_claim" + KubernetesHostName = "kubernetes_host_name" + KubernetesVolumePod = "kubernetes_volume_pod" // probe/awsecs ECSCluster = "ecs_cluster" ECSCreatedAt = "ecs_created_at" diff --git a/report/report.go b/report/report.go index c7c1f09792..c42b379b64 100644 --- a/report/report.go +++ b/report/report.go @@ -34,6 +34,8 @@ const ( VolumeSnapshot = "volume_snapshot" VolumeSnapshotData = "volume_snapshot_data" Job = "job" + Disk = "disk" + StoragePoolClaim = "storage_pool_claim" // Shapes used for different nodes Circle = "circle" @@ -49,6 +51,10 @@ const ( StorageSheet = "sheet" Camera = "camera" DottedTriangle = "dottedtriangle" + DottedSquare = "dottedsquare" + Controller = "controller" + Replica = "replica" + Rectangle = "rectangle" // Used when counting the number of containers ContainersKey = "containers" @@ -79,6 +85,8 @@ var topologyNames = []string{ VolumeSnapshot, VolumeSnapshotData, Job, + Disk, + StoragePoolClaim, } // Report is the core data type. It's produced by probes, and consumed and @@ -188,6 +196,14 @@ type Report struct { // Job represent all Kubernetes Job on hosts running probes. Job Topology + // Disk represent all NDM Disks on hosts running probes. + // Metadata is limited for now, more to come later. + Disk Topology + + // StoragePoolClaim represent all the CRD kubernetes Storage Pool Claims on hosts running probes. + // Metadata is limited for now, more to come later. + StoragePoolClaim Topology + DNS DNSRecords // Sampling data for this report. @@ -307,6 +323,14 @@ func MakeReport() Report { WithShape(DottedTriangle). WithLabel("job", "jobs"), + Disk: MakeTopology(). + WithShape(Rectangle). + WithLabel("disk", "disks"), + + StoragePoolClaim: MakeTopology(). + WithShape(DottedSquare). + WithLabel("storage pool claim", "storage pool claims"), + DNS: DNSRecords{}, Sampling: Sampling{}, @@ -425,6 +449,10 @@ func (r *Report) topology(name string) *Topology { return &r.VolumeSnapshotData case Job: return &r.Job + case Disk: + return &r.Disk + case StoragePoolClaim: + return &r.StoragePoolClaim } return nil } diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/register.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/register.go new file mode 100644 index 0000000000..f420912347 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/register.go @@ -0,0 +1,6 @@ +package openebsio + +// GroupName assigned to openebs.io +const ( + GroupName = "openebs.io" +) diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_keys.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_keys.go new file mode 100644 index 0000000000..bb5b37cfa1 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_keys.go @@ -0,0 +1,96 @@ +/* +Copyright 2018 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +// CASKey represents the key used either in resource annotation or label +type CASKey string + +const ( + // CreatePoolCASTemplateKey is the cas template annotation key whose value is + // the name of cas template that will be used to provision a storagepool + CreatePoolCASTemplateKey CASKey = "cas.openebs.io/create-pool-template" + + // DeletePoolCASTemplateKey is the cas template annotation key whose value is + // the name of cas template that will be used to delete a storagepool + DeletePoolCASTemplateKey CASKey = "cas.openebs.io/delete-pool-template" + + // OpenEBSVersionKey is the label key which provides the installed version of + // OpenEBS + OpenEBSVersionKey CASKey = "openebs.io/version" + + // VersionKey is the label key which provides the installed version of + // OpenEBS + // + // NOTE: + // This can be used for openebs specific custom resources where namespacing + // the key is not mandatory. The org specific namespace details is already + // present in the apiVersion itself. This also helps to parse version key + // easily. + VersionKey CASKey = "version" + + // CASTNameKey is the key to fetch name of CAS template + CASTNameKey CASKey = "castName" + + // CASConfigKey is the key to fetch configurations w.r.t a CAS entity + CASConfigKey CASKey = "cas.openebs.io/config" + + // NamespaceKey is the key to fetch cas entity's namespace + NamespaceKey CASKey = "openebs.io/namespace" + + // PersistentVolumeClaimKey is the key to fetch name of PersistentVolumeClaim + PersistentVolumeClaimKey CASKey = "openebs.io/persistentvolumeclaim" + + // StorageClassKey is the key to fetch name of StorageClass + StorageClassKey CASKey = "openebs.io/storageclass" + + // CASTypeKey is the key to fetch storage engine for the volume + CASTypeKey CASKey = "openebs.io/cas-type" + + // StorageClassHeaderKey is the key to fetch name of StorageClass + // This key is present only in get request headers + StorageClassHeaderKey CASKey = "storageclass" +) + +// DeprecatedKey is a typed string to represent deprecated annotations' or +// labels' key +type DeprecatedKey string + +const ( + // CapacityDeprecatedKey is a label key used to set volume capacity + // + // NOTE: + // Deprecated in favour of CASVolume.Spec.Capacity + CapacityDeprecatedKey DeprecatedKey = "volumeprovisioner.mapi.openebs.io/storage-size" + + // NamespaceDeprecatedKey is the key to fetch volume's namespace + // + // NOTE: + // Deprecated in favour of NamespaceKey + NamespaceDeprecatedKey DeprecatedKey = "k8s.io/namespace" + + // PersistentVolumeClaimDeprecatedKey is the key to fetch volume's PVC + // + // NOTE: + // Deprecated in favour of PersistentVolumeClaimKey + PersistentVolumeClaimDeprecatedKey DeprecatedKey = "k8s.io/pvc" + + // StorageClassDeprecatedKey is the key to fetch name of StorageClass + // + // NOTE: + // Deprecated in favour of StorageClassKey + StorageClassDeprecatedKey DeprecatedKey = "k8s.io/storage-class" +) diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_pool.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_pool.go new file mode 100644 index 0000000000..d73fdde35a --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_pool.go @@ -0,0 +1,94 @@ +/* +Copyright 2017 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CasPoolKey is the key for the CasPool. +type CasPoolKey string + +// CasPoolValString represents the string value for a CasPoolKey. +type CasPoolValString string + +// CasPoolValInt represents the integer value for a CasPoolKey +type CasPoolValInt int + +const ( + // HostNameCPK is the kubernetes host name label + HostNameCPK CasPoolKey = "kubernetes.io/hostname" + // StoragePoolClaimCPK is the storage pool claim label + StoragePoolClaimCPK CasPoolKey = "openebs.io/storage-pool-claim" + // NdmDiskTypeCPK is the node-disk-manager disk type e.g. 'sparse' or 'disk' + NdmDiskTypeCPK CasPoolKey = "ndm.io/disk-type" + // PoolTypeMirroredCPV is a key for mirrored for pool + PoolTypeMirroredCPV CasPoolValString = "mirrored" + // PoolTypeStripedCPV is a key for striped for pool + PoolTypeStripedCPV CasPoolValString = "striped" + // TypeSparseCPV is a key for sparse disk pool + TypeSparseCPV CasPoolValString = "sparse" + // TypeDiskCPV is a key for physical,iscsi,virtual etc disk pool + TypeDiskCPV CasPoolValString = "disk" + // StripedDiskCountCPV is the count for striped type pool + StripedDiskCountCPV CasPoolValInt = 1 + // MirroredDiskCountCPV is the count for mirrored type pool + MirroredDiskCountCPV CasPoolValInt = 2 +) + +// CasPool is a type which will be utilised by CAS engine to perform +// storagepool related operation. +// TODO: Restrucutre CasPool struct. +type CasPool struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // StoragePoolClaim is the name of the storagepoolclaim object + StoragePoolClaim string + + // CasCreateTemplate is the cas template that will be used for storagepool create + // operation + CasCreateTemplate string + + // CasDeleteTemplate is the cas template that will be used for storagepool delete + // operation + CasDeleteTemplate string + + // Namespace can be passed via storagepoolclaim as labels to decide on the + // execution of namespaced resources with respect to storagepool + Namespace string + + // DiskList is the list of disks over which a storagepool will be provisioned + DiskList []string + + // PoolType is the type of pool to be provisioned e.g. striped or mirrored + PoolType string + + // MaxPool is the maximum number of pool that should be provisioned + MaxPools int + + // MinPool is the minimum number of pool that should be provisioned + MinPools int + + // Type is the CasPool type e.g. sparse or openebs-cstor + Type string + + // reSync will decide whether the event is a reconciliation event + ReSync bool + + // PendingPoolCount is the number of pools that will be tried for creation as a part of reconciliation. + PendingPoolCount int +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_snapshot.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_snapshot.go new file mode 100644 index 0000000000..0b35a48397 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_snapshot.go @@ -0,0 +1,85 @@ +/* +Copyright 2017 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CASSnapshotKey is a typed string to represent CAS Snapshot related annotations' +// or labels' keys +// +// Example 1 - Below is a sample StorageClass that makes use of a CASSnapshotKey +// constant i.e. the cas template used to create a cas snapshot +// +// ```yaml +// apiVersion: storage.k8s.io/v1 +// kind: StorageClass +// metadata: +// name: openebs-standard +// annotations: +// cas.openebs.io/create-snapshot-template: cast-standard-0.8.0 +// provisioner: openebs.io/provisioner-iscsi +// ``` +type CASSnapshotKey string + +const ( + // CASTemplateKeyForSnapshotCreate is the key to fetch name of CASTemplate + // to create a CAS Snapshot + CASTemplateKeyForSnapshotCreate CASSnapshotKey = "cas.openebs.io/create-snapshot-template" + + // CASTemplateKeyForSnapshotRead is the key to fetch name of CASTemplate + // to read a CAS Snapshot + CASTemplateKeyForSnapshotRead CASSnapshotKey = "cas.openebs.io/read-snapshot-template" + + // CASTemplateKeyForSnapshotDelete is the key to fetch name of CASTemplate + // to delete a CAS Snapshot + CASTemplateKeyForSnapshotDelete CASSnapshotKey = "cas.openebs.io/delete-snapshot-template" + + // CASTemplateKeyForSnapshotList is the key to fetch name of CASTemplate + // to list CAS Snapshots + CASTemplateKeyForSnapshotList CASSnapshotKey = "cas.openebs.io/list-snapshot-template" +) + +// CASSnapshot represents a cas snapshot +type CASSnapshot struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Spec i.e. specifications of this cas snapshot + Spec SnapshotSpec `json:"spec"` +} + +// SnapshotSpec has the properties of a cas snapshot +type SnapshotSpec struct { + CasType string `json:"casType"` + VolumeName string `json:"volumeName"` +} + +// SnapshotOptions has the properties of a cas snapshot list +type SnapshotOptions struct { + CasType string `json:"casType,omitempty"` + VolumeName string `json:"volumeName,omitempty"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` +} + +// CASSnapshotList is a list of CASSnapshot resources +type CASSnapshotList struct { + metav1.TypeMeta `json:",inline"` + // Items are the list of volumes + Items []CASSnapshot `json:"items"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_template.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_template.go new file mode 100644 index 0000000000..344e15730b --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_template.go @@ -0,0 +1,124 @@ +/* +Copyright 2018 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:noStatus +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=castemplate + +// CASTemplate describes a Container Attached Storage template that is used +// to provision a CAS volume +type CASTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec CASTemplateSpec `json:"spec"` +} + +// CASTemplateSpec is the specifications for a CASTemplate resource +type CASTemplateSpec struct { + // Defaults are a list of default configurations that may be applied + // during execution of CAS template + Defaults []Config `json:"defaultConfig"` + // TaskNamespace is the namespace where the tasks are expected to be found + TaskNamespace string `json:"taskNamespace"` + // RunTasks refers to a set of tasks to be run + RunTasks RunTasks `json:"run"` + // OutputTask is the task that has the CAS template result's output + // format + OutputTask string `json:"output"` + // Fallback is the CASTemplate to fallback to in-case of specific failures + // e.g. VersionMismatchError, etc + Fallback string `json:"fallback"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=castemplates + +// CASTemplateList is a list of CASTemplate resources +type CASTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []CASTemplate `json:"items"` +} + +// Config holds a configuration element +// +// For example, it can represent a config property of a CAS volume +type Config struct { + // Name of the config + Name string `json:"name"` + // Enabled flags if this config is enabled or disabled; + // true indicates enabled while false indicates disabled + Enabled string `json:"enabled"` + // Value represents any specific value that is applicable + // to this config + Value string `json:"value"` + // Data represents an arbitrary map of key value pairs + Data map[string]string `json:"data"` +} + +// RunTasks contains fields to run a set of +// runtasks referred to by their names +type RunTasks struct { + // Items is a set of order-ed tasks referred to by their names + Tasks []string `json:"tasks"` +} + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=runtask + +// RunTask forms the specifications that deal with running a CAS template +// engine based task +type RunTask struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec RunTaskSpec `json:"spec"` +} + +// RunTaskSpec is the specifications of a RunTask resource +type RunTaskSpec struct { + // Meta is the meta specifications to run this task + Meta string `json:"meta"` + // Task is the resource to be operated via this task + Task string `json:"task"` + // PostRun is a set of go template functions that is run + // against the result of this task's execution. In other words, this + // is run post the task execution. + PostRun string `json:"post"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=runtasks + +// RunTaskList is a list of RunTask resources +type RunTaskList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []RunTask `json:"items"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_template_keys.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_template_keys.go new file mode 100644 index 0000000000..506786acb3 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_template_keys.go @@ -0,0 +1,305 @@ +/* +Copyright 2017 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +// TopLevelProperty represents the top level property that +// is a starting point to represent a hierarchical chain of +// properties. +// +// e.g. +// Config.prop1.subprop1 = val1 +// Config.prop1.subprop2 = val2 +// In above example Config is a top level object +// +// NOTE: +// The value of any hierarchical chain of properties +// can be parsed via dot notation +type TopLevelProperty string + +const ( + // CASTOptionsTLP is a top level property supported by CAS template engine. + // CAS template specific options are placed here + CASTOptionsTLP TopLevelProperty = "CAST" + + // ConfigTLP is a top level property supported by CAS template engine + // + // The policy specific properties are placed with ConfigTLP as the + // top level property + ConfigTLP TopLevelProperty = "Config" + + // VolumeTLP is a top level property supported by CAS template engine + // + // The properties provided by the caller are placed with VolumeTLP + // as the top level property + // + // NOTE: + // CAS template engine cannot modify these properties. These are the + // runtime properties that are provided as inputs to CAS template + // engine. + VolumeTLP TopLevelProperty = "Volume" + + // SnapshotTLP is a top level property supported by CAS template engine + // + // The properties provided by the caller are placed with SnapshotTLP + // as the top level property + // + // NOTE: + // CAS template engine cannot modify these properties. These are the + // runtime properties that are provided as inputs to CAS template + // engine. + SnapshotTLP TopLevelProperty = "Snapshot" + + // StoragePoolTLP is a top level property supported by CAS template engine + // + // The properties provided by the caller are placed with StoragePoolTLP + // as the top level property + // + // NOTE: + // CAS template engine cannot modify these properties. These are the + // runtime properties that are provided as inputs to CAS template + // engine. + StoragePoolTLP TopLevelProperty = "Storagepool" + + // TaskResultTLP is a top level property supported by CAS template engine + // + // The specific results after the execution of a task are placed with + // TaskResultTLP as the top level property + // + // NOTE: + // This is typically used to feed inputs of a task's execution + // result to **next task** before the later's execution + TaskResultTLP TopLevelProperty = "TaskResult" + + // CurrentJSONResultTLP is a top level property supported by CAS template engine + // The result of the current task's execution is stored in this top + // level property. + CurrentJSONResultTLP TopLevelProperty = "JsonResult" + + // ListItemsTLP is a top level property supported by CAS template engine + // + // Results of one or more tasks' execution can be saved in this property. + // + // Example: + // Below shows how specific properties of a list of items can be retrieved in + // a go template. Below dot notation is for illustration purposes and only + // reflects the way the specific property value was set. + // + // {{- .ListItems.volumes.default.mypv2.ip -}} + // {{- .ListItems.volumes.default.mypv2.status -}} + // {{- .ListItems.volumes.openebs.mypv.ip -}} + // {{- .ListItems.volumes.openebs.mypv.status -}} + ListItemsTLP TopLevelProperty = "ListItems" +) + +// StoragePoolTLPProperty is used to define properties that comes +// after StoragePoolTLP +type StoragePoolTLPProperty string + +const ( + // OwnerCTP indicates the owner of this pool; the one who + // is executing this policy + // + // NOTE: + // The corresponding value will be accessed as + // {{ .Storagepool.owner }} + OwnerCTP StoragePoolTLPProperty = "owner" + + // DiskListCTP indicates the list of disks + DiskListCTP StoragePoolTLPProperty = "diskList" +) + +// VolumeTLPProperty is used to define properties that comes +// after VolumeTLP +type VolumeTLPProperty string + +const ( + // OwnerVTP indicates the owner of this volume; the one who + // is executing this policy + // + // NOTE: + // The corresponding value will be accessed as + // {{ .Volume.owner }} + OwnerVTP VolumeTLPProperty = "owner" + + // RunNamespaceVTP is the namespace where this policy is + // supposed to run + // NOTE: + // The corresponding value will be accessed as + // {{ .Volume.runNamespace }} + RunNamespaceVTP VolumeTLPProperty = "runNamespace" + + // CapacityVTP is the capacity of the volume + // NOTE: + // The corresponding value will be accessed as + // {{ .Volume.capacity }} + CapacityVTP VolumeTLPProperty = "capacity" + + // PersistentVolumeClaimVTP is the PVC of the volume + // NOTE: + // The corresponding value will be accessed as + // {{ .Volume.pvc }} + PersistentVolumeClaimVTP VolumeTLPProperty = "pvc" + + // StorageClassVTP is the StorageClass of the volume + // + // NOTE: + // The corresponding value will be accessed as + // {{ .Volume.storageclass }} + StorageClassVTP VolumeTLPProperty = "storageclass" +) + +// CloneTLPProperty is used to define properties for clone operations +type CloneTLPProperty string + +const ( + // SnapshotNameVTP is the snapshot name + SnapshotNameVTP CloneTLPProperty = "snapshotName" + + // SourceVolumeTargetIPVTP is source volume target IP + SourceVolumeTargetIPVTP CloneTLPProperty = "sourceVolumeTargetIP" + + // IsCloneEnableVTP is a bool value for clone operations + // for a volume + IsCloneEnableVTP CloneTLPProperty = "isCloneEnable" + + // SourceVolumeVTP is the name of the source volume + SourceVolumeVTP CloneTLPProperty = "sourceVolume" +) + +// SnapshotTLPProperty is used to define properties for clone operations +type SnapshotTLPProperty string + +const ( + // VolumeNameSTP is the snapshot name + VolumeSTP SnapshotTLPProperty = "volumeName" +) + +// PolicyTLPProperty is the name of the property that is found +// under PolicyTLP +type PolicyTLPProperty string + +const ( + // EnabledPTP is the enabled property of the policy + // NOTE: + // The corresponding value will be accessed as + // {{ .Policy..enabled }} + EnabledPTP PolicyTLPProperty = "enabled" + + // ValuePTP is the value property of the policy + // NOTE: + // The corresponding value will be accessed as + // {{ .Policy..value }} + ValuePTP PolicyTLPProperty = "value" + + // DataPTP is the data property of the policy + // NOTE: + // The corresponding value will be accessed as + // {{ .Policy..data }} + DataPTP PolicyTLPProperty = "data" +) + +const ( + // TaskIdentityPrefix is the prefix used for all TaskIdentity + TaskIdentityPrefix string = "key" +) + +// TaskTLPProperty is the name of the property that is found +// under TaskTLP +type TaskTLPProperty string + +const ( + // APIVersionTTP is the apiVersion property of the task + // NOTE: + // The corresponding value will be accessed as + // {{ .Task..apiVersion }} + APIVersionTTP TaskTLPProperty = "apiVersion" + + // KindTTP is the kind property of the task + // NOTE: + // The corresponding value will be accessed as + // {{ .Task..kind }} + KindTTP TaskTLPProperty = "kind" +) + +// TaskResultTLPProperty is the name of the property that is found +// under TaskResultTLP +type TaskResultTLPProperty string + +const ( + // ObjectNameTRTP is the objectName property of the + // TaskResultTLP + // + // NOTE: + // The corresponding value will be accessed as + // {{ .TaskResult..objectName }} + ObjectNameTRTP TaskResultTLPProperty = "objectName" + + // AnnotationsTRTP is the annotations property of the + // TaskResultTLP + // + // NOTE: + // The corresponding value will be accessed as + // {{ .TaskResult..annotations }} + AnnotationsTRTP TaskResultTLPProperty = "annotations" + + // TaskResultVerifyErrTRTP is a property of TaskResultTLP + // + // First error found after **verification** checks done against the result of + // the task's execution is stored in this property. + // + // NOTE: + // The corresponding value will be accessed as + // {{ .TaskResult..verifyErr }} + TaskResultVerifyErrTRTP TaskResultTLPProperty = "verifyErr" + + // TaskResultNotFoundErrTRTP is a property of TaskResultTLP + // + // First error found after **not found** checks done against the result of + // the task's execution is stored in this property. + // + // NOTE: + // The corresponding value will be accessed as + // {{ .TaskResult..notFoundErr }} + TaskResultNotFoundErrTRTP TaskResultTLPProperty = "notFoundErr" + + // TaskResultVersionMismatchErrTRTP is a property of TaskResultTLP + // + // First error found after **version mismatch** checks done against the + // result of the task's execution is stored in this property. + // + // NOTE: + // The corresponding value will be accessed as + // {{ .TaskResult..versionMismatchErr }} + TaskResultVersionMismatchErrTRTP TaskResultTLPProperty = "versionMismatchErr" +) + +// ListItemsTLPProperty is the name of the property that is found +// under ListItemsTLP +type ListItemsTLPProperty string + +const ( + // CurrentRepeatResourceLITP is a property of ListItemsTLP + // + // It is the current repeat resource due to which a task is getting + // executed is set here + // + // Example: + // {{- .ListItems.currentRepeatResource -}} + // + // Above templating will give the current repeat resource name + CurrentRepeatResourceLITP ListItemsTLPProperty = "currentRepeatResource" +) diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_volume.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_volume.go new file mode 100644 index 0000000000..d6c3f55747 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cas_volume.go @@ -0,0 +1,170 @@ +/* +Copyright 2017 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TODO +// Convert `CASVolumeKey` to `CASKey` present in cas_keys.go file +// Move these keys to cas_keys.go file + +// CASVolumeKey is a typed string to represent CAS Volume related annotations' +// or labels' keys +// +// Example 1 - Below is a sample StorageClass that makes use of a CASVolumeKey +// constant i.e. the cas template used to create a cas volume +// +// ```yaml +// apiVersion: storage.k8s.io/v1 +// kind: StorageClass +// metadata: +// name: openebs-standard +// annotations: +// cas.openebs.io/create-volume-template: cast-standard-0.6.0 +// provisioner: openebs.io/provisioner-iscsi +// ``` +type CASVolumeKey string + +const ( + // CASTemplateKeyForVolumeCreate is the key to fetch name of CASTemplate + // to create a CAS Volume + CASTemplateKeyForVolumeCreate CASVolumeKey = "cas.openebs.io/create-volume-template" + + // CASTemplateKeyForVolumeRead is the key to fetch name of CASTemplate + // to read a CAS Volume + CASTemplateKeyForVolumeRead CASVolumeKey = "cas.openebs.io/read-volume-template" + + // CASTemplateKeyForVolumeDelete is the key to fetch name of CASTemplate + // to delete a CAS Volume + CASTemplateKeyForVolumeDelete CASVolumeKey = "cas.openebs.io/delete-volume-template" + + // CASTemplateKeyForVolumeList is the key to fetch name of CASTemplate + // to list CAS Volumes + CASTemplateKeyForVolumeList CASVolumeKey = "cas.openebs.io/list-volume-template" +) + +// TODO +// Remove if CASJivaVolumeDefault is no more required +// Remove the commented CASJivaVolumeDefault consts + +// CASJivaVolumeDefault is a typed string to represent defaults of Jiva based +// CAS Volume properties or attributes or operations +type CASJivaVolumeDefault string + +const ( +// NOTE: +// As per the current design there is no default CAS template to create a +// CAS Volume. It is expected that the StorageClass will explicitly set the +// cas template name required to create a CAS Volume. However reading, +// deleting & listing of cas volume(s) have corresponding cas templates that +// are used implicitly i.e. read, delete & list have their own default cas +// templates. + +// DefaultCASTemplateForJivaVolumeRead is the default cas template to read +// a Jiva based CAS Volume +//DefaultCASTemplateForJivaVolumeRead CASJivaVolumeDefault = "read-cstor-cas-volume-tpl" +// DefaultCASTemplateForJivaVolumeList is the default cas template to list +// Jiva based CAS Volumes +//DefaultCASTemplateForJivaVolumeList CASJivaVolumeDefault = "list-cstor-cas-volume-tpl" +// DefaultCASTemplateForJivaVolumeDelete is the default cas template to +// delete a Jiva based CAS Volume +//DefaultCASTemplateForJivaVolumeDelete CASJivaVolumeDefault = "delete-cstor-cas-volume-tpl" +) + +// CASVolume represents a cas volume +type CASVolume struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Spec i.e. specifications of this cas volume + Spec CASVolumeSpec `json:"spec"` + // CloneSpec contains the required information related to volume clone + CloneSpec VolumeCloneSpec `json:"cloneSpec,omitempty"` + // Status of this cas volume + Status CASVolumeStatus `json:"status"` +} + +// CASVolumeSpec has the properties of a cas volume +type CASVolumeSpec struct { + // Capacity will hold the capacity of this Volume + Capacity string `json:"capacity"` + // Iqn will hold the iqn value of this Volume + Iqn string `json:"iqn"` + // TargetPortal will hold the target portal for this volume + TargetPortal string `json:"targetPortal"` + // TargetIP will hold the targetIP for this Volume + TargetIP string `json:"targetIP"` + // TargetPort will hold the targetIP for this Volume + TargetPort string `json:"targetPort"` + // Replicas will hold the replica count for this volume + Replicas string `json:"replicas"` + // CasType will hold the storage engine used to provision this volume + CasType string `json:"casType"` + // FSType will specify the format type - ext4(default), xfs of PV + FSType string `json:"fsType"` + // Lun will specify the lun number 0, 1.. on iSCSI Volume. (default: 0) + Lun int32 `json:"lun"` +} + +// CASVolumeStatus provides status of a cas volume +type CASVolumeStatus struct { + // Phase indicates if a volume is available, pending or failed + Phase VolumePhase + // A human-readable message indicating details about why the volume + // is in this state + Message string + // Reason is a brief CamelCase string that describes any failure and is meant + // for machine parsing and tidy display in the CLI + Reason string +} + +// VolumeCloneSpec contains the required information which enable volume to cloned +type VolumeCloneSpec struct { + // Defaults to false, true will enable the volume to be created as a clone + IsClone bool `json:"isClone,omitempty"` + // SourceVolume is snapshotted volume + SourceVolume string `json:"sourceVolume,omitempty"` + // CloneIP is the source controller IP which will be used to make a sync and rebuild + // request from the new clone replica. + SourceVolumeTargetIP string `json:"sourceTargetIP,omitempty"` + // SnapshotName name of snapshot which is getting promoted as persistent + // volume(this snapshot will be cloned to new volume). + SnapshotName string `json:"snapshotName,omitempty"` +} + +// VolumePhase defines phase of a volume +type VolumePhase string + +const ( + // VolumePending - used for Volumes that are not available + VolumePending VolumePhase = "Pending" + // VolumeAvailable - used for Volumes that are available + VolumeAvailable VolumePhase = "Available" + // VolumeFailed - used for Volumes that failed for some reason + VolumeFailed VolumePhase = "Failed" +) + +// CASVolumeList is a list of CASVolume resources +type CASVolumeList struct { + metav1.ListOptions `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + metav1.ListMeta `json:"metalist"` + + // Items are the list of volumes + Items []CASVolume `json:"items"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_pool.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_pool.go new file mode 100644 index 0000000000..f9eab2d0f7 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_pool.go @@ -0,0 +1,101 @@ +/* +Copyright 2018 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient:nonNamespaced +// +resource:path=cstorpool + +// CStorPool describes a cstor pool resource created as custom resource. +type CStorPool struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec CStorPoolSpec `json:"spec"` + Status CStorPoolStatus `json:"status"` +} + +// CStorPoolSpec is the spec listing fields for a CStorPool resource. +type CStorPoolSpec struct { + Disks DiskAttr `json:"disks"` + PoolSpec CStorPoolAttr `json:"poolSpec"` +} + +// DiskAttr stores the disk related attributes. +type DiskAttr struct { + DiskList []string `json:"diskList"` +} + +// CStorPoolAttr is to describe zpool related attributes. +type CStorPoolAttr struct { + CacheFile string `json:"cacheFile"` //optional, faster if specified + PoolType string `json:"poolType"` //mirror, striped + OverProvisioning bool `json:"overProvisioning"` //true or false +} + +// CStorPoolPhase is a typed string for phase field of CStorPool. +type CStorPoolPhase string + +// Status written onto CStorPool and CStorVolumeReplica objects. +const ( + // CStorPoolStatusEmpty ensures the create operation is to be done, if import fails. + CStorPoolStatusEmpty CStorPoolPhase = "" + // CStorPoolStatusOnline signifies that the pool is online. + CStorPoolStatusOnline CStorPoolPhase = "Online" + // CStorPoolStatusOffline signifies that the pool is offline. + CStorPoolStatusOffline CStorPoolPhase = "Offline" + // CStorPoolStatusDegraded signifies that the pool is degraded. + CStorPoolStatusDegraded CStorPoolPhase = "Degraded" + // CStorPoolStatusFaulted signifies that the pool is faulted. + CStorPoolStatusFaulted CStorPoolPhase = "Faulted" + // CStorPoolStatusRemoved signifies that the pool is removed. + CStorPoolStatusRemoved CStorPoolPhase = "Removed" + // CStorPoolStatusUnavail signifies that the pool is not available. + CStorPoolStatusUnavail CStorPoolPhase = "Unavail" + // CStorPoolStatusDeletionFailed signifies that the pool status could not be fetched. + CStorPoolStatusUnknown CStorPoolPhase = "Unknown" + // CStorPoolStatusDeletionFailed ensures the resource deletion has failed. + CStorPoolStatusDeletionFailed CStorPoolPhase = "DeletionFailed" + // CStorPoolStatusInvalid ensures invalid resource. + CStorPoolStatusInvalid CStorPoolPhase = "Invalid" + // CStorPoolStatusErrorDuplicate ensures error due to duplicate resource. + CStorPoolStatusErrorDuplicate CStorPoolPhase = "ErrorDuplicate" + // CStorPoolStatusPending ensures pending task for cstorpool. + CStorPoolStatusPending CStorPoolPhase = "Pending" +) + +// CStorPoolStatus is for handling status of pool. +type CStorPoolStatus struct { + Phase CStorPoolPhase `json:"phase"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=cstorpools + +// CStorPoolList is a list of CStorPoolList resources +type CStorPoolList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []CStorPool `json:"items"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_volume.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_volume.go new file mode 100644 index 0000000000..8ace4c1e68 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_volume.go @@ -0,0 +1,73 @@ +/* +Copyright 2018 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=cstorvolume + +// CStorVolume describes a cstor volume resource created as custom resource +type CStorVolume struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec CStorVolumeSpec `json:"spec"` + Status CStorVolumeStatus `json:"status"` +} + +// CStorVolumeSpec is the spec for a CStorVolume resource +type CStorVolumeSpec struct { + Capacity string `json:"capacity"` + TargetIP string `json:"targetIP"` + TargetPort string `json:"targetPort"` + Iqn string `json:"iqn"` + TargetPortal string `json:"targetPortal"` + Status string `json:"status"` + NodeBase string `json:"nodeBase"` + ReplicationFactor int `json:"replicationFactor"` + ConsistencyFactor int `json:"consistencyFactor"` +} + +// CStorVolumePhase is to hold result of action. +type CStorVolumePhase string + +// CStorVolumeStatus is for handling status of cvr. +type CStorVolumeStatus struct { + Phase CStorVolumePhase `json:"phase"` + ReplicaStatuses []ReplicaStatus `json:"replicaStatuses,omitempty"` +} + +// ReplicaStatus represents the status of a volume replica +type ReplicaStatus struct { + GUID string `json:"guid"` + Status string `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=cstorvolume + +// CStorVolumeList is a list of CStorVolume resources +type CStorVolumeList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []CStorVolume `json:"items"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_volume_replica.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_volume_replica.go new file mode 100644 index 0000000000..00a903d8d9 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_volume_replica.go @@ -0,0 +1,92 @@ +/* +Copyright 2018 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CVRKey represents the properties of a cstorvolumereplica +type CVRKey string + +const ( + // CloneEnableKEY is used to enable/disable cloning for a cstorvolumereplica + CloneEnableKEY CVRKey = "openebs.io/cloned" + + // SourceVolumeKey stores the name of source volume whose snapshot is used to + // create this cvr + SourceVolumeKey CVRKey = "openebs.io/source-volume" + + // SnapshotNameKey stores the name of the snapshot being used to restore this replica + SnapshotNameKey CVRKey = "openebs.io/snapshot" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=cstorvolumereplica + +// CStorVolumeReplica describes a cstor volume resource created as custom resource +type CStorVolumeReplica struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec CStorVolumeReplicaSpec `json:"spec"` + Status CStorVolumeReplicaStatus `json:"status"` +} + +// CStorVolumeReplicaSpec is the spec for a CStorVolumeReplica resource +type CStorVolumeReplicaSpec struct { + TargetIP string `json:"targetIP"` + Capacity string `json:"capacity"` +} + +// CStorVolumeReplicaPhase is to hold result of action. +type CStorVolumeReplicaPhase string + +// Status written onto CStorVolumeReplica objects. +const ( + // CVRStatusEmpty ensures the create operation is to be done, if import fails. + CVRStatusEmpty CStorVolumeReplicaPhase = "" + // CVRStatusOnline ensures the resource is available. + CVRStatusOnline CStorVolumeReplicaPhase = "Online" + // CVRStatusOffline ensures the resource is not available. + CVRStatusOffline CStorVolumeReplicaPhase = "Offline" + // CVRStatusDeletionFailed ensures the resource deletion has failed. + CVRStatusDeletionFailed CStorVolumeReplicaPhase = "DeletionFailed" + // CVRStatusInvalid ensures invalid resource. + CVRStatusInvalid CStorVolumeReplicaPhase = "Invalid" + // CVRStatusErrorDuplicate ensures error due to duplicate resource. + CVRStatusErrorDuplicate CStorVolumeReplicaPhase = "ErrorDuplicate" + // CVRStatusPending ensures pending task of cvr resource. + CVRStatusPending CStorVolumeReplicaPhase = "Pending" +) + +// CStorVolumeReplicaStatus is for handling status of cvr. +type CStorVolumeReplicaStatus struct { + Phase CStorVolumeReplicaPhase `json:"phase"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=cstorvolumereplicas + +// CStorVolumeReplicaList is a list of CStorVolumeReplica resources +type CStorVolumeReplicaList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []CStorVolumeReplica `json:"items"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstorvolume.proto b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstorvolume.proto new file mode 100644 index 0000000000..29498933d5 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstorvolume.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package v1alpha1; + +message VolumeSnapCreateRequest { + int32 version = 1; + string volume = 2; + string snapname = 3; +} + +message VolumeSnapCreateResponse { + int32 version = 1; + bytes status = 2; +} + +message VolumeSnapDeleteRequest { + int32 version = 1; + string volume = 2; + string snapname = 3; +} + +message VolumeSnapDeleteResponse { + int32 version = 1; + bytes status = 2; +} + +service RunSnapCommand { + rpc RunVolumeSnapCreateCommand(VolumeSnapCreateRequest) returns (VolumeSnapCreateResponse) {}; + rpc RunVolumeSnapDeleteCommand(VolumeSnapDeleteRequest) returns (VolumeSnapDeleteResponse) {}; +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/disk.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/disk.go new file mode 100644 index 0000000000..efcad4c4fe --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/disk.go @@ -0,0 +1,81 @@ +/* +Copyright 2018 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:noStatus +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=disk + +// Disk describes disk resource. +type Disk struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DiskSpec `json:"spec"` + Status DiskStatus `json:"status"` +} + +// DiskSpec is the specification for the disk stored as CRD +type DiskSpec struct { + Path string `json:"path"` //Path contain devpath (e.g. /dev/sdb) + Capacity DiskCapacity `json:"capacity"` //Capacity + Details DiskDetails `json:"details"` //Details contains static attributes (model, serial ..) + DevLinks []DiskDevLink `json:"devlinks,omitempty"` //DevLinks contains soft links of one disk +} + +// DiskStatus is the state for the disk stored as CRD +type DiskStatus struct { + State string `json:"state"` //current state of the disk (Active/Inactive) +} + +// DiskCapacity is the size of the disk stored as CRD +type DiskCapacity struct { + Storage uint64 `json:"storage"` // disk size in bytes + LogicalSectorSize uint32 `json:"logicalSectorSize"` // disk logical size in bytes +} + +// DiskDetails contains basic and static info of a disk +type DiskDetails struct { + Model string `json:"model"` // Model is model of disk + Compliance string `json:"compliance"` // Implemented standards/specifications version such as SPC-1, SPC-2, etc + Serial string `json:"serial"` // Serial is serial no of disk + Vendor string `json:"vendor"` // Vendor is vendor of disk + FirmwareRevision string `json:"firmwareRevision"` // disk firmware revision +} + +// DiskDevLink holds the maping between type and links like by-id type or by-path type link +type DiskDevLink struct { + Kind string `json:"kind,omitempty"` // Kind is the type of link like by-id or by-path. + Links []string `json:"links,omitempty"` // Links are the soft links of Type type +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=disks + +// DiskList is a list of Disk object resources +type DiskList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []Disk `json:"items"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/doc.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/doc.go new file mode 100644 index 0000000000..56433e5a45 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/doc.go @@ -0,0 +1,5 @@ +// +k8s:deepcopy-gen=package,register + +// Package v1alpha1 is the v1alpha1 version of the API. +// +groupName=openebs.io +package v1alpha1 diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go new file mode 100644 index 0000000000..f73da9298c --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go @@ -0,0 +1,55 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/openebs/maya/pkg/apis/openebs.io" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: openebsio.GroupName, Version: "v1alpha1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder is the scheme builder with scheme init functions to run for this API package + SchemeBuilder runtime.SchemeBuilder + + localSchemeBuilder = &SchemeBuilder + // AddToScheme is a global function that registers this API group & version to a scheme + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &StoragePoolClaim{}, + &StoragePoolClaimList{}, + &StoragePool{}, + &StoragePoolList{}, + &CStorPool{}, + &CStorPoolList{}, + &CStorVolumeReplica{}, + &CStorVolumeReplicaList{}, + &CASTemplate{}, + &CASTemplateList{}, + &CStorVolume{}, + &CStorVolumeList{}, + &Disk{}, + &DiskList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool.go new file mode 100644 index 0000000000..61633c0f82 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool.go @@ -0,0 +1,58 @@ +/* +Copyright 2018 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:noStatus +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=storagepool + +// StoragePool describes a StoragePool. +type StoragePool struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec StoragePoolSpec `json:"spec"` +} + +// StoragePoolSpec is the spec for a StoragePool resource +type StoragePoolSpec struct { + Name string `json:"name"` + Format string `json:"format"` + Mountpoint string `json:"mountpoint"` + Nodename string `json:"nodename"` + Message string `json:"message"` + Path string `json:"path"` + Disks DiskAttr `json:"disks"` + PoolSpec CStorPoolAttr `json:"poolSpec"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=storagepools + +// StoragePoolList is a list of StoragePool resources +type StoragePoolList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []StoragePool `json:"items"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool_claim.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool_claim.go new file mode 100644 index 0000000000..28100a9335 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool_claim.go @@ -0,0 +1,66 @@ +/* +Copyright 2018 The OpenEBS Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:noStatus +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=storagepoolclaim + +// StoragePoolClaim describes a StoragePoolClaim custom resource. +type StoragePoolClaim struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec StoragePoolClaimSpec `json:"spec"` + Status StoragePoolClaimStatus `json:"status"` +} + +// StoragePoolClaimSpec is the spec for a StoragePoolClaimSpec resource +type StoragePoolClaimSpec struct { + Name string `json:"name"` + Format string `json:"format"` + Mountpoint string `json:"mountpoint"` + Path string `json:"path"` + Type string `json:"type"` + NodeSelector []string `json:"nodeSelector"` + Capacity string `json:"capacity"` + MaxPools int `json:"maxPools"` + MinPools int `json:"minPools"` + Disks DiskAttr `json:"disks"` + PoolSpec CStorPoolAttr `json:"poolSpec"` +} + +// StoragePoolClaimStatus is for handling status of pool. +type StoragePoolClaimStatus struct { + Phase string `json:"phase"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=storagepoolclaims + +// StoragePoolClaimList is a list of StoragePoolClaim resources +type StoragePoolClaimList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []StoragePoolClaim `json:"items"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..b8b5df3176 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,1094 @@ +// +build !ignore_autogenerated + +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CASSnapshot) DeepCopyInto(out *CASSnapshot) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CASSnapshot. +func (in *CASSnapshot) DeepCopy() *CASSnapshot { + if in == nil { + return nil + } + out := new(CASSnapshot) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CASSnapshotList) DeepCopyInto(out *CASSnapshotList) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CASSnapshot, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CASSnapshotList. +func (in *CASSnapshotList) DeepCopy() *CASSnapshotList { + if in == nil { + return nil + } + out := new(CASSnapshotList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CASTemplate) DeepCopyInto(out *CASTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CASTemplate. +func (in *CASTemplate) DeepCopy() *CASTemplate { + if in == nil { + return nil + } + out := new(CASTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CASTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CASTemplateList) DeepCopyInto(out *CASTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CASTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CASTemplateList. +func (in *CASTemplateList) DeepCopy() *CASTemplateList { + if in == nil { + return nil + } + out := new(CASTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CASTemplateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CASTemplateSpec) DeepCopyInto(out *CASTemplateSpec) { + *out = *in + if in.Defaults != nil { + in, out := &in.Defaults, &out.Defaults + *out = make([]Config, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.RunTasks.DeepCopyInto(&out.RunTasks) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CASTemplateSpec. +func (in *CASTemplateSpec) DeepCopy() *CASTemplateSpec { + if in == nil { + return nil + } + out := new(CASTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CASVolume) DeepCopyInto(out *CASVolume) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.CloneSpec = in.CloneSpec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CASVolume. +func (in *CASVolume) DeepCopy() *CASVolume { + if in == nil { + return nil + } + out := new(CASVolume) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CASVolumeList) DeepCopyInto(out *CASVolumeList) { + *out = *in + in.ListOptions.DeepCopyInto(&out.ListOptions) + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CASVolume, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CASVolumeList. +func (in *CASVolumeList) DeepCopy() *CASVolumeList { + if in == nil { + return nil + } + out := new(CASVolumeList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CASVolumeSpec) DeepCopyInto(out *CASVolumeSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CASVolumeSpec. +func (in *CASVolumeSpec) DeepCopy() *CASVolumeSpec { + if in == nil { + return nil + } + out := new(CASVolumeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CASVolumeStatus) DeepCopyInto(out *CASVolumeStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CASVolumeStatus. +func (in *CASVolumeStatus) DeepCopy() *CASVolumeStatus { + if in == nil { + return nil + } + out := new(CASVolumeStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorPool) DeepCopyInto(out *CStorPool) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorPool. +func (in *CStorPool) DeepCopy() *CStorPool { + if in == nil { + return nil + } + out := new(CStorPool) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CStorPool) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorPoolAttr) DeepCopyInto(out *CStorPoolAttr) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorPoolAttr. +func (in *CStorPoolAttr) DeepCopy() *CStorPoolAttr { + if in == nil { + return nil + } + out := new(CStorPoolAttr) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorPoolList) DeepCopyInto(out *CStorPoolList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CStorPool, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorPoolList. +func (in *CStorPoolList) DeepCopy() *CStorPoolList { + if in == nil { + return nil + } + out := new(CStorPoolList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CStorPoolList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorPoolSpec) DeepCopyInto(out *CStorPoolSpec) { + *out = *in + in.Disks.DeepCopyInto(&out.Disks) + out.PoolSpec = in.PoolSpec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorPoolSpec. +func (in *CStorPoolSpec) DeepCopy() *CStorPoolSpec { + if in == nil { + return nil + } + out := new(CStorPoolSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorPoolStatus) DeepCopyInto(out *CStorPoolStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorPoolStatus. +func (in *CStorPoolStatus) DeepCopy() *CStorPoolStatus { + if in == nil { + return nil + } + out := new(CStorPoolStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorVolume) DeepCopyInto(out *CStorVolume) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorVolume. +func (in *CStorVolume) DeepCopy() *CStorVolume { + if in == nil { + return nil + } + out := new(CStorVolume) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CStorVolume) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorVolumeList) DeepCopyInto(out *CStorVolumeList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CStorVolume, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorVolumeList. +func (in *CStorVolumeList) DeepCopy() *CStorVolumeList { + if in == nil { + return nil + } + out := new(CStorVolumeList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CStorVolumeList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorVolumeReplica) DeepCopyInto(out *CStorVolumeReplica) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorVolumeReplica. +func (in *CStorVolumeReplica) DeepCopy() *CStorVolumeReplica { + if in == nil { + return nil + } + out := new(CStorVolumeReplica) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CStorVolumeReplica) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorVolumeReplicaList) DeepCopyInto(out *CStorVolumeReplicaList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CStorVolumeReplica, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorVolumeReplicaList. +func (in *CStorVolumeReplicaList) DeepCopy() *CStorVolumeReplicaList { + if in == nil { + return nil + } + out := new(CStorVolumeReplicaList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CStorVolumeReplicaList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorVolumeReplicaSpec) DeepCopyInto(out *CStorVolumeReplicaSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorVolumeReplicaSpec. +func (in *CStorVolumeReplicaSpec) DeepCopy() *CStorVolumeReplicaSpec { + if in == nil { + return nil + } + out := new(CStorVolumeReplicaSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorVolumeReplicaStatus) DeepCopyInto(out *CStorVolumeReplicaStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorVolumeReplicaStatus. +func (in *CStorVolumeReplicaStatus) DeepCopy() *CStorVolumeReplicaStatus { + if in == nil { + return nil + } + out := new(CStorVolumeReplicaStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorVolumeSpec) DeepCopyInto(out *CStorVolumeSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorVolumeSpec. +func (in *CStorVolumeSpec) DeepCopy() *CStorVolumeSpec { + if in == nil { + return nil + } + out := new(CStorVolumeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorVolumeStatus) DeepCopyInto(out *CStorVolumeStatus) { + *out = *in + if in.ReplicaStatuses != nil { + in, out := &in.ReplicaStatuses, &out.ReplicaStatuses + *out = make([]ReplicaStatus, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorVolumeStatus. +func (in *CStorVolumeStatus) DeepCopy() *CStorVolumeStatus { + if in == nil { + return nil + } + out := new(CStorVolumeStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CasPool) DeepCopyInto(out *CasPool) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.DiskList != nil { + in, out := &in.DiskList, &out.DiskList + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CasPool. +func (in *CasPool) DeepCopy() *CasPool { + if in == nil { + return nil + } + out := new(CasPool) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Config) DeepCopyInto(out *Config) { + *out = *in + if in.Data != nil { + in, out := &in.Data, &out.Data + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config. +func (in *Config) DeepCopy() *Config { + if in == nil { + return nil + } + out := new(Config) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Disk) DeepCopyInto(out *Disk) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Disk. +func (in *Disk) DeepCopy() *Disk { + if in == nil { + return nil + } + out := new(Disk) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Disk) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskAttr) DeepCopyInto(out *DiskAttr) { + *out = *in + if in.DiskList != nil { + in, out := &in.DiskList, &out.DiskList + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskAttr. +func (in *DiskAttr) DeepCopy() *DiskAttr { + if in == nil { + return nil + } + out := new(DiskAttr) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskCapacity) DeepCopyInto(out *DiskCapacity) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskCapacity. +func (in *DiskCapacity) DeepCopy() *DiskCapacity { + if in == nil { + return nil + } + out := new(DiskCapacity) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskDetails) DeepCopyInto(out *DiskDetails) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskDetails. +func (in *DiskDetails) DeepCopy() *DiskDetails { + if in == nil { + return nil + } + out := new(DiskDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskDevLink) DeepCopyInto(out *DiskDevLink) { + *out = *in + if in.Links != nil { + in, out := &in.Links, &out.Links + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskDevLink. +func (in *DiskDevLink) DeepCopy() *DiskDevLink { + if in == nil { + return nil + } + out := new(DiskDevLink) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskList) DeepCopyInto(out *DiskList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Disk, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskList. +func (in *DiskList) DeepCopy() *DiskList { + if in == nil { + return nil + } + out := new(DiskList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DiskList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskSpec) DeepCopyInto(out *DiskSpec) { + *out = *in + out.Capacity = in.Capacity + out.Details = in.Details + if in.DevLinks != nil { + in, out := &in.DevLinks, &out.DevLinks + *out = make([]DiskDevLink, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskSpec. +func (in *DiskSpec) DeepCopy() *DiskSpec { + if in == nil { + return nil + } + out := new(DiskSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskStatus) DeepCopyInto(out *DiskStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskStatus. +func (in *DiskStatus) DeepCopy() *DiskStatus { + if in == nil { + return nil + } + out := new(DiskStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReplicaStatus) DeepCopyInto(out *ReplicaStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicaStatus. +func (in *ReplicaStatus) DeepCopy() *ReplicaStatus { + if in == nil { + return nil + } + out := new(ReplicaStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RunTask) DeepCopyInto(out *RunTask) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunTask. +func (in *RunTask) DeepCopy() *RunTask { + if in == nil { + return nil + } + out := new(RunTask) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RunTask) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RunTaskList) DeepCopyInto(out *RunTaskList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RunTask, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunTaskList. +func (in *RunTaskList) DeepCopy() *RunTaskList { + if in == nil { + return nil + } + out := new(RunTaskList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RunTaskList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RunTaskSpec) DeepCopyInto(out *RunTaskSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunTaskSpec. +func (in *RunTaskSpec) DeepCopy() *RunTaskSpec { + if in == nil { + return nil + } + out := new(RunTaskSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RunTasks) DeepCopyInto(out *RunTasks) { + *out = *in + if in.Tasks != nil { + in, out := &in.Tasks, &out.Tasks + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunTasks. +func (in *RunTasks) DeepCopy() *RunTasks { + if in == nil { + return nil + } + out := new(RunTasks) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotOptions) DeepCopyInto(out *SnapshotOptions) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotOptions. +func (in *SnapshotOptions) DeepCopy() *SnapshotOptions { + if in == nil { + return nil + } + out := new(SnapshotOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotSpec) DeepCopyInto(out *SnapshotSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotSpec. +func (in *SnapshotSpec) DeepCopy() *SnapshotSpec { + if in == nil { + return nil + } + out := new(SnapshotSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StoragePool) DeepCopyInto(out *StoragePool) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StoragePool. +func (in *StoragePool) DeepCopy() *StoragePool { + if in == nil { + return nil + } + out := new(StoragePool) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *StoragePool) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StoragePoolClaim) DeepCopyInto(out *StoragePoolClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StoragePoolClaim. +func (in *StoragePoolClaim) DeepCopy() *StoragePoolClaim { + if in == nil { + return nil + } + out := new(StoragePoolClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *StoragePoolClaim) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StoragePoolClaimList) DeepCopyInto(out *StoragePoolClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]StoragePoolClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StoragePoolClaimList. +func (in *StoragePoolClaimList) DeepCopy() *StoragePoolClaimList { + if in == nil { + return nil + } + out := new(StoragePoolClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *StoragePoolClaimList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StoragePoolClaimSpec) DeepCopyInto(out *StoragePoolClaimSpec) { + *out = *in + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make([]string, len(*in)) + copy(*out, *in) + } + in.Disks.DeepCopyInto(&out.Disks) + out.PoolSpec = in.PoolSpec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StoragePoolClaimSpec. +func (in *StoragePoolClaimSpec) DeepCopy() *StoragePoolClaimSpec { + if in == nil { + return nil + } + out := new(StoragePoolClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StoragePoolClaimStatus) DeepCopyInto(out *StoragePoolClaimStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StoragePoolClaimStatus. +func (in *StoragePoolClaimStatus) DeepCopy() *StoragePoolClaimStatus { + if in == nil { + return nil + } + out := new(StoragePoolClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StoragePoolList) DeepCopyInto(out *StoragePoolList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]StoragePool, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StoragePoolList. +func (in *StoragePoolList) DeepCopy() *StoragePoolList { + if in == nil { + return nil + } + out := new(StoragePoolList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *StoragePoolList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StoragePoolSpec) DeepCopyInto(out *StoragePoolSpec) { + *out = *in + in.Disks.DeepCopyInto(&out.Disks) + out.PoolSpec = in.PoolSpec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StoragePoolSpec. +func (in *StoragePoolSpec) DeepCopy() *StoragePoolSpec { + if in == nil { + return nil + } + out := new(StoragePoolSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeCloneSpec) DeepCopyInto(out *VolumeCloneSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeCloneSpec. +func (in *VolumeCloneSpec) DeepCopy() *VolumeCloneSpec { + if in == nil { + return nil + } + out := new(VolumeCloneSpec) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/clientset.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/clientset.go new file mode 100644 index 0000000000..0927cc632a --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/clientset.go @@ -0,0 +1,98 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + openebsv1alpha1 "github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + OpenebsV1alpha1() openebsv1alpha1.OpenebsV1alpha1Interface + // Deprecated: please explicitly pick a version if possible. + Openebs() openebsv1alpha1.OpenebsV1alpha1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + openebsV1alpha1 *openebsv1alpha1.OpenebsV1alpha1Client +} + +// OpenebsV1alpha1 retrieves the OpenebsV1alpha1Client +func (c *Clientset) OpenebsV1alpha1() openebsv1alpha1.OpenebsV1alpha1Interface { + return c.openebsV1alpha1 +} + +// Deprecated: Openebs retrieves the default version of OpenebsClient. +// Please explicitly pick a version. +func (c *Clientset) Openebs() openebsv1alpha1.OpenebsV1alpha1Interface { + return c.openebsV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.openebsV1alpha1, err = openebsv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.openebsV1alpha1 = openebsv1alpha1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.openebsV1alpha1 = openebsv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/doc.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/doc.go new file mode 100644 index 0000000000..b00c45ec41 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/clientset_generated.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..ef78ab9ecc --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,82 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + clientset "github.com/openebs/maya/pkg/client/clientset/versioned" + openebsv1alpha1 "github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1" + fakeopenebsv1alpha1 "github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// OpenebsV1alpha1 retrieves the OpenebsV1alpha1Client +func (c *Clientset) OpenebsV1alpha1() openebsv1alpha1.OpenebsV1alpha1Interface { + return &fakeopenebsv1alpha1.FakeOpenebsV1alpha1{Fake: &c.Fake} +} + +// Openebs retrieves the OpenebsV1alpha1Client +func (c *Clientset) Openebs() openebsv1alpha1.OpenebsV1alpha1Interface { + return &fakeopenebsv1alpha1.FakeOpenebsV1alpha1{Fake: &c.Fake} +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/doc.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..7cb27603ee --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/register.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..e25808f756 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + openebsv1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + openebsv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/doc.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..6d9810cf81 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/register.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..445e5f31b6 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + openebsv1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + openebsv1alpha1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/castemplate.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/castemplate.go new file mode 100644 index 0000000000..6d239e0201 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/castemplate.go @@ -0,0 +1,147 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CASTemplatesGetter has a method to return a CASTemplateInterface. +// A group's client should implement this interface. +type CASTemplatesGetter interface { + CASTemplates() CASTemplateInterface +} + +// CASTemplateInterface has methods to work with CASTemplate resources. +type CASTemplateInterface interface { + Create(*v1alpha1.CASTemplate) (*v1alpha1.CASTemplate, error) + Update(*v1alpha1.CASTemplate) (*v1alpha1.CASTemplate, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CASTemplate, error) + List(opts v1.ListOptions) (*v1alpha1.CASTemplateList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CASTemplate, err error) + CASTemplateExpansion +} + +// cASTemplates implements CASTemplateInterface +type cASTemplates struct { + client rest.Interface +} + +// newCASTemplates returns a CASTemplates +func newCASTemplates(c *OpenebsV1alpha1Client) *cASTemplates { + return &cASTemplates{ + client: c.RESTClient(), + } +} + +// Get takes name of the cASTemplate, and returns the corresponding cASTemplate object, and an error if there is any. +func (c *cASTemplates) Get(name string, options v1.GetOptions) (result *v1alpha1.CASTemplate, err error) { + result = &v1alpha1.CASTemplate{} + err = c.client.Get(). + Resource("castemplates"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CASTemplates that match those selectors. +func (c *cASTemplates) List(opts v1.ListOptions) (result *v1alpha1.CASTemplateList, err error) { + result = &v1alpha1.CASTemplateList{} + err = c.client.Get(). + Resource("castemplates"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cASTemplates. +func (c *cASTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("castemplates"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cASTemplate and creates it. Returns the server's representation of the cASTemplate, and an error, if there is any. +func (c *cASTemplates) Create(cASTemplate *v1alpha1.CASTemplate) (result *v1alpha1.CASTemplate, err error) { + result = &v1alpha1.CASTemplate{} + err = c.client.Post(). + Resource("castemplates"). + Body(cASTemplate). + Do(). + Into(result) + return +} + +// Update takes the representation of a cASTemplate and updates it. Returns the server's representation of the cASTemplate, and an error, if there is any. +func (c *cASTemplates) Update(cASTemplate *v1alpha1.CASTemplate) (result *v1alpha1.CASTemplate, err error) { + result = &v1alpha1.CASTemplate{} + err = c.client.Put(). + Resource("castemplates"). + Name(cASTemplate.Name). + Body(cASTemplate). + Do(). + Into(result) + return +} + +// Delete takes name of the cASTemplate and deletes it. Returns an error if one occurs. +func (c *cASTemplates) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("castemplates"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cASTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("castemplates"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cASTemplate. +func (c *cASTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CASTemplate, err error) { + result = &v1alpha1.CASTemplate{} + err = c.client.Patch(pt). + Resource("castemplates"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorpool.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorpool.go new file mode 100644 index 0000000000..8a622a3d7d --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorpool.go @@ -0,0 +1,147 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CStorPoolsGetter has a method to return a CStorPoolInterface. +// A group's client should implement this interface. +type CStorPoolsGetter interface { + CStorPools() CStorPoolInterface +} + +// CStorPoolInterface has methods to work with CStorPool resources. +type CStorPoolInterface interface { + Create(*v1alpha1.CStorPool) (*v1alpha1.CStorPool, error) + Update(*v1alpha1.CStorPool) (*v1alpha1.CStorPool, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CStorPool, error) + List(opts v1.ListOptions) (*v1alpha1.CStorPoolList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorPool, err error) + CStorPoolExpansion +} + +// cStorPools implements CStorPoolInterface +type cStorPools struct { + client rest.Interface +} + +// newCStorPools returns a CStorPools +func newCStorPools(c *OpenebsV1alpha1Client) *cStorPools { + return &cStorPools{ + client: c.RESTClient(), + } +} + +// Get takes name of the cStorPool, and returns the corresponding cStorPool object, and an error if there is any. +func (c *cStorPools) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorPool, err error) { + result = &v1alpha1.CStorPool{} + err = c.client.Get(). + Resource("cstorpools"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CStorPools that match those selectors. +func (c *cStorPools) List(opts v1.ListOptions) (result *v1alpha1.CStorPoolList, err error) { + result = &v1alpha1.CStorPoolList{} + err = c.client.Get(). + Resource("cstorpools"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cStorPools. +func (c *cStorPools) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("cstorpools"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cStorPool and creates it. Returns the server's representation of the cStorPool, and an error, if there is any. +func (c *cStorPools) Create(cStorPool *v1alpha1.CStorPool) (result *v1alpha1.CStorPool, err error) { + result = &v1alpha1.CStorPool{} + err = c.client.Post(). + Resource("cstorpools"). + Body(cStorPool). + Do(). + Into(result) + return +} + +// Update takes the representation of a cStorPool and updates it. Returns the server's representation of the cStorPool, and an error, if there is any. +func (c *cStorPools) Update(cStorPool *v1alpha1.CStorPool) (result *v1alpha1.CStorPool, err error) { + result = &v1alpha1.CStorPool{} + err = c.client.Put(). + Resource("cstorpools"). + Name(cStorPool.Name). + Body(cStorPool). + Do(). + Into(result) + return +} + +// Delete takes name of the cStorPool and deletes it. Returns an error if one occurs. +func (c *cStorPools) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("cstorpools"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cStorPools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("cstorpools"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cStorPool. +func (c *cStorPools) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorPool, err error) { + result = &v1alpha1.CStorPool{} + err = c.client.Patch(pt). + Resource("cstorpools"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolume.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolume.go new file mode 100644 index 0000000000..8f0401e9d4 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolume.go @@ -0,0 +1,157 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CStorVolumesGetter has a method to return a CStorVolumeInterface. +// A group's client should implement this interface. +type CStorVolumesGetter interface { + CStorVolumes(namespace string) CStorVolumeInterface +} + +// CStorVolumeInterface has methods to work with CStorVolume resources. +type CStorVolumeInterface interface { + Create(*v1alpha1.CStorVolume) (*v1alpha1.CStorVolume, error) + Update(*v1alpha1.CStorVolume) (*v1alpha1.CStorVolume, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CStorVolume, error) + List(opts v1.ListOptions) (*v1alpha1.CStorVolumeList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolume, err error) + CStorVolumeExpansion +} + +// cStorVolumes implements CStorVolumeInterface +type cStorVolumes struct { + client rest.Interface + ns string +} + +// newCStorVolumes returns a CStorVolumes +func newCStorVolumes(c *OpenebsV1alpha1Client, namespace string) *cStorVolumes { + return &cStorVolumes{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cStorVolume, and returns the corresponding cStorVolume object, and an error if there is any. +func (c *cStorVolumes) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorVolume, err error) { + result = &v1alpha1.CStorVolume{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CStorVolumes that match those selectors. +func (c *cStorVolumes) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeList, err error) { + result = &v1alpha1.CStorVolumeList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumes"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cStorVolumes. +func (c *cStorVolumes) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumes"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cStorVolume and creates it. Returns the server's representation of the cStorVolume, and an error, if there is any. +func (c *cStorVolumes) Create(cStorVolume *v1alpha1.CStorVolume) (result *v1alpha1.CStorVolume, err error) { + result = &v1alpha1.CStorVolume{} + err = c.client.Post(). + Namespace(c.ns). + Resource("cstorvolumes"). + Body(cStorVolume). + Do(). + Into(result) + return +} + +// Update takes the representation of a cStorVolume and updates it. Returns the server's representation of the cStorVolume, and an error, if there is any. +func (c *cStorVolumes) Update(cStorVolume *v1alpha1.CStorVolume) (result *v1alpha1.CStorVolume, err error) { + result = &v1alpha1.CStorVolume{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cstorvolumes"). + Name(cStorVolume.Name). + Body(cStorVolume). + Do(). + Into(result) + return +} + +// Delete takes name of the cStorVolume and deletes it. Returns an error if one occurs. +func (c *cStorVolumes) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorvolumes"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cStorVolumes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorvolumes"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cStorVolume. +func (c *cStorVolumes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolume, err error) { + result = &v1alpha1.CStorVolume{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("cstorvolumes"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolumereplica.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolumereplica.go new file mode 100644 index 0000000000..18186bb860 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolumereplica.go @@ -0,0 +1,157 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CStorVolumeReplicasGetter has a method to return a CStorVolumeReplicaInterface. +// A group's client should implement this interface. +type CStorVolumeReplicasGetter interface { + CStorVolumeReplicas(namespace string) CStorVolumeReplicaInterface +} + +// CStorVolumeReplicaInterface has methods to work with CStorVolumeReplica resources. +type CStorVolumeReplicaInterface interface { + Create(*v1alpha1.CStorVolumeReplica) (*v1alpha1.CStorVolumeReplica, error) + Update(*v1alpha1.CStorVolumeReplica) (*v1alpha1.CStorVolumeReplica, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.CStorVolumeReplica, error) + List(opts v1.ListOptions) (*v1alpha1.CStorVolumeReplicaList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolumeReplica, err error) + CStorVolumeReplicaExpansion +} + +// cStorVolumeReplicas implements CStorVolumeReplicaInterface +type cStorVolumeReplicas struct { + client rest.Interface + ns string +} + +// newCStorVolumeReplicas returns a CStorVolumeReplicas +func newCStorVolumeReplicas(c *OpenebsV1alpha1Client, namespace string) *cStorVolumeReplicas { + return &cStorVolumeReplicas{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cStorVolumeReplica, and returns the corresponding cStorVolumeReplica object, and an error if there is any. +func (c *cStorVolumeReplicas) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorVolumeReplica, err error) { + result = &v1alpha1.CStorVolumeReplica{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CStorVolumeReplicas that match those selectors. +func (c *cStorVolumeReplicas) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeReplicaList, err error) { + result = &v1alpha1.CStorVolumeReplicaList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cStorVolumeReplicas. +func (c *cStorVolumeReplicas) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cStorVolumeReplica and creates it. Returns the server's representation of the cStorVolumeReplica, and an error, if there is any. +func (c *cStorVolumeReplicas) Create(cStorVolumeReplica *v1alpha1.CStorVolumeReplica) (result *v1alpha1.CStorVolumeReplica, err error) { + result = &v1alpha1.CStorVolumeReplica{} + err = c.client.Post(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + Body(cStorVolumeReplica). + Do(). + Into(result) + return +} + +// Update takes the representation of a cStorVolumeReplica and updates it. Returns the server's representation of the cStorVolumeReplica, and an error, if there is any. +func (c *cStorVolumeReplicas) Update(cStorVolumeReplica *v1alpha1.CStorVolumeReplica) (result *v1alpha1.CStorVolumeReplica, err error) { + result = &v1alpha1.CStorVolumeReplica{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + Name(cStorVolumeReplica.Name). + Body(cStorVolumeReplica). + Do(). + Into(result) + return +} + +// Delete takes name of the cStorVolumeReplica and deletes it. Returns an error if one occurs. +func (c *cStorVolumeReplicas) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cStorVolumeReplicas) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cStorVolumeReplica. +func (c *cStorVolumeReplicas) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolumeReplica, err error) { + result = &v1alpha1.CStorVolumeReplica{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("cstorvolumereplicas"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/disk.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/disk.go new file mode 100644 index 0000000000..41f0224330 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/disk.go @@ -0,0 +1,147 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// DisksGetter has a method to return a DiskInterface. +// A group's client should implement this interface. +type DisksGetter interface { + Disks() DiskInterface +} + +// DiskInterface has methods to work with Disk resources. +type DiskInterface interface { + Create(*v1alpha1.Disk) (*v1alpha1.Disk, error) + Update(*v1alpha1.Disk) (*v1alpha1.Disk, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.Disk, error) + List(opts v1.ListOptions) (*v1alpha1.DiskList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Disk, err error) + DiskExpansion +} + +// disks implements DiskInterface +type disks struct { + client rest.Interface +} + +// newDisks returns a Disks +func newDisks(c *OpenebsV1alpha1Client) *disks { + return &disks{ + client: c.RESTClient(), + } +} + +// Get takes name of the disk, and returns the corresponding disk object, and an error if there is any. +func (c *disks) Get(name string, options v1.GetOptions) (result *v1alpha1.Disk, err error) { + result = &v1alpha1.Disk{} + err = c.client.Get(). + Resource("disks"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Disks that match those selectors. +func (c *disks) List(opts v1.ListOptions) (result *v1alpha1.DiskList, err error) { + result = &v1alpha1.DiskList{} + err = c.client.Get(). + Resource("disks"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested disks. +func (c *disks) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("disks"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a disk and creates it. Returns the server's representation of the disk, and an error, if there is any. +func (c *disks) Create(disk *v1alpha1.Disk) (result *v1alpha1.Disk, err error) { + result = &v1alpha1.Disk{} + err = c.client.Post(). + Resource("disks"). + Body(disk). + Do(). + Into(result) + return +} + +// Update takes the representation of a disk and updates it. Returns the server's representation of the disk, and an error, if there is any. +func (c *disks) Update(disk *v1alpha1.Disk) (result *v1alpha1.Disk, err error) { + result = &v1alpha1.Disk{} + err = c.client.Put(). + Resource("disks"). + Name(disk.Name). + Body(disk). + Do(). + Into(result) + return +} + +// Delete takes name of the disk and deletes it. Returns an error if one occurs. +func (c *disks) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("disks"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *disks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("disks"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched disk. +func (c *disks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Disk, err error) { + result = &v1alpha1.Disk{} + err = c.client.Patch(pt). + Resource("disks"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/doc.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/doc.go new file mode 100644 index 0000000000..be8ef1127a --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/doc.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/doc.go new file mode 100644 index 0000000000..6527f84023 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_castemplate.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_castemplate.go new file mode 100644 index 0000000000..9c279389e4 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_castemplate.go @@ -0,0 +1,120 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCASTemplates implements CASTemplateInterface +type FakeCASTemplates struct { + Fake *FakeOpenebsV1alpha1 +} + +var castemplatesResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "castemplates"} + +var castemplatesKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CASTemplate"} + +// Get takes name of the cASTemplate, and returns the corresponding cASTemplate object, and an error if there is any. +func (c *FakeCASTemplates) Get(name string, options v1.GetOptions) (result *v1alpha1.CASTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(castemplatesResource, name), &v1alpha1.CASTemplate{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CASTemplate), err +} + +// List takes label and field selectors, and returns the list of CASTemplates that match those selectors. +func (c *FakeCASTemplates) List(opts v1.ListOptions) (result *v1alpha1.CASTemplateList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(castemplatesResource, castemplatesKind, opts), &v1alpha1.CASTemplateList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CASTemplateList{ListMeta: obj.(*v1alpha1.CASTemplateList).ListMeta} + for _, item := range obj.(*v1alpha1.CASTemplateList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cASTemplates. +func (c *FakeCASTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(castemplatesResource, opts)) +} + +// Create takes the representation of a cASTemplate and creates it. Returns the server's representation of the cASTemplate, and an error, if there is any. +func (c *FakeCASTemplates) Create(cASTemplate *v1alpha1.CASTemplate) (result *v1alpha1.CASTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(castemplatesResource, cASTemplate), &v1alpha1.CASTemplate{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CASTemplate), err +} + +// Update takes the representation of a cASTemplate and updates it. Returns the server's representation of the cASTemplate, and an error, if there is any. +func (c *FakeCASTemplates) Update(cASTemplate *v1alpha1.CASTemplate) (result *v1alpha1.CASTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(castemplatesResource, cASTemplate), &v1alpha1.CASTemplate{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CASTemplate), err +} + +// Delete takes name of the cASTemplate and deletes it. Returns an error if one occurs. +func (c *FakeCASTemplates) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(castemplatesResource, name), &v1alpha1.CASTemplate{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCASTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(castemplatesResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CASTemplateList{}) + return err +} + +// Patch applies the patch and returns the patched cASTemplate. +func (c *FakeCASTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CASTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(castemplatesResource, name, pt, data, subresources...), &v1alpha1.CASTemplate{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CASTemplate), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpool.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpool.go new file mode 100644 index 0000000000..f94f349366 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpool.go @@ -0,0 +1,120 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorPools implements CStorPoolInterface +type FakeCStorPools struct { + Fake *FakeOpenebsV1alpha1 +} + +var cstorpoolsResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorpools"} + +var cstorpoolsKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorPool"} + +// Get takes name of the cStorPool, and returns the corresponding cStorPool object, and an error if there is any. +func (c *FakeCStorPools) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(cstorpoolsResource, name), &v1alpha1.CStorPool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPool), err +} + +// List takes label and field selectors, and returns the list of CStorPools that match those selectors. +func (c *FakeCStorPools) List(opts v1.ListOptions) (result *v1alpha1.CStorPoolList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(cstorpoolsResource, cstorpoolsKind, opts), &v1alpha1.CStorPoolList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorPoolList{ListMeta: obj.(*v1alpha1.CStorPoolList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorPoolList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorPools. +func (c *FakeCStorPools) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(cstorpoolsResource, opts)) +} + +// Create takes the representation of a cStorPool and creates it. Returns the server's representation of the cStorPool, and an error, if there is any. +func (c *FakeCStorPools) Create(cStorPool *v1alpha1.CStorPool) (result *v1alpha1.CStorPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(cstorpoolsResource, cStorPool), &v1alpha1.CStorPool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPool), err +} + +// Update takes the representation of a cStorPool and updates it. Returns the server's representation of the cStorPool, and an error, if there is any. +func (c *FakeCStorPools) Update(cStorPool *v1alpha1.CStorPool) (result *v1alpha1.CStorPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(cstorpoolsResource, cStorPool), &v1alpha1.CStorPool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPool), err +} + +// Delete takes name of the cStorPool and deletes it. Returns an error if one occurs. +func (c *FakeCStorPools) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(cstorpoolsResource, name), &v1alpha1.CStorPool{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorPools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(cstorpoolsResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorPoolList{}) + return err +} + +// Patch applies the patch and returns the patched cStorPool. +func (c *FakeCStorPools) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(cstorpoolsResource, name, pt, data, subresources...), &v1alpha1.CStorPool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorPool), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolume.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolume.go new file mode 100644 index 0000000000..6658841b12 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolume.go @@ -0,0 +1,128 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorVolumes implements CStorVolumeInterface +type FakeCStorVolumes struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var cstorvolumesResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorvolumes"} + +var cstorvolumesKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorVolume"} + +// Get takes name of the cStorVolume, and returns the corresponding cStorVolume object, and an error if there is any. +func (c *FakeCStorVolumes) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cstorvolumesResource, c.ns, name), &v1alpha1.CStorVolume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolume), err +} + +// List takes label and field selectors, and returns the list of CStorVolumes that match those selectors. +func (c *FakeCStorVolumes) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cstorvolumesResource, cstorvolumesKind, c.ns, opts), &v1alpha1.CStorVolumeList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorVolumeList{ListMeta: obj.(*v1alpha1.CStorVolumeList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorVolumeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorVolumes. +func (c *FakeCStorVolumes) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cstorvolumesResource, c.ns, opts)) + +} + +// Create takes the representation of a cStorVolume and creates it. Returns the server's representation of the cStorVolume, and an error, if there is any. +func (c *FakeCStorVolumes) Create(cStorVolume *v1alpha1.CStorVolume) (result *v1alpha1.CStorVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cstorvolumesResource, c.ns, cStorVolume), &v1alpha1.CStorVolume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolume), err +} + +// Update takes the representation of a cStorVolume and updates it. Returns the server's representation of the cStorVolume, and an error, if there is any. +func (c *FakeCStorVolumes) Update(cStorVolume *v1alpha1.CStorVolume) (result *v1alpha1.CStorVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cstorvolumesResource, c.ns, cStorVolume), &v1alpha1.CStorVolume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolume), err +} + +// Delete takes name of the cStorVolume and deletes it. Returns an error if one occurs. +func (c *FakeCStorVolumes) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cstorvolumesResource, c.ns, name), &v1alpha1.CStorVolume{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorVolumes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cstorvolumesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorVolumeList{}) + return err +} + +// Patch applies the patch and returns the patched cStorVolume. +func (c *FakeCStorVolumes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cstorvolumesResource, c.ns, name, pt, data, subresources...), &v1alpha1.CStorVolume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolume), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumereplica.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumereplica.go new file mode 100644 index 0000000000..aa569368e6 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumereplica.go @@ -0,0 +1,128 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCStorVolumeReplicas implements CStorVolumeReplicaInterface +type FakeCStorVolumeReplicas struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var cstorvolumereplicasResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "cstorvolumereplicas"} + +var cstorvolumereplicasKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "CStorVolumeReplica"} + +// Get takes name of the cStorVolumeReplica, and returns the corresponding cStorVolumeReplica object, and an error if there is any. +func (c *FakeCStorVolumeReplicas) Get(name string, options v1.GetOptions) (result *v1alpha1.CStorVolumeReplica, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cstorvolumereplicasResource, c.ns, name), &v1alpha1.CStorVolumeReplica{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeReplica), err +} + +// List takes label and field selectors, and returns the list of CStorVolumeReplicas that match those selectors. +func (c *FakeCStorVolumeReplicas) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeReplicaList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cstorvolumereplicasResource, cstorvolumereplicasKind, c.ns, opts), &v1alpha1.CStorVolumeReplicaList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.CStorVolumeReplicaList{ListMeta: obj.(*v1alpha1.CStorVolumeReplicaList).ListMeta} + for _, item := range obj.(*v1alpha1.CStorVolumeReplicaList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cStorVolumeReplicas. +func (c *FakeCStorVolumeReplicas) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cstorvolumereplicasResource, c.ns, opts)) + +} + +// Create takes the representation of a cStorVolumeReplica and creates it. Returns the server's representation of the cStorVolumeReplica, and an error, if there is any. +func (c *FakeCStorVolumeReplicas) Create(cStorVolumeReplica *v1alpha1.CStorVolumeReplica) (result *v1alpha1.CStorVolumeReplica, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cstorvolumereplicasResource, c.ns, cStorVolumeReplica), &v1alpha1.CStorVolumeReplica{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeReplica), err +} + +// Update takes the representation of a cStorVolumeReplica and updates it. Returns the server's representation of the cStorVolumeReplica, and an error, if there is any. +func (c *FakeCStorVolumeReplicas) Update(cStorVolumeReplica *v1alpha1.CStorVolumeReplica) (result *v1alpha1.CStorVolumeReplica, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cstorvolumereplicasResource, c.ns, cStorVolumeReplica), &v1alpha1.CStorVolumeReplica{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeReplica), err +} + +// Delete takes name of the cStorVolumeReplica and deletes it. Returns an error if one occurs. +func (c *FakeCStorVolumeReplicas) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cstorvolumereplicasResource, c.ns, name), &v1alpha1.CStorVolumeReplica{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCStorVolumeReplicas) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cstorvolumereplicasResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.CStorVolumeReplicaList{}) + return err +} + +// Patch applies the patch and returns the patched cStorVolumeReplica. +func (c *FakeCStorVolumeReplicas) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CStorVolumeReplica, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cstorvolumereplicasResource, c.ns, name, pt, data, subresources...), &v1alpha1.CStorVolumeReplica{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.CStorVolumeReplica), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_disk.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_disk.go new file mode 100644 index 0000000000..1be98203dd --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_disk.go @@ -0,0 +1,120 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeDisks implements DiskInterface +type FakeDisks struct { + Fake *FakeOpenebsV1alpha1 +} + +var disksResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "disks"} + +var disksKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "Disk"} + +// Get takes name of the disk, and returns the corresponding disk object, and an error if there is any. +func (c *FakeDisks) Get(name string, options v1.GetOptions) (result *v1alpha1.Disk, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(disksResource, name), &v1alpha1.Disk{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Disk), err +} + +// List takes label and field selectors, and returns the list of Disks that match those selectors. +func (c *FakeDisks) List(opts v1.ListOptions) (result *v1alpha1.DiskList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(disksResource, disksKind, opts), &v1alpha1.DiskList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.DiskList{ListMeta: obj.(*v1alpha1.DiskList).ListMeta} + for _, item := range obj.(*v1alpha1.DiskList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested disks. +func (c *FakeDisks) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(disksResource, opts)) +} + +// Create takes the representation of a disk and creates it. Returns the server's representation of the disk, and an error, if there is any. +func (c *FakeDisks) Create(disk *v1alpha1.Disk) (result *v1alpha1.Disk, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(disksResource, disk), &v1alpha1.Disk{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Disk), err +} + +// Update takes the representation of a disk and updates it. Returns the server's representation of the disk, and an error, if there is any. +func (c *FakeDisks) Update(disk *v1alpha1.Disk) (result *v1alpha1.Disk, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(disksResource, disk), &v1alpha1.Disk{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Disk), err +} + +// Delete takes name of the disk and deletes it. Returns an error if one occurs. +func (c *FakeDisks) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(disksResource, name), &v1alpha1.Disk{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeDisks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(disksResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.DiskList{}) + return err +} + +// Patch applies the patch and returns the patched disk. +func (c *FakeDisks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Disk, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(disksResource, name, pt, data, subresources...), &v1alpha1.Disk{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Disk), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go new file mode 100644 index 0000000000..a65ce82df6 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go @@ -0,0 +1,68 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeOpenebsV1alpha1 struct { + *testing.Fake +} + +func (c *FakeOpenebsV1alpha1) CASTemplates() v1alpha1.CASTemplateInterface { + return &FakeCASTemplates{c} +} + +func (c *FakeOpenebsV1alpha1) CStorPools() v1alpha1.CStorPoolInterface { + return &FakeCStorPools{c} +} + +func (c *FakeOpenebsV1alpha1) CStorVolumes(namespace string) v1alpha1.CStorVolumeInterface { + return &FakeCStorVolumes{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) CStorVolumeReplicas(namespace string) v1alpha1.CStorVolumeReplicaInterface { + return &FakeCStorVolumeReplicas{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) Disks() v1alpha1.DiskInterface { + return &FakeDisks{c} +} + +func (c *FakeOpenebsV1alpha1) RunTasks(namespace string) v1alpha1.RunTaskInterface { + return &FakeRunTasks{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) StoragePools() v1alpha1.StoragePoolInterface { + return &FakeStoragePools{c} +} + +func (c *FakeOpenebsV1alpha1) StoragePoolClaims() v1alpha1.StoragePoolClaimInterface { + return &FakeStoragePoolClaims{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeOpenebsV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_runtask.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_runtask.go new file mode 100644 index 0000000000..8ae307ff81 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_runtask.go @@ -0,0 +1,128 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeRunTasks implements RunTaskInterface +type FakeRunTasks struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var runtasksResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "runtasks"} + +var runtasksKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "RunTask"} + +// Get takes name of the runTask, and returns the corresponding runTask object, and an error if there is any. +func (c *FakeRunTasks) Get(name string, options v1.GetOptions) (result *v1alpha1.RunTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(runtasksResource, c.ns, name), &v1alpha1.RunTask{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RunTask), err +} + +// List takes label and field selectors, and returns the list of RunTasks that match those selectors. +func (c *FakeRunTasks) List(opts v1.ListOptions) (result *v1alpha1.RunTaskList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(runtasksResource, runtasksKind, c.ns, opts), &v1alpha1.RunTaskList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.RunTaskList{ListMeta: obj.(*v1alpha1.RunTaskList).ListMeta} + for _, item := range obj.(*v1alpha1.RunTaskList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested runTasks. +func (c *FakeRunTasks) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(runtasksResource, c.ns, opts)) + +} + +// Create takes the representation of a runTask and creates it. Returns the server's representation of the runTask, and an error, if there is any. +func (c *FakeRunTasks) Create(runTask *v1alpha1.RunTask) (result *v1alpha1.RunTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(runtasksResource, c.ns, runTask), &v1alpha1.RunTask{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RunTask), err +} + +// Update takes the representation of a runTask and updates it. Returns the server's representation of the runTask, and an error, if there is any. +func (c *FakeRunTasks) Update(runTask *v1alpha1.RunTask) (result *v1alpha1.RunTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(runtasksResource, c.ns, runTask), &v1alpha1.RunTask{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RunTask), err +} + +// Delete takes name of the runTask and deletes it. Returns an error if one occurs. +func (c *FakeRunTasks) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(runtasksResource, c.ns, name), &v1alpha1.RunTask{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRunTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(runtasksResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.RunTaskList{}) + return err +} + +// Patch applies the patch and returns the patched runTask. +func (c *FakeRunTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.RunTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(runtasksResource, c.ns, name, pt, data, subresources...), &v1alpha1.RunTask{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RunTask), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepool.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepool.go new file mode 100644 index 0000000000..ef49e6d340 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepool.go @@ -0,0 +1,120 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeStoragePools implements StoragePoolInterface +type FakeStoragePools struct { + Fake *FakeOpenebsV1alpha1 +} + +var storagepoolsResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "storagepools"} + +var storagepoolsKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "StoragePool"} + +// Get takes name of the storagePool, and returns the corresponding storagePool object, and an error if there is any. +func (c *FakeStoragePools) Get(name string, options v1.GetOptions) (result *v1alpha1.StoragePool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(storagepoolsResource, name), &v1alpha1.StoragePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePool), err +} + +// List takes label and field selectors, and returns the list of StoragePools that match those selectors. +func (c *FakeStoragePools) List(opts v1.ListOptions) (result *v1alpha1.StoragePoolList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(storagepoolsResource, storagepoolsKind, opts), &v1alpha1.StoragePoolList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.StoragePoolList{ListMeta: obj.(*v1alpha1.StoragePoolList).ListMeta} + for _, item := range obj.(*v1alpha1.StoragePoolList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested storagePools. +func (c *FakeStoragePools) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(storagepoolsResource, opts)) +} + +// Create takes the representation of a storagePool and creates it. Returns the server's representation of the storagePool, and an error, if there is any. +func (c *FakeStoragePools) Create(storagePool *v1alpha1.StoragePool) (result *v1alpha1.StoragePool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(storagepoolsResource, storagePool), &v1alpha1.StoragePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePool), err +} + +// Update takes the representation of a storagePool and updates it. Returns the server's representation of the storagePool, and an error, if there is any. +func (c *FakeStoragePools) Update(storagePool *v1alpha1.StoragePool) (result *v1alpha1.StoragePool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(storagepoolsResource, storagePool), &v1alpha1.StoragePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePool), err +} + +// Delete takes name of the storagePool and deletes it. Returns an error if one occurs. +func (c *FakeStoragePools) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(storagepoolsResource, name), &v1alpha1.StoragePool{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeStoragePools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(storagepoolsResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.StoragePoolList{}) + return err +} + +// Patch applies the patch and returns the patched storagePool. +func (c *FakeStoragePools) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(storagepoolsResource, name, pt, data, subresources...), &v1alpha1.StoragePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePool), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepoolclaim.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepoolclaim.go new file mode 100644 index 0000000000..9216c83019 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepoolclaim.go @@ -0,0 +1,120 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeStoragePoolClaims implements StoragePoolClaimInterface +type FakeStoragePoolClaims struct { + Fake *FakeOpenebsV1alpha1 +} + +var storagepoolclaimsResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "storagepoolclaims"} + +var storagepoolclaimsKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "StoragePoolClaim"} + +// Get takes name of the storagePoolClaim, and returns the corresponding storagePoolClaim object, and an error if there is any. +func (c *FakeStoragePoolClaims) Get(name string, options v1.GetOptions) (result *v1alpha1.StoragePoolClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(storagepoolclaimsResource, name), &v1alpha1.StoragePoolClaim{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePoolClaim), err +} + +// List takes label and field selectors, and returns the list of StoragePoolClaims that match those selectors. +func (c *FakeStoragePoolClaims) List(opts v1.ListOptions) (result *v1alpha1.StoragePoolClaimList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(storagepoolclaimsResource, storagepoolclaimsKind, opts), &v1alpha1.StoragePoolClaimList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.StoragePoolClaimList{ListMeta: obj.(*v1alpha1.StoragePoolClaimList).ListMeta} + for _, item := range obj.(*v1alpha1.StoragePoolClaimList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested storagePoolClaims. +func (c *FakeStoragePoolClaims) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(storagepoolclaimsResource, opts)) +} + +// Create takes the representation of a storagePoolClaim and creates it. Returns the server's representation of the storagePoolClaim, and an error, if there is any. +func (c *FakeStoragePoolClaims) Create(storagePoolClaim *v1alpha1.StoragePoolClaim) (result *v1alpha1.StoragePoolClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(storagepoolclaimsResource, storagePoolClaim), &v1alpha1.StoragePoolClaim{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePoolClaim), err +} + +// Update takes the representation of a storagePoolClaim and updates it. Returns the server's representation of the storagePoolClaim, and an error, if there is any. +func (c *FakeStoragePoolClaims) Update(storagePoolClaim *v1alpha1.StoragePoolClaim) (result *v1alpha1.StoragePoolClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(storagepoolclaimsResource, storagePoolClaim), &v1alpha1.StoragePoolClaim{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePoolClaim), err +} + +// Delete takes name of the storagePoolClaim and deletes it. Returns an error if one occurs. +func (c *FakeStoragePoolClaims) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(storagepoolclaimsResource, name), &v1alpha1.StoragePoolClaim{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeStoragePoolClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(storagepoolclaimsResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.StoragePoolClaimList{}) + return err +} + +// Patch applies the patch and returns the patched storagePoolClaim. +func (c *FakeStoragePoolClaims) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePoolClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(storagepoolclaimsResource, name, pt, data, subresources...), &v1alpha1.StoragePoolClaim{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.StoragePoolClaim), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go new file mode 100644 index 0000000000..8736db0b10 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go @@ -0,0 +1,35 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type CASTemplateExpansion interface{} + +type CStorPoolExpansion interface{} + +type CStorVolumeExpansion interface{} + +type CStorVolumeReplicaExpansion interface{} + +type DiskExpansion interface{} + +type RunTaskExpansion interface{} + +type StoragePoolExpansion interface{} + +type StoragePoolClaimExpansion interface{} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go new file mode 100644 index 0000000000..364475b9f6 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go @@ -0,0 +1,125 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type OpenebsV1alpha1Interface interface { + RESTClient() rest.Interface + CASTemplatesGetter + CStorPoolsGetter + CStorVolumesGetter + CStorVolumeReplicasGetter + DisksGetter + RunTasksGetter + StoragePoolsGetter + StoragePoolClaimsGetter +} + +// OpenebsV1alpha1Client is used to interact with features provided by the openebs.io group. +type OpenebsV1alpha1Client struct { + restClient rest.Interface +} + +func (c *OpenebsV1alpha1Client) CASTemplates() CASTemplateInterface { + return newCASTemplates(c) +} + +func (c *OpenebsV1alpha1Client) CStorPools() CStorPoolInterface { + return newCStorPools(c) +} + +func (c *OpenebsV1alpha1Client) CStorVolumes(namespace string) CStorVolumeInterface { + return newCStorVolumes(c, namespace) +} + +func (c *OpenebsV1alpha1Client) CStorVolumeReplicas(namespace string) CStorVolumeReplicaInterface { + return newCStorVolumeReplicas(c, namespace) +} + +func (c *OpenebsV1alpha1Client) Disks() DiskInterface { + return newDisks(c) +} + +func (c *OpenebsV1alpha1Client) RunTasks(namespace string) RunTaskInterface { + return newRunTasks(c, namespace) +} + +func (c *OpenebsV1alpha1Client) StoragePools() StoragePoolInterface { + return newStoragePools(c) +} + +func (c *OpenebsV1alpha1Client) StoragePoolClaims() StoragePoolClaimInterface { + return newStoragePoolClaims(c) +} + +// NewForConfig creates a new OpenebsV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*OpenebsV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &OpenebsV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new OpenebsV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *OpenebsV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new OpenebsV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *OpenebsV1alpha1Client { + return &OpenebsV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *OpenebsV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/runtask.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/runtask.go new file mode 100644 index 0000000000..60fd87ea5e --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/runtask.go @@ -0,0 +1,157 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// RunTasksGetter has a method to return a RunTaskInterface. +// A group's client should implement this interface. +type RunTasksGetter interface { + RunTasks(namespace string) RunTaskInterface +} + +// RunTaskInterface has methods to work with RunTask resources. +type RunTaskInterface interface { + Create(*v1alpha1.RunTask) (*v1alpha1.RunTask, error) + Update(*v1alpha1.RunTask) (*v1alpha1.RunTask, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.RunTask, error) + List(opts v1.ListOptions) (*v1alpha1.RunTaskList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.RunTask, err error) + RunTaskExpansion +} + +// runTasks implements RunTaskInterface +type runTasks struct { + client rest.Interface + ns string +} + +// newRunTasks returns a RunTasks +func newRunTasks(c *OpenebsV1alpha1Client, namespace string) *runTasks { + return &runTasks{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the runTask, and returns the corresponding runTask object, and an error if there is any. +func (c *runTasks) Get(name string, options v1.GetOptions) (result *v1alpha1.RunTask, err error) { + result = &v1alpha1.RunTask{} + err = c.client.Get(). + Namespace(c.ns). + Resource("runtasks"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of RunTasks that match those selectors. +func (c *runTasks) List(opts v1.ListOptions) (result *v1alpha1.RunTaskList, err error) { + result = &v1alpha1.RunTaskList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("runtasks"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested runTasks. +func (c *runTasks) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("runtasks"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a runTask and creates it. Returns the server's representation of the runTask, and an error, if there is any. +func (c *runTasks) Create(runTask *v1alpha1.RunTask) (result *v1alpha1.RunTask, err error) { + result = &v1alpha1.RunTask{} + err = c.client.Post(). + Namespace(c.ns). + Resource("runtasks"). + Body(runTask). + Do(). + Into(result) + return +} + +// Update takes the representation of a runTask and updates it. Returns the server's representation of the runTask, and an error, if there is any. +func (c *runTasks) Update(runTask *v1alpha1.RunTask) (result *v1alpha1.RunTask, err error) { + result = &v1alpha1.RunTask{} + err = c.client.Put(). + Namespace(c.ns). + Resource("runtasks"). + Name(runTask.Name). + Body(runTask). + Do(). + Into(result) + return +} + +// Delete takes name of the runTask and deletes it. Returns an error if one occurs. +func (c *runTasks) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("runtasks"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *runTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("runtasks"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched runTask. +func (c *runTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.RunTask, err error) { + result = &v1alpha1.RunTask{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("runtasks"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepool.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepool.go new file mode 100644 index 0000000000..c5d0e57850 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepool.go @@ -0,0 +1,147 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// StoragePoolsGetter has a method to return a StoragePoolInterface. +// A group's client should implement this interface. +type StoragePoolsGetter interface { + StoragePools() StoragePoolInterface +} + +// StoragePoolInterface has methods to work with StoragePool resources. +type StoragePoolInterface interface { + Create(*v1alpha1.StoragePool) (*v1alpha1.StoragePool, error) + Update(*v1alpha1.StoragePool) (*v1alpha1.StoragePool, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.StoragePool, error) + List(opts v1.ListOptions) (*v1alpha1.StoragePoolList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePool, err error) + StoragePoolExpansion +} + +// storagePools implements StoragePoolInterface +type storagePools struct { + client rest.Interface +} + +// newStoragePools returns a StoragePools +func newStoragePools(c *OpenebsV1alpha1Client) *storagePools { + return &storagePools{ + client: c.RESTClient(), + } +} + +// Get takes name of the storagePool, and returns the corresponding storagePool object, and an error if there is any. +func (c *storagePools) Get(name string, options v1.GetOptions) (result *v1alpha1.StoragePool, err error) { + result = &v1alpha1.StoragePool{} + err = c.client.Get(). + Resource("storagepools"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of StoragePools that match those selectors. +func (c *storagePools) List(opts v1.ListOptions) (result *v1alpha1.StoragePoolList, err error) { + result = &v1alpha1.StoragePoolList{} + err = c.client.Get(). + Resource("storagepools"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested storagePools. +func (c *storagePools) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("storagepools"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a storagePool and creates it. Returns the server's representation of the storagePool, and an error, if there is any. +func (c *storagePools) Create(storagePool *v1alpha1.StoragePool) (result *v1alpha1.StoragePool, err error) { + result = &v1alpha1.StoragePool{} + err = c.client.Post(). + Resource("storagepools"). + Body(storagePool). + Do(). + Into(result) + return +} + +// Update takes the representation of a storagePool and updates it. Returns the server's representation of the storagePool, and an error, if there is any. +func (c *storagePools) Update(storagePool *v1alpha1.StoragePool) (result *v1alpha1.StoragePool, err error) { + result = &v1alpha1.StoragePool{} + err = c.client.Put(). + Resource("storagepools"). + Name(storagePool.Name). + Body(storagePool). + Do(). + Into(result) + return +} + +// Delete takes name of the storagePool and deletes it. Returns an error if one occurs. +func (c *storagePools) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("storagepools"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *storagePools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("storagepools"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched storagePool. +func (c *storagePools) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePool, err error) { + result = &v1alpha1.StoragePool{} + err = c.client.Patch(pt). + Resource("storagepools"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepoolclaim.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepoolclaim.go new file mode 100644 index 0000000000..d9a0637989 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepoolclaim.go @@ -0,0 +1,147 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// StoragePoolClaimsGetter has a method to return a StoragePoolClaimInterface. +// A group's client should implement this interface. +type StoragePoolClaimsGetter interface { + StoragePoolClaims() StoragePoolClaimInterface +} + +// StoragePoolClaimInterface has methods to work with StoragePoolClaim resources. +type StoragePoolClaimInterface interface { + Create(*v1alpha1.StoragePoolClaim) (*v1alpha1.StoragePoolClaim, error) + Update(*v1alpha1.StoragePoolClaim) (*v1alpha1.StoragePoolClaim, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.StoragePoolClaim, error) + List(opts v1.ListOptions) (*v1alpha1.StoragePoolClaimList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePoolClaim, err error) + StoragePoolClaimExpansion +} + +// storagePoolClaims implements StoragePoolClaimInterface +type storagePoolClaims struct { + client rest.Interface +} + +// newStoragePoolClaims returns a StoragePoolClaims +func newStoragePoolClaims(c *OpenebsV1alpha1Client) *storagePoolClaims { + return &storagePoolClaims{ + client: c.RESTClient(), + } +} + +// Get takes name of the storagePoolClaim, and returns the corresponding storagePoolClaim object, and an error if there is any. +func (c *storagePoolClaims) Get(name string, options v1.GetOptions) (result *v1alpha1.StoragePoolClaim, err error) { + result = &v1alpha1.StoragePoolClaim{} + err = c.client.Get(). + Resource("storagepoolclaims"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of StoragePoolClaims that match those selectors. +func (c *storagePoolClaims) List(opts v1.ListOptions) (result *v1alpha1.StoragePoolClaimList, err error) { + result = &v1alpha1.StoragePoolClaimList{} + err = c.client.Get(). + Resource("storagepoolclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested storagePoolClaims. +func (c *storagePoolClaims) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("storagepoolclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a storagePoolClaim and creates it. Returns the server's representation of the storagePoolClaim, and an error, if there is any. +func (c *storagePoolClaims) Create(storagePoolClaim *v1alpha1.StoragePoolClaim) (result *v1alpha1.StoragePoolClaim, err error) { + result = &v1alpha1.StoragePoolClaim{} + err = c.client.Post(). + Resource("storagepoolclaims"). + Body(storagePoolClaim). + Do(). + Into(result) + return +} + +// Update takes the representation of a storagePoolClaim and updates it. Returns the server's representation of the storagePoolClaim, and an error, if there is any. +func (c *storagePoolClaims) Update(storagePoolClaim *v1alpha1.StoragePoolClaim) (result *v1alpha1.StoragePoolClaim, err error) { + result = &v1alpha1.StoragePoolClaim{} + err = c.client.Put(). + Resource("storagepoolclaims"). + Name(storagePoolClaim.Name). + Body(storagePoolClaim). + Do(). + Into(result) + return +} + +// Delete takes name of the storagePoolClaim and deletes it. Returns an error if one occurs. +func (c *storagePoolClaims) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("storagepoolclaims"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *storagePoolClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("storagepoolclaims"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched storagePoolClaim. +func (c *storagePoolClaims) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.StoragePoolClaim, err error) { + result = &v1alpha1.StoragePoolClaim{} + err = c.client.Patch(pt). + Resource("storagepoolclaims"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/factory.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/factory.go new file mode 100644 index 0000000000..7c47966a15 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/factory.go @@ -0,0 +1,180 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + openebsio "github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Openebs() openebsio.Interface +} + +func (f *sharedInformerFactory) Openebs() openebsio.Interface { + return openebsio.New(f, f.namespace, f.tweakListOptions) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go new file mode 100644 index 0000000000..134f4f6701 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go @@ -0,0 +1,76 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=openebs.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("castemplates"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().CASTemplates().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("cstorpools"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().CStorPools().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("cstorvolumes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().CStorVolumes().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("cstorvolumereplicas"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().CStorVolumeReplicas().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("disks"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().Disks().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("runtasks"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().RunTasks().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("storagepools"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().StoragePools().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("storagepoolclaims"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().StoragePoolClaims().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..28dd08203b --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,40 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +// TweakListOptionsFunc is a function that transforms a v1.ListOptions. +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/interface.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/interface.go new file mode 100644 index 0000000000..75104f73f2 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package openebs + +import ( + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/castemplate.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/castemplate.go new file mode 100644 index 0000000000..a050c2ec2f --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/castemplate.go @@ -0,0 +1,88 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + openebsiov1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CASTemplateInformer provides access to a shared informer and lister for +// CASTemplates. +type CASTemplateInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.CASTemplateLister +} + +type cASTemplateInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCASTemplateInformer constructs a new informer for CASTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCASTemplateInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCASTemplateInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCASTemplateInformer constructs a new informer for CASTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCASTemplateInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().CASTemplates().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().CASTemplates().Watch(options) + }, + }, + &openebsiov1alpha1.CASTemplate{}, + resyncPeriod, + indexers, + ) +} + +func (f *cASTemplateInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCASTemplateInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cASTemplateInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&openebsiov1alpha1.CASTemplate{}, f.defaultInformer) +} + +func (f *cASTemplateInformer) Lister() v1alpha1.CASTemplateLister { + return v1alpha1.NewCASTemplateLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorpool.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorpool.go new file mode 100644 index 0000000000..6db3865794 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorpool.go @@ -0,0 +1,88 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + openebsiov1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CStorPoolInformer provides access to a shared informer and lister for +// CStorPools. +type CStorPoolInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.CStorPoolLister +} + +type cStorPoolInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCStorPoolInformer constructs a new informer for CStorPool type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCStorPoolInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCStorPoolInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCStorPoolInformer constructs a new informer for CStorPool type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCStorPoolInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().CStorPools().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().CStorPools().Watch(options) + }, + }, + &openebsiov1alpha1.CStorPool{}, + resyncPeriod, + indexers, + ) +} + +func (f *cStorPoolInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCStorPoolInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cStorPoolInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&openebsiov1alpha1.CStorPool{}, f.defaultInformer) +} + +func (f *cStorPoolInformer) Lister() v1alpha1.CStorPoolLister { + return v1alpha1.NewCStorPoolLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolume.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolume.go new file mode 100644 index 0000000000..f898d11dc0 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolume.go @@ -0,0 +1,89 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + openebsiov1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CStorVolumeInformer provides access to a shared informer and lister for +// CStorVolumes. +type CStorVolumeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.CStorVolumeLister +} + +type cStorVolumeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCStorVolumeInformer constructs a new informer for CStorVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCStorVolumeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCStorVolumeInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCStorVolumeInformer constructs a new informer for CStorVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCStorVolumeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().CStorVolumes(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().CStorVolumes(namespace).Watch(options) + }, + }, + &openebsiov1alpha1.CStorVolume{}, + resyncPeriod, + indexers, + ) +} + +func (f *cStorVolumeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCStorVolumeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cStorVolumeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&openebsiov1alpha1.CStorVolume{}, f.defaultInformer) +} + +func (f *cStorVolumeInformer) Lister() v1alpha1.CStorVolumeLister { + return v1alpha1.NewCStorVolumeLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolumereplica.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolumereplica.go new file mode 100644 index 0000000000..ec8cca51aa --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolumereplica.go @@ -0,0 +1,89 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + openebsiov1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CStorVolumeReplicaInformer provides access to a shared informer and lister for +// CStorVolumeReplicas. +type CStorVolumeReplicaInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.CStorVolumeReplicaLister +} + +type cStorVolumeReplicaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCStorVolumeReplicaInformer constructs a new informer for CStorVolumeReplica type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCStorVolumeReplicaInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCStorVolumeReplicaInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCStorVolumeReplicaInformer constructs a new informer for CStorVolumeReplica type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCStorVolumeReplicaInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().CStorVolumeReplicas(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().CStorVolumeReplicas(namespace).Watch(options) + }, + }, + &openebsiov1alpha1.CStorVolumeReplica{}, + resyncPeriod, + indexers, + ) +} + +func (f *cStorVolumeReplicaInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCStorVolumeReplicaInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cStorVolumeReplicaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&openebsiov1alpha1.CStorVolumeReplica{}, f.defaultInformer) +} + +func (f *cStorVolumeReplicaInformer) Lister() v1alpha1.CStorVolumeReplicaLister { + return v1alpha1.NewCStorVolumeReplicaLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/disk.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/disk.go new file mode 100644 index 0000000000..c91e6d0d38 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/disk.go @@ -0,0 +1,88 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + openebsiov1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// DiskInformer provides access to a shared informer and lister for +// Disks. +type DiskInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.DiskLister +} + +type diskInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewDiskInformer constructs a new informer for Disk type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDiskInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDiskInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredDiskInformer constructs a new informer for Disk type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDiskInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().Disks().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().Disks().Watch(options) + }, + }, + &openebsiov1alpha1.Disk{}, + resyncPeriod, + indexers, + ) +} + +func (f *diskInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDiskInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *diskInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&openebsiov1alpha1.Disk{}, f.defaultInformer) +} + +func (f *diskInformer) Lister() v1alpha1.DiskLister { + return v1alpha1.NewDiskLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go new file mode 100644 index 0000000000..012100bfde --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go @@ -0,0 +1,94 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CASTemplates returns a CASTemplateInformer. + CASTemplates() CASTemplateInformer + // CStorPools returns a CStorPoolInformer. + CStorPools() CStorPoolInformer + // CStorVolumes returns a CStorVolumeInformer. + CStorVolumes() CStorVolumeInformer + // CStorVolumeReplicas returns a CStorVolumeReplicaInformer. + CStorVolumeReplicas() CStorVolumeReplicaInformer + // Disks returns a DiskInformer. + Disks() DiskInformer + // RunTasks returns a RunTaskInformer. + RunTasks() RunTaskInformer + // StoragePools returns a StoragePoolInformer. + StoragePools() StoragePoolInformer + // StoragePoolClaims returns a StoragePoolClaimInformer. + StoragePoolClaims() StoragePoolClaimInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CASTemplates returns a CASTemplateInformer. +func (v *version) CASTemplates() CASTemplateInformer { + return &cASTemplateInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CStorPools returns a CStorPoolInformer. +func (v *version) CStorPools() CStorPoolInformer { + return &cStorPoolInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CStorVolumes returns a CStorVolumeInformer. +func (v *version) CStorVolumes() CStorVolumeInformer { + return &cStorVolumeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// CStorVolumeReplicas returns a CStorVolumeReplicaInformer. +func (v *version) CStorVolumeReplicas() CStorVolumeReplicaInformer { + return &cStorVolumeReplicaInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Disks returns a DiskInformer. +func (v *version) Disks() DiskInformer { + return &diskInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// RunTasks returns a RunTaskInformer. +func (v *version) RunTasks() RunTaskInformer { + return &runTaskInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StoragePools returns a StoragePoolInformer. +func (v *version) StoragePools() StoragePoolInformer { + return &storagePoolInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// StoragePoolClaims returns a StoragePoolClaimInformer. +func (v *version) StoragePoolClaims() StoragePoolClaimInformer { + return &storagePoolClaimInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/runtask.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/runtask.go new file mode 100644 index 0000000000..5253e5fc1d --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/runtask.go @@ -0,0 +1,89 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + openebsiov1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// RunTaskInformer provides access to a shared informer and lister for +// RunTasks. +type RunTaskInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RunTaskLister +} + +type runTaskInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRunTaskInformer constructs a new informer for RunTask type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRunTaskInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRunTaskInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRunTaskInformer constructs a new informer for RunTask type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRunTaskInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().RunTasks(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().RunTasks(namespace).Watch(options) + }, + }, + &openebsiov1alpha1.RunTask{}, + resyncPeriod, + indexers, + ) +} + +func (f *runTaskInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRunTaskInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *runTaskInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&openebsiov1alpha1.RunTask{}, f.defaultInformer) +} + +func (f *runTaskInformer) Lister() v1alpha1.RunTaskLister { + return v1alpha1.NewRunTaskLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepool.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepool.go new file mode 100644 index 0000000000..346e84de4f --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepool.go @@ -0,0 +1,88 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + openebsiov1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// StoragePoolInformer provides access to a shared informer and lister for +// StoragePools. +type StoragePoolInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.StoragePoolLister +} + +type storagePoolInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStoragePoolInformer constructs a new informer for StoragePool type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStoragePoolInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStoragePoolInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStoragePoolInformer constructs a new informer for StoragePool type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStoragePoolInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().StoragePools().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().StoragePools().Watch(options) + }, + }, + &openebsiov1alpha1.StoragePool{}, + resyncPeriod, + indexers, + ) +} + +func (f *storagePoolInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStoragePoolInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *storagePoolInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&openebsiov1alpha1.StoragePool{}, f.defaultInformer) +} + +func (f *storagePoolInformer) Lister() v1alpha1.StoragePoolLister { + return v1alpha1.NewStoragePoolLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepoolclaim.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepoolclaim.go new file mode 100644 index 0000000000..875c4c1dea --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepoolclaim.go @@ -0,0 +1,88 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + openebsiov1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// StoragePoolClaimInformer provides access to a shared informer and lister for +// StoragePoolClaims. +type StoragePoolClaimInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.StoragePoolClaimLister +} + +type storagePoolClaimInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStoragePoolClaimInformer constructs a new informer for StoragePoolClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStoragePoolClaimInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStoragePoolClaimInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStoragePoolClaimInformer constructs a new informer for StoragePoolClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStoragePoolClaimInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().StoragePoolClaims().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().StoragePoolClaims().Watch(options) + }, + }, + &openebsiov1alpha1.StoragePoolClaim{}, + resyncPeriod, + indexers, + ) +} + +func (f *storagePoolClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStoragePoolClaimInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *storagePoolClaimInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&openebsiov1alpha1.StoragePoolClaim{}, f.defaultInformer) +} + +func (f *storagePoolClaimInformer) Lister() v1alpha1.StoragePoolClaimLister { + return v1alpha1.NewStoragePoolClaimLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/castemplate.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/castemplate.go new file mode 100644 index 0000000000..3fa9c7f60d --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/castemplate.go @@ -0,0 +1,65 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CASTemplateLister helps list CASTemplates. +type CASTemplateLister interface { + // List lists all CASTemplates in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.CASTemplate, err error) + // Get retrieves the CASTemplate from the index for a given name. + Get(name string) (*v1alpha1.CASTemplate, error) + CASTemplateListerExpansion +} + +// cASTemplateLister implements the CASTemplateLister interface. +type cASTemplateLister struct { + indexer cache.Indexer +} + +// NewCASTemplateLister returns a new CASTemplateLister. +func NewCASTemplateLister(indexer cache.Indexer) CASTemplateLister { + return &cASTemplateLister{indexer: indexer} +} + +// List lists all CASTemplates in the indexer. +func (s *cASTemplateLister) List(selector labels.Selector) (ret []*v1alpha1.CASTemplate, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CASTemplate)) + }) + return ret, err +} + +// Get retrieves the CASTemplate from the index for a given name. +func (s *cASTemplateLister) Get(name string) (*v1alpha1.CASTemplate, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("castemplate"), name) + } + return obj.(*v1alpha1.CASTemplate), nil +} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorpool.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorpool.go new file mode 100644 index 0000000000..1b5da3e37e --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorpool.go @@ -0,0 +1,65 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CStorPoolLister helps list CStorPools. +type CStorPoolLister interface { + // List lists all CStorPools in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.CStorPool, err error) + // Get retrieves the CStorPool from the index for a given name. + Get(name string) (*v1alpha1.CStorPool, error) + CStorPoolListerExpansion +} + +// cStorPoolLister implements the CStorPoolLister interface. +type cStorPoolLister struct { + indexer cache.Indexer +} + +// NewCStorPoolLister returns a new CStorPoolLister. +func NewCStorPoolLister(indexer cache.Indexer) CStorPoolLister { + return &cStorPoolLister{indexer: indexer} +} + +// List lists all CStorPools in the indexer. +func (s *cStorPoolLister) List(selector labels.Selector) (ret []*v1alpha1.CStorPool, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CStorPool)) + }) + return ret, err +} + +// Get retrieves the CStorPool from the index for a given name. +func (s *cStorPoolLister) Get(name string) (*v1alpha1.CStorPool, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("cstorpool"), name) + } + return obj.(*v1alpha1.CStorPool), nil +} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolume.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolume.go new file mode 100644 index 0000000000..e70440310f --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolume.go @@ -0,0 +1,94 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CStorVolumeLister helps list CStorVolumes. +type CStorVolumeLister interface { + // List lists all CStorVolumes in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.CStorVolume, err error) + // CStorVolumes returns an object that can list and get CStorVolumes. + CStorVolumes(namespace string) CStorVolumeNamespaceLister + CStorVolumeListerExpansion +} + +// cStorVolumeLister implements the CStorVolumeLister interface. +type cStorVolumeLister struct { + indexer cache.Indexer +} + +// NewCStorVolumeLister returns a new CStorVolumeLister. +func NewCStorVolumeLister(indexer cache.Indexer) CStorVolumeLister { + return &cStorVolumeLister{indexer: indexer} +} + +// List lists all CStorVolumes in the indexer. +func (s *cStorVolumeLister) List(selector labels.Selector) (ret []*v1alpha1.CStorVolume, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CStorVolume)) + }) + return ret, err +} + +// CStorVolumes returns an object that can list and get CStorVolumes. +func (s *cStorVolumeLister) CStorVolumes(namespace string) CStorVolumeNamespaceLister { + return cStorVolumeNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CStorVolumeNamespaceLister helps list and get CStorVolumes. +type CStorVolumeNamespaceLister interface { + // List lists all CStorVolumes in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.CStorVolume, err error) + // Get retrieves the CStorVolume from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.CStorVolume, error) + CStorVolumeNamespaceListerExpansion +} + +// cStorVolumeNamespaceLister implements the CStorVolumeNamespaceLister +// interface. +type cStorVolumeNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CStorVolumes in the indexer for a given namespace. +func (s cStorVolumeNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CStorVolume, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CStorVolume)) + }) + return ret, err +} + +// Get retrieves the CStorVolume from the indexer for a given namespace and name. +func (s cStorVolumeNamespaceLister) Get(name string) (*v1alpha1.CStorVolume, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("cstorvolume"), name) + } + return obj.(*v1alpha1.CStorVolume), nil +} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolumereplica.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolumereplica.go new file mode 100644 index 0000000000..ab4de92d69 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolumereplica.go @@ -0,0 +1,94 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CStorVolumeReplicaLister helps list CStorVolumeReplicas. +type CStorVolumeReplicaLister interface { + // List lists all CStorVolumeReplicas in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.CStorVolumeReplica, err error) + // CStorVolumeReplicas returns an object that can list and get CStorVolumeReplicas. + CStorVolumeReplicas(namespace string) CStorVolumeReplicaNamespaceLister + CStorVolumeReplicaListerExpansion +} + +// cStorVolumeReplicaLister implements the CStorVolumeReplicaLister interface. +type cStorVolumeReplicaLister struct { + indexer cache.Indexer +} + +// NewCStorVolumeReplicaLister returns a new CStorVolumeReplicaLister. +func NewCStorVolumeReplicaLister(indexer cache.Indexer) CStorVolumeReplicaLister { + return &cStorVolumeReplicaLister{indexer: indexer} +} + +// List lists all CStorVolumeReplicas in the indexer. +func (s *cStorVolumeReplicaLister) List(selector labels.Selector) (ret []*v1alpha1.CStorVolumeReplica, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CStorVolumeReplica)) + }) + return ret, err +} + +// CStorVolumeReplicas returns an object that can list and get CStorVolumeReplicas. +func (s *cStorVolumeReplicaLister) CStorVolumeReplicas(namespace string) CStorVolumeReplicaNamespaceLister { + return cStorVolumeReplicaNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CStorVolumeReplicaNamespaceLister helps list and get CStorVolumeReplicas. +type CStorVolumeReplicaNamespaceLister interface { + // List lists all CStorVolumeReplicas in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.CStorVolumeReplica, err error) + // Get retrieves the CStorVolumeReplica from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.CStorVolumeReplica, error) + CStorVolumeReplicaNamespaceListerExpansion +} + +// cStorVolumeReplicaNamespaceLister implements the CStorVolumeReplicaNamespaceLister +// interface. +type cStorVolumeReplicaNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CStorVolumeReplicas in the indexer for a given namespace. +func (s cStorVolumeReplicaNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CStorVolumeReplica, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CStorVolumeReplica)) + }) + return ret, err +} + +// Get retrieves the CStorVolumeReplica from the indexer for a given namespace and name. +func (s cStorVolumeReplicaNamespaceLister) Get(name string) (*v1alpha1.CStorVolumeReplica, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("cstorvolumereplica"), name) + } + return obj.(*v1alpha1.CStorVolumeReplica), nil +} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/disk.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/disk.go new file mode 100644 index 0000000000..dc88a03c44 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/disk.go @@ -0,0 +1,65 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DiskLister helps list Disks. +type DiskLister interface { + // List lists all Disks in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.Disk, err error) + // Get retrieves the Disk from the index for a given name. + Get(name string) (*v1alpha1.Disk, error) + DiskListerExpansion +} + +// diskLister implements the DiskLister interface. +type diskLister struct { + indexer cache.Indexer +} + +// NewDiskLister returns a new DiskLister. +func NewDiskLister(indexer cache.Indexer) DiskLister { + return &diskLister{indexer: indexer} +} + +// List lists all Disks in the indexer. +func (s *diskLister) List(selector labels.Selector) (ret []*v1alpha1.Disk, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Disk)) + }) + return ret, err +} + +// Get retrieves the Disk from the index for a given name. +func (s *diskLister) Get(name string) (*v1alpha1.Disk, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("disk"), name) + } + return obj.(*v1alpha1.Disk), nil +} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go new file mode 100644 index 0000000000..6be51e29ec --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go @@ -0,0 +1,63 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// CASTemplateListerExpansion allows custom methods to be added to +// CASTemplateLister. +type CASTemplateListerExpansion interface{} + +// CStorPoolListerExpansion allows custom methods to be added to +// CStorPoolLister. +type CStorPoolListerExpansion interface{} + +// CStorVolumeListerExpansion allows custom methods to be added to +// CStorVolumeLister. +type CStorVolumeListerExpansion interface{} + +// CStorVolumeNamespaceListerExpansion allows custom methods to be added to +// CStorVolumeNamespaceLister. +type CStorVolumeNamespaceListerExpansion interface{} + +// CStorVolumeReplicaListerExpansion allows custom methods to be added to +// CStorVolumeReplicaLister. +type CStorVolumeReplicaListerExpansion interface{} + +// CStorVolumeReplicaNamespaceListerExpansion allows custom methods to be added to +// CStorVolumeReplicaNamespaceLister. +type CStorVolumeReplicaNamespaceListerExpansion interface{} + +// DiskListerExpansion allows custom methods to be added to +// DiskLister. +type DiskListerExpansion interface{} + +// RunTaskListerExpansion allows custom methods to be added to +// RunTaskLister. +type RunTaskListerExpansion interface{} + +// RunTaskNamespaceListerExpansion allows custom methods to be added to +// RunTaskNamespaceLister. +type RunTaskNamespaceListerExpansion interface{} + +// StoragePoolListerExpansion allows custom methods to be added to +// StoragePoolLister. +type StoragePoolListerExpansion interface{} + +// StoragePoolClaimListerExpansion allows custom methods to be added to +// StoragePoolClaimLister. +type StoragePoolClaimListerExpansion interface{} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/runtask.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/runtask.go new file mode 100644 index 0000000000..5ebc3784ee --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/runtask.go @@ -0,0 +1,94 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RunTaskLister helps list RunTasks. +type RunTaskLister interface { + // List lists all RunTasks in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.RunTask, err error) + // RunTasks returns an object that can list and get RunTasks. + RunTasks(namespace string) RunTaskNamespaceLister + RunTaskListerExpansion +} + +// runTaskLister implements the RunTaskLister interface. +type runTaskLister struct { + indexer cache.Indexer +} + +// NewRunTaskLister returns a new RunTaskLister. +func NewRunTaskLister(indexer cache.Indexer) RunTaskLister { + return &runTaskLister{indexer: indexer} +} + +// List lists all RunTasks in the indexer. +func (s *runTaskLister) List(selector labels.Selector) (ret []*v1alpha1.RunTask, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RunTask)) + }) + return ret, err +} + +// RunTasks returns an object that can list and get RunTasks. +func (s *runTaskLister) RunTasks(namespace string) RunTaskNamespaceLister { + return runTaskNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RunTaskNamespaceLister helps list and get RunTasks. +type RunTaskNamespaceLister interface { + // List lists all RunTasks in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.RunTask, err error) + // Get retrieves the RunTask from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.RunTask, error) + RunTaskNamespaceListerExpansion +} + +// runTaskNamespaceLister implements the RunTaskNamespaceLister +// interface. +type runTaskNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RunTasks in the indexer for a given namespace. +func (s runTaskNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.RunTask, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RunTask)) + }) + return ret, err +} + +// Get retrieves the RunTask from the indexer for a given namespace and name. +func (s runTaskNamespaceLister) Get(name string) (*v1alpha1.RunTask, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("runtask"), name) + } + return obj.(*v1alpha1.RunTask), nil +} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepool.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepool.go new file mode 100644 index 0000000000..4b05493f1a --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepool.go @@ -0,0 +1,65 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StoragePoolLister helps list StoragePools. +type StoragePoolLister interface { + // List lists all StoragePools in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.StoragePool, err error) + // Get retrieves the StoragePool from the index for a given name. + Get(name string) (*v1alpha1.StoragePool, error) + StoragePoolListerExpansion +} + +// storagePoolLister implements the StoragePoolLister interface. +type storagePoolLister struct { + indexer cache.Indexer +} + +// NewStoragePoolLister returns a new StoragePoolLister. +func NewStoragePoolLister(indexer cache.Indexer) StoragePoolLister { + return &storagePoolLister{indexer: indexer} +} + +// List lists all StoragePools in the indexer. +func (s *storagePoolLister) List(selector labels.Selector) (ret []*v1alpha1.StoragePool, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.StoragePool)) + }) + return ret, err +} + +// Get retrieves the StoragePool from the index for a given name. +func (s *storagePoolLister) Get(name string) (*v1alpha1.StoragePool, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("storagepool"), name) + } + return obj.(*v1alpha1.StoragePool), nil +} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepoolclaim.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepoolclaim.go new file mode 100644 index 0000000000..985d1f1efc --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepoolclaim.go @@ -0,0 +1,65 @@ +/* +Copyright 2018 The OpenEBS Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StoragePoolClaimLister helps list StoragePoolClaims. +type StoragePoolClaimLister interface { + // List lists all StoragePoolClaims in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.StoragePoolClaim, err error) + // Get retrieves the StoragePoolClaim from the index for a given name. + Get(name string) (*v1alpha1.StoragePoolClaim, error) + StoragePoolClaimListerExpansion +} + +// storagePoolClaimLister implements the StoragePoolClaimLister interface. +type storagePoolClaimLister struct { + indexer cache.Indexer +} + +// NewStoragePoolClaimLister returns a new StoragePoolClaimLister. +func NewStoragePoolClaimLister(indexer cache.Indexer) StoragePoolClaimLister { + return &storagePoolClaimLister{indexer: indexer} +} + +// List lists all StoragePoolClaims in the indexer. +func (s *storagePoolClaimLister) List(selector labels.Selector) (ret []*v1alpha1.StoragePoolClaim, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.StoragePoolClaim)) + }) + return ret, err +} + +// Get retrieves the StoragePoolClaim from the index for a given name. +func (s *storagePoolClaimLister) Get(name string) (*v1alpha1.StoragePoolClaim, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("storagepoolclaim"), name) + } + return obj.(*v1alpha1.StoragePoolClaim), nil +} From 29cdf34ae3a6311bdb31ff38a5ddc3d04603d754 Mon Sep 17 00:00:00 2001 From: "Pradeep Kumar B.K" Date: Thu, 22 Nov 2018 18:45:09 +0530 Subject: [PATCH 15/45] update circle-ci for image-tag. (#118) Signed-off-by: Pradeep --- .circleci/config.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e60f66d04..35a1759633 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,6 +45,13 @@ workflows: requires: - client-test - integration-tests + - deploy-mdap: + filters: + branches: + only: mdap-rc1 + requires: + - client-test + - integration-tests jobs: lint: @@ -198,3 +205,23 @@ jobs: docker tag weaveworks/scope:latest openebs/scope:v1.11.$CIRCLE_BUILD_NUM docker push openebs/scope:v1.11.$CIRCLE_BUILD_NUM done + deploy-mdap: + <<: *defaults + environment: + IMAGES: scope cloud-agent + steps: + - checkout + - setup_remote_docker + - attach_workspace: + at: . + - run: | + pip install awscli + docker load -i scope.tar + docker load -i cloud-agent.tar + - run: | + test -z "${DOCKER_USER}" && exit 0 + docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS + for IMAGE in $IMAGES; do + docker tag weaveworks/scope:latest openebs/scope:mdap-rc1 + docker push openebs/scope:mdap-rc1 + done From 20e557a130e3089ce748d3d72ac767780aff7dd2 Mon Sep 17 00:00:00 2001 From: Satyam Zode Date: Fri, 23 Nov 2018 15:48:46 +0530 Subject: [PATCH 16/45] Add cStor support in Scope * Add support for CV, CVR & CSP in Scope * Add proper shapes for CV, CVR & CSP * Add status field to CV, CVR & CSP * Remove unnecessary filter in the APITopologyGroup * Remove unsed PodComponent method * Filter disk when Show Pods in Volumes Signed-off-by: Satyam Zode --- app/api_topologies.go | 18 +-- probe/kubernetes/client.go | 46 ++++++- probe/kubernetes/cstor_storage_pool.go | 42 +++++++ probe/kubernetes/cstor_volume.go | 52 ++++++++ probe/kubernetes/cstor_volume_replica.go | 68 +++++++++++ probe/kubernetes/reporter.go | 147 +++++++++++++++++------ probe/kubernetes/reporter_test.go | 9 ++ render/cstorvolume.go | 48 ++++++++ render/detailed/node.go | 21 ++++ render/detailed/summary.go | 25 ++++ render/filters.go | 52 ++++++-- render/persistentvolume.go | 11 ++ report/id.go | 17 +++ report/map_keys.go | 127 +++++++++++--------- report/report.go | 34 ++++++ 15 files changed, 602 insertions(+), 115 deletions(-) create mode 100644 probe/kubernetes/cstor_storage_pool.go create mode 100644 probe/kubernetes/cstor_volume.go create mode 100644 probe/kubernetes/cstor_volume_replica.go create mode 100644 render/cstorvolume.go diff --git a/app/api_topologies.go b/app/api_topologies.go index 580c4edaa5..951bad8067 100644 --- a/app/api_topologies.go +++ b/app/api_topologies.go @@ -50,14 +50,6 @@ var ( {Value: "hide", Label: "Hide unmanaged", filter: render.IsNotPseudo, filterPseudo: true}, }, } - storageFilter = APITopologyOptionGroup{ - ID: "storage", - Default: "hide", - Options: []APITopologyOption{ - {Value: "show", Label: "Show storage", filter: nil, filterPseudo: false}, - {Value: "hide", Label: "Hide storage", filter: render.IsPodComponent, filterPseudo: false}, - }, - } snapshotFilter = APITopologyOptionGroup{ ID: "snapshot", Default: "hide", @@ -66,6 +58,14 @@ var ( {Value: "hide", Label: "Hide snapshots", filter: render.IsNonSnapshotComponent, filterPseudo: false}, }, } + podsFilter = APITopologyOptionGroup{ + ID: "cstor", + Default: "showCRs", + Options: []APITopologyOption{ + {Value: "showPods", Label: "Show pods", filter: render.IsNotCStorCustomResource, filterPseudo: false}, + {Value: "showCRs", Label: "Show custom resources", filter: render.IsCStorCustomResource, filterPseudo: false}, + }, + } ) // namespaceFilters generates a namespace selector option group based on the given namespaces @@ -316,7 +316,7 @@ func MakeRegistry() *Registry { parent: hostsID, renderer: render.KubernetesVolumesRenderer, Name: "Volumes", - Options: []APITopologyOptionGroup{snapshotFilter, unmanagedFilter}, + Options: []APITopologyOptionGroup{podsFilter, snapshotFilter, unmanagedFilter}, HideIfEmpty: true, }, ) diff --git a/probe/kubernetes/client.go b/probe/kubernetes/client.go index fa6f082fb4..5d3aed36ca 100644 --- a/probe/kubernetes/client.go +++ b/probe/kubernetes/client.go @@ -62,7 +62,9 @@ type Client interface { WalkJobs(f func(Job) error) error WalkDisks(f func(Disk) error) error WalkStoragePoolClaims(f func(StoragePoolClaim) error) error - + WalkCStorVolumes(f func(CStorVolume) error) error + WalkCStorVolumeReplicas(f func(CStorVolumeReplica) error) error + WalkCStorPools(f func(CStorPool) error) error WatchPods(f func(Event, Pod)) CloneVolumeSnapshot(namespaceID, volumeSnapshotID, persistentVolumeClaimID, capacity string) error @@ -111,6 +113,9 @@ type client struct { volumeSnapshotDataStore cache.Store diskStore cache.Store storagePoolClaimStore cache.Store + cStorvolumeStore cache.Store + cStorvolumeReplicaStore cache.Store + cStorPoolStore cache.Store podWatchesMutex sync.Mutex podWatches []func(Event, Pod) @@ -214,6 +219,9 @@ func NewClient(config ClientConfig) (Client, error) { result.volumeSnapshotDataStore = result.setupStore("volumesnapshotdatas") result.diskStore = result.setupStore("disks") result.storagePoolClaimStore = result.setupStore("storagepoolclaims") + result.cStorvolumeStore = result.setupStore("cstorvolumes") + result.cStorvolumeReplicaStore = result.setupStore("cstorvolumereplicas") + result.cStorPoolStore = result.setupStore("cstorpools") return result, nil } @@ -274,6 +282,12 @@ func (c *client) clientAndType(resource string) (rest.Interface, interface{}, er return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.Disk{}, nil case "storagepoolclaims": return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.StoragePoolClaim{}, nil + case "cstorvolumes": + return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.CStorVolume{}, nil + case "cstorvolumereplicas": + return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.CStorVolumeReplica{}, nil + case "cstorpools": + return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.CStorPool{}, nil case "cronjobs": ok, err := c.isResourceSupported(c.client.BatchV1beta1().RESTClient().APIVersion(), resource) if err != nil { @@ -508,6 +522,36 @@ func (c *client) WalkStoragePoolClaims(f func(StoragePoolClaim) error) error { return nil } +func (c *client) WalkCStorVolumes(f func(CStorVolume) error) error { + for _, m := range c.cStorvolumeStore.List() { + cStorVolume := m.(*mayav1alpha1.CStorVolume) + if err := f(NewCStorVolume(cStorVolume)); err != nil { + return err + } + } + return nil +} + +func (c *client) WalkCStorVolumeReplicas(f func(CStorVolumeReplica) error) error { + for _, m := range c.cStorvolumeReplicaStore.List() { + cStorVolumeReplica := m.(*mayav1alpha1.CStorVolumeReplica) + if err := f(NewCStorVolumeReplica(cStorVolumeReplica)); err != nil { + return err + } + } + return nil +} + +func (c *client) WalkCStorPools(f func(CStorPool) error) error { + for _, m := range c.cStorPoolStore.List() { + cStorPool := m.(*mayav1alpha1.CStorPool) + if err := f(NewCStorPool(cStorPool)); err != nil { + return err + } + } + return nil +} + func (c *client) CloneVolumeSnapshot(namespaceID, volumeSnapshotID, persistentVolumeClaimID, capacity string) error { var scName string var claimSize string diff --git a/probe/kubernetes/cstor_storage_pool.go b/probe/kubernetes/cstor_storage_pool.go new file mode 100644 index 0000000000..a7589136ab --- /dev/null +++ b/probe/kubernetes/cstor_storage_pool.go @@ -0,0 +1,42 @@ +package kubernetes + +import ( + mayav1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "github.com/weaveworks/scope/report" +) + +// CStorPool interface +type CStorPool interface { + Meta + GetNode() report.Node + GetStatus() string +} + +// cStorPool represents cStor Volume CSP +type cStorPool struct { + *mayav1alpha1.CStorPool + Meta +} + +// NewCStorPool returns fresh CStorPool instance +func NewCStorPool(p *mayav1alpha1.CStorPool) CStorPool { + return &cStorPool{CStorPool: p, Meta: meta{p.ObjectMeta}} +} + +// GetNode returns updated node with CStor Volume details +func (p *cStorPool) GetNode() report.Node { + latests := map[string]string{ + NodeType: "CStor Pool", + APIVersion: p.APIVersion, + } + + if p.GetStatus() != "" { + latests[CStorPoolStatus] = p.GetStatus() + } + return p.MetaNode(report.MakeCStorPoolNodeID(p.UID())).WithLatests(latests) +} + +func (p *cStorPool) GetStatus() string { + status := p.Status.Phase + return string(status) +} diff --git a/probe/kubernetes/cstor_volume.go b/probe/kubernetes/cstor_volume.go new file mode 100644 index 0000000000..c4ad37921f --- /dev/null +++ b/probe/kubernetes/cstor_volume.go @@ -0,0 +1,52 @@ +package kubernetes + +import ( + mayav1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "github.com/weaveworks/scope/report" +) + +// CStorVolume interface +type CStorVolume interface { + Meta + GetNode() report.Node + GetPersistentVolumeName() string + GetStatus() string +} + +// cStorVolume represents cStor Volume CR +type cStorVolume struct { + *mayav1alpha1.CStorVolume + Meta +} + +// NewCStorVolume returns fresh CStorVolume instance +func NewCStorVolume(p *mayav1alpha1.CStorVolume) CStorVolume { + return &cStorVolume{CStorVolume: p, Meta: meta{p.ObjectMeta}} +} + +// GetNode returns updated node with CStor Volume details +func (p *cStorVolume) GetNode() report.Node { + latests := map[string]string{ + NodeType: "CStor Volume", + APIVersion: p.APIVersion, + } + + if p.GetPersistentVolumeName() != "" { + latests[VolumeName] = p.GetPersistentVolumeName() + } + + if p.GetStatus() != "" { + latests[CStorVolumeStatus] = p.GetStatus() + } + return p.MetaNode(report.MakeCStorVolumeNodeID(p.Name())).WithLatests(latests) +} + +func (p *cStorVolume) GetPersistentVolumeName() string { + persistentVolumeName := p.Labels()["openebs.io/persistent-volume"] + return persistentVolumeName +} + +func (p *cStorVolume) GetStatus() string { + status := p.Status.Phase + return string(status) +} diff --git a/probe/kubernetes/cstor_volume_replica.go b/probe/kubernetes/cstor_volume_replica.go new file mode 100644 index 0000000000..479c9ef096 --- /dev/null +++ b/probe/kubernetes/cstor_volume_replica.go @@ -0,0 +1,68 @@ +package kubernetes + +import ( + mayav1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "github.com/weaveworks/scope/report" +) + +// CStorVolumeReplica interface +type CStorVolumeReplica interface { + Meta + GetNode() report.Node + GetCStorVolume() string + GetCStorPool() string + GetStatus() string +} + +// cStorVolume represents cStor Volume Replica CR +type cStorVolumeReplica struct { + *mayav1alpha1.CStorVolumeReplica + Meta +} + +// NewCStorVolumeReplica returns fresh CStorVolumeReplica instance +func NewCStorVolumeReplica(p *mayav1alpha1.CStorVolumeReplica) CStorVolumeReplica { + return &cStorVolumeReplica{CStorVolumeReplica: p, Meta: meta{p.ObjectMeta}} +} + +// GetNode returns updated node with CStor Volume details +func (p *cStorVolumeReplica) GetNode() report.Node { + var cStorPoolNodeID string + latests := map[string]string{ + NodeType: "CStor Volume Replica", + APIVersion: p.APIVersion, + } + if p.GetCStorVolume() != "" { + latests[CStorVolumeName] = p.GetCStorVolume() + } + if p.GetCStorPool() != "" { + cStorPoolNodeID = report.MakeCStorPoolNodeID(p.GetCStorPool()) + } + + if p.GetCStorPool() != "" { + latests[CStorPoolUID] = p.GetCStorPool() + } + + if p.GetStatus() != "" { + latests[CStorVolumeReplicaStatus] = p.GetStatus() + } + + return p.MetaNode(report.MakeCStorVolumeNodeID(p.UID())). + WithLatests(latests). + WithAdjacent(cStorPoolNodeID) +} + +func (p *cStorVolumeReplica) GetCStorVolume() string { + cStorVolumeName := p.Labels()["cstorvolume.openebs.io/name"] + return cStorVolumeName +} + +func (p *cStorVolumeReplica) GetCStorPool() string { + cStorVolumeUID := p.Labels()["cstorpool.openebs.io/uid"] + return cStorVolumeUID +} + +func (p *cStorVolumeReplica) GetStatus() string { + status := p.Status.Phase + return string(status) +} diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index 7d366d0c22..ee57501208 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -16,41 +16,48 @@ import ( // These constants are keys used in node metadata const ( - IP = report.KubernetesIP - ObservedGeneration = report.KubernetesObservedGeneration - Replicas = report.KubernetesReplicas - DesiredReplicas = report.KubernetesDesiredReplicas - NodeType = report.KubernetesNodeType - Type = report.KubernetesType - Ports = report.KubernetesPorts - VolumeClaim = report.KubernetesVolumeClaim - StorageClassName = report.KubernetesStorageClassName - AccessModes = report.KubernetesAccessModes - ReclaimPolicy = report.KubernetesReclaimPolicy - Status = report.KubernetesStatus - Message = report.KubernetesMessage - VolumeName = report.KubernetesVolumeName - Provisioner = report.KubernetesProvisioner - StorageDriver = report.KubernetesStorageDriver - VolumeSnapshotName = report.KubernetesVolumeSnapshotName - SnapshotData = report.KubernetesSnapshotData - VolumeCapacity = report.KubernetesVolumeCapacity - Model = report.KubernetesModel - LogicalSectorSize = report.KubernetesLogicalSectorSize - Storage = report.KubernetesStorage - FirmwareRevision = report.KubernetesFirmwareRevision - Serial = report.KubernetesSerial - Vendor = report.KubernetesVendor - DiskList = report.KubernetesDiskList - MaxPools = report.KubernetesMaxPools - APIVersion = report.KubernetesAPIVersion - Value = report.KubernetesValue - StoragePoolClaimName = report.KubernetesStoragePoolClaimName - DiskName = report.KubernetesDiskName - PoolName = report.KubernetesPoolName - PoolClaim = report.KubernetesPoolClaim - HostName = report.KubernetesHostName - VolumePod = report.KubernetesVolumePod + IP = report.KubernetesIP + ObservedGeneration = report.KubernetesObservedGeneration + Replicas = report.KubernetesReplicas + DesiredReplicas = report.KubernetesDesiredReplicas + NodeType = report.KubernetesNodeType + Type = report.KubernetesType + Ports = report.KubernetesPorts + VolumeClaim = report.KubernetesVolumeClaim + StorageClassName = report.KubernetesStorageClassName + AccessModes = report.KubernetesAccessModes + ReclaimPolicy = report.KubernetesReclaimPolicy + Status = report.KubernetesStatus + Message = report.KubernetesMessage + VolumeName = report.KubernetesVolumeName + Provisioner = report.KubernetesProvisioner + StorageDriver = report.KubernetesStorageDriver + VolumeSnapshotName = report.KubernetesVolumeSnapshotName + SnapshotData = report.KubernetesSnapshotData + VolumeCapacity = report.KubernetesVolumeCapacity + Model = report.KubernetesModel + LogicalSectorSize = report.KubernetesLogicalSectorSize + Storage = report.KubernetesStorage + FirmwareRevision = report.KubernetesFirmwareRevision + Serial = report.KubernetesSerial + Vendor = report.KubernetesVendor + DiskList = report.KubernetesDiskList + MaxPools = report.KubernetesMaxPools + APIVersion = report.KubernetesAPIVersion + Value = report.KubernetesValue + StoragePoolClaimName = report.KubernetesStoragePoolClaimName + DiskName = report.KubernetesDiskName + PoolName = report.KubernetesPoolName + PoolClaim = report.KubernetesPoolClaim + HostName = report.KubernetesHostName + VolumePod = report.KubernetesVolumePod + CStorVolumeName = report.KubernetesCStorVolumeName + CStorVolumeReplicaName = report.KubernetesCStorVolumeReplicaName + CStorPoolName = report.KubernetesCStorPoolName + CStorPoolUID = report.KubernetesCStorPoolUID + CStorVolumeStatus = report.KubernetesCStorVolumeStatus + CStorVolumeReplicaStatus = report.KubernetesCStorVolumeReplicaStatus + CStorPoolStatus = report.KubernetesCStorPoolStatus ) // Exposed for testing @@ -188,6 +195,20 @@ var ( MaxPools: {ID: MaxPools, Label: "MaxPools", From: report.FromLatest, Priority: 4}, } + CStorVolumeMetadataTemplates = report.MetadataTemplates{ + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + VolumeName: {ID: CStorVolumeName, Label: "CStor Volume", From: report.FromLatest, Priority: 2}, + CStorVolumeStatus: {ID: CStorVolumeStatus, Label: "Status", From: report.FromLatest, Priority: 3}, + } + CStorVolumeReplicaMetadataTemplates = report.MetadataTemplates{ + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + VolumeName: {ID: CStorVolumeReplicaName, Label: "CStor Volume Replica", From: report.FromLatest, Priority: 2}, + CStorVolumeReplicaStatus: {ID: CStorVolumeReplicaStatus, Label: "Status", From: report.FromLatest, Priority: 3}, + } + CStorPoolMetadataTemplates = report.MetadataTemplates{ + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + VolumeName: {ID: CStorPoolName, Label: "CStor Pool", From: report.FromLatest, Priority: 2}, + } TableTemplates = report.TableTemplates{ LabelPrefix: { ID: LabelPrefix, @@ -392,10 +413,24 @@ func (r *Reporter) Report() (report.Report, error) { if err != nil { return result, err } + storagePoolClaimTopology, _, err := r.storagePoolClaimTopology() if err != nil { return result, err } + + cStorVolumeTopology, _, err := r.cStorVolumeTopology() + if err != nil { + return result, err + } + cStorVolumeReplicaTopology, _, err := r.cStorVolumeReplicaTopology() + if err != nil { + return result, err + } + cStorPoolTopology, _, err := r.cStorPoolTopology() + if err != nil { + return result, err + } result.Pod = result.Pod.Merge(podTopology) result.Service = result.Service.Merge(serviceTopology) result.DaemonSet = result.DaemonSet.Merge(daemonSetTopology) @@ -411,6 +446,9 @@ func (r *Reporter) Report() (report.Report, error) { result.Job = result.Job.Merge(jobTopology) result.Disk = result.Disk.Merge(diskTopology) result.StoragePoolClaim = result.StoragePoolClaim.Merge(storagePoolClaimTopology) + result.CStorVolume = result.CStorVolume.Merge(cStorVolumeTopology) + result.CStorVolumeReplica = result.CStorVolumeReplica.Merge(cStorVolumeReplicaTopology) + result.CStorPool = result.CStorPool.Merge(cStorPoolTopology) return result, nil } @@ -624,6 +662,45 @@ func (r *Reporter) storagePoolClaimTopology() (report.Topology, []StoragePoolCla return result, storagePoolClaims, err } +func (r *Reporter) cStorVolumeTopology() (report.Topology, []CStorVolume, error) { + cStorVolumes := []CStorVolume{} + result := report.MakeTopology(). + WithMetadataTemplates(CStorVolumeMetadataTemplates). + WithTableTemplates(TableTemplates) + err := r.client.WalkCStorVolumes(func(p CStorVolume) error { + result.AddNode(p.GetNode()) + cStorVolumes = append(cStorVolumes, p) + return nil + }) + return result, cStorVolumes, err +} + +func (r *Reporter) cStorVolumeReplicaTopology() (report.Topology, []CStorVolumeReplica, error) { + cStorVolumeReplicas := []CStorVolumeReplica{} + result := report.MakeTopology(). + WithMetadataTemplates(CStorVolumeReplicaMetadataTemplates). + WithTableTemplates(TableTemplates) + err := r.client.WalkCStorVolumeReplicas(func(p CStorVolumeReplica) error { + result.AddNode(p.GetNode()) + cStorVolumeReplicas = append(cStorVolumeReplicas, p) + return nil + }) + return result, cStorVolumeReplicas, err +} + +func (r *Reporter) cStorPoolTopology() (report.Topology, []CStorPool, error) { + cStorPool := []CStorPool{} + result := report.MakeTopology(). + WithMetadataTemplates(CStorPoolMetadataTemplates). + WithTableTemplates(TableTemplates) + err := r.client.WalkCStorPools(func(p CStorPool) error { + result.AddNode(p.GetNode()) + cStorPool = append(cStorPool, p) + return nil + }) + return result, cStorPool, err +} + type labelledChild interface { Labels() map[string]string AddParent(string, string) diff --git a/probe/kubernetes/reporter_test.go b/probe/kubernetes/reporter_test.go index cd8002149a..66fb0aeb74 100644 --- a/probe/kubernetes/reporter_test.go +++ b/probe/kubernetes/reporter_test.go @@ -181,6 +181,15 @@ func (c *mockClient) WalkDisks(f func(kubernetes.Disk) error) error { func (c *mockClient) WalkStoragePoolClaims(f func(kubernetes.StoragePoolClaim) error) error { return nil } +func (c *mockClient) WalkCStorVolumes(f func(kubernetes.CStorVolume) error) error { + return nil +} +func (c *mockClient) WalkCStorVolumeReplicas(f func(kubernetes.CStorVolumeReplica) error) error { + return nil +} +func (c *mockClient) WalkCStorPools(f func(kubernetes.CStorPool) error) error { + return nil +} func (*mockClient) WatchPods(func(kubernetes.Event, kubernetes.Pod)) {} func (c *mockClient) GetLogs(namespaceID, podName string, _ []string) (io.ReadCloser, error) { r, ok := c.logs[namespaceID+";"+podName] diff --git a/render/cstorvolume.go b/render/cstorvolume.go new file mode 100644 index 0000000000..f285282076 --- /dev/null +++ b/render/cstorvolume.go @@ -0,0 +1,48 @@ +package render + +import ( + "context" + + "github.com/weaveworks/scope/probe/kubernetes" + "github.com/weaveworks/scope/report" +) + +//CStorVolumeRenderer is a Renderer which produces a renderable openebs CV. +var CStorVolumeRenderer = cStorVolumeRenderer{} + +//cStorVolumeRenderer is a Renderer to render CStor Volumes. +type cStorVolumeRenderer struct{} + +//Render renders the CV. +func (v cStorVolumeRenderer) Render(ctx context.Context, rpt report.Report) Nodes { + cStorNodes := make(report.Nodes) + + for cvID, cvNode := range rpt.CStorVolume.Nodes { + cStorNodes[cvID] = cvNode + } + + for cspID, cspNode := range rpt.CStorPool.Nodes { + cStorNodes[cspID] = cspNode + } + + for cvrID, cvrNode := range rpt.CStorVolumeReplica.Nodes { + cStorVolume, _ := cvrNode.Latest.Lookup(kubernetes.CStorVolumeName) + cStorVolumeNodeID := report.MakeCStorVolumeNodeID(cStorVolume) + + if cvNode, ok := cStorNodes[cStorVolumeNodeID]; ok { + cvNode.Adjacency = cvNode.Adjacency.Add(cvrID) + cvNode.Children = cvNode.Children.Add(cvrNode) + cStorNodes[cStorVolumeNodeID] = cvNode + } + + cStorPoolUID, _ := cvrNode.Latest.Lookup(kubernetes.CStorPoolUID) + cStorPoolNodeID := report.MakeCStorPoolNodeID(cStorPoolUID) + if cStorPoolNode, ok := cStorNodes[cStorPoolNodeID]; ok { + cvrNode.Children = cvrNode.Children.Add(cStorPoolNode) + } + + cStorNodes[cvrID] = cvrNode + } + + return Nodes{Nodes: cStorNodes} +} diff --git a/render/detailed/node.go b/render/detailed/node.go index 9442aae0da..629e9a295a 100644 --- a/render/detailed/node.go +++ b/render/detailed/node.go @@ -237,6 +237,27 @@ var nodeSummaryGroupSpecs = []struct { Columns: []Column{}, }, }, + { + topologyID: report.CStorVolume, + NodeSummaryGroup: NodeSummaryGroup{ + Label: "CStor Volumes", + Columns: []Column{}, + }, + }, + { + topologyID: report.CStorVolumeReplica, + NodeSummaryGroup: NodeSummaryGroup{ + Label: "CStor Volume Replica", + Columns: []Column{}, + }, + }, + { + topologyID: report.CStorPool, + NodeSummaryGroup: NodeSummaryGroup{ + Label: "CStor Pool", + Columns: []Column{}, + }, + }, } func children(rc RenderContext, n report.Node) []NodeSummaryGroup { diff --git a/render/detailed/summary.go b/render/detailed/summary.go index 72ab0fa420..b74bcfa4eb 100644 --- a/render/detailed/summary.go +++ b/render/detailed/summary.go @@ -92,6 +92,9 @@ var renderers = map[string]func(BasicNodeSummary, report.Node) BasicNodeSummary{ report.VolumeSnapshotData: volumeSnapshotDataNodeSummary, report.Disk: diskNodeSummary, report.StoragePoolClaim: storagePoolClaimNodeSummary, + report.CStorVolume: cStorVolumeNodeSummary, + report.CStorVolumeReplica: cStorVolumeReplicaNodeSummary, + report.CStorPool: cStorPoolNodeSummary, } // For each report.Topology, map to a 'primary' API topology. This can then be used in a variety of places. @@ -117,6 +120,9 @@ var primaryAPITopology = map[string]string{ report.VolumeSnapshotData: "volumes", report.Disk: "hosts", report.StoragePoolClaim: "pools", + report.CStorVolume: "volumes", + report.CStorVolumeReplica: "volumes", + report.CStorPool: "volumes", } // MakeBasicNodeSummary returns a basic summary of a node, if @@ -436,6 +442,25 @@ func storagePoolClaimNodeSummary(base BasicNodeSummary, n report.Node) BasicNode return base } +func cStorVolumeNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { + base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "cStor Volume" + return base +} + +func cStorVolumeReplicaNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { + base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "cStor Volume Replica" + return base +} + +func cStorPoolNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { + base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "cStor Pool" + base.Stack = true + return base +} + // groupNodeSummary renders the summary for a group node. n.Topology is // expected to be of the form: group:container:hostname func groupNodeSummary(base BasicNodeSummary, r report.Report, n report.Node) BasicNodeSummary { diff --git a/render/filters.go b/render/filters.go index c586c77dc2..19bf1a155a 100644 --- a/render/filters.go +++ b/render/filters.go @@ -15,6 +15,21 @@ const ( swarmNamespaceLabel = "com.docker.stack.namespace" ) +var storageComponents = map[string]string{ + "persistent_volume": "persistent_volume", + "persistent_volume_claim": "persistent_volume_claim", + "storage_class": "storage_class", + "storage_pool_claim": "storage_pool_claim", + "disk": "disk", +} + +var cStorComponents = map[string]string{ + "cstor_volume": "cstor_volume", + "cstor_volume_replica": "cstor_volume_replica", + "cstor_pool": "cstor_pool", + "disk": "disk", +} + // CustomRenderer allow for mapping functions that received the entire topology // in one call - useful for functions that need to consider the entire graph. // We should minimise the use of this renderer type, as it is very inflexible. @@ -129,16 +144,6 @@ func IsConnected(node report.Node) bool { return ok } -// IsPodComponent check whether given node is everything but PV, PVC, SC -func IsPodComponent(node report.Node) bool { - var ok bool - ok = true - if node.Topology == "persistent_volume" || node.Topology == "persistent_volume_claim" || node.Topology == "storage_class" { - ok = false - } - return ok -} - // IsNonSnapshotComponent checks whether given node is everything but Volume Snapshot, Volume Snapshot Data func IsNonSnapshotComponent(node report.Node) bool { if node.Topology == "volume_snapshot" || node.Topology == "volume_snapshot_data" { @@ -147,6 +152,33 @@ func IsNonSnapshotComponent(node report.Node) bool { return true } +//IsCStorCustomResource checks whether given node is cStor CR +func IsCStorCustomResource(node report.Node) bool { + if _, ok := cStorComponents[node.Topology]; ok { + return ok + } + + if _, ok := storageComponents[node.Topology]; ok { + return true + } + + if node.Topology == report.Pod { + _, ok := node.Latest.Lookup(kubernetes.VolumeClaim) + if ok { + return true + } + } + return false +} + +//IsNotCStorCustomResource ignores cStor Components +func IsNotCStorCustomResource(node report.Node) bool { + if _, ok := cStorComponents[node.Topology]; ok { + return false + } + return true +} + // connected returns the node ids of nodes which have edges to/from // them, excluding edges to/from themselves. func connected(nodes report.Nodes) map[string]struct{} { diff --git a/render/persistentvolume.go b/render/persistentvolume.go index 03b2b1c881..607c188ee8 100644 --- a/render/persistentvolume.go +++ b/render/persistentvolume.go @@ -11,6 +11,7 @@ import ( // KubernetesVolumesRenderer is a Renderer which combines all Kubernetes // volumes components such as stateful Pods, Persistent Volume, Persistent Volume Claim, Storage Class. var KubernetesVolumesRenderer = MakeReduce( + CStorVolumeRenderer, VolumesRenderer, PodToVolumeRenderer, PVCToStorageClassRenderer, @@ -154,6 +155,16 @@ func (v pvToControllerRenderer) Render(ctx context.Context, rpt report.Report) N p.Children = p.Children.Add(volumeSnapshotNode) } } + + for cvID, cvNode := range rpt.CStorVolume.Nodes { + pvName, _ := cvNode.Latest.Lookup(kubernetes.VolumeName) + if pvName == volumeName { + p.Adjacency = p.Adjacency.Add(cvID) + p.Children = p.Children.Add(cvNode) + } + nodes[pvNodeID] = p + } + if p.ID != "" { nodes[pvNodeID] = p } diff --git a/report/id.go b/report/id.go index c4e85d0b7e..d6a6e45e8c 100644 --- a/report/id.go +++ b/report/id.go @@ -205,6 +205,23 @@ var ( // ParseStoragePoolClaimNodeID parses a Stoage Pool Claim node ID ParseStoragePoolClaimNodeID = parseSingleComponentID("storage_pool_claim") + // MakeCStorVolumeNodeID produces a CStor Volume node ID from its composite parts. + MakeCStorVolumeNodeID = makeSingleComponentID("cstor_volume") + + // ParseCStorVolumeNodeID parses a CStor Volume node ID + ParseCStorVolumeNodeID = parseSingleComponentID("cstor_volume") + + // MakeCStorVolumeReplicaNodeID produces a CStor Volume node ID from its composite parts. + MakeCStorVolumeReplicaNodeID = makeSingleComponentID("cstor_volume_replica") + + // ParseCStorVolumeReplicaNodeID parses a CStor Volume node ID + ParseCStorVolumeReplicaNodeID = parseSingleComponentID("cstor_volume_replica") + + // MakeCStorPoolNodeID produces a CStor Pool node ID from its composite parts. + MakeCStorPoolNodeID = makeSingleComponentID("cstor_pool") + + // ParseCStorPoolNodeID parses a CStor Volume node ID + ParseCStorPoolNodeID = parseSingleComponentID("cstor_pool") ) // makeSingleComponentID makes a single-component node id encoder diff --git a/report/map_keys.go b/report/map_keys.go index af97727b70..0a2177ed6c 100644 --- a/report/map_keys.go +++ b/report/map_keys.go @@ -45,66 +45,73 @@ const ( DockerContainerNetworkMode = "docker_container_network_mode" DockerEnvPrefix = "docker_env_" // probe/kubernetes - KubernetesName = "kubernetes_name" - KubernetesNamespace = "kubernetes_namespace" - KubernetesCreated = "kubernetes_created" - KubernetesIP = "kubernetes_ip" - KubernetesObservedGeneration = "kubernetes_observed_generation" - KubernetesReplicas = "kubernetes_replicas" - KubernetesDesiredReplicas = "kubernetes_desired_replicas" - KubernetesNodeType = "kubernetes_node_type" - KubernetesGetLogs = "kubernetes_get_logs" - KubernetesDeletePod = "kubernetes_delete_pod" - KubernetesScaleUp = "kubernetes_scale_up" - KubernetesScaleDown = "kubernetes_scale_down" - KubernetesUpdatedReplicas = "kubernetes_updated_replicas" - KubernetesAvailableReplicas = "kubernetes_available_replicas" - KubernetesUnavailableReplicas = "kubernetes_unavailable_replicas" - KubernetesStrategy = "kubernetes_strategy" - KubernetesFullyLabeledReplicas = "kubernetes_fully_labeled_replicas" - KubernetesState = "kubernetes_state" - KubernetesIsInHostNetwork = "kubernetes_is_in_host_network" - KubernetesRestartCount = "kubernetes_restart_count" - KubernetesMisscheduledReplicas = "kubernetes_misscheduled_replicas" - KubernetesPublicIP = "kubernetes_public_ip" - KubernetesSchedule = "kubernetes_schedule" - KubernetesSuspended = "kubernetes_suspended" - KubernetesLastScheduled = "kubernetes_last_scheduled" - KubernetesActiveJobs = "kubernetes_active_jobs" - KubernetesType = "kubernetes_type" - KubernetesPorts = "kubernetes_ports" - KubernetesVolumeClaim = "kubernetes_volume_claim" - KubernetesStorageClassName = "kubernetes_storage_class_name" - KubernetesAccessModes = "kubernetes_access_modes" - KubernetesReclaimPolicy = "kubernetes_reclaim_policy" - KubernetesStatus = "kubernetes_status" - KubernetesMessage = "kubernetes_message" - KubernetesVolumeName = "kubernetes_volume_name" - KubernetesProvisioner = "kubernetes_provisioner" - KubernetesStorageDriver = "kubernetes_storage_driver" - KubernetesVolumeSnapshotName = "kubernetes_volume_snapshot_name" - KubernetesSnapshotData = "kuberneets_snapshot_data" - KubernetesCreateVolumeSnapshot = "kubernetes_create_volume_snapshot" - KubernetesVolumeCapacity = "kubernetes_volume_capacity" - KubernetesCloneVolumeSnapshot = "kubernetes_clone_volume_snapshot" - KubernetesDeleteVolumeSnapshot = "kubernetes_delete_volume_snapshot" - KubernetesDescribe = "kubernetes_describe" - KubernetesModel = "kubernetes_model" - KubernetesLogicalSectorSize = "kubernetes_logical_sector_size" - KubernetesStorage = "kubernetes_storage" - KubernetesFirmwareRevision = "kubernetes_firmware_version" - KubernetesSerial = "kubernetes_serial" - KubernetesVendor = "kubernetes_vendor" - KubernetesDiskList = "kubernetes_disk_list" - KubernetesMaxPools = "kubernetes_max_pools" - KubernetesAPIVersion = "kubernetes_api_version" - KubernetesValue = "kubernetes_value" - KubernetesStoragePoolClaimName = "kubernetes_storage_pool_claim" - KubernetesDiskName = "kubernetes_disk_name" - KubernetesPoolName = "kubernetes_pool_name" - KubernetesPoolClaim = "kubernetes_pool_claim" - KubernetesHostName = "kubernetes_host_name" - KubernetesVolumePod = "kubernetes_volume_pod" + KubernetesName = "kubernetes_name" + KubernetesNamespace = "kubernetes_namespace" + KubernetesCreated = "kubernetes_created" + KubernetesIP = "kubernetes_ip" + KubernetesObservedGeneration = "kubernetes_observed_generation" + KubernetesReplicas = "kubernetes_replicas" + KubernetesDesiredReplicas = "kubernetes_desired_replicas" + KubernetesNodeType = "kubernetes_node_type" + KubernetesGetLogs = "kubernetes_get_logs" + KubernetesDeletePod = "kubernetes_delete_pod" + KubernetesScaleUp = "kubernetes_scale_up" + KubernetesScaleDown = "kubernetes_scale_down" + KubernetesUpdatedReplicas = "kubernetes_updated_replicas" + KubernetesAvailableReplicas = "kubernetes_available_replicas" + KubernetesUnavailableReplicas = "kubernetes_unavailable_replicas" + KubernetesStrategy = "kubernetes_strategy" + KubernetesFullyLabeledReplicas = "kubernetes_fully_labeled_replicas" + KubernetesState = "kubernetes_state" + KubernetesIsInHostNetwork = "kubernetes_is_in_host_network" + KubernetesRestartCount = "kubernetes_restart_count" + KubernetesMisscheduledReplicas = "kubernetes_misscheduled_replicas" + KubernetesPublicIP = "kubernetes_public_ip" + KubernetesSchedule = "kubernetes_schedule" + KubernetesSuspended = "kubernetes_suspended" + KubernetesLastScheduled = "kubernetes_last_scheduled" + KubernetesActiveJobs = "kubernetes_active_jobs" + KubernetesType = "kubernetes_type" + KubernetesPorts = "kubernetes_ports" + KubernetesVolumeClaim = "kubernetes_volume_claim" + KubernetesStorageClassName = "kubernetes_storage_class_name" + KubernetesAccessModes = "kubernetes_access_modes" + KubernetesReclaimPolicy = "kubernetes_reclaim_policy" + KubernetesStatus = "kubernetes_status" + KubernetesMessage = "kubernetes_message" + KubernetesVolumeName = "kubernetes_volume_name" + KubernetesProvisioner = "kubernetes_provisioner" + KubernetesStorageDriver = "kubernetes_storage_driver" + KubernetesVolumeSnapshotName = "kubernetes_volume_snapshot_name" + KubernetesSnapshotData = "kuberneets_snapshot_data" + KubernetesCreateVolumeSnapshot = "kubernetes_create_volume_snapshot" + KubernetesVolumeCapacity = "kubernetes_volume_capacity" + KubernetesCloneVolumeSnapshot = "kubernetes_clone_volume_snapshot" + KubernetesDeleteVolumeSnapshot = "kubernetes_delete_volume_snapshot" + KubernetesDescribe = "kubernetes_describe" + KubernetesModel = "kubernetes_model" + KubernetesLogicalSectorSize = "kubernetes_logical_sector_size" + KubernetesStorage = "kubernetes_storage" + KubernetesFirmwareRevision = "kubernetes_firmware_version" + KubernetesSerial = "kubernetes_serial" + KubernetesVendor = "kubernetes_vendor" + KubernetesDiskList = "kubernetes_disk_list" + KubernetesMaxPools = "kubernetes_max_pools" + KubernetesAPIVersion = "kubernetes_api_version" + KubernetesValue = "kubernetes_value" + KubernetesStoragePoolClaimName = "kubernetes_storage_pool_claim" + KubernetesDiskName = "kubernetes_disk_name" + KubernetesPoolName = "kubernetes_pool_name" + KubernetesPoolClaim = "kubernetes_pool_claim" + KubernetesHostName = "kubernetes_host_name" + KubernetesVolumePod = "kubernetes_volume_pod" + KubernetesCStorVolumeName = "kubernetes_cstor_volume" + KubernetesCStorVolumeReplicaName = "kubernetes_cstor_volume_replica" + KubernetesCStorPoolName = "kubernetes_cstor_pool" + KubernetesCStorPoolUID = "kubernetes_cstor_pool_uid" + KubernetesCStorVolumeStatus = "kubernetes_cstor_volume_status" + KubernetesCStorVolumeReplicaStatus = "kubernetes_cstor_volume_replica_status" + KubernetesCStorPoolStatus = "kubernetes_cstor_pool_status" // probe/awsecs ECSCluster = "ecs_cluster" ECSCreatedAt = "ecs_created_at" diff --git a/report/report.go b/report/report.go index c42b379b64..38c196b751 100644 --- a/report/report.go +++ b/report/report.go @@ -36,6 +36,9 @@ const ( Job = "job" Disk = "disk" StoragePoolClaim = "storage_pool_claim" + CStorVolume = "cstor_volume" + CStorVolumeReplica = "cstor_volume_replica" + CStorPool = "cstor_pool" // Shapes used for different nodes Circle = "circle" @@ -87,6 +90,9 @@ var topologyNames = []string{ Job, Disk, StoragePoolClaim, + CStorVolume, + CStorVolumeReplica, + CStorPool, } // Report is the core data type. It's produced by probes, and consumed and @@ -196,6 +202,15 @@ type Report struct { // Job represent all Kubernetes Job on hosts running probes. Job Topology + // CStorVolume represent all Kubernetes cStor volumes running in cluster + CStorVolume Topology + + // CStorVolumeReplica represent all Kubernetes cStor volume replicas running in cluster + CStorVolumeReplica Topology + + // CStorPool represent all Kubernetes cStor pools running in cluster + CStorPool Topology + // Disk represent all NDM Disks on hosts running probes. // Metadata is limited for now, more to come later. Disk Topology @@ -331,6 +346,19 @@ func MakeReport() Report { WithShape(DottedSquare). WithLabel("storage pool claim", "storage pool claims"), + //FIXME: Change shape to actual CV shape + CStorVolume: MakeTopology(). + WithShape(Controller). + WithLabel("cStor Volume", "cStor Volumes"), + + CStorVolumeReplica: MakeTopology(). + WithShape(Replica). + WithLabel("cStor Volume Replica", "cStor Volume Replica"), + + CStorPool: MakeTopology(). + WithShape(Square). + WithLabel("cStor Pool", "cStor Pool"), + DNS: DNSRecords{}, Sampling: Sampling{}, @@ -453,6 +481,12 @@ func (r *Report) topology(name string) *Topology { return &r.Disk case StoragePoolClaim: return &r.StoragePoolClaim + case CStorVolume: + return &r.CStorVolume + case CStorVolumeReplica: + return &r.CStorVolumeReplica + case CStorPool: + return &r.CStorPool } return nil } From eff42b5bf6ab04b0176abed64592d6697445006f Mon Sep 17 00:00:00 2001 From: Satyam Zode Date: Fri, 23 Nov 2018 17:11:39 +0530 Subject: [PATCH 17/45] Fix snapshot filter for show customer resources Signed-off-by: Satyam Zode --- render/filters.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/render/filters.go b/render/filters.go index 19bf1a155a..3a019f6183 100644 --- a/render/filters.go +++ b/render/filters.go @@ -21,6 +21,8 @@ var storageComponents = map[string]string{ "storage_class": "storage_class", "storage_pool_claim": "storage_pool_claim", "disk": "disk", + "volume_snapshot": "volume_snapshot", + "volume_snapshot_data": "volume_snapshot_data", } var cStorComponents = map[string]string{ From 0e0b54df30a2a9fc8e13b24d12a00931d54c057b Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Fri, 23 Nov 2018 20:19:57 +0530 Subject: [PATCH 18/45] Add node tag and status support Signed-off-by: Akash Srivastava --- client/app/scripts/charts/edge.js | 2 +- client/app/scripts/charts/nodes-chart-elements.js | 8 +++++++- probe/kubernetes/cstor_storage_pool.go | 15 ++++++++++++++- probe/kubernetes/cstor_volume.go | 14 +++++++++++++- probe/kubernetes/cstor_volume_replica.go | 15 +++++++++++++-- probe/kubernetes/reporter.go | 14 ++++++++++++++ render/detailed/summary.go | 2 ++ report/node.go | 13 +++++++++++++ 8 files changed, 77 insertions(+), 6 deletions(-) diff --git a/client/app/scripts/charts/edge.js b/client/app/scripts/charts/edge.js index d6d35e7b75..92e2ead139 100644 --- a/client/app/scripts/charts/edge.js +++ b/client/app/scripts/charts/edge.js @@ -6,7 +6,7 @@ import { enterEdge, leaveEdge } from '../actions/app-actions'; import { encodeIdAttribute, decodeIdAttribute } from '../utils/dom-utils'; function isStorageComponent(id) { - const storageComponents = ['', '', '', '', '']; + const storageComponents = ['', '', '', '', '', '', '', '', '', '', '']; return storageComponents.includes(id); } diff --git a/client/app/scripts/charts/nodes-chart-elements.js b/client/app/scripts/charts/nodes-chart-elements.js index 52c3e3b1fc..37fe3dedbc 100644 --- a/client/app/scripts/charts/nodes-chart-elements.js +++ b/client/app/scripts/charts/nodes-chart-elements.js @@ -153,6 +153,12 @@ class NodesChartElements extends React.Component { // old versions of scope reports have a node shape of `storagesheet` // if so, normalise to `sheet` const shape = node.get('shape') === 'storagesheet' ? 'sheet' : node.get('shape'); + let nodeTag; + if (node.get('nodeTag') === undefined) { + nodeTag = node.get('tag'); + } else { + nodeTag = node.get('nodeTag'); + } return ( Date: Sat, 24 Nov 2018 17:01:14 +0530 Subject: [PATCH 19/45] Add unknown state if status is empty (#123) Signed-off-by: Akash Srivastava --- probe/kubernetes/cstor_storage_pool.go | 2 +- probe/kubernetes/cstor_volume.go | 2 +- probe/kubernetes/cstor_volume_replica.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/probe/kubernetes/cstor_storage_pool.go b/probe/kubernetes/cstor_storage_pool.go index c43fbb2a05..c211fae400 100644 --- a/probe/kubernetes/cstor_storage_pool.go +++ b/probe/kubernetes/cstor_storage_pool.go @@ -51,5 +51,5 @@ func (p *cStorPool) GetNodeTagOnStatus(status string) string { if status != "" { return CStorVolumeStatusMap[status] } - return "" + return "unknown" } diff --git a/probe/kubernetes/cstor_volume.go b/probe/kubernetes/cstor_volume.go index 428338b240..ac98c6c703 100644 --- a/probe/kubernetes/cstor_volume.go +++ b/probe/kubernetes/cstor_volume.go @@ -60,5 +60,5 @@ func (p *cStorVolume) GetNodeTagOnStatus(status string) string { if status != "" { return CStorVolumeStatusMap[status] } - return "" + return "unknown" } diff --git a/probe/kubernetes/cstor_volume_replica.go b/probe/kubernetes/cstor_volume_replica.go index 3eb7b2b8ad..e82d819edf 100644 --- a/probe/kubernetes/cstor_volume_replica.go +++ b/probe/kubernetes/cstor_volume_replica.go @@ -75,5 +75,5 @@ func (p *cStorVolumeReplica) GetNodeTagOnStatus(status string) string { if status != "" { return CStorVolumeStatusMap[status] } - return "" + return "unknown" } From 367a9c840249adb3b1fcc638af83c16d6459e1d1 Mon Sep 17 00:00:00 2001 From: Satyam Zode Date: Mon, 26 Nov 2018 19:20:37 +0530 Subject: [PATCH 20/45] Add adjacency for the CSP, Disk & SPC * Add adjacency for the CSP, Disk & SPC * Fix comments for renderer Signed-off-by: Satyam Zode --- probe/kubernetes/cstor_storage_pool.go | 19 ++++++- probe/kubernetes/disk.go | 13 ++++- probe/kubernetes/reporter.go | 2 +- render/cstorvolume.go | 3 ++ render/persistentvolume.go | 2 +- render/storagerenderer.go | 71 +++++++++++++++++++------- 6 files changed, 86 insertions(+), 24 deletions(-) diff --git a/probe/kubernetes/cstor_storage_pool.go b/probe/kubernetes/cstor_storage_pool.go index c211fae400..486fbff3ce 100644 --- a/probe/kubernetes/cstor_storage_pool.go +++ b/probe/kubernetes/cstor_storage_pool.go @@ -13,6 +13,8 @@ type CStorPool interface { GetNode() report.Node GetStatus() string GetNodeTagOnStatus(status string) string + GetHost() string + GetStoragePoolClaim() string } // cStorPool represents cStor Volume CSP @@ -29,8 +31,11 @@ func NewCStorPool(p *mayav1alpha1.CStorPool) CStorPool { // GetNode returns updated node with CStor Volume details func (p *cStorPool) GetNode() report.Node { latests := map[string]string{ - NodeType: "CStor Pool", - APIVersion: p.APIVersion, + NodeType: "CStor Pool", + APIVersion: p.APIVersion, + DiskList: strings.Join(p.Spec.Disks.DiskList, "~p$"), + HostName: p.GetHost(), + StoragePoolClaimName: p.GetStoragePoolClaim(), } if p.GetStatus() != "" { @@ -53,3 +58,13 @@ func (p *cStorPool) GetNodeTagOnStatus(status string) string { } return "unknown" } + +func (p *cStorPool) GetHost() string { + host := p.Labels()["kubernetes.io/hostname"] + return string(host) +} + +func (p *cStorPool) GetStoragePoolClaim() string { + host := p.Labels()["openebs.io/storage-pool-claim"] + return string(host) +} diff --git a/probe/kubernetes/disk.go b/probe/kubernetes/disk.go index 22591c1cc5..8b817931ac 100644 --- a/probe/kubernetes/disk.go +++ b/probe/kubernetes/disk.go @@ -2,6 +2,7 @@ package kubernetes import ( "strconv" + "strings" maya1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" "github.com/weaveworks/scope/report" @@ -11,6 +12,7 @@ import ( type Disk interface { Meta GetNode() report.Node + GetPath() []string } // disk represents NDM Disks @@ -29,11 +31,20 @@ func (p *disk) GetNode() report.Node { return p.MetaNode(report.MakeDiskNodeID(p.UID())).WithLatests(map[string]string{ NodeType: "Disk", LogicalSectorSize: strconv.Itoa(int(p.Spec.Capacity.LogicalSectorSize)), - Storage: strconv.Itoa(int(p.Spec.Capacity.Storage / (1024 * 1024 * 1024))), + Storage: strconv.Itoa(int(p.Spec.Capacity.Storage/(1024*1024*1024))) + " GB", FirmwareRevision: p.Spec.Details.FirmwareRevision, Model: p.Spec.Details.Model, Serial: p.Spec.Details.Serial, Vendor: p.Spec.Details.Vendor, HostName: p.GetLabels()["kubernetes.io/hostname"], + DiskList: strings.Join(p.GetPath(), "~p$"), }) } + +func (p *disk) GetPath() []string { + if len(p.Spec.DevLinks) > 0 { + return p.Spec.DevLinks[0].Links + } + diskList := []string{p.Spec.Path} + return diskList +} diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index a32c3755c9..1052e1bb1c 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -66,7 +66,7 @@ var ( "degraded": "degraded", "error": "failed", "healthy": "", - "init": "", + "init": "pending", "invalid": "notpermitted", "offline": "offline", "online": "", diff --git a/render/cstorvolume.go b/render/cstorvolume.go index f285282076..7436471408 100644 --- a/render/cstorvolume.go +++ b/render/cstorvolume.go @@ -44,5 +44,8 @@ func (v cStorVolumeRenderer) Render(ctx context.Context, rpt report.Report) Node cStorNodes[cvrID] = cvrNode } + for diskID, diskNode := range rpt.Disk.Nodes { + cStorNodes[diskID] = diskNode + } return Nodes{Nodes: cStorNodes} } diff --git a/render/persistentvolume.go b/render/persistentvolume.go index 607c188ee8..d82d124107 100644 --- a/render/persistentvolume.go +++ b/render/persistentvolume.go @@ -17,7 +17,7 @@ var KubernetesVolumesRenderer = MakeReduce( PVCToStorageClassRenderer, PVToControllerRenderer, VolumeSnapshotRenderer, - SPToDiskRenderer, + CSPToDiskRenderer, MakeFilter( func(n report.Node) bool { value, _ := n.Latest.Lookup(kubernetes.VolumePod) diff --git a/render/storagerenderer.go b/render/storagerenderer.go index 574f89a520..1127f4020c 100644 --- a/render/storagerenderer.go +++ b/render/storagerenderer.go @@ -2,44 +2,77 @@ package render import ( "context" + "strings" + "github.com/weaveworks/scope/probe/kubernetes" "github.com/weaveworks/scope/report" ) // KubernetesStorageRenderer is a Renderer which combines all Kubernetes -// storage components such as storage pools, storage pool claims and disks. +// storage components such as CstorPools, storage pool claims and disks. var KubernetesStorageRenderer = MakeReduce( - SPCToSPRenderer, - SPToDiskRenderer, + SPCToCSPRenderer, + CSPToDiskRenderer, ) -// SPCToSPRenderer is a Renderer which produces a renderable kubernetes CRD SPC -var SPCToSPRenderer = spcToSpRenderer{} +// SPCToCSPRenderer is a Renderer which produces a renderable kubernetes CRD SPC +var SPCToCSPRenderer = spcToCSPRenderer{} -// spcToSpRenderer is a Renderer to render SPC & SP nodes. -type spcToSpRenderer struct{} +// spcToCSPRenderer is a Renderer to render SPC & CSP nodes. +type spcToCSPRenderer struct{} -// Render renders the SPC & SP nodes with adjacency. -// Here we are obtaining the spc name from sp and adjacency is created by matching it with spc name. -func (v spcToSpRenderer) Render(ctx context.Context, rpt report.Report) Nodes { +// Render renders the SPC & CSP nodes with adjacency. +// Here we are obtaining the spc name from csp and adjacency is created by matching it with spc name. +func (v spcToCSPRenderer) Render(ctx context.Context, rpt report.Report) Nodes { nodes := make(report.Nodes) for spcID, spcNode := range rpt.StoragePoolClaim.Nodes { - nodes[spcID] = spcNode + spcName, _ := spcNode.Latest.Lookup(kubernetes.Name) + for cspID, cspNode := range rpt.CStorPool.Nodes { + storagePoolCaimName, _ := cspNode.Latest.Lookup(kubernetes.StoragePoolClaimName) + if storagePoolCaimName == spcName { + spcNode.Adjacency = spcNode.Adjacency.Add(cspID) + spcNode.Children = spcNode.Children.Add(cspNode) + } + nodes[spcID] = spcNode + } + } return Nodes{Nodes: nodes} } -// SPToDiskRenderer is a Renderer which produces a renderable kubernetes CRD Disk -var SPToDiskRenderer = spToDiskRenderer{} +// CSPToDiskRenderer is a Renderer which produces a renderable kubernetes CRD Disk +var CSPToDiskRenderer = cspToDiskRenderer{} + +// cspToDiskRenderer is a Renderer to render CSP & Disk . +type cspToDiskRenderer struct{} -// spToDiskRenderer is a Renderer to render SP & Disk . -type spToDiskRenderer struct{} +// Render renders the CSP & Disk nodes with adjacency. +func (v cspToDiskRenderer) Render(ctx context.Context, rpt report.Report) Nodes { + // var disks []string -// Render renders the SP & Disk nodes with adjacency. -func (v spToDiskRenderer) Render(ctx context.Context, rpt report.Report) Nodes { nodes := make(report.Nodes) - for diskID, diskNode := range rpt.Disk.Nodes { - nodes[diskID] = diskNode + for cspID, cspNode := range rpt.CStorPool.Nodes { + cspDiskPaths, _ := cspNode.Latest.Lookup(kubernetes.DiskList) + cspHostname, _ := cspNode.Latest.Lookup(kubernetes.HostName) + + diskList := strings.Split(cspDiskPaths, "~p$") + + for diskID, diskNode := range rpt.Disk.Nodes { + diskHostname, _ := diskNode.Latest.Lookup(kubernetes.HostName) + diskPaths, _ := diskNode.Latest.Lookup(kubernetes.DiskList) + diskPathList := strings.Split(diskPaths, "~p$") + for _, cspDiskPath := range diskList { + for _, diskPath := range diskPathList { + if (cspDiskPath == diskPath) && (cspHostname == diskHostname) { + cspNode.Adjacency = cspNode.Adjacency.Add(diskID) + cspNode.Children = cspNode.Children.Add(diskNode) + } + } + } + nodes[diskID] = diskNode + } + nodes[cspID] = cspNode } + return Nodes{Nodes: nodes} } From d5c51e82343f840a170e9841396828fd69ca8c58 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Wed, 28 Nov 2018 16:31:58 +0530 Subject: [PATCH 21/45] Change favicon.ico and title (#129) Signed-off-by: Akash Srivastava --- client/app/html/index.html | 2 +- client/app/images/favicon.ico | Bin 741 -> 115226 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/html/index.html b/client/app/html/index.html index f7ab5ee9ba..9b88bb1eb2 100644 --- a/client/app/html/index.html +++ b/client/app/html/index.html @@ -2,7 +2,7 @@ - Weave Scope + MayaOnline - Topology diff --git a/client/app/images/favicon.ico b/client/app/images/favicon.ico index 2d15c780889b9db340d2ce1e5690caf0b66851ac..158cfef12e1a55309e7db28e55ec75f1226b96df 100644 GIT binary patch literal 115226 zcmeF32T&Bzmau!sNCpuk=O{r0l$?VoK_q7Z$r;IMkgNm|5Rn`u=bR-7l2MZ6C^<8v zVVJ+gw_E#fy{-5ETlK2;y|=gO6w^K3J>B;^_ndRjxeWk701V)Fg8+0uu_ypofS;kz zKih0r5P(<=03;>mQNX)JaSOaO-eW~s_21wA7OdYtZQzm*{-&twV_7K;&*|M3>vznPZVML@4-@Mq zTHW2;vI8A5Af~K>?=jflIgMo9;W@G@#tsu8It{~qP2tQmOitHhR%efXM_#d34st?_ zuW%kmon;rsJQ{D_$7}r_s33t)_-K3VZtFidPP=&5-%RbDnZDr%smm3 z`#t^dWf|uq!;{fI0PRo3pNvM}XkbnrX? z=<+pvmfiZ7o0-+n0D4I?#w^zP(y}m@Xc7m@nbp;!tam#arf3n^?cAojQ2LMTW&Wwh zhwgN|9X!H-BForH3D#_eBC5%|;Yj)OeG`<@?itO(Sv&rpn9#g16EC@4GY6wm#iX6K zTUnm>$hmI6vJVX#^QP(DO{Bw}Ihj^xb#GA1IYy_W97r$bSvoM~%vxcJL2G-Tin6x|(Z@ z?(~?_2fr`UldOHs$_uYuf7%@qPsc|^_Z5woypfy{zzya8N^a!Si}VYn4z4-`pn5f@ zaIe7F2Sc&;R{!8-~H#x^#`ch=d;`1Ftd@(0?<(_AwiJtl2qzdcy!p1K{F@Y!+ z3md%FTL2%_W3A9vVt#L#^kVPmRv83%Q0f&(8guwVb#=W?oT1Y@61)6?ilntF0pqKc zKrBRbRMSdSsR&E4!R=yw4q~P5z4vtuDZ&fBdyG}Y->O)dY2PNU-#HKcc`-8JDEQ_1 zroMDt>O+SK;YM4 zxy**{MFr$z=F!`)p;{DpoGM1|7knAkYv5E>Z-@X&SCO$|1T}D7=ehXcY`U&Ht#(BL zJrra7iRzf4&9#waP8K;PCRPxt&Bll1c!dn3^{}8`Y)?16Ba!_u=g5I~iDk}>W$>fSafDxk)l z`AC#4bh$!3mbiw0op{HOFXv-mjR5I+ZRJ-h`49F#P_;NY#2uXfk z`l{^Mi^ado7ue{n4V=1kx04paYbuc%Sm*1ABDAhXOdQt|LP#jutMJCWr9U2R^!k7f=F6TO*)(u0Z)Sg)~19dE@ zf~kG$9p&@tvAld^G$IR=M|%`_8S_{R^WLaBx|%2^FCMe-xMzPmKsf34X+cJ;I3RRb z5xdGcEDJ!pGh0&qD?|DFZ&a92sI+&7YcsHK+hDWK+nz*>`Kn+u1M#l0U77~TU!Z~) z(*y}2SivFcSw%sm{uhuNB_GUu2=QO>(0l6`o;z(HzI^QXh`yAPhPV!ZGB4ueFKRD? zgE>6bG-r$Ks9kblj~}pr<>E4#S?l_7XitujHI1Sb3aDILI6vNO8UHjrbR4MH;zoPl zA5a`b8>zvPP)icy`YDSx_2EvS75i>`Ep};1?KXQ6g7gTD^^NH(s*IclDa^~U9sf+p z@SrTa1IzD>*au{(dPy#rxK6Oe#yL=D*)&_x&h;NVD6$qK&@61tj5%E$9vxeHtm2Ixz4J=uo0CR-=SrB>%DDHhF85mzOiJL|OWEO2;-@I{Dd z%~Wwy?x@MY0Q>lLh_)Yp7H)lkEwQ#`yp3_u{wf(hD`RJ{4k4`=gOeSD@3t%VQkuy4 zLyq*%VuR7mujE+HY->8+E?lIYtsm;NPfTv7B)`#09!?QT*^~ZbJ8uT1tJPDe0!`6; zO!?TIy;e=pu^E|k45)hSo4Q%1y{I}$>O1I@*y!oy@mmel78aTn@VAM~zwUI@*hD!$ zPM$N?dmmx1Kl$3TUGaJjST%V0dHpyZjT#$=e3ZCE#mJFafD{9c9Y^wsmA(z3(4e*6 zC2Q-wW7xoAxl)ndOm$^qEpShK8GgPr5P5FIfBR~0rGay|)xxLy#V0gT6ec`@Jr_G) z2;joK(fByFs}#G!=gg=kFKe?@rGGWIY=V59`_n_8CVu|y#(A~-#Io%>DHN`Tq!N-$ zyyA_i#uscMqM3v>PY?ZE!g+~eTFlW2h&wpsZl8*K(o+a)6m;J>&5zOJfdBE+T(m{c zX8(1riI&?nW5Rq&Bx1QENgBO%7<;*hOSpLZsAa1bf!VIvyaZ=l<c|c~^ygA*wj?eiBQ)4`D|;$PLpB{a*5!D-u7f|HZ523F7ujy$5$` zFC)ds7gp*P;@ZxqDZeBFl6=1)DU;VHFM+rE*OK!0S)gA=y2&9Xysz#jd7$#Sx#DuCnsMwi7awyx;PF>$l_!?uIN zQ`jHm2pMK09AyX#Cic+k)%Hj6vy`Ua-VA7#W0rR0nK?{*WuSHg3&F9kyQrqC?Mt~hR{?C)X~Kqz366O zorc;&)~Lrq*%H_a8Wd5)dSc$xi|_}mZPyst|IoX`i1C0G0A|s+I`(<|hpvgAu>ta- zXnivpKXWwX1R;w}0ekd&;!VwcAB}nG{lb!9a?je1#bEgJ-qRhh9vSBPvcv-Aaoc;ADVL=e+e z;LZRf9)b%xPF}U%qQ{aw^ZpP5c1?4gs-JrLZAR;Nl1D~b_&+I%V+;hZk-}2Y0*z9W zVt?sxK0=$pe`t+syxeANC_WT>g%j2SGXN=K8XGow0#JxVBN7^ru08X!@ zpGM=dH^iTAw^bJl@2518GZFcZ3)jUj&f6Q*FF7rHMHW5STJl`OqwUVWUhMkVUXh*Y zC5fdxT0)27(4@=c5K=|9YRQpMKEp3bD|*Sc?S`JLDkf*|#W(X3MF%K-t1Yk4B_l*e z0JM)lGg5CK>*&0Xm_|-CL5%#x3|`<PHRs^5>g#?vM<<=hUXjG_;>i^+Hbx(QxTIEGtJfjF>A*-A(jdxbrobaDW_Hd}ta`-MuedeK|-1w}~vxEtayz>0gPPoSl( zx#Mxa{mRyZ9p-+{NIfxr$Stqx_;6&GHKm`J{xJ6KqhJG#b`^{)APIDLTD5g`fGd%jz@cnW~?=bzemi<~i9Ux~Di zx+}0h4Xkgn0jsX%ZXU+dR&7Z_U%$JYC#9#^M;$!SYg?kjVyd%Bb3MkDa*nvqH23yl zr!({mq-HMmSz}Y(Q#arpabnx0TXbCbdAfuOeA>yOO&OXDIf1mt-f!HVdghEtSSVxd zS5Pc;w1DJoZ=wy|`(E>Ai@}zc>UJ9D)d|;HrGy~8T2a{W(g;+M8Mx)u;TFe{=4nND zzMX4&p5a52+T_kvz`Vg&;7~8|XK0@qpb|20-u;RZ^n&yB#2yi~@B)(WAXXPOj-)5F zxWFTLvt07I4(W=7`4|xo!Kd{h+^R_h{xa_8ah77TM4k1!7Dc&F4o4X`Z}0Gk*^w<< zUR@*xwO!AL)#ztu;sC9!={=4&J#`=Dw<$RtLo3%R5(E4NjoJ|OmJI9aJU}Gw=VYq< zas4=7BcBIqslFcuireV*dx3Yc*t~Aa%RgyDm-1!X7tV|Ns0dA0zPopeGCS;4ylC7@ z6DjcrJB`u!LJt;SyV?CYoo&y07uu3qVYUjHr74TXjc85dTZ7Q0tFE6O`cayb8UM2=0?R?+)C4)XpZJtn&f#h}h0ek`DsfEG$~|51n-H;w5Z z(lr$t2FR1{S6=>(Evyywx2F+gJWmFO z?zSw9{NzO)zE(>DTEv2-=?&cNrprki=0l6$DQrGJn@WGvBVJFpe|2P*;8HCNFJXP6 z?ctN+b071a%+xdvF842kwOz&JU)vXv@~g8}mwDx3OHOKz`2xs? zs%T`-yu~`^DVn~1{5`X*V#Hf~=pSY;>x{<=r(}&d5CX{W=2g-hROx0qN~oD09K}C< z@B1{mZK*uNw(|K8Vu#!0QwyvkJ}VQnPLt>=RL^-veJs~d*BH7TPSb(<<{7iu0_=BK z&})BTdN#XlO^#T_m2LCt+O<|;F6UF}bAr}_b;n0cips##VLtN{0+N+>E^9QX%p>>e zT-9H5A41|rx9&la6*Ff1H;#Kp5%oZ;nU7&9)|GvIYRQFOVH52ZYK@*P{yr*_)T z7hT61c>VH0`U9x8adq(Xyh7RHV$SddRXSNm8*nlp9cv$}6WQFs3 z-ZyLx2sF;cv6Z0tPu2tc1Tcu!@FSY+M3>4vml!_=x5MIG>?W8%rNJU)kq*&zi^x*7)hiNBwsnjj_gC^DtAI@?VNtAWzP2 zXKA?}p6cIQW!Qh_NRU~kZ78Fke9zcuDQElm>UCE)r!#@4iG}#gsF`}9rImHk;c`(Q z+V$*bbOXz6zZ7A5+3dS%$72Gm^Jlikk)bv~YfIe9bSzNLg^NlKrt{REx*kBiM{-v` zWYM-R=sHSPWE3`?oDpNdJ4t6SyuIVqHA@QbDJ-y#ZI8Oc^)|)egnH;Us!3}1f|0zB zB+01=zqxy(-tCFCk|)YeQ*cT>SayE{M8*6#)=x)P_ZYLOxro^%<4E#hs{P!&fA=PI zQMU$+5yJW-eSR^~{5^z^X(uyXKKYGNM%E~?ZP^H@FbR!N@Wzt5lyaDUpJC(`$~0e7 zW|dRF)mWCO_NLWH8W7?luGGkoZEWHuR?eK4ed3qzO7?R3&dXOrWcDIcwJshBN@K)W zu1CQMuikLn(Vwy1`kY6jxIUY~p3PoR|pCtaM`jLX6dktmYf=~)6CP^AQCdlu16 zz0^2&CEZ*#y49?=ehBA49?|@rlnCco;ZgQqAM@-4C?W&JYl1G&38L7XWi1W@=WwVL z42LUT1g0aJ8`BVera#_1yWc58i`*Y*FLKP^zSxNo)v!?l%()t?^~_S*^3gu*7nM#* z+g+K!;x%7NO|E6H@h#t3aTO7}b2ANn%7F*fecxL0vVb5%@q*c0>kz4{aS^CB-d_>R z%%yqwE8eAF2jGx3bTv@8#QKwemfGqZ3VnNemCLNpDjh#{sdRBhUlzdD}@MJHH z{m@M*eY-Kk^m=-@q5d#bji-i-$)T`?Zk^Zx8QggCK5)F(!f)ShWSL>h{AB(7!P(FH z_2>id#?nul3q=bJD_U-13ZZf?V#CJo&sUInEGeRnGffMwuYr84Trr79WEq5m)KM|F zaPb@v#W0x3!9;Qw9l&dL+9&5_K$#}LK`~4GAExASeQ4yAq%FYS+sU_bE-tapM=Axi zw67%5JMMAc=Qg;7mwIoyz825-nkPSLlhKT!V5N2Pbjw?XisW%{@;+)}X)sy%-H)4# zm*JmPbtCNk?W9etcnyf)S3mD=e75>3dQ}47(~7xJH9CD@`8utMEl%jIZyGOuJ#675 zo_$lC3avc(dy_I{DP1o1J0+l=+Xaa3+Kxuev}Csrj<>1Ip2w0As(M2hyrOp)q8_W> zkavpWx0hL#NG##W##ZGsSZkVZY}lE`$Lzl6A2 z-qc?Pov5W%Z@cfo31_FJ@4d7u{q1c^SrRbRxMNXCJ#cewQ`HEwmbO{MJ(yg5kj{9U z(eW|&=P~&V0qiw8c2aDTl?a=#<3v6y9{bl0+)>ftT`fry`qh*5_`Jn~g-zUnj3pes z;r(tU9T9nBPd9VRcX@U20MVEb`ycuK)7AkZ2>>}w4lz`}7VdG3lakNhUo@+Z$%}(~ zLZm`PU@SN(XZoC)zj49CS7Y(VS!iP2Pc;84)33M_%EQ?;n5(Rg+PePE`TJ5op0oHa zR}1IQ^D%c@77A!ax28T-?w55cEy;x|-N6a=HUBlX8#sV#9-$b|^sm2G-JiQ^yl0wFlSwqt995pDcah z{}fq4{w>p>e+7`RNC3`kiaEQv=tf6Mp-A* z{GMXQ=$z_5>($Ne+5g(-NZ4DE@|w&#z~_N}S_VHFy=-H#1ogL{rKeA%Th6uQU(qwb zDzPf|y1!-M*di+G&d&?{c&_EKaLShlnj)!^uN^iv`)9l?!}aFZ#wNCo!YhjA^M5_is7w$Bdqot6+9@hxb&3Wgz zYaW-tQ#>Te^W|;xGoPfz8tr1uyH(HpI(^dwivu%c0N81MhiI!pw*u|jBWhmHE%xaV zr`ayFMLvcFi3i>=_pjE*AI1e#ZuwhO0O8vi-Dl|n;m`^qn6zR2K(C8=#&)QjI&5W_ zBA1wXZ=<^A9>IHW!w$GJrt$=Pe2iY4PZ)&8<mF(pOME4tQ6IJ5?x}peLKuwIRt`^%uO@jdIet%3 zzX>{`XVHT1o_ug*eeF&HY3~G70H}E+?94s@-^4oPKG`7T{4Nm?tu@!wp#xmx4?gNTXnFI8k- zDY^!}hnF*W=+Ku1k0lxEtyx}?m++AG@5ljsmaZ-~j3?i;#rSwRKbzQ&$ECKE zrp<;ZmUz3rJ3^JyNpDpVjHh(^QDAms>;^(9Br7DD0aRddYI8cE0~I`ypNWy!5A^HL1M?h37(S4sXOW82%Oa|Mo5j?p^UQ$1OZMF!sYWo~wK%I|+bYg(VSp9uo{!KP!|~ynGH8Px{el!nK|xBT8;! zVv8z8$?*u@wUi&1L$$i`<*AV`3$71zu`4Tr3$KzB%%&rYCEgDdK0grr5jZa1QKPZH z7m7l+PKOy>*k(_!sgoJ6DMBb3y%pS_V;t2xl&ynP4EUOTWrWc(+ANBIe;#lw6SKuZ68 z{H`U2XpH_u)l<68Mjx=I{GhvXKuzLHjZBhZ8LFfYU-2uSsi{*pQYJmFVA zj4(J$pWOYFC;3q_@#~YC);)S67ip)R>zR|eIXhxCx;G4OK0HsC{7k1Sr~h&U^_<8c zkvO0%xe?YWP8%oFyRJ#wTD*c;C?R(zeH`Y@ajEdC%2K24^tOC#4-qtZJ^{b}B{&~! zn*ytFrkE5!-JR>+dURlcps5qc?A=i&-5V2k;U@HPn;y5u1a3_?SDF>Q>C?r{(Nk@q zv4Kds+i2Kf)%`-U2 zaixIu2g^~4{WaDq25kwrr-kQO%??82R6vkop0{Nb#_xQ}zl};s!t$8>Y^*0L2`n;J zTrU#b%G6pQ_wI!XYu#z;vI{js^%E;$X_p$!MmVr~0RUK8%9_VYTtQlrW~H{Mz8|&n zynRMBU(K-|iXy3`C|i*?z%GDpV{a4-Q|LTkV)sl}<1@+f7qcr#KfFqs z>S`LP-G0oG!Q6Z9z(g!AT5Ds2a?EHXN?_$jobqSejaQX1rd6G3O)bdf``uYHBYKtJct z9Sv&6;LC75t;T~bUeofmlr41@S0H)l)vJ-SX%pTZfq&~g=z2E91W$1xQ#PDeTG@D* zPnqC=VZ2}zjoUzd^F?-NR_?glL~ld;ftoGxd7vbi8@n`oxH2E7MC!RO<7OOmPq1jj zi8^6Zw>P(~7M7fdC7^3165zeKfliiVr%W(-nL{_K z@J5nqV4ng0+EC%Bu}|V|TNzMr>NrzhP%_N<+22ECLyH18w8cUOFGFiZ0Kfqj;hU>@ zgk$OyjoGcY-#dFL{S*e1$)=(DhS*uBx6v~v?wHiJy!E37qA*sbBOA-^)&cKaHA^sC z<|Zw8!HHpiL(8^9=4DZ*U)N?A$0%+e)H zHVf%PLD1;mZR=4c_?Wt%B3%=mUFs;lMkUDxj0r37QZOY!Uiv6du%45Inx zBI@EL_H3EkTa@0CjRsIW^!5Q1Wr!yw;BZtxRL6OXU}t5&kx)`K##`7$C^rv7s`f1} z2C?U{p&RsUj+qE;$t(21-cRrET!A@MXHwEugBSy*^dsJ>Bxie9SzTddV}65;02?W` zOwf|Z*h2E&w9?%)OWeRbt~=}5;|+t?6F1J;4DEN}!tOn8mn$%&P?VcXnk#~L@{9vs z1x~Tb!YE5M_2c*|F&?ND6~PLulU^BcC1R~)|5SJ5!eO&QPd|fioGiu{C&_F#h%(X76!vnYO^o2o32y0qf?uk zk`V=ee88QEc1OpLW?)fAJT z0D~=`9`_foQ=1#WF$w3J9$h*f0=CS1=og~QsfpiNvhTOoG%8&l`i^B*pDFt}QsMx2 zo*Y)v-P>>ldelE)QEWVqz|-aKIB*^qdd#2fJUO!?27AG@_=QUQEwBNkI=ibZ&vvT; z{K5lhY>8NmolA1=>UZ>CV3ZYS6(XL%($g|+KDF&aXRLY2Pu~va-DT1cyU+ge?R8qI z>_@G6wxC0XWQN>Nw+FmYz6HJ?h3Bg-Dixsk3olJPJ4&ArhR!_2oX|v!eQwDF&VR-2 z-G;IQ=clv+J;R2}vbpuUcesU5C&E0g@`g86O<%VQyWtiFSWX+YQ#1$Wc?{fiD6tOz#;|OGf9U z#Lr$Gyhi%jdph@1%bFj!gTphZ<4-Ef4xer`(_+0IWzo=n#~sigdWMgu{$9=X`n_F} z)R3vNdn%op&CjD-D=k$@-OUJ#CWI@6uTun9j$8gWQ&u{Q#hSV?#Hg57Dwsu$HCRX^ z&Q&Te9M>#={==+ow5w?PVEThd_|z0$K6Tf_R^4MlO-vNPsqt~BY2bUZIky4?&!FJQ zHoD-a_GNY3XA$>O`U6AiZAhNqJqdp;^a|0<|0$IjP?A$J75?6M?Q3l7{7c4L+@g9( zV-tQ;yDnwXtai?hzi z8YL2yACl3OSDA@|CN=eo)5ys1Ia%k7)Vz|&=63FCfBHn{s#j!9FWLdBBEx`9XMq4z z1I5H9G!fEFST?zJrTrQ}2YS~lUN|c$*iws)C_M7l=)#Q5O~BR0)b07sw=({4?C^T6 zt?OF|NtRe1-UAt)@0ID5bj2sP7365H8vLnX7_3~QK|sB)z)GA_vJ=8N_O{39OsV}> zn-J$UJ{5z#t%1E{;UM zh|7!-DxM1Ouu=8=^BFb^OUG=jYm5%oY|R&rurjd4;p$9s5<*jY`JvI@=HB^&D5>9Fswpq>CfDs+N)FE!M@ zP8?}n^Hoo5>^0DS_DoKribS&T$e7mWp2$VEYvL*`>I){5mTzs%olP0+?Ai%h%$8@I7@hzFh$^ zAEUkmw$+B8T|)YA_T^NWOPpWp|q9W!g>p61kfB-c`>|)LMG~^H_gxd&va>Z^;<;79BBC%hzG8XPh!Mb@i z1WzxLexvo~>nq zT9srrq&ULUbZe1DNvx6>z<`VFbmYpWQ#tSpHGECIgIIs`LP?ZRr7$llbbPpKUa~}8 z`OWb}+eOrJsYJpbwMZS>6eO|+aGv-EV)39r3E2da>sjY}oyD);s-QiZ=Apeya*(x* z&uQB}Rx^||Z_j_1PbpHz@a4b|XRH{%VtHiv9Jm;XbT@1S@52~;AHb6gIPFo8Qzu|7 zsr}_Od&FJd)!)j2aP#Mhc2+=Hq>NElcV6AU?%dJ^Bv1hMZpG|x5kUEFl#Cg5Ny&Iu zz2dCa^GT*Wcl)1IR51CEb6CI=&iIoYRB4YGB0!|)?5-t`6-vfe>b1)sbJYr8(NxlJ z!LFljZ4`grq)$2q0ExwQZ7pX(y_ROyo~gaJ=AcFDF$#9$CtSlO%p9{S1gfMV@$wz@ z`0w7n)}#s(F7&M*x?D`@6yowIuYUT$Z3=z7?WFe3e)?9fO7?xQ{OF-o18m9C8vqmQTT zahnM7q(Inc>)d(at6|txPU%vc9!Acv_ys<`?RF%L!ziOKL8$I>#67lU03UsOojiSj zGc2lk<oacH(B>@15~PmJTB@Y2lGwmFZ!h=2piE1*H=m){pv_@ zah8Jz=~`hh+P0OKLu=WT0(A>^OFFCboBP=xE}>sh%SEUt>*b!5eliAg{kS|^1I1w2 zRw*F0I>mAL2CE(!w9f>Dh|>p9lZ>)91rxdhcqV|WtZzY95j`eHKWdMe!1grCoyTXlRMGA^)( z3eAM*To6t3p-j7Va7*7`$ws022~IdLDIMF0NLCmwh@EXvUsXr-1XUK z3xgB;kbj4VRW*OT!wu!>FiS~AdHrnKdv)pl+7z9K0WUvmz$um2E|b#|w2geZ!VUe_ z)BKyywF*;rPR$ z7a&`-y%lZ4pu+^f6@jti0gUa+0;Dd5Lr9JA2} zNyDF0V2-@M$i@$qhmQgZG)4h{{g6YW1?flNHmeOe7>EnuJUm+6*W!V^5QuY$NTHKt z0PY1Uqe1m(C`rjFa1#v^-}SRY)CzXfcN6;|j52yQpXGjaJ3gpIpL%BajSjf<9!KaF z9kdGISD^8VXZhQ{(lIel-dz%-)iHWTustT=@Ao2N<Kza(KOGFY~8pNDHQnjO9V}HgQdR= zoLb(w<*I1D{qxYsLCeFW+& z*}z;N3-DCO^x!A$MceHdME9^zH=|kgTE!#$McMla3SSc_v4B#85;FmtvDn34_sYfO~aSq z@~sA{>mNTl>Tr>%;ZsRq^Yk%O4Gz1}=F zfQmq2jdm>2Zoq%>G&u@UWb85;>5bETDG#li$Fm21mCsE%u>HbT=!q;I;E;X6pfWIX zF*g$+gNnxKEh6sK6or|!O!J|}%N~ci0H*D8sM+Ry+H4n!j9y1wxE}N@CYnare{%s> zU>po2@iB5x9rc>oLZBg@1IIsYy_e)*L9ZrX_}LaqOT9Gi7Q^Vk^9b144(K0%n8&oV zN=WCwGMYqJlGEI@WaUqOH%{>cFp>Xpw!3<9=6B$K8asO;I&)Nn5kyZym4lr@0(eRo zC4KruD}09s0*yEI%}|}EiNV9mi+h$W!|)8|C}y8c^>{~*+7qTs%Dd_{<3U86JG?7c z9rnQ=SEOFE77zEdD0McVF2wW%SDA*$DVqXm?JDNsS5kaP04^${jA|iRJ4Kz= z*>2`SSxjQ>hd^Bqy{~CCj3mv8MFDv968(2H$wt4e*B!Niqe}-`T-*=ly;ZS+g@q(w z%66ghh2!JRs2Rc@tx|EI9_}t;y>35K(sJ*|(Ga|_WbleX!efs(fJe{ps)aSb5h1oG z_Q!*}Cjr~K7`&K(RQvI`o)ta-U1wy^zgPU~{X8*R54Oay*Ta<2sMz=a7zCBY!9pS?JwAjJX+N4mHVc! z%uvi}8&Ekf&vV*WWzX%v+6>Kgu?uZ()WMG=uynVQ+7-nda3X#1+vTZB=+4GPxB5if z#NmH(c;AAt%cCDcL}|)=&xR4nfDUlbE;dmRai0RcW2ZRnXu{?bp`>xld)KxDIWnW$ z_s_owMNBe~y&weEdHk+|CFugaWi~(N!BtPE24J6?u)sBysZ$76RV*qo;%WB}H4kc# zL9SBogKO)%%GypX4pObcA)-b0-X=oVGxV-t%9o5280y(hESpFqvgWAMmiuvBM;1$Z zc`$z2ODE-W-h=ZtB`4P5lUT1sW%+YmWD4#HPJL{F1b@b-#+`VZC=y6{<5ycUo_?HB zLJ5S1^{~&yuD~B=1J=N~mByF{A-c&RSNT4?5(0?5M63x)lJlk2D^y6o6EQv4a`0`Hd1h++6rDay3 z2c70J(q%ujd45`R#(mhb8J5Y}lbjkB2w_RZDRN87|9?&XeRru+wA z2J)>tmGetmb~n`;afJKczx=i8*>>s)%adF#I=o!C%AGCyWe^XTm@8HXBlm*4U&=GO zAiQX@vyw1BtNygWr!y-q=6D#jqGpQ!hT6hqt6Ov)uGaT(0ozqMx2xkU9fxLA5OKXP zrki4acCml^KU8ynSWlFQlLnx-w?%3j1#ntnN#6xnq7Pd9#9m<%PB^z+$iGC-<7(01 zCcbsCp^$4ML%Nqem-wZeM(lB9aNoicpR(0Pt6?%@ya|r+@?h6|mxWx}KH0+jRB`j22UD&Mx*y|EN~k3DRF(U4J?~*1nEfhupbg{NUFK+=7YtzeL8U}} z7Td!S2Sfwyy>!$fd>m;JJ*_9@4<3!E;uC5Ge@hx@Eq&>&V(QGU0Z-KSg2h~S1+dfL zpt$M|NBDaFl&6t^;^&)K+SPVqJ@uZFADQ|uCApFi{+2~ zo|$Lldp;XQl2l5+1BTojyq}4*W*J$96(?ujk9XXEtk7Y(Pab`H=UiVy5WHU`I2Xmz zTytwOJJY-3ovIB?AL@HGuoS@d#~+5Nqw0joP9;71ML>j(J5KrNzR0iy0MIX953eJP zBOVI7Yn*&|yNZ(enNArYB?HH*UQJEXmCq$E)!x==aZyf-=_wSr@~7*(_noeN23RIG z(tM=|E?i$7!GSu8J;s$RS`S)Z4l#!7xuJmHzw6KB_X=*k4Xzs_RR~=~k<{(Lf<|Uf z+8OA?f7HiXSj&A`Dt@N)t~&FW;{1$HQ5>ruByBJ=v`;1Ymm4-hoqElpk*G!cqD%YH z$m+NaUJKA3nZ<1WJ+In;;URveiyfa~5I&Y4-|#WHn{t_c(UDCv7*EU}cVtnwcHvg5 zi~(C}B@M!*&>kbRlj-mWmgFO7%XT$KgwSk&SCGSjk|L*#D8_H8YREjrNl=hsWYU&< zMQZUP1uJm#ZUn(lh_}RpRphzzyRqe>hX=G191*<6p1%q@^moNii~lT?`?Jum(GTB5 ztWo*gEPwmh(Bi7db5S)N766GoxRzoOiWY?uX+K6{U zs!%7VtF7WKiJ>vu=izAWT_1IZ);hvU>TrG3il}a*6_z~mNDcF{>;(=w+@rw6?MqF= zh9sdsaQ&cb0!M00==mn=8?qU{ozy>>p|4iJrVbL}PuUl=jOs~*H5XDNTpIJx zd%w6@H@uuT!pv--*6TJ9O!tfQI=?;;H6lKx_TVeS+r=2p;?pHR}7chPHfRz z@nV-b?my<8vpUiQe=d!dZm$v5!WYO*GDIg#{Ka=UjxR)|swaOAYcuAd>*GfQ7_N;8 zL#S0Fm-goQ_5ffq&~GQ7{B2#6gF2Jpn|@~LfOM_J%Al(F6NcofW8!|!CGQq|gXS#L zGj4+q`~084xApY!$_982-j1rtsUH&57?%2PKR%lAGYZ50W9#liPVdND5qA|!4N4EA z*5Bcp8Bnr^q1LC7*_cJK=#NtngQ#k8v8+hTLh`7v{6h3Jo2r%2%Ji3F^yO_QsVvF` zzp&RF%T;|F^z1!eypYQOh53GR-EzQc`>mRdKdHr?0OL&qL}k#$R<;18Y@7@U(_S~H()h|-rI+bXfX&;DAu^5Hij;A&%3aR)=S-;)-kyZ24s}*S+$Ki$gG2an=z!ser1WaZ!F!~X83ks7w z`+m2Fpd6!oo<_fJS34t*fMfb&%mf41*QiOB0V+w%(eE?}T7g?N6a+on>Wh!E;CFe~ zlYYvb6Wj@W^G&>+nQbs8;{9Vm_Dq`voL{%-Z*?-;@I4dwiGGXLCamW2gd}H>hFtjH zu?gdZexF9My10d<{Kj)2kdGaWpM*}2#Xg{zYkSKFwGVw=hICY?Ej6j-;qMoGZ{G6_ z9a==H-lW=HZBa=4DTE>S;#`^ROmA^{}Bh^{}OadDzh1h^H;>sizI~si!sNiH98- zD5R%ewnXP%wm3*HTMSVCchLNUsmovZLqPtwLH;x#e^HRX6v+Px$p1OWUk7Awej}c? zrXYWPkiRC#{xK-BApeITeOv< zsR?h+vy)>lO7qe#>nlEAHrEzk_H@+2d%GIo13fM9p>OT*;r=i1??Yd2WOT3_KHS#< zAM9F=4Ho) zgxX_+g8nbj;s3)P5@e6^du)UJAA$T$K>l$c{{oQzG{}Dq8}|6yJ8Pj@@#z7A-hFrN82J^{u5>{D#VS@x&ti}uFj%fWB3 ztL4Qr#PQL^_2tDS5`KvQq}eIM2dd+qKE^RP8SdRh~L^80@T{crnk z^Z*k4r%j+hPCadLLBC9P9v9Agp8QS(9M49VCAof=B{{hl4VBXuEp@x_(E%iUW(tYe z-a=kqoP#()rhm@{>Jg}8pxszSUM@U_Q9%CpK>oTQ|N8Tk_v4oxEy$~>G352}(VwyT_vHNF zxHe*I19`PLhrFyPyu8Rso(K7tgZvFZ{(}FqF#jJP{P%bV1?9xumIoH(C3}{Z5PVTv zmIjWmhO6<>rK{LpMm_{K>o{@t@Q_2vp~KLH;bL4rDP4f1aX`NxCoML{9`mjU}X9`w}94hIy0v$*irXGt;LV4S{j zwJ>)8j-@NmpM!B67=Qh}efr-=1OD7MXsdq5C5WSg^Q)D`lgrN5t@F&phSLzwv{OG9 z>Qf(QqQB8a|8!r2u`voLXlJ2bw7+A!i|kM47bUs*7Zn97U`z%7?MMIF+BG-_LG0}y z;iH4di@LJO^PEp#&eIZ<&y(JXfcYpgFduabw12gjTp+K0PQb6e4{cty)i+(_rG}k_`M!h)c@QI^uK$$z zB#=EmC<5o7VpGpEK5l?>cEs3%Y&SH zJ7}MOjP}25te(4?nc71f?89&JYu8{-?q9k6&O3s(0I|D$akaJ#yU0!&0PSNA=o9XP za_1ja4?v_h^;cMsI{_@njr=?@+W(>`I|ts|aRuhx!8F}}k*E7h&h;AXlNI&wYJ^-UvjyP3o0wp73<2+K?f-2vPb2)r zVV<@u|0p^D@<%%j^?d|N5m-xKyjooXb0Pn=pZ~4%@ShXNi-syBEXV^1dlPWeM~Hne z*ZWV>uI8qZzw6MjFkd8?*Syh%zm?Ylvb*7r*x9@p2Y=$3T zotrl1`q-y)wxzyH*4eQIJCi$e{gjPDNJ&0;Ae-3N{6c(0|Gx3z{VqW-dNTExvq@zA zUPYa2=zHnuLW=e`$wK2Z$7f@s1{C04fdAM*X5M5ZCwV6n!T-?*f&Yf0zQ&mM_Qq8? znm{~4NRiH)eIo;2T@LL3m3qwB6vPHzdlvN~d)LrxqT0PVOU8$`cTT*uqt6q8TDJ>|Fxq@3t)430`=?mnkC&6 z%{M;@-`)}?&rSXLnQY?j+p_VgqYHGN7v|po1%Kp&;D7+yA#7ldt{`y8S6zIG79MLf1?^^nH%eM6C5KX5is)BBQ+0z{|92@`hCJ) zz4)!>W_`YL!pa?-dpvfnM%sQy=SsRQ*$fxj+3VbI0#X(NA^xP5mVxfViA zU(vb;f2H7i6MJ`M)hF@xUOXT6e{5)dmiJ~;&mHu=^f*0bEbI*{vevvQ74^TR-!<9T zm_b>|LPalW9Q{RfV&;w49B1v4N3b;=5pU@FdFm0fIgd{sK0ZEU?0(^>KsudyD?U%W zO>87QUI?uhGzYW~+MCuIp4s2;HC6Rn`$TNQ zuxw(_&YZqPxa2r3!qXY_7)Guw9GHh~B}c6TtsNsLgnlk6&;gPQq#iu*lD%}!z1Wid zgZ$yza}EIePg8%5@5=+yV+0k^CnCJ z>6-LBvTri@uL>OK9S>*MHe*K|)-P<$Q`nN(_WbEr0RQva1OC}jy*p4(Ppn+{$HeL- zZ)9G6F;qBXZ$h5GV0!g%_pOcijB)INo3fH89k0c?<)*B)a7Nq40=g+ab}+QS(^=8e zMTLDpc*b5fcQ=yxQ`3hb8;*Ok3TdeLDGS$qwRKS7Z0IHxDt^*XS>lu8EKXbSd-r=;dg`WUtd z52Oy<`4=OX_0oLMXW~-@C#~1AeW|kVT0hp(xkhIsp5mA;qJ5x?G#2rR!?MW5qZtp; z4$#r|vUxe3VZ2!6B6}Hl=2(36z?szlhz9y~_$2f^Beh`Kg^6u9IH^Y-C|>xYL-BL5 zuV0?y^{Rw#+4)k>+z0>3jzoIlW4f>oh$E4;*Dj3)?!K|K;0c}0>&-sv9|vPQ)^aGp zzIi9LPgL-aH}?F4HEG0H(H=oE+4M{Bdf2qY#}BEB&o2viPv7yaH+zfhsE+A^&Qfw- zYu?m$fxnTVp(~Idv~=kHB3m15%u>kO*WzdRZEDT7wRD;@y$CmEjahBeLD?H6x2d{A>Dao7HA%YYuVt1|g+#c z**NxLk}HMUjTa5XQMw@67rGn8DllucMxMXi7{%vLGcwYkUTQB!CiI*&vj5H0nsvnJ zmp?-N2llfA=$!-iePhdUI%3IC0ypxq9b5Be$vPo5IjC@hP65b*j^vTB#IV%@D z3*P=wymz;n_5f^7|Bm{5WO+{n+Tug&5QC+1y_RP`ucpt~z?PJMdAsiaKLf9te)VNz zVJlSN*XX8i4uIfqIg?c=mtWOXoh4 zdHvO*y^ARH?A)w=IXb}TtuRkVq0w4pb#yY>%j#plMh zoo`F$FWx1rk8Qd>pu4dbk`1w69wfc2;6qHRHL=0h4XYCVCj$SEByQe3m_0KSB!5pm zP3$Ya+otxHnFrD#B-n@BBJ;_-{WgANuO4yuyAwq^Ozk)AGESl`g#)lFH1gO0Jt_F% zd27Zvvhh@2@H;()dKonAY!iPczz!eXZ)tnBGO#T<9@vLTZf0*-iOlEEIUTS&pj93- zhp>}D2Upel$41S_+xInB`L*KPrJpCxLHog<{YtW?6h4zd_Okd596|^27h)%#MXg9D z5btx<8Psmc+jg%{OZUcJ?=PaqqtNjM&I8H1!Tr*E8vCb!dF^jc*mfoQ3 zwZkv8wP2%@mEUV%KijfKJkMH-W*U3BAUtW}%`|U|0sBu=&#eRtSQAH_OI^R8p#HD|_;+w_Tzi3Y!|ImQBlr6R3%KpEm&%qsK52Nn^hN%W(wpV%3X4Tf{{EFa zH+GWn$JN0fehvCVI=n~<@E0B6Y`vj<#!P%GawfwkdvP_5H!@SlNx}oHrFJU^f2X1Q znb`PTMBg2Jd5SiE>3X0kutyoxE`1T-t-Zz2vp$(aEwB)uD*mOa{a2)R6N_g5NOXhZaQKUn zYhjx!xlEhd9MXT`G5f}K{?FEYF1sP=jH-q|Ybw#at>*6rJt$lFnAXiebR{AEZ_9P* zodflw$z;Y^JnMDpjB@bDhWLBLTD~&=DLMkbWYK;(A5PY5gzMkP`mys9zv7o=w`DF!_L3s@LQU{z%^3d! z?>MxnG18gEv$6?R+=r;=Kzz<5^X{T1vYwRt2HdcN_%T1Eo)ZfH$s;GDZ{Jb$4#q$} z+1j6@guDAL`Grdl8?~Lc^8ARFtqK0np`ssxGO;N}CCk7QZAMjl@>{qg9 z)wr2_6Ga13`vuWZ^6jjOC#e9}nz&NPn2L(lF8=h`h22B`yWZ4Khr)m9>~+qj)x|+P z1b@cTAy${WW+OX7YuW43^{`f>9&6)&ybu55THwEWvB?*veJ{#l<|MWSRmr3(f&ZZ1 z(B{L7n=1H2cO)Nu;67mANWCx={;L*lg@$;(=q0i%WZt4rju!sXwaKrc4Z8NCwt6lk z?z+v``P71IC5MvCMlz%*i;+o4CmppMNOlXzWrB)q#PAb*7`^To>feRJf6d~XiBnXZ zfC1W-7$3%NDzbI2IgRaz=4=u;wMWssA}3c(d#!A^B?Au9tF@)Au1+E*yD9NK6|C)w z?g7V%jt-)qB~JzKJWAZKiPSHK!hhZJW_&J-oh+~^6>n~@S{Pk>>9>h_vt*9;rnU@e z=(DmNBu-9k@RzRzwyjaqq;6wl_%|xnMMbc!aE{2|TD)73y;SO{#~w!qG>iI`F!+;$ zWgq!ceL`efEck0JVIvu7d+EQ8KTD~&VeWXJ+R5k4g6E0P7$5C;Vmpz+H&8wR{sR0DV%M;W8k&y~ z`u;X><`ILxY$6mJSNut&MK}<;-N@Q%Twk(75sr?$ZTXIB-rFl9-cJR8WK2QuPe1wC zGx0&aS5hwuUH=d;$KT{)4$w8VWj?6?vR!La>;-H9 zL{CX3?YDn#OWWLMB})&3zWIJ)HUo7fVf&YuvuUWb2~A^nj~IX-=y=L`9N1%Kqt>|=KW z`(D&g{SUI(3B(cGUi1>Z108~cOhI(u;7iC!Qt#dZXjuaWte(XQw zBP-fCWFA(0o%cxo5p_{s8Ts)?Wv3#&s$|H@;T$EM5;^>dF)MjjQPFx(4w?P8-i%+@ z_o<g?Lu_V&5`6P_Zr zk!UD02O?^4)bN+Aix_~#twVP&KU(&%&C0(^4b3@E9_k<4vnO{qc6j8Y^cNG?Vlpv( zqp)Gt{xA9uyb_s>4RhVObw^gR)i%#h7ycY$!}{jW~my7MWQ~qz7*y}-ZZ`slb7e*D=MD%Lr&|AeZOp1F^ z*%jcg*x~Xch-zH*9?8|T_eH6vkpH~&i&3>xv2v3S-dj9Q@b2(*NoW14CD}fGPNSX} z27jk_=L-^xXZ;{~;7;P-6z6MA=WW0ge+E>tNaq9D$0iftsTiYs;vfQl2!XlGLeB7euX+M4DRlA;Q#)_iuqq9C%p|^ij;_w ztH>rsa{E@})5D) zk;o@Z{2gRJL2Jm^g4lL4-qdqB^{P^EcYm{Hjr%b5mgIpup7eLo@CDF?#-;|kxXoiN znBz6;}0M{DBHbEvC`|8Sq7%e}Y``bzXVxu?Lh#km{( zZL9QLb|s3-XKXFK-}Ch+=v2DSH2Ee?taWU5D*a|H_bCp)g)hJM!Jxc6LG3GCW9+in zVTy(@a?}W5uRh3rQha}qor2=$kXzg0zF$(mSqkp%Z?Qg|-$%WY_-AX4|3iRo&g3<~ z*Pxa$40$Sc92M;8m-BVS@B9jtG@fksej|bxYW@izcBTCN->aIm!F$d(s zDmznSb6L(Nfc2z3UwzaV)Rb$c78n43(JZpx3A45G&sx(?e5Z}?mvRD#W~=4f-e*LU zAVV{LDvFU8uy+!}ucYn(^T+@+yPICLE#^kNr(}8~A@~grhpv`^o z_J{u!cQ203hGGvWmq^KiTto6G<;aRk)>~>^o53<1C!ak~>3|)&HPqF4?dz`#qahh*8aaq;x zxa&h1;h0u6XY^g^Fpy!}@GtT+G;IX#vORKkZ8v_Nq8Y1tZ-rwi8LY_>`S>G#jAL-8 z_$g=A;)(IzU4HL}Z6)XAdHbw#z2P_VSYTWc=0pP7jlF_c_Z7DJ-TUx)iejw9H-r1q z*v$sf%jttpWx)OE#HvNV0GEgA`%29NyKmC*u7r&#pzeNQ)KrlfM^bENGH&R1weZ%1HUI+Fas3%yH zhWE9x3zK}k$Uk2=fc$)l)hik&ioU)3juLwWv602=m^ev)4)B?ho%Vfq;kUYdTfDKy z rYK3q7LJI4BV{|&xyLkzFuk1xjr6mP4XHWnwUl=HnR@_ z7<{~ITME8uCGlRrOsxs`d*_67#>sgzKk00~-bx110m3=#IpV|HE4JCYb0IeuluyFM zr9zhIFM>h((A!RY)WBwH4=)Vc@;~tJl$bgBJmT2j1ON4`*#jiYc8lQ8d14>_p%MEB zy$km|4iK;D^83iV6hpvY(yyZHIrwx-d_=$T)StHn=Kg2lHBX}sB_`q)vkwHw8cnP< zWFYVE0Recst#qyA?O0e#hZGSwehMH=0W%2JMwYr74ZD`CIjS-ngg=MFuu3MPm=%iyYrxJ^FTgAieVa7 z$p4jqHj5?ZP5BYBo(~4WEvjq4{%q_8;c zf&Y+A+|+xBQPc$NKSO=57e?**f42Ur(^8}Qe;E7qSCY5gS}csnH#isT@Re)}{xiy{ zam2>(IG$(H>nb*w;!cG5MvLA{J$JALzmyHs|7=fK2fZ8kcd!TcI5FPX^HOKy%HfII zZ%t!=SZow8K2`J}w&{v{Z1SzjcH%gOPkXjq>s~T6t((A@GmNF=e8gyel^D`@Cj0d{ zhuUTtZxD>jT_cXj3DnOM6Y`JjL65+jzFm}mCXWXs8cyZHPoN491NrQJ=X7<&rmyKFML2gjbTOf zispfd$*1`DQQ5)018|ArAQ`)It@{9bYXf`XQS>j)s)aFY^6;OvG<5!K6!2^7JAnQB zsb3%u={WohZ#MGb06B$tMez$}FTj^lKGjjjKW$Ik+#c_i{iJ+VWk+TFw?bke$<8D7 z@crpz^R|8DXBuyfAN)DsAL_^5R+!fEJpM($rH(=ekrDqNR*amO`C%=X#vB;h8V|k$ z)^auTM0Px~ZBF3?@y8M zDv)>0(}apABRg3ezuNd{Y~uf?z+Ut(`W(f6l59uop;Y_>e8tk}-JZ2Z^y_SmX!sVe z??mlTE1cTA^h8vn?hAm8!$%iL|h<0SH&YVaU_f$ub5qSmx=g(a6_7Sdr50_(^c{Mu9vnIE=THl z`cMb_&jJ2FbT+J<1aG*Ld7czq7*^y@EB_A3yp+dI@dYIRKJMp19@op~5BfOgC!%<= zVZKe0o5SPbFO+26?{k*Vn{AC6_zmFy@goJlD8CbHy7u3wgRxB@oKu}s1KwVFM9f|f4`gKH{*LF*rOQXRp2ly(vgb{mlBe}fjuIwE@?F6G zbm|A~8Dp<@RxO&IXeO`pU!F}%h80+(ON0j!J}^1U4&0ra3lYTeJ!11fK0)xdTJQ4B zQa_BI%ns0#xp0RsR@^%0`lT;mx8Lkc9`zGv!q5wW|Eb3^tyk$>f^NCYo<63#bHmz4 z@l}2mzj7Sm69kp?*b(|Bgm5Ie>y4ee;^d1qkh~z)*z<_{dzPF#qU&Uzh1_1gh_cmC zd<60IqVELz(301a!Y^C+YrSpHowOUh>TIXs>Q7UTDgM4vScl!`^zC{o^+Id<*h$vx ziBAICq;g7DRNxg9%OF9F2>CmUZi(f@Q|IFr--p3o*Ma>>)DI%JzQUS4p&tIX8Q=Yf(#VU5HCGZB2v5k~ z-NdtyUoHN>@_$iGF6qgoH;Ku=wms*B_)_8?Dqo$6wK{WrE)D=T4zkN6zB0J}shsRS zKxgZMU%A*6HvoB_P5=Lr*nZ;;_TrfXfd8+7|LMR#G(UH#@jYIC! zy%gC-3OP{5$h{>Ss-Q@AAi0A4>JzLvd+jn}X^p~8GMcz_fp|qem&hn&+bVxw#TZp? z2>HQRQ!rT^MI0Lxfk7j07B-L5?IJW%=Gq2c=wvniq;E;t&^8{&LnL;;ji+ux1@D%iJJoVHQZ-MJyV!v7oPc$~&(B&-b zC?d7fJ`yl%&u@^M_LBJE>wa%d9sPi_dEHC08DK7y#|JL(kCh`jT+#jH4#_08-H?JW zSdBcZ$?4nebJR21a}1B?cPlqF@c%aOZ@|W7T4MLkjl}qQ44m*n`p?f~uzAavcn2l; z#-lO?SnG;oEEy;9G7`kId=0zYhoEh4NZhbyG4TIA@c%KeKbQKBr0=7icP;guFQEP) zHo9qPe9GuOT1Utc(~6rOb)N7x%^AU-`6xelWPBNHGFym``2g{GX2tto^CP=&c)pFO z$LyW-K45<`^-SRZd1(8KlIxcLEU|WJcW3p|>4_WH-JRHa!$J1;OzOb{nY3s|#U}`{ zooN$%Jr9cp(08P-0w-mNk!L4vzVUf*)m_e-B~zW%3kN#O=6v6tGx0mX|3ct@7Vtmi zodlPo(U)vfua49Y+V$POLp-C-_T*6;?AepSHjQgyS1J=bGuSHLH z)lagMyLF<5##lcZTepy@3B8fd3W1{tMJk0DJIK(=ls{bF9O#z1xQ@^}W>7pt(P5_wD*c z{Gz{U_33hn-Mh>8HzrK>tgYn$3m zt$X*i?~cIH9{~@0EIfgt>s zZ9d!qnx8E?_dty17UN^j?-%R$!uFBhf&Ax(FbrN+rwO`_f)qf!7&*jAC{cfzG z+h?qXuGkHAJFfUtyZ_Z4tO3`2#F{YVr}nxP{m4(dh*;xyr|!G^4PqLl*BO5(RYiOs@M>3d-)nQz#y zwInvKUP;`hZ!;I#&Bl~(*2RYP`G~V_`6%Y!OReIAp+C*Vj|~kUS!i-w|B)`ZRjgF- zO!}1<P0@7n<`lFf$68HzuYiC>MM zQ+pT1Lzb;)Y)~)7#?9$}-H$R4S(nd|8|iXnz>&-Y{5#LYk9lURT-NkcIca0c`Ih%b zkY7lYd!E}R|50NepD`}?U1D#USaQ%&1$#nuotyqo&-b72n|xXLWa+v)23iZ)Xn_w#eh2%4n)Zbj z?De5Nf0cUl!Gp$TKK55w3(3|eZ-Z8hwvEDW3!}38WN3Y2%>NcRAj>!k^364LjwSZlC z0an@LcfXy&SH^T?0&{=|)IM{5k-ZV1oEiPPVrTpgZyU-%z?A#4N-bI^S* z%A?jEd}4TvC45q4TU#jXQ_!Zb+EYe<$qU<3|0jm^>5y19_a~|Q?=5U*qQ5QT{ucTg z)PJtY7T@qYg$6|U5Ac+)t#V10YKLO)7@uV3tBP#&MJwZPSrNaGoH*=sc=THf^bPNk zok^*07JkE*$l!qzKB2XZ2z%|b&*b9nhK#+p4az4W{@N|@O*T1$epw3c?r-+kK|f~Q z6c`!t<%(}mcz?O?d3uB#su}R(c6i1!-F^lgv!i;S zDB0Qq~)A(5t9|_rzxgT2|GtP<|6IRT=k55m< z^N>AJ{`oE}q2E&QE(_zmy9N4YaQy`6ys7MWIVMK1zxhUdfGdx0E8JAd_toI<8&>D= zw{iu$m3R`06DZkOXo2=nY$1~qx5Bw7e<+jFTrU+}c>g^IVgtMXy$f&e5qa!Ku%*LD zF4uj@=;Sw5@p#h*#rbf@JE$M>s|s7kG4jr*i4jq%5F;^bxwLO3V}Sp**$=@VD)@26 z>_s!LMMhb~8xV)-U$HknXlO{*i`i@N`>wSA!jbY*D^--sS-fK4JHea6@g<9%-_D$@ zB9@N5c8QTC>b>I8;nU_o54Fk}&QEpNw+~>h#B`t5sk3uS<@iSX9`=};-z5ukSh;@# z```Z>;PZ6J$MvIPi&Ya}&aBBiKGyidAMTAc_V|K#?mP9}-Ut6SpZFApXb=q}-@?Fl z2FyG84lAxNBUiHhW?Z$O1iVA*TK4B<3w@BUTgAD?@o$y?vRhL3-tjvAsXy@cA71&B ztdlJ+%_E!<#N!0Eo4zQ{7xvTcCqj?%k47gD+<)ef_=`%4Y<*3B=%8^7xJG=E!fVNG znn|o*@!QP6?gboR4e9-DuHWPGkMjAb7|*g6wNJRu7Csd4kMte#Q4AZ$q)(<3@CtKD z>nuKXROoyB??R5Ta5+#tM;=>i||mXyxEdrWaWEZK~X0sM-l~oIo%jv~-*e_S z`qwScy63t$&_VB-dgh6o@KSVN*dFcsmSj(gT~cX5|7qgM6tyq^UW+)|W%p3e$KrD) zR|Y3?4;Y{J{IkyH^?Ovkg}F7)4Cv-EeZ=RdTMudhMpid$s-R(!u+=EgKk&X65U**on+My#%A?x}8wa!g zD~SokoC>9Ted|km3bbgUy`}z1?A=vS|BY@c|03ekW}NF+{5sv|x`JNB>D~D>^p|r@ zye955bn3FXW#6sXXeJJ9sYdF3#5u2I?wfH&CStE&S)LBmm@b`DwvD2Z&|ei=n7sFn zSBX>heRuA=M|=6)2KXKm)Xm_CTeg;;ukdV&QB;opGr5v{a1NVOx^83%$T~`u^h?j@ zV&;{3ujq5-9Z^xgkRja~8_@mpZol1Qd_=?L$e*4zI6yd%^{V+@s-5~xa3z*C@G6Lm zTQys}q|q6bX=khNAPW!;=B~$9FH}E>F^;^VJbd`3)}8yF^lPt5elm-_?<}|9?$N35 z`l00Qy9p|jBZFj;-Um$s=y?lP#ALf1C{*z;_19E{0&|kTLmcY}3k8ins_8+ajoxcI@%{{;~it|_vpIvsG{C#ZCbJmbzZ@V^W#L`MSs~67$&Y`+c zVtAcsuUfFl*w<*##0wH*sfBkPQ+=yo++-tBkjH}0fa~+|A-#X*hq?dU8r5_u`mzEt z)BK4~8h%{$U;DDz^YeB}%>6WYXfwIw%El;4j2nI`{P6ZdE^_S!$YqWj_=7hjlkwU@ zV8dZy7j=an)uMefQRJJ!ZPeRrT)U3@Rx&7S#|y~4wOR4C$cc5Qpqo;c(m$)y!ZydLr&on$YXwTwB1Q%2tY6Zu0 zB{XuBI8!le!SmwL3hSK#(A-Sy+Ww3+sF!j{75Mv7bG*{u;787chL{Wve4~I5^i6n6 z=`CVo!3nZwh_avlcZnxZZZ-G}uTGOzXur>Z>mRX()L&9*pQ^o&_@3vYdu>cT^5ApG za}O(f(QBhWGJIJ%`?Q+J2f2`Jtz`ou`Ang}r(qZ25QDVYo;3U)qlUYGjF6k1=`5c8 zJNUbYl+&cp4$XyF%xZ}v0UxQpMF zjMLzD|2M#SiS3*IVlSB9H9ol4hlz*MCOq%&W4Uw1d$xx6KMR?`AJBh4fxHBx_*AR; zAlxKALO4R}Rk8uue^}_FwT5L+Yt5aCt;HO}=R4@>i4|?~hiNVuc}jjyGb76wD1I=p z0b|zusn;ha4gWMTmMf-f%k`<&--&PfA#41Q25|3Psh3~;tD!^adsIbZDBla@AkUIl zZ*{z>*QLb1IjZ?#gT@MffltIH47)aY%T4Qv-S;Pa!>o+*L$OY)D!^Rv7_n7IBVT@% zd9xS0tx3o&FC*^aF_$CJI~MpGbVxK@^EcMWfj@9oF1VIGX$H89oCtUP1$~vtm!!Oq z!ev_5vTKxGn{+P7%`)(vf5l(+0r>apv6UN!kKcdA`(OP9Vh zCm(6w#`YXf;pjxat|wZ3yS|rLRi|KgbvkjXP9sj0;@x#hG;}}VNcWd@*_;bt;Kmjp z48r+Zt<80H<_AVZ0TfJZf{XKUYR=C`M<7rGx0xH=W0TH#KnLQ&>l&s zCoawhU2x;KxW_XNn#b$hW2ffaxqIxGKkwL-yY4@B$X{=-W8wR5JAB7Z2kT66k7wlj z=^ovFy2rw}H!n@f*TDSUAVe% z&K}g|3wh0#ssBYS#EJM6C+%G9!3`a)`fg_u1LC99PvKL10Wlyx?DXw&`mq)R!o)Nf z-0L)WzzgsR`-QV&!L-EAE!)89cOY-N9~$ss=(LBD58ih#I;4H%f>?*#Wf1irtQlj^ zB{p3r0Z>nxeoIk|7w2KdDme6-kHMW(eT)wpoDX#XWXF8aVUIWnFl zCiC?8n8qI=LoDdbi@z4#75o-ESQCeT6y0iXd^{gTo`KM%M&DBP1^qL7>|YZ%Z{CSN z*gwYy_dY$k)*gNnbGR-u;F=TR!!AcBdKdci=!if;2l^NL=R@q9i{lO5KA9TQ|M15n z_%A-F_c`cYr$Bc>e6{9j4o{8<{&Q^ToI4LX3#b1FGPa8RvPyN&%=3vuKb~mbwgwyS z+?dmT>2O6yMpYzVG4^>{KZ3cSpzu}AeF=P@u85c8QjBcKMEAp9=jI^Lji~tBZ zyQHg)51{-&T|a#Ev@vJx(gDcnDux68y>%@OUC)3%U+UWMk(U`+!_|?dy*d(^x6K# zRd6n!3CW#HeaGk?@l8@Oc0aQx{zi^KB zaihZvo0GbZ92R+ud0){V;S;}&B=`&2P0_990(z;O?@wvnvGiFg@up%1C?04SwGlzwXLklp|e00Yr=qS58*Ov_%{`KVC zNd;cPS-WJQ*{`*p zCb9UYI5)|#7Vt3lmAk%F`=x6NojZC5^hO~Lji>M0$IZT|4+RwYILC%JgnwH&K=z~* za&X$L*&n;@Puy~oapW`KE(J%;W7$G5USY-flLy#%3n!J5SId@Ec7>s1r#UFUa|-t+ zX#cMZ?ccN0AP3Qz@lw9*&^>`T-_sd0j>?(s8GHS&_qsmZp4(gfD|-R|bKY~sax!C= zOeV1({$rv2yLax@i^{cMbfGu?M5~YIPn4I%`_01t==96kQ#v9{Rpkutr`&F7;h}1>EUxj`pznZ(s*y=8){;%khqy=eozl6TlC%RU7$c$#eQ3{yYxv zDBsYM^dk3)zZYF7m}3KWv*J3mYCI>{Eu4UyaJx�i)7wDA&e_eizP=d`m^Jwq}k0 zoxknwIkA9$f-KMQ0isnkPfCtsL~RWH2J77>E}7xUwMO zbmb=opB+UX1I5$RnCHhHIozZx(RCEot=n$zF+Og{=g|4Qi)USJHT9}#-2MHsntGnael{BZ<4t#7 zYCn|RM)E%c4}4b3$?QyD73UI}b`1Ho;(8hRaz6I2bUn$t_C0RTo%FBRTt?D%^#!}i zy7YuTCs<<#U7EaY_a6K;bFdIVMDrnYP;46UuafD?FH3ZVXamV@;`k+qud$cUGqjbN zCtlk#{Gp(S{_3n-F`L{9AGHSe^bcVq=T4t49q7Zk@H<_|NqHYJ;o`1esXMn63km(O z*>??-d|K78K+*>k|R>_V5g1YKM&Y-_)UF8_m8!&UFW z{w|WXMD-G5OV-f!RIA?PJp3s1%6Z6&&%!RWQ+wEuVeo~KQO=;NQAg~JF4pm&vX60W zQdY6tu>(hAzr-=64makH7uVGpbEWfrN3;yQ20Nw0$L9RGIieA5(m58+N9)+E@6!%* z^tAJ!uDj>-!{0yCfBJ34gK==jC1;-H88=>J#*qiixN@Tz=lr-!i2HHsCDekQ*84eW zLqX5kfxYca_=yX#z5E{WF|VLrj^EVZqeHxa95l*5(}phuKZ@PssnDK3$G?45>bZkY zfd3M*5f}X`8p80aFTD^$etkdu_DtyU?=rtn41QbXSMAXQPokf{lf4%EaE|zK@odFcS7ftiIEuA4s8W*yp~Ap+B(i2H@GUulY8jv z?1g_4O(2@4lx!*N^WrfimnDu=2Ai;(@uzJSL(=W1|7gvg^abplF~otsfA~H_O99ug z&xBr=JV|jR$o0TL@UHvr+GC9yQnC&4nPbmm4|+)Zk%^y+EJC!6=%H$hk=5|5&2@q=;p6WzhE% z>y}>zEs++D;itoOUdaqN8bUz(OnvM>8FEeXK0zg zt`=S79mH!Xeg`s#q++izHi?@y4)J~;9`ft(QMS?BqfaRMK6I_g7vO#j7)hU}K1pWg z*TG2#97Hoq*CIJ2aW$TZ4Y;NdPcXUv)?sRw`dIXB=8(SCihknziqYiW3ryXXnWOMx zUYu%_Y|2E^V z(vetNtiOkLOaElz-?-zXBV(ob#oi)aYLMJ8j&54G#aoQ--}^rPmp`4^-)^~Sgw~%* za)0w+gMaWJENbtx(T8(1(8eMg5cmD?|Hc*t{HtR0&Hi{$!avL%)@BM`_p;pA>+0-D zBfgSpdE3@_Nv`d0gM63e^Jmt408S~~&w4R9dBKcqEI@Z4{3hEX+VGgwuX}+el5Zk= z)(!?HXY=RwDaxa4eUyJlcz(-zDErn09`aJ;ktxX}HAf45il_~ef5=XOn9;9b&wh66 zuh-RKyVVi7`W)zwjC_+@Jou%pZ4rKwoRXS^SNOgE+wQqNZOpk^mztkB8Gq~bSW7!3 z?~&b{`i|Z4QsO(neT5fm=C})qRRHly{0_xmZ38Sc-;ACBm_q~KVvQeEGM|LoDq!`c z)YFgS*b4oPoJVuN5*?&FKH6in&JAy5+iAvfvo)kof!=VxQ|f5Xp7=57rR$At1wP|i zx6+qMZsvZc)e-tCK4F;gK{m7!3a`+-~R><2j~ll z+`z@q0vZ#=ZIOMkXf4@ChzB%wIE)##aBjiiMKNWSV#Fh10Ja^^U@2=g&3CX zCqX=!p(FEqq-c`#!KW7MdE&Btk^C-cSJx#ypt1X6O^NQ1jfRTZfAYMiVv90PF=E=B z1K-fyOLs|sX$tF2@^tOZZZUTA`F%_F6Zoq9ly6Ti*g(=gx9y@?^d03yaA`foFmQ2; z=x<^+^gy0{`1w2ysqe`b+T6=KwH8$jFOmPg`#f^|YYOdW>|DB5asu~T$~B`R{8G3E zFRS(^ZrUKZL}C0iUa~9m?hmoi1HnmmX05!fVT?H9X8ab-IvX0J4w=X~_=&tm zJgaZ%8GlLcx#jEhe zSaefwW^{L9a%BKPWN%_+AW3auXJt}lVPtu6$z?nM0072NOjJexrHnt_|Nqj(zx4lp zevbdUsIs!V|Mc;n?*IQ*C;#2l|Bi36S4aPBL!Xq3FWUcQe>gr5)&KAO|IhdTK0a31 z*xmB-^e;SCZ|486@&EssegDU|CU%z0%+gQb|BH*6A*IOw=;B}F|DSSku-D{&=>LbN zsU?oEWo38&cT&Y`S(uom7{u$($;I-RfRF3{Z$d`@u$mv&|C61X9J}E=%t+8uXVT8Au%C&?CVF_!^?HQOQoLS?C{|JYQ zztX~SPk7Os<8Zk#))9C~xcEeW9%JXGC0wcD1!k}zE@rmiD*k;ed%}RYT*C-Qimx&1 zf##mQhXcgrGe+$x9C*+b%4>}JkK@oj36az6D#@THFff9X**8o5e;ycN+r67J5zN5|RsZsaAsE4jzF=Md7KdK} a1^`CE)h|F%p|t=2002n`MNUMnLSTX)ic*~b From efedf24f39dd85e2d766af026d3a8db188379b72 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Mon, 3 Dec 2018 15:54:17 +0530 Subject: [PATCH 22/45] Add adjacency between volumeSnapshot and clonedPVC (#132) Signed-off-by: Akash Srivastava --- probe/kubernetes/persistentvolumeclaim.go | 15 +++++++++++++++ render/persistentvolume.go | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/probe/kubernetes/persistentvolumeclaim.go b/probe/kubernetes/persistentvolumeclaim.go index 000820e53c..2bd1eab449 100644 --- a/probe/kubernetes/persistentvolumeclaim.go +++ b/probe/kubernetes/persistentvolumeclaim.go @@ -11,6 +11,8 @@ import ( const ( // BetaStorageClassAnnotation is the annotation for default storage class BetaStorageClassAnnotation = "volume.beta.kubernetes.io/storage-class" + // VolumeSnapshotAnnotation is the annotation for volume snapshot + VolumeSnapshotAnnotation = "snapshot.alpha.kubernetes.io/snapshot" ) // PersistentVolumeClaim represents kubernetes PVC interface @@ -20,6 +22,7 @@ type PersistentVolumeClaim interface { GetNode(string) report.Node GetStorageClass() string GetCapacity() string + GetVolumeSnapshot() string } // persistentVolumeClaim represents kubernetes Persistent Volume Claims @@ -57,6 +60,14 @@ func (p *persistentVolumeClaim) GetCapacity() string { return "" } +func (p *persistentVolumeClaim) GetVolumeSnapshot() string { + volumeSnapshotName := p.GetAnnotations()[VolumeSnapshotAnnotation] + if volumeSnapshotName != "" { + return volumeSnapshotName + } + return "" +} + // GetNode returns Persistent Volume Claim as Node func (p *persistentVolumeClaim) GetNode(probeID string) report.Node { latests := map[string]string{ @@ -71,6 +82,10 @@ func (p *persistentVolumeClaim) GetNode(probeID string) report.Node { latests[VolumeCapacity] = p.GetCapacity() } + if p.GetVolumeSnapshot() != "" { + latests[VolumeSnapshotName] = p.GetVolumeSnapshot() + } + return p.MetaNode(report.MakePersistentVolumeClaimNodeID(p.UID())). WithLatests(latests). WithLatestActiveControls(CreateVolumeSnapshot, Describe) diff --git a/render/persistentvolume.go b/render/persistentvolume.go index d82d124107..e24b17bde0 100644 --- a/render/persistentvolume.go +++ b/render/persistentvolume.go @@ -183,6 +183,7 @@ type volumeSnapshotRenderer struct{} func (v volumeSnapshotRenderer) Render(ctx context.Context, rpt report.Report) Nodes { nodes := make(report.Nodes) for volumeSnapshotID, volumeSnapshotNode := range rpt.VolumeSnapshot.Nodes { + volumeSnapshotName, _ := volumeSnapshotNode.Latest.Lookup(kubernetes.Name) snapshotData, _ := volumeSnapshotNode.Latest.Lookup(kubernetes.SnapshotData) for volumeSnapshotDataID, volumeSnapshotDataNode := range rpt.VolumeSnapshotData.Nodes { snapshotDataName, _ := volumeSnapshotDataNode.Latest.Lookup(kubernetes.Name) @@ -192,6 +193,17 @@ func (v volumeSnapshotRenderer) Render(ctx context.Context, rpt report.Report) N } nodes[volumeSnapshotDataID] = volumeSnapshotDataNode } + + for persistentVolumeClaimID, persistentVolumeClaimNode := range rpt.PersistentVolumeClaim.Nodes { + vsName, ok := persistentVolumeClaimNode.Latest.Lookup(kubernetes.VolumeSnapshotName) + if !ok { + continue + } + if vsName == volumeSnapshotName { + volumeSnapshotNode.Adjacency = volumeSnapshotNode.Adjacency.Add(persistentVolumeClaimID) + volumeSnapshotNode.Children = volumeSnapshotNode.Children.Add(persistentVolumeClaimNode) + } + } nodes[volumeSnapshotID] = volumeSnapshotNode } return Nodes{Nodes: nodes} From b761f6ecb382c81d5a4d97d8bb9ebc4f912c0d82 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Tue, 4 Dec 2018 16:08:10 +0530 Subject: [PATCH 23/45] Read status only once Signed-off-by: Akash Srivastava --- probe/kubernetes/cstor_storage_pool.go | 7 ++++--- probe/kubernetes/cstor_volume.go | 7 ++++--- probe/kubernetes/cstor_volume_replica.go | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/probe/kubernetes/cstor_storage_pool.go b/probe/kubernetes/cstor_storage_pool.go index 486fbff3ce..fd9d3ab728 100644 --- a/probe/kubernetes/cstor_storage_pool.go +++ b/probe/kubernetes/cstor_storage_pool.go @@ -30,6 +30,7 @@ func NewCStorPool(p *mayav1alpha1.CStorPool) CStorPool { // GetNode returns updated node with CStor Volume details func (p *cStorPool) GetNode() report.Node { + status := p.GetStatus() latests := map[string]string{ NodeType: "CStor Pool", APIVersion: p.APIVersion, @@ -38,12 +39,12 @@ func (p *cStorPool) GetNode() report.Node { StoragePoolClaimName: p.GetStoragePoolClaim(), } - if p.GetStatus() != "" { - latests[CStorPoolStatus] = p.GetStatus() + if status != "" { + latests[CStorPoolStatus] = status } return p.MetaNode(report.MakeCStorPoolNodeID(p.UID())). WithLatests(latests). - WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(p.GetStatus()))) + WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(status))) } diff --git a/probe/kubernetes/cstor_volume.go b/probe/kubernetes/cstor_volume.go index ac98c6c703..05ea032767 100644 --- a/probe/kubernetes/cstor_volume.go +++ b/probe/kubernetes/cstor_volume.go @@ -29,6 +29,7 @@ func NewCStorVolume(p *mayav1alpha1.CStorVolume) CStorVolume { // GetNode returns updated node with CStor Volume details func (p *cStorVolume) GetNode() report.Node { + status := p.GetStatus() latests := map[string]string{ NodeType: "CStor Volume", APIVersion: p.APIVersion, @@ -38,12 +39,12 @@ func (p *cStorVolume) GetNode() report.Node { latests[VolumeName] = p.GetPersistentVolumeName() } - if p.GetStatus() != "" { - latests[CStorVolumeStatus] = p.GetStatus() + if status != "" { + latests[CStorVolumeStatus] = status } return p.MetaNode(report.MakeCStorVolumeNodeID(p.Name())). WithLatests(latests). - WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(p.GetStatus()))) + WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(status))) } func (p *cStorVolume) GetPersistentVolumeName() string { diff --git a/probe/kubernetes/cstor_volume_replica.go b/probe/kubernetes/cstor_volume_replica.go index e82d819edf..e642a74b35 100644 --- a/probe/kubernetes/cstor_volume_replica.go +++ b/probe/kubernetes/cstor_volume_replica.go @@ -31,6 +31,7 @@ func NewCStorVolumeReplica(p *mayav1alpha1.CStorVolumeReplica) CStorVolumeReplic // GetNode returns updated node with CStor Volume details func (p *cStorVolumeReplica) GetNode() report.Node { var cStorPoolNodeID string + status := p.GetStatus() latests := map[string]string{ NodeType: "CStor Volume Replica", APIVersion: p.APIVersion, @@ -46,14 +47,14 @@ func (p *cStorVolumeReplica) GetNode() report.Node { latests[CStorPoolUID] = p.GetCStorPool() } - if p.GetStatus() != "" { - latests[CStorVolumeReplicaStatus] = p.GetStatus() + if status != "" { + latests[CStorVolumeReplicaStatus] = status } return p.MetaNode(report.MakeCStorVolumeReplicaNodeID(p.UID())). WithLatests(latests). WithAdjacent(cStorPoolNodeID). - WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(p.GetStatus()))) + WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(status))) } func (p *cStorVolumeReplica) GetCStorVolume() string { From 0eb4571638cb6c426fb60a4711231a3db8ce2b6d Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Wed, 5 Dec 2018 11:29:23 +0530 Subject: [PATCH 24/45] Fix UI balnkout issue Signed-off-by: Akash Srivastava --- render/persistentvolume.go | 1 - 1 file changed, 1 deletion(-) diff --git a/render/persistentvolume.go b/render/persistentvolume.go index e24b17bde0..b89997abac 100644 --- a/render/persistentvolume.go +++ b/render/persistentvolume.go @@ -162,7 +162,6 @@ func (v pvToControllerRenderer) Render(ctx context.Context, rpt report.Report) N p.Adjacency = p.Adjacency.Add(cvID) p.Children = p.Children.Add(cvNode) } - nodes[pvNodeID] = p } if p.ID != "" { From 1f14cd62b1aa146c6bf74185b3956756154fbb33 Mon Sep 17 00:00:00 2001 From: Satyam Zode Date: Thu, 6 Dec 2018 13:17:33 +0530 Subject: [PATCH 25/45] Add disk status and creation time in Disk Node This will also enable the NodeTag for Disk objects. Signed-off-by: Satyam Zode --- probe/kubernetes/disk.go | 15 ++++++++++++++- probe/kubernetes/reporter.go | 5 +++++ report/map_keys.go | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/probe/kubernetes/disk.go b/probe/kubernetes/disk.go index 8b817931ac..2efafa9f0b 100644 --- a/probe/kubernetes/disk.go +++ b/probe/kubernetes/disk.go @@ -13,6 +13,7 @@ type Disk interface { Meta GetNode() report.Node GetPath() []string + GetNodeTagStatus(string) string } // disk represents NDM Disks @@ -28,6 +29,9 @@ func NewDisk(p *maya1alpha1.Disk) Disk { // GetNode returns Disk as Node func (p *disk) GetNode() report.Node { + var diskStatus string + diskStatus = p.Status.State + return p.MetaNode(report.MakeDiskNodeID(p.UID())).WithLatests(map[string]string{ NodeType: "Disk", LogicalSectorSize: strconv.Itoa(int(p.Spec.Capacity.LogicalSectorSize)), @@ -38,7 +42,9 @@ func (p *disk) GetNode() report.Node { Vendor: p.Spec.Details.Vendor, HostName: p.GetLabels()["kubernetes.io/hostname"], DiskList: strings.Join(p.GetPath(), "~p$"), - }) + Status: diskStatus, + CreationTimeStamp: p.ObjectMeta.CreationTimestamp.String(), + }).WithNodeTag(p.GetNodeTagStatus(diskStatus)) } func (p *disk) GetPath() []string { @@ -48,3 +54,10 @@ func (p *disk) GetPath() []string { diskList := []string{p.Spec.Path} return diskList } + +func (p *disk) GetNodeTagStatus(status string) string { + if len(status) > 0 { + return CStorVolumeStatusMap[strings.ToLower(status)] + } + return "" +} diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index 1052e1bb1c..85bf8f1f8f 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -58,6 +58,7 @@ const ( CStorVolumeStatus = report.KubernetesCStorVolumeStatus CStorVolumeReplicaStatus = report.KubernetesCStorVolumeReplicaStatus CStorPoolStatus = report.KubernetesCStorPoolStatus + CreationTimeStamp = report.KubernetesCreationTimeStamp ) var ( @@ -71,6 +72,8 @@ var ( "offline": "offline", "online": "", "rebuilding": "reload", + "inactive": "offline", + "active": "", } ) @@ -200,6 +203,8 @@ var ( FirmwareRevision: {ID: FirmwareRevision, Label: "Firmware Revision", From: report.FromLatest, Priority: 5}, LogicalSectorSize: {ID: LogicalSectorSize, Label: "Logical Sector Size", From: report.FromLatest, Priority: 6}, Storage: {ID: Storage, Label: "Capacity", From: report.FromLatest, Priority: 7}, + Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 8}, + CreationTimeStamp: {ID: CreationTimeStamp, Label: "Created On", From: report.FromLatest, Priority: 9}, } StoragePoolClaimMetadataTemplates = report.MetadataTemplates{ diff --git a/report/map_keys.go b/report/map_keys.go index 0a2177ed6c..68249b6b77 100644 --- a/report/map_keys.go +++ b/report/map_keys.go @@ -112,6 +112,7 @@ const ( KubernetesCStorVolumeStatus = "kubernetes_cstor_volume_status" KubernetesCStorVolumeReplicaStatus = "kubernetes_cstor_volume_replica_status" KubernetesCStorPoolStatus = "kubernetes_cstor_pool_status" + KubernetesCreationTimeStamp = "kubernetes_creation_time" // probe/awsecs ECSCluster = "ecs_cluster" ECSCreatedAt = "ecs_created_at" From b1abf78d578543d230ab2d9f9cd2ef640cbbfcc6 Mon Sep 17 00:00:00 2001 From: Satyam Zode Date: Fri, 7 Dec 2018 13:53:11 +0530 Subject: [PATCH 26/45] Add more details to cv volume (#137) Signed-off-by: Satyam Zode --- probe/kubernetes/cstor_volume.go | 29 +++++++ probe/kubernetes/reporter.go | 98 ++++++++++++---------- report/map_keys.go | 139 ++++++++++++++++--------------- 3 files changed, 152 insertions(+), 114 deletions(-) diff --git a/probe/kubernetes/cstor_volume.go b/probe/kubernetes/cstor_volume.go index 05ea032767..dbedbbfdbf 100644 --- a/probe/kubernetes/cstor_volume.go +++ b/probe/kubernetes/cstor_volume.go @@ -1,6 +1,7 @@ package kubernetes import ( + "strconv" "strings" mayav1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" @@ -14,6 +15,9 @@ type CStorVolume interface { GetPersistentVolumeName() string GetStatus() string GetNodeTagOnStatus(status string) string + GetConsistencyFactor() string + GetReplicationFactor() string + GetIQNInfo() string } // cStorVolume represents cStor Volume CR @@ -42,6 +46,19 @@ func (p *cStorVolume) GetNode() report.Node { if status != "" { latests[CStorVolumeStatus] = status } + + if p.GetConsistencyFactor() != "" { + latests[CStorVolumeConsistencyFactor] = p.GetConsistencyFactor() + } + + if p.GetReplicationFactor() != "" { + latests[CStorVolumeReplicationFactor] = p.GetReplicationFactor() + } + + if p.GetIQNInfo() != "" { + latests[CStorVolumeIQN] = p.GetIQNInfo() + } + return p.MetaNode(report.MakeCStorVolumeNodeID(p.Name())). WithLatests(latests). WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(status))) @@ -63,3 +80,15 @@ func (p *cStorVolume) GetNodeTagOnStatus(status string) string { } return "unknown" } + +func (p *cStorVolume) GetConsistencyFactor() string { + return strconv.Itoa(p.Spec.ConsistencyFactor) +} + +func (p *cStorVolume) GetReplicationFactor() string { + return strconv.Itoa(p.Spec.ReplicationFactor) +} + +func (p *cStorVolume) GetIQNInfo() string { + return p.Spec.Iqn +} diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index 85bf8f1f8f..a530e9be60 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -16,49 +16,52 @@ import ( // These constants are keys used in node metadata const ( - IP = report.KubernetesIP - ObservedGeneration = report.KubernetesObservedGeneration - Replicas = report.KubernetesReplicas - DesiredReplicas = report.KubernetesDesiredReplicas - NodeType = report.KubernetesNodeType - Type = report.KubernetesType - Ports = report.KubernetesPorts - VolumeClaim = report.KubernetesVolumeClaim - StorageClassName = report.KubernetesStorageClassName - AccessModes = report.KubernetesAccessModes - ReclaimPolicy = report.KubernetesReclaimPolicy - Status = report.KubernetesStatus - Message = report.KubernetesMessage - VolumeName = report.KubernetesVolumeName - Provisioner = report.KubernetesProvisioner - StorageDriver = report.KubernetesStorageDriver - VolumeSnapshotName = report.KubernetesVolumeSnapshotName - SnapshotData = report.KubernetesSnapshotData - VolumeCapacity = report.KubernetesVolumeCapacity - Model = report.KubernetesModel - LogicalSectorSize = report.KubernetesLogicalSectorSize - Storage = report.KubernetesStorage - FirmwareRevision = report.KubernetesFirmwareRevision - Serial = report.KubernetesSerial - Vendor = report.KubernetesVendor - DiskList = report.KubernetesDiskList - MaxPools = report.KubernetesMaxPools - APIVersion = report.KubernetesAPIVersion - Value = report.KubernetesValue - StoragePoolClaimName = report.KubernetesStoragePoolClaimName - DiskName = report.KubernetesDiskName - PoolName = report.KubernetesPoolName - PoolClaim = report.KubernetesPoolClaim - HostName = report.KubernetesHostName - VolumePod = report.KubernetesVolumePod - CStorVolumeName = report.KubernetesCStorVolumeName - CStorVolumeReplicaName = report.KubernetesCStorVolumeReplicaName - CStorPoolName = report.KubernetesCStorPoolName - CStorPoolUID = report.KubernetesCStorPoolUID - CStorVolumeStatus = report.KubernetesCStorVolumeStatus - CStorVolumeReplicaStatus = report.KubernetesCStorVolumeReplicaStatus - CStorPoolStatus = report.KubernetesCStorPoolStatus - CreationTimeStamp = report.KubernetesCreationTimeStamp + IP = report.KubernetesIP + ObservedGeneration = report.KubernetesObservedGeneration + Replicas = report.KubernetesReplicas + DesiredReplicas = report.KubernetesDesiredReplicas + NodeType = report.KubernetesNodeType + Type = report.KubernetesType + Ports = report.KubernetesPorts + VolumeClaim = report.KubernetesVolumeClaim + StorageClassName = report.KubernetesStorageClassName + AccessModes = report.KubernetesAccessModes + ReclaimPolicy = report.KubernetesReclaimPolicy + Status = report.KubernetesStatus + Message = report.KubernetesMessage + VolumeName = report.KubernetesVolumeName + Provisioner = report.KubernetesProvisioner + StorageDriver = report.KubernetesStorageDriver + VolumeSnapshotName = report.KubernetesVolumeSnapshotName + SnapshotData = report.KubernetesSnapshotData + VolumeCapacity = report.KubernetesVolumeCapacity + Model = report.KubernetesModel + LogicalSectorSize = report.KubernetesLogicalSectorSize + Storage = report.KubernetesStorage + FirmwareRevision = report.KubernetesFirmwareRevision + Serial = report.KubernetesSerial + Vendor = report.KubernetesVendor + DiskList = report.KubernetesDiskList + MaxPools = report.KubernetesMaxPools + APIVersion = report.KubernetesAPIVersion + Value = report.KubernetesValue + StoragePoolClaimName = report.KubernetesStoragePoolClaimName + DiskName = report.KubernetesDiskName + PoolName = report.KubernetesPoolName + PoolClaim = report.KubernetesPoolClaim + HostName = report.KubernetesHostName + VolumePod = report.KubernetesVolumePod + CStorVolumeName = report.KubernetesCStorVolumeName + CStorVolumeReplicaName = report.KubernetesCStorVolumeReplicaName + CStorPoolName = report.KubernetesCStorPoolName + CStorPoolUID = report.KubernetesCStorPoolUID + CStorVolumeStatus = report.KubernetesCStorVolumeStatus + CStorVolumeReplicaStatus = report.KubernetesCStorVolumeReplicaStatus + CStorPoolStatus = report.KubernetesCStorPoolStatus + CStorVolumeConsistencyFactor = report.KubernetesCStorVolumeConsistencyFactor + CStorVolumeReplicationFactor = report.KubernetesCStorVolumeReplicationFactor + CStorVolumeIQN = report.KubernetesCStorVolumeIQN + CreationTimeStamp = report.KubernetesCreationTimeStamp ) var ( @@ -215,9 +218,12 @@ var ( } CStorVolumeMetadataTemplates = report.MetadataTemplates{ - NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, - VolumeName: {ID: CStorVolumeName, Label: "CStor Volume", From: report.FromLatest, Priority: 2}, - CStorVolumeStatus: {ID: CStorVolumeStatus, Label: "Status", From: report.FromLatest, Priority: 3}, + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + VolumeName: {ID: CStorVolumeName, Label: "CStor Volume", From: report.FromLatest, Priority: 2}, + CStorVolumeStatus: {ID: CStorVolumeStatus, Label: "Status", From: report.FromLatest, Priority: 3}, + CStorVolumeConsistencyFactor: {ID: CStorVolumeConsistencyFactor, Label: "Conistency Factor", From: report.FromLatest, Priority: 4}, + CStorVolumeReplicationFactor: {ID: CStorVolumeReplicationFactor, Label: "Replication Factor", From: report.FromLatest, Priority: 5}, + CStorVolumeIQN: {ID: CStorVolumeIQN, Label: "Iqn", From: report.FromLatest, Priority: 6}, } CStorVolumeReplicaMetadataTemplates = report.MetadataTemplates{ NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, diff --git a/report/map_keys.go b/report/map_keys.go index 68249b6b77..65f440d589 100644 --- a/report/map_keys.go +++ b/report/map_keys.go @@ -45,74 +45,77 @@ const ( DockerContainerNetworkMode = "docker_container_network_mode" DockerEnvPrefix = "docker_env_" // probe/kubernetes - KubernetesName = "kubernetes_name" - KubernetesNamespace = "kubernetes_namespace" - KubernetesCreated = "kubernetes_created" - KubernetesIP = "kubernetes_ip" - KubernetesObservedGeneration = "kubernetes_observed_generation" - KubernetesReplicas = "kubernetes_replicas" - KubernetesDesiredReplicas = "kubernetes_desired_replicas" - KubernetesNodeType = "kubernetes_node_type" - KubernetesGetLogs = "kubernetes_get_logs" - KubernetesDeletePod = "kubernetes_delete_pod" - KubernetesScaleUp = "kubernetes_scale_up" - KubernetesScaleDown = "kubernetes_scale_down" - KubernetesUpdatedReplicas = "kubernetes_updated_replicas" - KubernetesAvailableReplicas = "kubernetes_available_replicas" - KubernetesUnavailableReplicas = "kubernetes_unavailable_replicas" - KubernetesStrategy = "kubernetes_strategy" - KubernetesFullyLabeledReplicas = "kubernetes_fully_labeled_replicas" - KubernetesState = "kubernetes_state" - KubernetesIsInHostNetwork = "kubernetes_is_in_host_network" - KubernetesRestartCount = "kubernetes_restart_count" - KubernetesMisscheduledReplicas = "kubernetes_misscheduled_replicas" - KubernetesPublicIP = "kubernetes_public_ip" - KubernetesSchedule = "kubernetes_schedule" - KubernetesSuspended = "kubernetes_suspended" - KubernetesLastScheduled = "kubernetes_last_scheduled" - KubernetesActiveJobs = "kubernetes_active_jobs" - KubernetesType = "kubernetes_type" - KubernetesPorts = "kubernetes_ports" - KubernetesVolumeClaim = "kubernetes_volume_claim" - KubernetesStorageClassName = "kubernetes_storage_class_name" - KubernetesAccessModes = "kubernetes_access_modes" - KubernetesReclaimPolicy = "kubernetes_reclaim_policy" - KubernetesStatus = "kubernetes_status" - KubernetesMessage = "kubernetes_message" - KubernetesVolumeName = "kubernetes_volume_name" - KubernetesProvisioner = "kubernetes_provisioner" - KubernetesStorageDriver = "kubernetes_storage_driver" - KubernetesVolumeSnapshotName = "kubernetes_volume_snapshot_name" - KubernetesSnapshotData = "kuberneets_snapshot_data" - KubernetesCreateVolumeSnapshot = "kubernetes_create_volume_snapshot" - KubernetesVolumeCapacity = "kubernetes_volume_capacity" - KubernetesCloneVolumeSnapshot = "kubernetes_clone_volume_snapshot" - KubernetesDeleteVolumeSnapshot = "kubernetes_delete_volume_snapshot" - KubernetesDescribe = "kubernetes_describe" - KubernetesModel = "kubernetes_model" - KubernetesLogicalSectorSize = "kubernetes_logical_sector_size" - KubernetesStorage = "kubernetes_storage" - KubernetesFirmwareRevision = "kubernetes_firmware_version" - KubernetesSerial = "kubernetes_serial" - KubernetesVendor = "kubernetes_vendor" - KubernetesDiskList = "kubernetes_disk_list" - KubernetesMaxPools = "kubernetes_max_pools" - KubernetesAPIVersion = "kubernetes_api_version" - KubernetesValue = "kubernetes_value" - KubernetesStoragePoolClaimName = "kubernetes_storage_pool_claim" - KubernetesDiskName = "kubernetes_disk_name" - KubernetesPoolName = "kubernetes_pool_name" - KubernetesPoolClaim = "kubernetes_pool_claim" - KubernetesHostName = "kubernetes_host_name" - KubernetesVolumePod = "kubernetes_volume_pod" - KubernetesCStorVolumeName = "kubernetes_cstor_volume" - KubernetesCStorVolumeReplicaName = "kubernetes_cstor_volume_replica" - KubernetesCStorPoolName = "kubernetes_cstor_pool" - KubernetesCStorPoolUID = "kubernetes_cstor_pool_uid" - KubernetesCStorVolumeStatus = "kubernetes_cstor_volume_status" - KubernetesCStorVolumeReplicaStatus = "kubernetes_cstor_volume_replica_status" - KubernetesCStorPoolStatus = "kubernetes_cstor_pool_status" - KubernetesCreationTimeStamp = "kubernetes_creation_time" + KubernetesName = "kubernetes_name" + KubernetesNamespace = "kubernetes_namespace" + KubernetesCreated = "kubernetes_created" + KubernetesIP = "kubernetes_ip" + KubernetesObservedGeneration = "kubernetes_observed_generation" + KubernetesReplicas = "kubernetes_replicas" + KubernetesDesiredReplicas = "kubernetes_desired_replicas" + KubernetesNodeType = "kubernetes_node_type" + KubernetesGetLogs = "kubernetes_get_logs" + KubernetesDeletePod = "kubernetes_delete_pod" + KubernetesScaleUp = "kubernetes_scale_up" + KubernetesScaleDown = "kubernetes_scale_down" + KubernetesUpdatedReplicas = "kubernetes_updated_replicas" + KubernetesAvailableReplicas = "kubernetes_available_replicas" + KubernetesUnavailableReplicas = "kubernetes_unavailable_replicas" + KubernetesStrategy = "kubernetes_strategy" + KubernetesFullyLabeledReplicas = "kubernetes_fully_labeled_replicas" + KubernetesState = "kubernetes_state" + KubernetesIsInHostNetwork = "kubernetes_is_in_host_network" + KubernetesRestartCount = "kubernetes_restart_count" + KubernetesMisscheduledReplicas = "kubernetes_misscheduled_replicas" + KubernetesPublicIP = "kubernetes_public_ip" + KubernetesSchedule = "kubernetes_schedule" + KubernetesSuspended = "kubernetes_suspended" + KubernetesLastScheduled = "kubernetes_last_scheduled" + KubernetesActiveJobs = "kubernetes_active_jobs" + KubernetesType = "kubernetes_type" + KubernetesPorts = "kubernetes_ports" + KubernetesVolumeClaim = "kubernetes_volume_claim" + KubernetesStorageClassName = "kubernetes_storage_class_name" + KubernetesAccessModes = "kubernetes_access_modes" + KubernetesReclaimPolicy = "kubernetes_reclaim_policy" + KubernetesStatus = "kubernetes_status" + KubernetesMessage = "kubernetes_message" + KubernetesVolumeName = "kubernetes_volume_name" + KubernetesProvisioner = "kubernetes_provisioner" + KubernetesStorageDriver = "kubernetes_storage_driver" + KubernetesVolumeSnapshotName = "kubernetes_volume_snapshot_name" + KubernetesSnapshotData = "kuberneets_snapshot_data" + KubernetesCreateVolumeSnapshot = "kubernetes_create_volume_snapshot" + KubernetesVolumeCapacity = "kubernetes_volume_capacity" + KubernetesCloneVolumeSnapshot = "kubernetes_clone_volume_snapshot" + KubernetesDeleteVolumeSnapshot = "kubernetes_delete_volume_snapshot" + KubernetesDescribe = "kubernetes_describe" + KubernetesModel = "kubernetes_model" + KubernetesLogicalSectorSize = "kubernetes_logical_sector_size" + KubernetesStorage = "kubernetes_storage" + KubernetesFirmwareRevision = "kubernetes_firmware_version" + KubernetesSerial = "kubernetes_serial" + KubernetesVendor = "kubernetes_vendor" + KubernetesDiskList = "kubernetes_disk_list" + KubernetesMaxPools = "kubernetes_max_pools" + KubernetesAPIVersion = "kubernetes_api_version" + KubernetesValue = "kubernetes_value" + KubernetesStoragePoolClaimName = "kubernetes_storage_pool_claim" + KubernetesDiskName = "kubernetes_disk_name" + KubernetesPoolName = "kubernetes_pool_name" + KubernetesPoolClaim = "kubernetes_pool_claim" + KubernetesHostName = "kubernetes_host_name" + KubernetesVolumePod = "kubernetes_volume_pod" + KubernetesCStorVolumeName = "kubernetes_cstor_volume" + KubernetesCStorVolumeReplicaName = "kubernetes_cstor_volume_replica" + KubernetesCStorPoolName = "kubernetes_cstor_pool" + KubernetesCStorPoolUID = "kubernetes_cstor_pool_uid" + KubernetesCStorVolumeStatus = "kubernetes_cstor_volume_status" + KubernetesCStorVolumeReplicaStatus = "kubernetes_cstor_volume_replica_status" + KubernetesCStorPoolStatus = "kubernetes_cstor_pool_status" + KubernetesCStorVolumeConsistencyFactor = "kubernetes_cstor_volume_consistency_factor" + KubernetesCStorVolumeReplicationFactor = "kubernetes_cstor_volume_replication_factor" + KubernetesCStorVolumeIQN = "kubernetes_cstor_volume_iqn" + KubernetesCreationTimeStamp = "kubernetes_disk_creation_time" // probe/awsecs ECSCluster = "ecs_cluster" ECSCreatedAt = "ecs_created_at" From b5d49e9f90e62e54da526d4dfa550f4d39bbd5d5 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Fri, 7 Dec 2018 15:44:57 +0530 Subject: [PATCH 27/45] Update clientset for disk CR Signed-off-by: Akash Srivastava --- .../maya/pkg/apis/openebs.io/v1alpha1/disk.go | 26 +++++++++++--- .../v1alpha1/zz_generated.deepcopy.go | 34 +++++++++++++++++++ 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/disk.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/disk.go index efcad4c4fe..8fff5958aa 100644 --- a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/disk.go +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/disk.go @@ -33,6 +33,7 @@ type Disk struct { Spec DiskSpec `json:"spec"` Status DiskStatus `json:"status"` + Stats DiskStat `json:"stats"` } // DiskSpec is the specification for the disk stored as CRD @@ -43,19 +44,20 @@ type DiskSpec struct { DevLinks []DiskDevLink `json:"devlinks,omitempty"` //DevLinks contains soft links of one disk } -// DiskStatus is the state for the disk stored as CRD type DiskStatus struct { State string `json:"state"` //current state of the disk (Active/Inactive) } -// DiskCapacity is the size of the disk stored as CRD type DiskCapacity struct { - Storage uint64 `json:"storage"` // disk size in bytes - LogicalSectorSize uint32 `json:"logicalSectorSize"` // disk logical size in bytes + Storage uint64 `json:"storage"` // disk size in bytes + PhysicalSectorSize uint32 `json: "physicalSectorSize"` // disk physical-Sector size in bytes + LogicalSectorSize uint32 `json:"logicalSectorSize"` // disk logical-sector size in bytes } // DiskDetails contains basic and static info of a disk type DiskDetails struct { + RotationRate uint16 `json: "rotationRate"` // Disk rotation speed if disk is not SSD + DriveType string `json: "driveType"` // DriveType represents the type of drive like SSD, HDD etc., Model string `json:"model"` // Model is model of disk Compliance string `json:"compliance"` // Implemented standards/specifications version such as SPC-1, SPC-2, etc Serial string `json:"serial"` // Serial is serial no of disk @@ -63,7 +65,7 @@ type DiskDetails struct { FirmwareRevision string `json:"firmwareRevision"` // disk firmware revision } -// DiskDevLink holds the maping between type and links like by-id type or by-path type link +// DiskDevlink holds the maping between type and links like by-id type or by-path type link type DiskDevLink struct { Kind string `json:"kind,omitempty"` // Kind is the type of link like by-id or by-path. Links []string `json:"links,omitempty"` // Links are the soft links of Type type @@ -79,3 +81,17 @@ type DiskList struct { Items []Disk `json:"items"` } + +type DiskStat struct { + TempInfo Temperature `json:"diskTemperature"` + TotalBytesRead uint64 `json:"totalBytesRead"` + TotalBytesWritten uint64 `json:"totalBytesWritten"` + DeviceUtilizationRate float64 `json:"deviceUtilizationRate"` + PercentEnduranceUsed float64 `json:"percentEnduranceUsed"` +} + +type Temperature struct { + CurrentTemperature int16 `json:"currentTemperature"` + HighestTemperature int16 `json:"highestTemperature"` + LowestTemperature int16 `json:"lowestTemperature"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go index b8b5df3176..e1e91a6bca 100644 --- a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go @@ -585,6 +585,7 @@ func (in *Disk) DeepCopyInto(out *Disk) { in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) out.Status = in.Status + out.Stats = in.Stats return } @@ -738,6 +739,23 @@ func (in *DiskSpec) DeepCopy() *DiskSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskStat) DeepCopyInto(out *DiskStat) { + *out = *in + out.TempInfo = in.TempInfo + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskStat. +func (in *DiskStat) DeepCopy() *DiskStat { + if in == nil { + return nil + } + out := new(DiskStat) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DiskStatus) DeepCopyInto(out *DiskStatus) { *out = *in @@ -1077,6 +1095,22 @@ func (in *StoragePoolSpec) DeepCopy() *StoragePoolSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Temperature) DeepCopyInto(out *Temperature) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Temperature. +func (in *Temperature) DeepCopy() *Temperature { + if in == nil { + return nil + } + out := new(Temperature) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumeCloneSpec) DeepCopyInto(out *VolumeCloneSpec) { *out = *in From 67e72296450e124adea51175a1317f2777fd1532 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Fri, 7 Dec 2018 17:40:28 +0530 Subject: [PATCH 28/45] Add new metadata in disk Signed-off-by: Akash Srivastava --- probe/kubernetes/disk.go | 40 ++++++++++++++++++++++++------------ probe/kubernetes/reporter.go | 36 ++++++++++++++++++++++++-------- report/map_keys.go | 9 ++++++++ 3 files changed, 63 insertions(+), 22 deletions(-) diff --git a/probe/kubernetes/disk.go b/probe/kubernetes/disk.go index 2efafa9f0b..c7eca18c2a 100644 --- a/probe/kubernetes/disk.go +++ b/probe/kubernetes/disk.go @@ -1,6 +1,7 @@ package kubernetes import ( + "fmt" "strconv" "strings" @@ -32,19 +33,32 @@ func (p *disk) GetNode() report.Node { var diskStatus string diskStatus = p.Status.State - return p.MetaNode(report.MakeDiskNodeID(p.UID())).WithLatests(map[string]string{ - NodeType: "Disk", - LogicalSectorSize: strconv.Itoa(int(p.Spec.Capacity.LogicalSectorSize)), - Storage: strconv.Itoa(int(p.Spec.Capacity.Storage/(1024*1024*1024))) + " GB", - FirmwareRevision: p.Spec.Details.FirmwareRevision, - Model: p.Spec.Details.Model, - Serial: p.Spec.Details.Serial, - Vendor: p.Spec.Details.Vendor, - HostName: p.GetLabels()["kubernetes.io/hostname"], - DiskList: strings.Join(p.GetPath(), "~p$"), - Status: diskStatus, - CreationTimeStamp: p.ObjectMeta.CreationTimestamp.String(), - }).WithNodeTag(p.GetNodeTagStatus(diskStatus)) + latests := map[string]string{ + NodeType: "Disk", + PhysicalSectorSize: strconv.Itoa(int(p.Spec.Capacity.PhysicalSectorSize)), + LogicalSectorSize: strconv.Itoa(int(p.Spec.Capacity.LogicalSectorSize)), + Storage: strconv.Itoa(int(p.Spec.Capacity.Storage/(1024*1024*1024))) + " GB", + FirmwareRevision: p.Spec.Details.FirmwareRevision, + Model: p.Spec.Details.Model, + RotationRate: strconv.Itoa(int(p.Spec.Details.RotationRate)), + Serial: p.Spec.Details.Serial, + Vendor: p.Spec.Details.Vendor, + HostName: p.GetLabels()["kubernetes.io/hostname"], + DiskList: strings.Join(p.GetPath(), "~p$"), + Status: diskStatus, + CurrentTemperature: strconv.Itoa(int(p.Stats.TempInfo.CurrentTemperature)), + HighestTemperature: strconv.Itoa(int(p.Stats.TempInfo.HighestTemperature)), + LowestTemperature: strconv.Itoa(int(p.Stats.TempInfo.LowestTemperature)), + TotalBytesRead: strconv.Itoa(int(p.Stats.TotalBytesRead)), + TotalBytesWritten: strconv.Itoa(int(p.Stats.TotalBytesWritten)), + DeviceUtilizationRate: fmt.Sprintf("%.2f", p.Stats.DeviceUtilizationRate), + PercentEnduranceUsed: fmt.Sprintf("%.2f", p.Stats.PercentEnduranceUsed), + CreationTimeStamp: p.ObjectMeta.CreationTimestamp.String(), + } + + return p.MetaNode(report.MakeDiskNodeID(p.UID())). + WithLatests(latests). + WithNodeTag(p.GetNodeTagStatus(diskStatus)) } func (p *disk) GetPath() []string { diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index a530e9be60..301a349b23 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -62,6 +62,15 @@ const ( CStorVolumeReplicationFactor = report.KubernetesCStorVolumeReplicationFactor CStorVolumeIQN = report.KubernetesCStorVolumeIQN CreationTimeStamp = report.KubernetesCreationTimeStamp + PhysicalSectorSize = report.KubernetesPhysicalSectorSize + RotationRate = report.KubernetesRotationRate + CurrentTemperature = report.KubernetesCurrentTemperature + HighestTemperature = report.KubernetesHighestTemperature + LowestTemperature = report.KubernetesLowestTemperature + TotalBytesRead = report.KubernetesTotalBytesRead + TotalBytesWritten = report.KubernetesTotalBytesWritten + DeviceUtilizationRate = report.KubernetesDeviceUtilizationRate + PercentEnduranceUsed = report.KubernetesPercentEnduranceUsed ) var ( @@ -199,15 +208,24 @@ var ( JobMetricTemplates = PodMetricTemplates DiskMetadataTemplates = report.MetadataTemplates{ - NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, - Model: {ID: Model, Label: "Model", From: report.FromLatest, Priority: 2}, - Serial: {ID: Serial, Label: "Serial", From: report.FromLatest, Priority: 3}, - Vendor: {ID: Vendor, Label: "Vendor", From: report.FromLatest, Priority: 4}, - FirmwareRevision: {ID: FirmwareRevision, Label: "Firmware Revision", From: report.FromLatest, Priority: 5}, - LogicalSectorSize: {ID: LogicalSectorSize, Label: "Logical Sector Size", From: report.FromLatest, Priority: 6}, - Storage: {ID: Storage, Label: "Capacity", From: report.FromLatest, Priority: 7}, - Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 8}, - CreationTimeStamp: {ID: CreationTimeStamp, Label: "Created On", From: report.FromLatest, Priority: 9}, + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + Model: {ID: Model, Label: "Model", From: report.FromLatest, Priority: 2}, + Serial: {ID: Serial, Label: "Serial", From: report.FromLatest, Priority: 3}, + Vendor: {ID: Vendor, Label: "Vendor", From: report.FromLatest, Priority: 4}, + FirmwareRevision: {ID: FirmwareRevision, Label: "Firmware Revision", From: report.FromLatest, Priority: 5}, + LogicalSectorSize: {ID: LogicalSectorSize, Label: "Logical Sector Size", From: report.FromLatest, Priority: 6}, + PhysicalSectorSize: {ID: PhysicalSectorSize, Label: "Physical Sector Size", From: report.FromLatest, Priority: 7}, + Storage: {ID: Storage, Label: "Capacity", From: report.FromLatest, Priority: 8}, + Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 9}, + CreationTimeStamp: {ID: CreationTimeStamp, Label: "Created On", From: report.FromLatest, Priority: 10}, + RotationRate: {ID: RotationRate, Label: "Rotation Rate", From: report.FromLatest, Priority: 11}, + CurrentTemperature: {ID: CurrentTemperature, Label: "Current Temperature", From: report.FromLatest, Priority: 12}, + HighestTemperature: {ID: HighestTemperature, Label: "Highest Temperature", From: report.FromLatest, Priority: 13}, + LowestTemperature: {ID: LowestTemperature, Label: "Lowest Temperature", From: report.FromLatest, Priority: 14}, + TotalBytesRead: {ID: TotalBytesRead, Label: "Total Bytes Read", From: report.FromLatest, Priority: 15}, + TotalBytesWritten: {ID: TotalBytesWritten, Label: "Total Bytes Written", From: report.FromLatest, Priority: 16}, + DeviceUtilizationRate: {ID: DeviceUtilizationRate, Label: "Device Utilization Rate", From: report.FromLatest, Priority: 17}, + PercentEnduranceUsed: {ID: PercentEnduranceUsed, Label: "Percent Endurance Used", From: report.FromLatest, Priority: 18}, } StoragePoolClaimMetadataTemplates = report.MetadataTemplates{ diff --git a/report/map_keys.go b/report/map_keys.go index 65f440d589..e3d6bf8421 100644 --- a/report/map_keys.go +++ b/report/map_keys.go @@ -116,6 +116,15 @@ const ( KubernetesCStorVolumeReplicationFactor = "kubernetes_cstor_volume_replication_factor" KubernetesCStorVolumeIQN = "kubernetes_cstor_volume_iqn" KubernetesCreationTimeStamp = "kubernetes_disk_creation_time" + KubernetesPhysicalSectorSize = "kubernetes_physical_sector_size" + KubernetesRotationRate = "kubernetes_rotation_rate" + KubernetesCurrentTemperature = "kubernetes_current_temperature" + KubernetesHighestTemperature = "kubernetes_highest_temperature" + KubernetesLowestTemperature = "kubernetes_lowest_temperature" + KubernetesTotalBytesRead = "kubernetes_total_bytes_read" + KubernetesTotalBytesWritten = "kubernetes_total_bytes_written" + KubernetesDeviceUtilizationRate = "kubernetes_device_utilization_rate" + KubernetesPercentEnduranceUsed = "kubernetes_percent_endurance_used" // probe/awsecs ECSCluster = "ecs_cluster" ECSCreatedAt = "ecs_created_at" From ccea3cfddd470bd0c6ade9fe42c0e7115636e99b Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Fri, 7 Dec 2018 23:06:32 +0530 Subject: [PATCH 29/45] Update logic to add adjacency between pod and pvc (#141) - Adjacency was made just by checking the name of pod claim name and pvc name, issue is when two pvc in different namespace has same name. Signed-off-by: Akash Srivastava --- probe/kubernetes/reporter.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index 301a349b23..030573141c 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -249,8 +249,9 @@ var ( CStorVolumeReplicaStatus: {ID: CStorVolumeReplicaStatus, Label: "Status", From: report.FromLatest, Priority: 3}, } CStorPoolMetadataTemplates = report.MetadataTemplates{ - NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, - VolumeName: {ID: CStorPoolName, Label: "CStor Pool", From: report.FromLatest, Priority: 2}, + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + VolumeName: {ID: CStorPoolName, Label: "CStor Pool", From: report.FromLatest, Priority: 2}, + CStorPoolStatus: {ID: CStorPoolStatus, Label: "Status", From: report.FromLatest, Priority: 3}, } TableTemplates = report.TableTemplates{ LabelPrefix: { From ec0bf7ba9f548597de4dd4fd5edfb88c8200b7a1 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Tue, 18 Dec 2018 15:50:57 +0530 Subject: [PATCH 30/45] Remove repititive columns (#144) Signed-off-by: Akash Srivastava --- probe/kubernetes/cstor_storage_pool.go | 2 +- probe/kubernetes/cstor_volume.go | 2 +- probe/kubernetes/cstor_volume_replica.go | 2 +- probe/kubernetes/disk.go | 4 ++-- probe/kubernetes/reporter.go | 30 ++++++++++-------------- report/map_keys.go | 5 ---- 6 files changed, 17 insertions(+), 28 deletions(-) diff --git a/probe/kubernetes/cstor_storage_pool.go b/probe/kubernetes/cstor_storage_pool.go index fd9d3ab728..659a9fb6fc 100644 --- a/probe/kubernetes/cstor_storage_pool.go +++ b/probe/kubernetes/cstor_storage_pool.go @@ -40,7 +40,7 @@ func (p *cStorPool) GetNode() report.Node { } if status != "" { - latests[CStorPoolStatus] = status + latests[Status] = status } return p.MetaNode(report.MakeCStorPoolNodeID(p.UID())). WithLatests(latests). diff --git a/probe/kubernetes/cstor_volume.go b/probe/kubernetes/cstor_volume.go index dbedbbfdbf..e1903ca4ba 100644 --- a/probe/kubernetes/cstor_volume.go +++ b/probe/kubernetes/cstor_volume.go @@ -44,7 +44,7 @@ func (p *cStorVolume) GetNode() report.Node { } if status != "" { - latests[CStorVolumeStatus] = status + latests[Status] = status } if p.GetConsistencyFactor() != "" { diff --git a/probe/kubernetes/cstor_volume_replica.go b/probe/kubernetes/cstor_volume_replica.go index e642a74b35..2e0ed98f76 100644 --- a/probe/kubernetes/cstor_volume_replica.go +++ b/probe/kubernetes/cstor_volume_replica.go @@ -48,7 +48,7 @@ func (p *cStorVolumeReplica) GetNode() report.Node { } if status != "" { - latests[CStorVolumeReplicaStatus] = status + latests[Status] = status } return p.MetaNode(report.MakeCStorVolumeReplicaNodeID(p.UID())). diff --git a/probe/kubernetes/disk.go b/probe/kubernetes/disk.go index c7eca18c2a..dc4400c98a 100644 --- a/probe/kubernetes/disk.go +++ b/probe/kubernetes/disk.go @@ -37,7 +37,7 @@ func (p *disk) GetNode() report.Node { NodeType: "Disk", PhysicalSectorSize: strconv.Itoa(int(p.Spec.Capacity.PhysicalSectorSize)), LogicalSectorSize: strconv.Itoa(int(p.Spec.Capacity.LogicalSectorSize)), - Storage: strconv.Itoa(int(p.Spec.Capacity.Storage/(1024*1024*1024))) + " GB", + VolumeCapacity: strconv.Itoa(int(p.Spec.Capacity.Storage/(1024*1024*1024))) + " GB", FirmwareRevision: p.Spec.Details.FirmwareRevision, Model: p.Spec.Details.Model, RotationRate: strconv.Itoa(int(p.Spec.Details.RotationRate)), @@ -53,7 +53,7 @@ func (p *disk) GetNode() report.Node { TotalBytesWritten: strconv.Itoa(int(p.Stats.TotalBytesWritten)), DeviceUtilizationRate: fmt.Sprintf("%.2f", p.Stats.DeviceUtilizationRate), PercentEnduranceUsed: fmt.Sprintf("%.2f", p.Stats.PercentEnduranceUsed), - CreationTimeStamp: p.ObjectMeta.CreationTimestamp.String(), + Created: p.ObjectMeta.CreationTimestamp.String(), } return p.MetaNode(report.MakeDiskNodeID(p.UID())). diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index 030573141c..50e42f9be7 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -37,7 +37,6 @@ const ( VolumeCapacity = report.KubernetesVolumeCapacity Model = report.KubernetesModel LogicalSectorSize = report.KubernetesLogicalSectorSize - Storage = report.KubernetesStorage FirmwareRevision = report.KubernetesFirmwareRevision Serial = report.KubernetesSerial Vendor = report.KubernetesVendor @@ -55,13 +54,9 @@ const ( CStorVolumeReplicaName = report.KubernetesCStorVolumeReplicaName CStorPoolName = report.KubernetesCStorPoolName CStorPoolUID = report.KubernetesCStorPoolUID - CStorVolumeStatus = report.KubernetesCStorVolumeStatus - CStorVolumeReplicaStatus = report.KubernetesCStorVolumeReplicaStatus - CStorPoolStatus = report.KubernetesCStorPoolStatus CStorVolumeConsistencyFactor = report.KubernetesCStorVolumeConsistencyFactor CStorVolumeReplicationFactor = report.KubernetesCStorVolumeReplicationFactor CStorVolumeIQN = report.KubernetesCStorVolumeIQN - CreationTimeStamp = report.KubernetesCreationTimeStamp PhysicalSectorSize = report.KubernetesPhysicalSectorSize RotationRate = report.KubernetesRotationRate CurrentTemperature = report.KubernetesCurrentTemperature @@ -180,8 +175,7 @@ var ( StorageClassMetadataTemplates = report.MetadataTemplates{ NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, - Name: {ID: Name, Label: "Name", From: report.FromLatest, Priority: 2}, - Provisioner: {ID: Provisioner, Label: "Provisioner", From: report.FromLatest, Priority: 3}, + Provisioner: {ID: Provisioner, Label: "Provisioner", From: report.FromLatest, Priority: 2}, } VolumeSnapshotMetadataTemplates = report.MetadataTemplates{ @@ -215,9 +209,9 @@ var ( FirmwareRevision: {ID: FirmwareRevision, Label: "Firmware Revision", From: report.FromLatest, Priority: 5}, LogicalSectorSize: {ID: LogicalSectorSize, Label: "Logical Sector Size", From: report.FromLatest, Priority: 6}, PhysicalSectorSize: {ID: PhysicalSectorSize, Label: "Physical Sector Size", From: report.FromLatest, Priority: 7}, - Storage: {ID: Storage, Label: "Capacity", From: report.FromLatest, Priority: 8}, + VolumeCapacity: {ID: VolumeCapacity, Label: "Capacity", From: report.FromLatest, Priority: 8}, Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 9}, - CreationTimeStamp: {ID: CreationTimeStamp, Label: "Created On", From: report.FromLatest, Priority: 10}, + Created: {ID: Created, Label: "Created", From: report.FromLatest, Datatype: report.DateTime, Priority: 10}, RotationRate: {ID: RotationRate, Label: "Rotation Rate", From: report.FromLatest, Priority: 11}, CurrentTemperature: {ID: CurrentTemperature, Label: "Current Temperature", From: report.FromLatest, Priority: 12}, HighestTemperature: {ID: HighestTemperature, Label: "Highest Temperature", From: report.FromLatest, Priority: 13}, @@ -236,22 +230,22 @@ var ( } CStorVolumeMetadataTemplates = report.MetadataTemplates{ - NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, - VolumeName: {ID: CStorVolumeName, Label: "CStor Volume", From: report.FromLatest, Priority: 2}, - CStorVolumeStatus: {ID: CStorVolumeStatus, Label: "Status", From: report.FromLatest, Priority: 3}, + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + VolumeName: {ID: CStorVolumeName, Label: "CStor Volume", From: report.FromLatest, Priority: 2}, + Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 3}, CStorVolumeConsistencyFactor: {ID: CStorVolumeConsistencyFactor, Label: "Conistency Factor", From: report.FromLatest, Priority: 4}, CStorVolumeReplicationFactor: {ID: CStorVolumeReplicationFactor, Label: "Replication Factor", From: report.FromLatest, Priority: 5}, CStorVolumeIQN: {ID: CStorVolumeIQN, Label: "Iqn", From: report.FromLatest, Priority: 6}, } CStorVolumeReplicaMetadataTemplates = report.MetadataTemplates{ - NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, - VolumeName: {ID: CStorVolumeReplicaName, Label: "CStor Volume Replica", From: report.FromLatest, Priority: 2}, - CStorVolumeReplicaStatus: {ID: CStorVolumeReplicaStatus, Label: "Status", From: report.FromLatest, Priority: 3}, + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + VolumeName: {ID: CStorVolumeReplicaName, Label: "CStor Volume Replica", From: report.FromLatest, Priority: 2}, + Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 3}, } CStorPoolMetadataTemplates = report.MetadataTemplates{ - NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, - VolumeName: {ID: CStorPoolName, Label: "CStor Pool", From: report.FromLatest, Priority: 2}, - CStorPoolStatus: {ID: CStorPoolStatus, Label: "Status", From: report.FromLatest, Priority: 3}, + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + VolumeName: {ID: CStorPoolName, Label: "CStor Pool", From: report.FromLatest, Priority: 2}, + Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 3}, } TableTemplates = report.TableTemplates{ LabelPrefix: { diff --git a/report/map_keys.go b/report/map_keys.go index e3d6bf8421..eebcede171 100644 --- a/report/map_keys.go +++ b/report/map_keys.go @@ -91,7 +91,6 @@ const ( KubernetesDescribe = "kubernetes_describe" KubernetesModel = "kubernetes_model" KubernetesLogicalSectorSize = "kubernetes_logical_sector_size" - KubernetesStorage = "kubernetes_storage" KubernetesFirmwareRevision = "kubernetes_firmware_version" KubernetesSerial = "kubernetes_serial" KubernetesVendor = "kubernetes_vendor" @@ -109,13 +108,9 @@ const ( KubernetesCStorVolumeReplicaName = "kubernetes_cstor_volume_replica" KubernetesCStorPoolName = "kubernetes_cstor_pool" KubernetesCStorPoolUID = "kubernetes_cstor_pool_uid" - KubernetesCStorVolumeStatus = "kubernetes_cstor_volume_status" - KubernetesCStorVolumeReplicaStatus = "kubernetes_cstor_volume_replica_status" - KubernetesCStorPoolStatus = "kubernetes_cstor_pool_status" KubernetesCStorVolumeConsistencyFactor = "kubernetes_cstor_volume_consistency_factor" KubernetesCStorVolumeReplicationFactor = "kubernetes_cstor_volume_replication_factor" KubernetesCStorVolumeIQN = "kubernetes_cstor_volume_iqn" - KubernetesCreationTimeStamp = "kubernetes_disk_creation_time" KubernetesPhysicalSectorSize = "kubernetes_physical_sector_size" KubernetesRotationRate = "kubernetes_rotation_rate" KubernetesCurrentTemperature = "kubernetes_current_temperature" From 93950416fde202f4fb4ff3ed127399f668f72ac5 Mon Sep 17 00:00:00 2001 From: Satyam Zode Date: Sat, 22 Dec 2018 21:10:32 +0530 Subject: [PATCH 31/45] Change log level from warn to debug (#147) Signed-off-by: Satyam Zode --- probe/kubernetes/reporter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index 50e42f9be7..c956df53ac 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -853,7 +853,7 @@ func (r *Reporter) podTopology(services []Service, deployments []Deployment, dae var err error localPodUIDs, err = GetLocalPodUIDs(fmt.Sprintf("127.0.0.1:%d", r.kubeletPort)) if err != nil { - log.Warnf("No node name and cannot obtain local pods, reporting all (which may impact performance): %v", err) + log.Debugf("No node name and cannot obtain local pods, reporting all (which may impact performance): %v", err) } } err := r.client.WalkPods(func(p Pod) error { From ff7df585a749910efa86d15fc8e86cc7f7cd9070 Mon Sep 17 00:00:00 2001 From: Satyam Zode Date: Thu, 27 Dec 2018 17:50:34 +0530 Subject: [PATCH 32/45] Remove checkpoint to preserve system info of users (#149) (#150) Signed-off-by: Satyam Zode --- prog/app.go | 16 - prog/main.go | 14 - prog/probe.go | 34 -- .../weaveworks/go-checkpoint/LICENSE | 354 -------------- .../weaveworks/go-checkpoint/Makefile | 36 -- .../weaveworks/go-checkpoint/README.md | 29 -- .../go-checkpoint/backend/Dockerfile | 12 - .../weaveworks/go-checkpoint/backend/build.sh | 23 - .../weaveworks/go-checkpoint/checkpoint.go | 432 ------------------ .../go-checkpoint/checkpoint_test.go | 264 ----------- .../weaveworks/go-checkpoint/circle.yml | 13 - vendor/manifest | 7 - 12 files changed, 1234 deletions(-) delete mode 100644 vendor/github.com/weaveworks/go-checkpoint/LICENSE delete mode 100644 vendor/github.com/weaveworks/go-checkpoint/Makefile delete mode 100644 vendor/github.com/weaveworks/go-checkpoint/README.md delete mode 100644 vendor/github.com/weaveworks/go-checkpoint/backend/Dockerfile delete mode 100644 vendor/github.com/weaveworks/go-checkpoint/backend/build.sh delete mode 100644 vendor/github.com/weaveworks/go-checkpoint/checkpoint.go delete mode 100644 vendor/github.com/weaveworks/go-checkpoint/checkpoint_test.go delete mode 100644 vendor/github.com/weaveworks/go-checkpoint/circle.yml diff --git a/prog/app.go b/prog/app.go index 27050e8ec7..2b1c2a817e 100644 --- a/prog/app.go +++ b/prog/app.go @@ -26,7 +26,6 @@ import ( "github.com/weaveworks/common/network" "github.com/weaveworks/common/signals" "github.com/weaveworks/common/tracing" - "github.com/weaveworks/go-checkpoint" "github.com/weaveworks/scope/app" "github.com/weaveworks/scope/app/multitenant" "github.com/weaveworks/scope/common/weave" @@ -267,21 +266,6 @@ func appMain(flags appFlags) { return } - // Start background version checking - checkpoint.CheckInterval(&checkpoint.CheckParams{ - Product: "scope-app", - Version: app.Version, - Flags: makeBaseCheckpointFlags(), - }, versionCheckPeriod, func(r *checkpoint.CheckResponse, err error) { - if err != nil { - log.Errorf("Error checking version: %v", err) - } else if r.Outdated { - log.Infof("Scope version %s is available; please update at %s", - r.CurrentVersion, r.CurrentDownloadURL) - app.NewVersion(r.CurrentVersion, r.CurrentDownloadURL) - } - }) - // Periodically try and register our IP address in WeaveDNS. if flags.weaveEnabled && flags.weaveHostname != "" { weave, err := newWeavePublisher( diff --git a/prog/main.go b/prog/main.go index 7817908579..fb159ffb6d 100644 --- a/prog/main.go +++ b/prog/main.go @@ -7,7 +7,6 @@ import ( "net" "os" "regexp" - "runtime" "strconv" "strings" "time" @@ -19,7 +18,6 @@ import ( "github.com/weaveworks/scope/app/multitenant" "github.com/weaveworks/scope/common/xfer" "github.com/weaveworks/scope/probe/appclient" - "github.com/weaveworks/scope/probe/host" "github.com/weaveworks/scope/probe/kubernetes" "github.com/weaveworks/scope/render" "github.com/weaveworks/weave/common" @@ -257,18 +255,6 @@ func logCensoredArgs() { log.Infof("command line args:%s", prettyPrintedArgs) } -func makeBaseCheckpointFlags() map[string]string { - release, _, err := host.GetKernelReleaseAndVersion() - if err != nil { - release = "unknown" - } - return map[string]string{ - // Inconsistent key (using a dash) to match Weave Net - "kernel-version": release, - "os": runtime.GOOS, - } -} - func setupFlags(flags *flags) { flags.containerLabelFilterFlags = containerLabelFiltersFlag{exclude: false, filterIDPrefix: "containerLabelFilterExclude"} flags.containerLabelFilterFlagsExclude = containerLabelFiltersFlag{exclude: true, filterIDPrefix: "containerLabelFilter"} diff --git a/prog/probe.go b/prog/probe.go index 3e14d2f376..2dddae2e11 100644 --- a/prog/probe.go +++ b/prog/probe.go @@ -21,7 +21,6 @@ import ( "github.com/weaveworks/common/sanitize" "github.com/weaveworks/common/signals" "github.com/weaveworks/common/tracing" - "github.com/weaveworks/go-checkpoint" "github.com/weaveworks/scope/common/hostname" "github.com/weaveworks/scope/common/weave" "github.com/weaveworks/scope/common/xfer" @@ -41,7 +40,6 @@ import ( ) const ( - versionCheckPeriod = 6 * time.Hour defaultServiceHost = "https://cloud.weave.works.:443" kubernetesRoleHost = "host" @@ -52,37 +50,6 @@ var ( pluginAPIVersion = "1" ) -func checkNewScopeVersion(flags probeFlags) { - checkpointFlags := makeBaseCheckpointFlags() - if flags.kubernetesEnabled { - checkpointFlags["kubernetes_enabled"] = "true" - } - if flags.ecsEnabled { - checkpointFlags["ecs_enabled"] = "true" - } - - go func() { - handleResponse := func(r *checkpoint.CheckResponse, err error) { - if err != nil { - log.Errorf("Error checking version: %v", err) - } else if r.Outdated { - log.Infof("Scope version %s is available; please update at %s", - r.CurrentVersion, r.CurrentDownloadURL) - } - } - - // Start background version checking - params := checkpoint.CheckParams{ - Product: "scope-probe", - Version: version, - Flags: checkpointFlags, - } - resp, err := checkpoint.Check(¶ms) - handleResponse(resp, err) - checkpoint.CheckInterval(¶ms, versionCheckPeriod, handleResponse) - }() -} - func maybeExportProfileData(flags probeFlags) { if flags.httpListen != "" { go func() { @@ -142,7 +109,6 @@ func probeMain(flags probeFlags, targets []appclient.Target) { hostID = hostName // TODO(pb): we should sanitize the hostname ) log.Infof("probe starting, version %s, ID %s", version, probeID) - checkNewScopeVersion(flags) handlerRegistry := controls.NewDefaultHandlerRegistry() clientFactory := func(hostname string, url url.URL) (appclient.AppClient, error) { diff --git a/vendor/github.com/weaveworks/go-checkpoint/LICENSE b/vendor/github.com/weaveworks/go-checkpoint/LICENSE deleted file mode 100644 index c33dcc7c92..0000000000 --- a/vendor/github.com/weaveworks/go-checkpoint/LICENSE +++ /dev/null @@ -1,354 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/weaveworks/go-checkpoint/Makefile b/vendor/github.com/weaveworks/go-checkpoint/Makefile deleted file mode 100644 index 294727626d..0000000000 --- a/vendor/github.com/weaveworks/go-checkpoint/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -.PHONY: all build test lint - -BUILD_IN_CONTAINER ?= true -RM=--rm -BUILD_UPTODATE=backend/.image.uptodate -BUILD_IMAGE=checkpoint_build - -all: build - -$(BUILD_UPTODATE): backend/* - docker build -t $(BUILD_IMAGE) backend - touch $@ - -ifeq ($(BUILD_IN_CONTAINER),true) - -build test lint: $(BUILD_UPTODATE) - $(SUDO) docker run $(RM) -ti \ - -v $(shell pwd):/go/src/github.com/weaveworks/go-checkpoint \ - -e GOARCH -e GOOS -e BUILD_IN_CONTAINER=false \ - $(BUILD_IMAGE) $@ - -else - -build: - go get . - go build . - -test: - go get -t . - go test - -lint: - ./tools/lint -notestpackage . - -endif - diff --git a/vendor/github.com/weaveworks/go-checkpoint/README.md b/vendor/github.com/weaveworks/go-checkpoint/README.md deleted file mode 100644 index f82a370951..0000000000 --- a/vendor/github.com/weaveworks/go-checkpoint/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Go Checkpoint Client - -[![Circle CI](https://circleci.com/gh/weaveworks/go-checkpoint/tree/master.svg?style=shield)](https://circleci.com/gh/weaveworks/go-checkpoint/tree/master) - -Checkpoint is an internal service at -[Weaveworks](https://www.weave.works/) to check version information, -broadcast security bulletins, etc. This repository contains the client -code for accessing that service. It is a fork of -[Hashicorp's Go Checkpoint Client](https://github.com/hashicorp/go-checkpoint) -and is embedded in several -[Weaveworks open source projects](https://github.com/weaveworks/) and -proprietary software. - -We understand that software making remote calls over the internet for -any reason can be undesirable. Because of this, Checkpoint can be -disabled in all of Weavework's software that includes it. You can view -the source of this client to see that it is not sending any private -information. - -To disable checkpoint calls, set the `CHECKPOINT_DISABLE` environment -variable, e.g. - -``` -export CHECKPOINT_DISABLE=1 -``` - -**Note:** This repository is probably useless outside of internal -Weaveworks use. It is open source for disclosure and because -Weaveworks open source projects must be able to link to it. diff --git a/vendor/github.com/weaveworks/go-checkpoint/backend/Dockerfile b/vendor/github.com/weaveworks/go-checkpoint/backend/Dockerfile deleted file mode 100644 index f3a5a7fc73..0000000000 --- a/vendor/github.com/weaveworks/go-checkpoint/backend/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM golang:1.6.2 -RUN apt-get update && \ - apt-get install -y python-requests time file sudo && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN go get -tags netgo \ - github.com/fzipp/gocyclo \ - github.com/golang/lint/golint \ - github.com/kisielk/errcheck \ - github.com/client9/misspell/cmd/misspell && \ - rm -rf /go/pkg/ /go/src/ -COPY build.sh / -ENTRYPOINT ["/build.sh"] diff --git a/vendor/github.com/weaveworks/go-checkpoint/backend/build.sh b/vendor/github.com/weaveworks/go-checkpoint/backend/build.sh deleted file mode 100644 index 7a68640868..0000000000 --- a/vendor/github.com/weaveworks/go-checkpoint/backend/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -set -eu - -SRC=$GOPATH/src/github.com/weaveworks/go-checkpoint - -# Mount the checkpoint repo: -# -v $(pwd):/go/src/github.com/weaveworks/checkpoint - -# If we run make directly, any files created on the bind mount -# will have awkward ownership. So we switch to a user with the -# same user and group IDs as source directory. We have to set a -# few things up so that sudo works without complaining later on. -uid=$(stat --format="%u" $SRC) -gid=$(stat --format="%g" $SRC) -echo "weave:x:$uid:$gid::$SRC:/bin/sh" >>/etc/passwd -echo "weave:*:::::::" >>/etc/shadow -echo "weave ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers - -chmod o+rw $GOPATH/src -chmod o+rw $GOPATH/src/github.com - -su weave -c "PATH=$PATH make -C $SRC BUILD_IN_CONTAINER=false $*" diff --git a/vendor/github.com/weaveworks/go-checkpoint/checkpoint.go b/vendor/github.com/weaveworks/go-checkpoint/checkpoint.go deleted file mode 100644 index 423640c6d1..0000000000 --- a/vendor/github.com/weaveworks/go-checkpoint/checkpoint.go +++ /dev/null @@ -1,432 +0,0 @@ -// Package checkpoint is a package for checking version information and alerts -// for a Weaveworks product. -package checkpoint - -import ( - "crypto/rand" - "encoding/base64" - "encoding/binary" - "encoding/json" - "fmt" - "golang.org/x/crypto/scrypt" - "io" - "io/ioutil" - mrand "math/rand" - "net/http" - "net/url" - "os" - "path/filepath" - "reflect" - "runtime" - "strings" - "sync" - "time" - - "github.com/hashicorp/go-cleanhttp" -) - -var magicBytes = [4]byte{0x35, 0x77, 0x69, 0xFB} - -// CheckParams are the parameters for configuring a check request. -type CheckParams struct { - // Product and version are used to lookup the correct product and - // alerts for the proper version. The version is also used to perform - // a version check. - Product string - Version string - - // Generic product flags - Flags map[string]string - - // Arch and OS are used to filter alerts potentially only to things - // affecting a specific os/arch combination. If these aren't specified, - // they'll be automatically filled in. - Arch string - OS string - - // Signature is some random signature that should be stored and used - // as a cookie-like value. This ensures that alerts aren't repeated. - // If the signature is changed, repeat alerts may be sent down. The - // signature should NOT be anything identifiable to a user (such as - // a MAC address). It should be random. - // - // If SignatureFile is given, then the signature will be read from this - // file. If the file doesn't exist, then a random signature will - // automatically be generated and stored here. SignatureFile will be - // ignored if Signature is given. - Signature string - SignatureFile string - - // CacheFile, if specified, will cache the result of a check. The - // duration of the cache is specified by CacheDuration, and defaults - // to 48 hours if not specified. If the CacheFile is newer than the - // CacheDuration, than the Check will short-circuit and use those - // results. - // - // If the CacheFile directory doesn't exist, it will be created with - // permissions 0755. - CacheFile string - CacheDuration time.Duration - - // Force, if true, will force the check even if CHECKPOINT_DISABLE - // is set. Within HashiCorp products, this is ONLY USED when the user - // specifically requests it. This is never automatically done without - // the user's consent. - Force bool -} - -// CheckResponse is the response for a check request. -type CheckResponse struct { - Product string - CurrentVersion string `json:"current_version"` - CurrentReleaseDate int `json:"current_release_date"` - CurrentDownloadURL string `json:"current_download_url"` - CurrentChangelogURL string `json:"current_changelog_url"` - ProjectWebsite string `json:"project_website"` - Outdated bool `json:"outdated"` - Alerts []*CheckAlert -} - -// CheckAlert is a single alert message from a check request. -// -// These never have to be manually constructed, and are typically populated -// into a CheckResponse as a result of the Check request. -type CheckAlert struct { - ID int - Date int - Message string - URL string - Level string -} - -// Checker is a state of a checker. -type Checker struct { - doneCh chan struct{} - nextCheckAt time.Time - nextCheckAtLock sync.RWMutex -} - -// Check checks for alerts and new version information. -func Check(p *CheckParams) (*CheckResponse, error) { - if IsCheckDisabled() && !p.Force { - return &CheckResponse{}, nil - } - - // If we have a cached result, then use that - if r, err := checkCache(p.Version, p.CacheFile, p.CacheDuration); err != nil { - return nil, err - } else if r != nil { - defer r.Close() - return checkResult(r) - } - - var u url.URL - - if p.Arch == "" { - p.Arch = runtime.GOARCH - } - if p.OS == "" { - p.OS = runtime.GOOS - } - - // If we're not given a Signature, then attempt to read one from a - // file, if specified, or derive it from the system uuid. - // - // NB: We ignore errors here since it is better to perform the - // check with an empty signature than not at all. - var signature string - switch { - case p.Signature != "": - signature = p.Signature - case p.SignatureFile != "": - signature, _ = checkSignature(p.SignatureFile) - default: - signature, _ = getSystemUUID() - } - - v := u.Query() - v.Set("version", p.Version) - v.Set("arch", p.Arch) - v.Set("os", p.OS) - v.Set("signature", signature) - for flag, value := range p.Flags { - v.Set("flag_"+flag, value) - } - - u.Scheme = "https" - u.Host = "checkpoint-api.weave.works" - u.Path = fmt.Sprintf("/v1/check/%s", p.Product) - u.RawQuery = v.Encode() - - req, err := http.NewRequest("GET", u.String(), nil) - if err != nil { - return nil, err - } - req.Header.Add("Accept", "application/json") - req.Header.Add("User-Agent", "HashiCorp/go-checkpoint") - - client := cleanhttp.DefaultClient() - defer client.Transport.(*http.Transport).CloseIdleConnections() - resp, err := client.Do(req) - if err != nil { - return nil, err - } - if resp.StatusCode != 200 { - return nil, fmt.Errorf("Unknown status: %d", resp.StatusCode) - } - - var r io.Reader = resp.Body - defer resp.Body.Close() - if p.CacheFile != "" { - // Make sure the directory holding our cache exists. - if err := os.MkdirAll(filepath.Dir(p.CacheFile), 0755); err != nil { - return nil, err - } - - // We have to cache the result, so write the response to the - // file as we read it. - f, err := os.Create(p.CacheFile) - if err != nil { - return nil, err - } - - // Write the cache header - if err := writeCacheHeader(f, p.Version); err != nil { - f.Close() - os.Remove(p.CacheFile) - return nil, err - } - - defer f.Close() - r = io.TeeReader(r, f) - } - - return checkResult(r) -} - -// CheckInterval is used to check for a response on a given interval duration. -// The interval is not exact, and checks are randomized to prevent a thundering -// herd. However, it is expected that on average one check is performed per -// interval. -// The first check happens immediately after a goroutine which is responsible for -// making checks has been started. -func CheckInterval(p *CheckParams, interval time.Duration, - cb func(*CheckResponse, error)) *Checker { - - state := &Checker{ - doneCh: make(chan struct{}), - } - - if IsCheckDisabled() { - return state - } - - go func() { - cb(Check(p)) - - for { - after := randomStagger(interval) - state.nextCheckAtLock.Lock() - state.nextCheckAt = time.Now().Add(after) - state.nextCheckAtLock.Unlock() - - select { - case <-time.After(after): - cb(Check(p)) - case <-state.doneCh: - return - } - } - }() - - return state -} - -// NextCheckAt returns at what time next check will happen. -func (c *Checker) NextCheckAt() time.Time { - c.nextCheckAtLock.RLock() - defer c.nextCheckAtLock.RUnlock() - return c.nextCheckAt -} - -// Stop stops the checker. -func (c *Checker) Stop() { - close(c.doneCh) -} - -// IsCheckDisabled returns true if checks are disabled. -func IsCheckDisabled() bool { - return os.Getenv("CHECKPOINT_DISABLE") != "" -} - -// randomStagger returns an interval that is between 3/4 and 5/4 of -// the given interval. The expected value is the interval. -func randomStagger(interval time.Duration) time.Duration { - stagger := time.Duration(mrand.Int63()) % (interval / 2) - return 3*(interval/4) + stagger -} - -func checkCache(current string, path string, d time.Duration) (io.ReadCloser, error) { - fi, err := os.Stat(path) - if err != nil { - if os.IsNotExist(err) { - // File doesn't exist, not a problem - return nil, nil - } - - return nil, err - } - - if d == 0 { - d = 48 * time.Hour - } - - if fi.ModTime().Add(d).Before(time.Now()) { - // Cache is busted, delete the old file and re-request. We ignore - // errors here because re-creating the file is fine too. - os.Remove(path) - return nil, nil - } - - // File looks good so far, open it up so we can inspect the contents. - f, err := os.Open(path) - if err != nil { - return nil, err - } - - // Check the signature of the file - var sig [4]byte - if err := binary.Read(f, binary.LittleEndian, sig[:]); err != nil { - f.Close() - return nil, err - } - if !reflect.DeepEqual(sig, magicBytes) { - // Signatures don't match. Reset. - f.Close() - return nil, nil - } - - // Check the version. If it changed, then rewrite - var length uint32 - if err := binary.Read(f, binary.LittleEndian, &length); err != nil { - f.Close() - return nil, err - } - data := make([]byte, length) - if _, err := io.ReadFull(f, data); err != nil { - f.Close() - return nil, err - } - if string(data) != current { - // Version changed, reset - f.Close() - return nil, nil - } - - return f, nil -} - -func checkResult(r io.Reader) (*CheckResponse, error) { - var result CheckResponse - dec := json.NewDecoder(r) - if err := dec.Decode(&result); err != nil { - return nil, err - } - - return &result, nil -} - -// getSystemUUID returns the base64 encoded, scrypt hashed contents of -// /sys/class/dmi/id/product_uuid, or, if that is not available, -// sys/hypervisor/uuid. -func getSystemUUID() (string, error) { - uuid, err := ioutil.ReadFile("/sys/class/dmi/id/product_uuid") - if os.IsNotExist(err) { - uuid, err = ioutil.ReadFile("/sys/hypervisor/uuid") - } - if err != nil { - return "", err - } - if len(uuid) <= 0 { - return "", fmt.Errorf("Empty system uuid") - } - hash, err := scrypt.Key(uuid, uuid, 16384, 8, 1, 32) - if err != nil { - return "", err - } - return base64.StdEncoding.EncodeToString(hash), nil -} - -func checkSignature(path string) (string, error) { - _, err := os.Stat(path) - if err == nil { - // The file exists, read it out - sigBytes, err := ioutil.ReadFile(path) - if err != nil { - return "", err - } - - // Split the file into lines - lines := strings.SplitN(string(sigBytes), "\n", 2) - if len(lines) > 0 { - return strings.TrimSpace(lines[0]), nil - } - } - - // If this isn't a non-exist error, then return that. - if !os.IsNotExist(err) { - return "", err - } - - // The file doesn't exist, so create a signature. - var b [16]byte - n := 0 - for n < 16 { - n2, err := rand.Read(b[n:]) - if err != nil { - return "", err - } - - n += n2 - } - signature := fmt.Sprintf( - "%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:]) - - // Make sure the directory holding our signature exists. - if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil { - return "", err - } - - // Write the signature - if err := ioutil.WriteFile(path, []byte(signature+"\n\n"+userMessage+"\n"), 0644); err != nil { - return "", err - } - - return signature, nil -} - -func writeCacheHeader(f io.Writer, v string) error { - // Write our signature first - if err := binary.Write(f, binary.LittleEndian, magicBytes); err != nil { - return err - } - - // Write out our current version length - var length = uint32(len(v)) - if err := binary.Write(f, binary.LittleEndian, length); err != nil { - return err - } - - _, err := f.Write([]byte(v)) - return err -} - -// userMessage is suffixed to the signature file to provide feedback. -var userMessage = ` -This signature is a randomly generated UUID used to de-duplicate -alerts and version information. This signature is random, it is -not based on any personally identifiable information. To create -a new signature, you can simply delete this file at any time. -See the documentation for the software using Checkpoint for more -information on how to disable it. -` diff --git a/vendor/github.com/weaveworks/go-checkpoint/checkpoint_test.go b/vendor/github.com/weaveworks/go-checkpoint/checkpoint_test.go deleted file mode 100644 index b818555567..0000000000 --- a/vendor/github.com/weaveworks/go-checkpoint/checkpoint_test.go +++ /dev/null @@ -1,264 +0,0 @@ -package checkpoint - -import ( - "io/ioutil" - "os" - "path/filepath" - "reflect" - "testing" - "time" -) - -func TestCheck(t *testing.T) { - expected := &CheckResponse{ - CurrentVersion: "1.0.0", - CurrentReleaseDate: 1460459932, // 2016-04-12 11:18:52 - CurrentDownloadURL: "https://test-app.used-for-testing", - CurrentChangelogURL: "https://test-app.used-for-testing", - ProjectWebsite: "https://test-app.used-for-testing", - Outdated: false, - Alerts: nil, - } - - actual, err := Check(&CheckParams{ - Product: "test-app", - Version: "1.0.0", - }) - - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v", actual) - } -} - -func TestCheck_flags(t *testing.T) { - expected := &CheckResponse{ - CurrentVersion: "1.0.0", - CurrentReleaseDate: 1460459932, // 2016-04-12 11:18:52 - CurrentDownloadURL: "https://test-app.used-for-testing", - CurrentChangelogURL: "https://test-app.used-for-testing", - ProjectWebsite: "https://test-app.used-for-testing", - Outdated: false, - Alerts: nil, - } - - actual, err := Check(&CheckParams{ - Product: "test-app", - Version: "1.0.0", - Flags: map[string]string{ - "flag1": "value1", - "flag2": "value2", - }, - }) - - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v", actual) - } -} - -func TestCheck_disabled(t *testing.T) { - os.Setenv("CHECKPOINT_DISABLE", "1") - defer os.Setenv("CHECKPOINT_DISABLE", "") - - expected := &CheckResponse{} - - actual, err := Check(&CheckParams{ - Product: "test-app", - Version: "1.0.0", - }) - - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("expected %+v to equal %+v", actual, expected) - } -} - -func TestCheck_cache(t *testing.T) { - dir, err := ioutil.TempDir("", "checkpoint") - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := &CheckResponse{ - CurrentVersion: "1.0.0", - CurrentReleaseDate: 1460459932, // 2016-04-12 11:18:52 - CurrentDownloadURL: "https://test-app.used-for-testing", - CurrentChangelogURL: "https://test-app.used-for-testing", - ProjectWebsite: "https://test-app.used-for-testing", - Outdated: false, - Alerts: nil, - } - - var actual *CheckResponse - for i := 0; i < 5; i++ { - var err error - actual, err = Check(&CheckParams{ - Product: "test-app", - Version: "1.0.0", - CacheFile: filepath.Join(dir, "cache"), - }) - if err != nil { - t.Fatalf("err: %s", err) - } - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v %#v", actual, expected) - } -} - -func TestCheck_cacheNested(t *testing.T) { - dir, err := ioutil.TempDir("", "checkpoint") - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := &CheckResponse{ - CurrentVersion: "1.0.0", - CurrentReleaseDate: 1460459932, // 2016-04-12 11:18:52 - CurrentDownloadURL: "https://test-app.used-for-testing", - CurrentChangelogURL: "https://test-app.used-for-testing", - ProjectWebsite: "https://test-app.used-for-testing", - Outdated: false, - Alerts: nil, - } - - var actual *CheckResponse - for i := 0; i < 5; i++ { - var err error - actual, err = Check(&CheckParams{ - Product: "test-app", - Version: "1.0.0", - CacheFile: filepath.Join(dir, "nested", "cache"), - }) - if err != nil { - t.Fatalf("err: %s", err) - } - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v", actual) - } -} - -func TestCheckInterval(t *testing.T) { - expected := &CheckResponse{ - CurrentVersion: "1.0.0", - CurrentReleaseDate: 1460459932, // 2016-04-12 11:18:52 - CurrentDownloadURL: "https://test-app.used-for-testing", - CurrentChangelogURL: "https://test-app.used-for-testing", - ProjectWebsite: "https://test-app.used-for-testing", - Outdated: false, - Alerts: nil, - } - - params := &CheckParams{ - Product: "test-app", - Version: "1.0.0", - } - - calledCh := make(chan struct{}) - checkFn := func(actual *CheckResponse, err error) { - defer close(calledCh) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v", actual) - } - } - - st := CheckInterval(params, 500*time.Millisecond, checkFn) - defer st.Stop() - - select { - case <-calledCh: - case <-time.After(time.Second): - t.Fatalf("timeout") - } -} - -func TestCheckInterval_disabled(t *testing.T) { - os.Setenv("CHECKPOINT_DISABLE", "1") - defer os.Setenv("CHECKPOINT_DISABLE", "") - - params := &CheckParams{ - Product: "test-app", - Version: "1.0.0", - } - - calledCh := make(chan struct{}) - checkFn := func(actual *CheckResponse, err error) { - defer close(calledCh) - } - - st := CheckInterval(params, 500*time.Millisecond, checkFn) - defer st.Stop() - - select { - case <-calledCh: - t.Fatal("expected callback to not invoke") - case <-time.After(time.Second): - } -} - -func TestCheckInterval_immediate(t *testing.T) { - expected := &CheckResponse{ - CurrentVersion: "1.0.0", - CurrentReleaseDate: 1460459932, // 2016-04-12 11:18:52 - CurrentDownloadURL: "https://test-app.used-for-testing", - CurrentChangelogURL: "https://test-app.used-for-testing", - ProjectWebsite: "https://test-app.used-for-testing", - Outdated: false, - Alerts: nil, - } - - params := &CheckParams{ - Product: "test-app", - Version: "1.0.0", - } - - calledCh := make(chan struct{}) - checkFn := func(actual *CheckResponse, err error) { - defer close(calledCh) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v", actual) - } - } - - st := CheckInterval(params, 500*time.Second, checkFn) - defer st.Stop() - - select { - case <-calledCh: - case <-time.After(time.Second): - t.Fatalf("timeout") - } -} - -func TestRandomStagger(t *testing.T) { - intv := 24 * time.Hour - min := 18 * time.Hour - max := 30 * time.Hour - for i := 0; i < 1000; i++ { - out := randomStagger(intv) - if out < min || out > max { - t.Fatalf("bad: %v", out) - } - } -} diff --git a/vendor/github.com/weaveworks/go-checkpoint/circle.yml b/vendor/github.com/weaveworks/go-checkpoint/circle.yml deleted file mode 100644 index 497e52eb21..0000000000 --- a/vendor/github.com/weaveworks/go-checkpoint/circle.yml +++ /dev/null @@ -1,13 +0,0 @@ -machine: - services: - - docker - -dependencies: - override: - - git submodule update --init --recursive - -test: - override: - - make RM= lint - - make - - make test diff --git a/vendor/manifest b/vendor/manifest index efde051d6e..d411849ce2 100644 --- a/vendor/manifest +++ b/vendor/manifest @@ -2002,13 +2002,6 @@ "path": "/pkg/mflag", "notests": true }, - { - "importpath": "github.com/weaveworks/go-checkpoint", - "repository": "https://github.com/weaveworks/go-checkpoint", - "vcs": "", - "revision": "62324982ab514860761ec81e618664580513ffad", - "branch": "master" - }, { "importpath": "github.com/weaveworks/go-odp/odp", "repository": "https://github.com/weaveworks/go-odp", From 06b64846e2bb8eade6db41dc956e514024d71271 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Tue, 15 Jan 2019 15:58:05 +0530 Subject: [PATCH 33/45] Allow filtering controls on basis of user kind (#153) * Add support to disable admin controls This commit will categorize the controls into two types:- 1. Admin Controls (exec, scaleup, scaledown etc.) 2. Read only Controls (logs, describe, attach) This will add a new flag i.e disableAdminControls by default, teh value for the above flag will be false, if value is true, all the admin controls will be disabled. Signed-off-by: Akash Srivastava * Read user kind header and filter the controls This commit will read the header "x-api-user-kind" from request and check if it is "readAdmin" or not. If it is the readAdmin, then it will filter all the adminControls else it will provide all the controls. Signed-off-by: Akash Srivastava --- app/api_topology.go | 9 ++++- probe/awsecs/reporter.go | 18 +++++---- probe/docker/reporter.go | 72 ++++++++++++++++++++---------------- probe/host/reporter.go | 7 ++-- probe/kubernetes/reporter.go | 66 ++++++++++++++++++--------------- probe/probe.go | 26 ++++++++----- probe/probe_internal_test.go | 4 +- prog/main.go | 2 + prog/probe.go | 4 +- render/detailed/node.go | 47 ++++++++++++++++++----- report/controls.go | 12 ++++++ report/map_keys.go | 11 ++++++ 12 files changed, 181 insertions(+), 97 deletions(-) diff --git a/app/api_topology.go b/app/api_topology.go index 9a48ada0f4..337718b2f7 100644 --- a/app/api_topology.go +++ b/app/api_topology.go @@ -75,8 +75,13 @@ func handleNode(ctx context.Context, renderer render.Renderer, transformer rende nodes.Nodes[nodeID] = node nodes.Filtered-- } - rawNode := detailed.MakeNode(topologyID, rc, nodes.Nodes, node) - respondWith(w, http.StatusOK, APINode{Node: detailed.CensorNode(rawNode, censorCfg)}) + if r.Header.Get(report.UserKindHeader) == report.ReadAdminUSer { + rawNode := detailed.MakeNodeWithReadOnlyControls(topologyID, r.Header.Get(report.UserKindHeader), rc, nodes.Nodes, node) + respondWith(w, http.StatusOK, APINode{Node: detailed.CensorNode(rawNode, censorCfg)}) + } else { + rawNode := detailed.MakeNode(topologyID, rc, nodes.Nodes, node) + respondWith(w, http.StatusOK, APINode{Node: detailed.CensorNode(rawNode, censorCfg)}) + } } // Websocket for the full topology. diff --git a/probe/awsecs/reporter.go b/probe/awsecs/reporter.go index b080f45116..f827efa8bc 100644 --- a/probe/awsecs/reporter.go +++ b/probe/awsecs/reporter.go @@ -211,16 +211,18 @@ func (Reporter) Report() (report.Report, error) { serviceTopology := report.MakeTopology().WithMetadataTemplates(serviceMetadata) serviceTopology.Controls.AddControls([]report.Control{ { - ID: ScaleDown, - Human: "Scale down", - Icon: "fa fa-minus", - Rank: 0, + ID: ScaleDown, + Human: "Scale down", + Category: report.AdminControl, + Icon: "fa fa-minus", + Rank: 0, }, { - ID: ScaleUp, - Human: "Scale up", - Icon: "fa fa-plus", - Rank: 1, + ID: ScaleUp, + Human: "Scale up", + Category: report.AdminControl, + Icon: "fa fa-plus", + Rank: 1, }, }) result.ECSService = result.ECSService.Merge(serviceTopology) diff --git a/probe/docker/reporter.go b/probe/docker/reporter.go index be7345b623..62cb3048d4 100644 --- a/probe/docker/reporter.go +++ b/probe/docker/reporter.go @@ -91,52 +91,60 @@ var ( ContainerControls = []report.Control{ { - ID: AttachContainer, - Human: "Attach", - Icon: "fa fa-desktop", - Rank: 1, + ID: AttachContainer, + Human: "Attach", + Category: report.ReadOnlyControl, + Icon: "fa fa-desktop", + Rank: 1, }, { - ID: ExecContainer, - Human: "Exec shell", - Icon: "fa fa-terminal", - Rank: 2, + ID: ExecContainer, + Human: "Exec shell", + Category: report.AdminControl, + Icon: "fa fa-terminal", + Rank: 2, }, { - ID: StartContainer, - Human: "Start", - Icon: "fa fa-play", - Rank: 3, + ID: StartContainer, + Human: "Start", + Category: report.AdminControl, + Icon: "fa fa-play", + Rank: 3, }, { - ID: RestartContainer, - Human: "Restart", - Icon: "fa fa-redo", - Rank: 4, + ID: RestartContainer, + Human: "Restart", + Category: report.AdminControl, + Icon: "fa fa-redo", + Rank: 4, }, { - ID: PauseContainer, - Human: "Pause", - Icon: "fa fa-pause", - Rank: 5, + ID: PauseContainer, + Human: "Pause", + Category: report.AdminControl, + Icon: "fa fa-pause", + Rank: 5, }, { - ID: UnpauseContainer, - Human: "Unpause", - Icon: "fa fa-play", - Rank: 6, + ID: UnpauseContainer, + Human: "Unpause", + Category: report.AdminControl, + Icon: "fa fa-play", + Rank: 6, }, { - ID: StopContainer, - Human: "Stop", - Icon: "fa fa-stop", - Rank: 7, + ID: StopContainer, + Human: "Stop", + Category: report.AdminControl, + Icon: "fa fa-stop", + Rank: 7, }, { - ID: RemoveContainer, - Human: "Remove", - Icon: "far fa-trash-alt", - Rank: 8, + ID: RemoveContainer, + Human: "Remove", + Category: report.AdminControl, + Icon: "far fa-trash-alt", + Rank: 8, }, } diff --git a/probe/host/reporter.go b/probe/host/reporter.go index fd9502ea4c..531d058f3e 100644 --- a/probe/host/reporter.go +++ b/probe/host/reporter.go @@ -142,9 +142,10 @@ func (r *Reporter) Report() (report.Report, error) { ) rep.Host.Controls.AddControl(report.Control{ - ID: ExecHost, - Human: "Exec shell", - Icon: "fa fa-terminal", + ID: ExecHost, + Human: "Exec shell", + Category: report.AdminControl, + Icon: "fa fa-terminal", }) return rep, nil diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index c956df53ac..34c6dec965 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -200,7 +200,7 @@ var ( } JobMetricTemplates = PodMetricTemplates - + DiskMetadataTemplates = report.MetadataTemplates{ NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, Model: {ID: Model, Label: "Model", From: report.FromLatest, Priority: 2}, @@ -258,24 +258,27 @@ var ( ScalingControls = []report.Control{ { - ID: ScaleDown, - Human: "Scale down", - Icon: "fa fa-minus", - Rank: 0, + ID: ScaleDown, + Human: "Scale down", + Category: report.AdminControl, + Icon: "fa fa-minus", + Rank: 0, }, { - ID: ScaleUp, - Human: "Scale up", - Icon: "fa fa-plus", - Rank: 1, + ID: ScaleUp, + Human: "Scale up", + Category: report.AdminControl, + Icon: "fa fa-plus", + Rank: 1, }, } DescribeControl = report.Control{ - ID: Describe, - Human: "Describe", - Icon: "fa fa-file-text", - Rank: 2, + ID: Describe, + Human: "Describe", + Category: report.ReadOnlyControl, + Icon: "fa fa-file-text", + Rank: 2, } ) @@ -591,10 +594,11 @@ func (r *Reporter) persistentVolumeClaimTopology() (report.Topology, []Persisten WithMetadataTemplates(PersistentVolumeClaimMetadataTemplates). WithTableTemplates(TableTemplates) result.Controls.AddControl(report.Control{ - ID: CreateVolumeSnapshot, - Human: "Create snapshot", - Icon: "fa fa-camera", - Rank: 0, + ID: CreateVolumeSnapshot, + Human: "Create snapshot", + Category: report.AdminControl, + Icon: "fa fa-camera", + Rank: 0, }) result.Controls.AddControl(DescribeControl) err := r.client.WalkPersistentVolumeClaims(func(p PersistentVolumeClaim) error { @@ -625,16 +629,18 @@ func (r *Reporter) volumeSnapshotTopology() (report.Topology, []VolumeSnapshot, WithMetadataTemplates(VolumeSnapshotMetadataTemplates). WithTableTemplates(TableTemplates) result.Controls.AddControl(report.Control{ - ID: CloneVolumeSnapshot, - Human: "Clone snapshot", - Icon: "far fa-clone", - Rank: 0, + ID: CloneVolumeSnapshot, + Human: "Clone snapshot", + Category: report.AdminControl, + Icon: "far fa-clone", + Rank: 0, }) result.Controls.AddControl(report.Control{ - ID: DeleteVolumeSnapshot, - Human: "Delete", - Icon: "far fa-trash-alt", - Rank: 1, + ID: DeleteVolumeSnapshot, + Human: "Delete", + Category: report.AdminControl, + Icon: "far fa-trash-alt", + Rank: 1, }) result.Controls.AddControl(DescribeControl) err := r.client.WalkVolumeSnapshots(func(p VolumeSnapshot) error { @@ -763,14 +769,16 @@ func (r *Reporter) podTopology(services []Service, deployments []Deployment, dae selectors = []func(labelledChild){} ) pods.Controls.AddControl(report.Control{ - ID: GetLogs, - Human: "Get logs", - Icon: "fa fa-desktop", - Rank: 0, + ID: GetLogs, + Human: "Get logs", + Category: report.ReadOnlyControl, + Icon: "fa fa-desktop", + Rank: 0, }) pods.Controls.AddControl(report.Control{ ID: DeletePod, Human: "Delete", + Category: report.AdminControl, Icon: "far fa-trash-alt", Confirmation: "Are you sure you want to delete this pod?", Rank: 3, diff --git a/probe/probe.go b/probe/probe.go index 415e2f0e95..25d4a9fbb8 100644 --- a/probe/probe.go +++ b/probe/probe.go @@ -5,7 +5,7 @@ import ( "sync" "time" - "github.com/armon/go-metrics" + metrics "github.com/armon/go-metrics" log "github.com/sirupsen/logrus" "golang.org/x/time/rate" @@ -28,6 +28,7 @@ type Probe struct { publisher ReportPublisher rateLimiter *rate.Limiter noControls bool + disableAdminControls bool tickers []Ticker reporters []Reporter @@ -78,16 +79,18 @@ func New( spyInterval, publishInterval time.Duration, publisher ReportPublisher, noControls bool, + disableAdminControls bool, ) *Probe { result := &Probe{ - spyInterval: spyInterval, - publishInterval: publishInterval, - publisher: publisher, - rateLimiter: rate.NewLimiter(rate.Every(publishInterval/100), 1), - noControls: noControls, - quit: make(chan struct{}), - spiedReports: make(chan report.Report, spiedReportBufferSize), - shortcutReports: make(chan report.Report, shortcutReportBufferSize), + spyInterval: spyInterval, + publishInterval: publishInterval, + publisher: publisher, + rateLimiter: rate.NewLimiter(rate.Every(publishInterval/100), 1), + noControls: noControls, + disableAdminControls: disableAdminControls, + quit: make(chan struct{}), + spiedReports: make(chan report.Report, spiedReportBufferSize), + shortcutReports: make(chan report.Report, shortcutReportBufferSize), } return result } @@ -218,6 +221,11 @@ ForLoop: t.Controls = report.Controls{} }) } + if p.disableAdminControls { + rpt.WalkTopologies(func(t *report.Topology) { + t.Controls = t.Controls.DisableAdminControls() + }) + } if err := p.publisher.Publish(rpt); err != nil { log.Infof("Publish: %v", err) } diff --git a/probe/probe_internal_test.go b/probe/probe_internal_test.go index adc5cd143f..81e145f645 100644 --- a/probe/probe_internal_test.go +++ b/probe/probe_internal_test.go @@ -16,7 +16,7 @@ func TestApply(t *testing.T) { endpointNode = report.MakeNodeWith(endpointNodeID, map[string]string{"5": "6"}) ) - p := New(0, 0, nil, false) + p := New(0, 0, nil, false, false) p.AddTagger(NewTopologyTagger()) r := report.MakeReport() @@ -79,7 +79,7 @@ func TestProbe(t *testing.T) { pub := mockPublisher{make(chan report.Report, 10)} - p := New(10*time.Millisecond, 100*time.Millisecond, pub, false) + p := New(10*time.Millisecond, 100*time.Millisecond, pub, false, false) p.AddReporter(mockReporter{want}) p.Start() defer p.Stop() diff --git a/prog/main.go b/prog/main.go index fb159ffb6d..08ae363fb7 100644 --- a/prog/main.go +++ b/prog/main.go @@ -106,6 +106,7 @@ type probeFlags struct { resolver string noApp bool noControls bool + disableAdminControls bool noCommandLineArguments bool noEnvironmentVariables bool @@ -285,6 +286,7 @@ func setupFlags(flags *flags) { flag.DurationVar(&flags.probe.spyInterval, "probe.spy.interval", time.Second, "spy (scan) interval") flag.StringVar(&flags.probe.pluginsRoot, "probe.plugins.root", "/var/run/scope/plugins", "Root directory to search for plugins") flag.BoolVar(&flags.probe.noControls, "probe.no-controls", false, "Disable controls (e.g. start/stop containers, terminals, logs ...)") + flag.BoolVar(&flags.probe.disableAdminControls, "probe.disable-admin-controls", false, "Disable controls (e.g. start/stop containers, terminals)") flag.BoolVar(&flags.probe.noCommandLineArguments, "probe.omit.cmd-args", false, "Disable collection of command-line arguments") flag.BoolVar(&flags.probe.noEnvironmentVariables, "probe.omit.env-vars", true, "Disable collection of environment variables") diff --git a/prog/probe.go b/prog/probe.go index 2dddae2e11..440fea7500 100644 --- a/prog/probe.go +++ b/prog/probe.go @@ -12,7 +12,7 @@ import ( "strconv" "time" - "github.com/armon/go-metrics" + metrics "github.com/armon/go-metrics" "github.com/prometheus/client_golang/prometheus" log "github.com/sirupsen/logrus" @@ -192,7 +192,7 @@ func probeMain(flags probeFlags, targets []appclient.Target) { clients = multiClients } - p := probe.New(flags.spyInterval, flags.publishInterval, clients, flags.noControls) + p := probe.New(flags.spyInterval, flags.publishInterval, clients, flags.noControls, flags.disableAdminControls) p.AddTagger(probe.NewTopologyTagger()) var processCache *process.CachingWalker diff --git a/render/detailed/node.go b/render/detailed/node.go index 629e9a295a..c626efb63d 100644 --- a/render/detailed/node.go +++ b/render/detailed/node.go @@ -93,7 +93,7 @@ func MakeNode(topologyID string, rc RenderContext, ns report.Nodes, n report.Nod summary, _ := MakeNodeSummary(rc, n) return Node{ NodeSummary: summary, - Controls: controls(rc.Report, n), + Controls: controls(rc.Report, n, ""), Children: children(rc, n), Connections: []ConnectionsSummary{ incomingConnectionsSummary(topologyID, rc.Report, n, ns), @@ -102,7 +102,22 @@ func MakeNode(topologyID string, rc RenderContext, ns report.Nodes, n report.Nod } } -func controlsFor(topology report.Topology, nodeID string) []ControlInstance { +// MakeNodeWithReadOnlyControls transforms a renderable node to a detailed node. It uses +// aggregate metadata, plus the set of origin node IDs, to produce tables. +func MakeNodeWithReadOnlyControls(topologyID, userKind string, rc RenderContext, ns report.Nodes, n report.Node) Node { + summary, _ := MakeNodeSummary(rc, n) + return Node{ + NodeSummary: summary, + Controls: controls(rc.Report, n, userKind), + Children: children(rc, n), + Connections: []ConnectionsSummary{ + incomingConnectionsSummary(topologyID, rc.Report, n, ns), + outgoingConnectionsSummary(topologyID, rc.Report, n, ns), + }, + } +} + +func controlsFor(topology report.Topology, nodeID, userKind string) []ControlInstance { result := []ControlInstance{} node, ok := topology.Nodes[nodeID] if !ok { @@ -116,20 +131,32 @@ func controlsFor(topology report.Topology, nodeID string) []ControlInstance { if data.Dead { return } - if control, ok := topology.Controls[controlID]; ok { - result = append(result, ControlInstance{ - ProbeID: probeID, - NodeID: nodeID, - Control: control, - }) + if userKind == report.ReadAdminUSer { + if control, ok := topology.Controls[controlID]; ok { + if control.Category == report.ReadOnlyControl { + result = append(result, ControlInstance{ + ProbeID: probeID, + NodeID: nodeID, + Control: control, + }) + } + } + } else { + if control, ok := topology.Controls[controlID]; ok { + result = append(result, ControlInstance{ + ProbeID: probeID, + NodeID: nodeID, + Control: control, + }) + } } }) return result } -func controls(r report.Report, n report.Node) []ControlInstance { +func controls(r report.Report, n report.Node, userKind string) []ControlInstance { if t, ok := r.Topology(n.Topology); ok { - return controlsFor(t, n.ID) + return controlsFor(t, n.ID, userKind) } return []ControlInstance{} } diff --git a/report/controls.go b/report/controls.go index dcf5cb3a63..b61722b0de 100644 --- a/report/controls.go +++ b/report/controls.go @@ -14,6 +14,7 @@ type Controls map[string]Control type Control struct { ID string `json:"id"` Human string `json:"human"` + Category string `json:"category"` Icon string `json:"icon"` // from https://fortawesome.github.io/Font-Awesome/cheatsheet/ please Confirmation string `json:"confirmation,omitempty"` Rank int `json:"rank"` @@ -58,6 +59,17 @@ func (cs Controls) AddControls(controls []Control) { } } +// DisableAdminControls will remove all the admin controls +func (cs Controls) DisableAdminControls() Controls { + result := Controls{} + for k, v := range cs { + if v.Category != AdminControl { + result[k] = v + } + } + return result +} + // NodeControls represent the individual controls that are valid for a given // node at a given point in time. It's immutable. A zero-value for Timestamp // indicated this NodeControls is 'not set'. diff --git a/report/map_keys.go b/report/map_keys.go index eebcede171..bb8744a334 100644 --- a/report/map_keys.go +++ b/report/map_keys.go @@ -12,6 +12,11 @@ const ( PPID = "ppid" Cmdline = "cmdline" Threads = "threads" + + // Controls + AdminControl = "admin_control" + ReadOnlyControl = "read_only_control" + // probe/docker DockerContainerID = "docker_container_id" DockerImageID = "docker_image_id" @@ -130,6 +135,12 @@ const ( ECSScaleDown = "ecs_scale_down" ) +// User kind keys +const ( + UserKindHeader = "x-api-user-kind" + ReadAdminUSer = "readAdmin" +) + /* Lookup table to allow msgpack/json decoder to avoid heap allocation for common ps.Map keys. The map is static so we don't have to lock access from multiple threads and don't have to worry about it From 82bdd6eba032d2743e0d898bd9092382456f6ae2 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Fri, 21 Jun 2019 18:54:07 +0530 Subject: [PATCH 34/45] Add Block Device support (#162) * Update openebs clientset to include block device Signed-off-by: Akash Srivastava * Update CSP spec to incorporate changes from 0.9 and 1.0 - In 0.9, CSP spec has DiskList but in 1.0 CSP spec has BlockDeviceGroup To support both add DiskList and Group in CSP spec and update the clientset of the same. Signed-off-by: Akash Srivastava * Add Block Device support This commit will :- - Visualize Block Device (shape similar to Disk) - Add Adjacency between BlockDevice and Disk - Add Adjacency between CSP and BlockDevice only if CSP has block device list(1.0) otherwise add the adjacency between CSP and Disk(0.9) Signed-off-by: Akash Srivastava * Add describe control on block device This commit will:- - Add GetBlockDeviceList method to CSP interface. - Add CaptureBlockDevice method which will be used to fetch the name and namespace of selected Block Device. - Add entry of block device in the switch case. Signed-off-by: Akash Srivastava --- probe/kubernetes/blockdevice.go | 41 +++ probe/kubernetes/client.go | 15 + probe/kubernetes/controls.go | 212 ++++++++++++++ probe/kubernetes/cstor_storage_pool.go | 40 ++- probe/kubernetes/cstor_volume.go | 12 +- probe/kubernetes/cstor_volume_replica.go | 12 +- probe/kubernetes/disk.go | 11 +- probe/kubernetes/reporter.go | 47 +++- probe/kubernetes/reporter_test.go | 3 + probe/kubernetes/storagepoolclaim.go | 15 +- render/detailed/node.go | 7 + render/detailed/summary.go | 8 + render/filters.go | 2 + render/persistentvolume.go | 3 +- render/selectors.go | 1 + render/storagerenderer.go | 84 ++++-- report/id.go | 6 + report/map_keys.go | 3 + report/report.go | 12 + .../apis/openebs.io/v1alpha1/block_device.go | 93 ++++++ .../apis/openebs.io/v1alpha1/cstor_pool.go | 43 ++- .../pkg/apis/openebs.io/v1alpha1/register.go | 4 +- .../apis/openebs.io/v1alpha1/storage_pool.go | 17 +- .../openebs.io/v1alpha1/storage_pool_claim.go | 23 +- .../v1alpha1/zz_generated.deepcopy.go | 264 +++++++++++++++++- .../client/clientset/versioned/clientset.go | 2 +- .../pkg/client/clientset/versioned/doc.go | 2 +- .../versioned/fake/clientset_generated.go | 2 +- .../client/clientset/versioned/fake/doc.go | 2 +- .../clientset/versioned/fake/register.go | 2 +- .../client/clientset/versioned/scheme/doc.go | 2 +- .../clientset/versioned/scheme/register.go | 2 +- .../typed/openebs.io/v1alpha1/blockdevice.go | 164 +++++++++++ .../typed/openebs.io/v1alpha1/castemplate.go | 19 +- .../typed/openebs.io/v1alpha1/cstorpool.go | 19 +- .../typed/openebs.io/v1alpha1/cstorvolume.go | 19 +- .../openebs.io/v1alpha1/cstorvolumereplica.go | 19 +- .../typed/openebs.io/v1alpha1/disk.go | 19 +- .../typed/openebs.io/v1alpha1/doc.go | 2 +- .../typed/openebs.io/v1alpha1/fake/doc.go | 2 +- .../v1alpha1/fake/fake_blockdevice.go | 120 ++++++++ .../v1alpha1/fake/fake_castemplate.go | 2 +- .../v1alpha1/fake/fake_cstorpool.go | 2 +- .../v1alpha1/fake/fake_cstorvolume.go | 2 +- .../v1alpha1/fake/fake_cstorvolumereplica.go | 2 +- .../openebs.io/v1alpha1/fake/fake_disk.go | 2 +- .../v1alpha1/fake/fake_openebs.io_client.go | 6 +- .../openebs.io/v1alpha1/fake/fake_runtask.go | 2 +- .../v1alpha1/fake/fake_storagepool.go | 2 +- .../v1alpha1/fake/fake_storagepoolclaim.go | 2 +- .../v1alpha1/generated_expansion.go | 4 +- .../openebs.io/v1alpha1/openebs.io_client.go | 7 +- .../typed/openebs.io/v1alpha1/runtask.go | 19 +- .../typed/openebs.io/v1alpha1/storagepool.go | 19 +- .../openebs.io/v1alpha1/storagepoolclaim.go | 19 +- .../informers/externalversions/factory.go | 2 +- .../informers/externalversions/generic.go | 4 +- .../internalinterfaces/factory_interfaces.go | 2 +- .../externalversions/openebs.io/interface.go | 2 +- .../openebs.io/v1alpha1/blockdevice.go | 88 ++++++ .../openebs.io/v1alpha1/castemplate.go | 2 +- .../openebs.io/v1alpha1/cstorpool.go | 2 +- .../openebs.io/v1alpha1/cstorvolume.go | 2 +- .../openebs.io/v1alpha1/cstorvolumereplica.go | 2 +- .../openebs.io/v1alpha1/disk.go | 2 +- .../openebs.io/v1alpha1/interface.go | 9 +- .../openebs.io/v1alpha1/runtask.go | 2 +- .../openebs.io/v1alpha1/storagepool.go | 2 +- .../openebs.io/v1alpha1/storagepoolclaim.go | 2 +- .../openebs.io/v1alpha1/blockdevice.go | 65 +++++ .../openebs.io/v1alpha1/castemplate.go | 2 +- .../listers/openebs.io/v1alpha1/cstorpool.go | 2 +- .../openebs.io/v1alpha1/cstorvolume.go | 2 +- .../openebs.io/v1alpha1/cstorvolumereplica.go | 2 +- .../listers/openebs.io/v1alpha1/disk.go | 2 +- .../v1alpha1/expansion_generated.go | 6 +- .../listers/openebs.io/v1alpha1/runtask.go | 2 +- .../openebs.io/v1alpha1/storagepool.go | 2 +- .../openebs.io/v1alpha1/storagepoolclaim.go | 2 +- 79 files changed, 1544 insertions(+), 131 deletions(-) create mode 100644 probe/kubernetes/blockdevice.go create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdevice.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdevice.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdevice.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdevice.go diff --git a/probe/kubernetes/blockdevice.go b/probe/kubernetes/blockdevice.go new file mode 100644 index 0000000000..c9a91725dd --- /dev/null +++ b/probe/kubernetes/blockdevice.go @@ -0,0 +1,41 @@ +package kubernetes + +import ( + "strconv" + + mayav1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "github.com/weaveworks/scope/report" +) + +// BlockDevice represent NDM BlockDevice interface +type BlockDevice interface { + Meta + GetNode(probeID string) report.Node +} + +// blockDevice represents NDM blockDevices +type blockDevice struct { + *mayav1alpha1.BlockDevice + Meta +} + +// NewBlockDevice returns new block device type +func NewBlockDevice(b *mayav1alpha1.BlockDevice) BlockDevice { + return &blockDevice{BlockDevice: b, Meta: meta{b.ObjectMeta}} +} + +// GetNode returns Block Device as Node +func (b *blockDevice) GetNode(probeID string) report.Node { + return b.MetaNode(report.MakeBlockDeviceNodeID(b.UID())).WithLatests(map[string]string{ + NodeType: "Block Device", + LogicalSectorSize: strconv.Itoa(int(b.Spec.Capacity.LogicalSectorSize)), + Storage: strconv.Itoa(int(b.Spec.Capacity.Storage / (1024 * 1024 * 1024))), + FirmwareRevision: b.Spec.Details.FirmwareRevision, + Model: b.Spec.Details.Model, + Serial: b.Spec.Details.Serial, + Vendor: b.Spec.Details.Vendor, + HostName: b.GetLabels()["kubernetes.io/hostname"], + Path: b.Spec.Path, + report.ControlProbeID: probeID, + }).WithLatestActiveControls(Describe) +} diff --git a/probe/kubernetes/client.go b/probe/kubernetes/client.go index 5d3aed36ca..85ab10fe83 100644 --- a/probe/kubernetes/client.go +++ b/probe/kubernetes/client.go @@ -65,6 +65,7 @@ type Client interface { WalkCStorVolumes(f func(CStorVolume) error) error WalkCStorVolumeReplicas(f func(CStorVolumeReplica) error) error WalkCStorPools(f func(CStorPool) error) error + WalkBlockDevices(f func(BlockDevice) error) error WatchPods(f func(Event, Pod)) CloneVolumeSnapshot(namespaceID, volumeSnapshotID, persistentVolumeClaimID, capacity string) error @@ -116,6 +117,7 @@ type client struct { cStorvolumeStore cache.Store cStorvolumeReplicaStore cache.Store cStorPoolStore cache.Store + blockDeviceStore cache.Store podWatchesMutex sync.Mutex podWatches []func(Event, Pod) @@ -222,6 +224,7 @@ func NewClient(config ClientConfig) (Client, error) { result.cStorvolumeStore = result.setupStore("cstorvolumes") result.cStorvolumeReplicaStore = result.setupStore("cstorvolumereplicas") result.cStorPoolStore = result.setupStore("cstorpools") + result.blockDeviceStore = result.setupStore("blockdevices") return result, nil } @@ -288,6 +291,8 @@ func (c *client) clientAndType(resource string) (rest.Interface, interface{}, er return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.CStorVolumeReplica{}, nil case "cstorpools": return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.CStorPool{}, nil + case "blockdevices": + return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.BlockDevice{}, nil case "cronjobs": ok, err := c.isResourceSupported(c.client.BatchV1beta1().RESTClient().APIVersion(), resource) if err != nil { @@ -512,6 +517,16 @@ func (c *client) WalkDisks(f func(Disk) error) error { return nil } +func (c *client) WalkBlockDevices(f func(BlockDevice) error) error { + for _, m := range c.blockDeviceStore.List() { + blockDevice := m.(*mayav1alpha1.BlockDevice) + if err := f(NewBlockDevice(blockDevice)); err != nil { + return err + } + } + return nil +} + func (c *client) WalkStoragePoolClaims(f func(StoragePoolClaim) error) error { for _, m := range c.storagePoolClaimStore.List() { spc := m.(*mayav1alpha1.StoragePoolClaim) diff --git a/probe/kubernetes/controls.go b/probe/kubernetes/controls.go index 71d4f1c93a..96e79f022a 100644 --- a/probe/kubernetes/controls.go +++ b/probe/kubernetes/controls.go @@ -27,6 +27,8 @@ const ( const ( SnapshotGroupName = "volumesnapshot.external-storage.k8s.io" SnapshotVersion = "v1" + OpenEBSGroupName = "openebs.io" + OpenEBSVersion = "v1alpha1" ) // GetLogs is the control to get the logs for a kubernetes pod @@ -117,6 +119,72 @@ func (r *Reporter) describeVolumeSnapshotData(req xfer.Request, volumeSnapshotID return r.describe(req, "", volumeSnapshotID, schema.GroupKind{}, restMapping) } +func (r *Reporter) describeCV(req xfer.Request, namespaceID, CVID string) xfer.Response { + restMapping := apimeta.RESTMapping{ + Resource: schema.GroupVersionResource{ + Group: OpenEBSGroupName, + Version: OpenEBSVersion, + Resource: "cstorvolumes", + }, + } + return r.describe(req, namespaceID, CVID, schema.GroupKind{}, restMapping) +} + +func (r *Reporter) describeCVR(req xfer.Request, namespaceID, CVRID string) xfer.Response { + restMapping := apimeta.RESTMapping{ + Resource: schema.GroupVersionResource{ + Group: OpenEBSGroupName, + Version: OpenEBSVersion, + Resource: "cstorvolumereplicas", + }, + } + return r.describe(req, namespaceID, CVRID, schema.GroupKind{}, restMapping) +} + +func (r *Reporter) describeCSP(req xfer.Request, CSPID string) xfer.Response { + restMapping := apimeta.RESTMapping{ + Resource: schema.GroupVersionResource{ + Group: OpenEBSGroupName, + Version: OpenEBSVersion, + Resource: "cstorpools", + }, + } + return r.describe(req, "", CSPID, schema.GroupKind{}, restMapping) +} + +func (r *Reporter) describeSPC(req xfer.Request, SPCID string) xfer.Response { + restMapping := apimeta.RESTMapping{ + Resource: schema.GroupVersionResource{ + Group: OpenEBSGroupName, + Version: OpenEBSVersion, + Resource: "storagepoolclaims", + }, + } + return r.describe(req, "", SPCID, schema.GroupKind{}, restMapping) +} + +func (r *Reporter) describeDisk(req xfer.Request, diskID string) xfer.Response { + restMapping := apimeta.RESTMapping{ + Resource: schema.GroupVersionResource{ + Group: OpenEBSGroupName, + Version: OpenEBSVersion, + Resource: "disks", + }, + } + return r.describe(req, "", diskID, schema.GroupKind{}, restMapping) +} + +func (r *Reporter) describeBlockDevice(req xfer.Request, namespaceID, blockDeviceID string) xfer.Response { + restMapping := apimeta.RESTMapping{ + Resource: schema.GroupVersionResource{ + Group: OpenEBSGroupName, + Version: OpenEBSVersion, + Resource: "blockdevices", + }, + } + return r.describe(req, namespaceID, blockDeviceID, schema.GroupKind{}, restMapping) +} + // GetLogs is the control to get the logs for a kubernetes pod func (r *Reporter) describe(req xfer.Request, namespaceID, resourceID string, groupKind schema.GroupKind, restMapping apimeta.RESTMapping) xfer.Response { readCloser, err := r.client.Describe(namespaceID, resourceID, groupKind, restMapping) @@ -210,6 +278,18 @@ func (r *Reporter) Describe() func(xfer.Request) xfer.Response { f = r.CaptureVolumeSnapshotData(r.describeVolumeSnapshotData) case "": f = r.CaptureJob(r.describeJob) + case "": + f = r.CaptureCStorVolume(r.describeCV) + case "": + f = r.CaptureCStorVolumeReplica(r.describeCVR) + case "": + f = r.CaptureCStorPool(r.describeCSP) + case "": + f = r.CaptureStoragePoolClaim(r.describeSPC) + case "": + f = r.CaptureDisk(r.describeDisk) + case "": + f = r.CaptureBlockDevice(r.describeBlockDevice) default: return xfer.ResponseErrorf("Node not found: %s", req.NodeID) } @@ -474,6 +554,138 @@ func (r *Reporter) CaptureJob(f func(xfer.Request, string, string) xfer.Response } } +// CaptureCStorVolume will return name and namespace of cstor volume +func (r *Reporter) CaptureCStorVolume(f func(xfer.Request, string, string) xfer.Response) func(xfer.Request) xfer.Response { + return func(req xfer.Request) xfer.Response { + uid, ok := report.ParseCStorVolumeNodeID(req.NodeID) + if !ok { + return xfer.ResponseErrorf("Invalid ID: %s", req.NodeID) + } + // find cv by UID + var cstorVolume CStorVolume + r.client.WalkCStorVolumes(func(c CStorVolume) error { + if c.Name() == uid { + cstorVolume = c + } + return nil + }) + if cstorVolume == nil { + return xfer.ResponseErrorf("CStor volume not found: %s", uid) + } + return f(req, cstorVolume.Namespace(), cstorVolume.Name()) + } +} + +// CaptureCStorVolumeReplica will return name and namespace of cstor volume replica +func (r *Reporter) CaptureCStorVolumeReplica(f func(xfer.Request, string, string) xfer.Response) func(xfer.Request) xfer.Response { + return func(req xfer.Request) xfer.Response { + uid, ok := report.ParseCStorVolumeReplicaNodeID(req.NodeID) + if !ok { + return xfer.ResponseErrorf("Invalid ID: %s", req.NodeID) + } + // find cvr by UID + var cstorVolumeReplica CStorVolumeReplica + r.client.WalkCStorVolumeReplicas(func(c CStorVolumeReplica) error { + if c.UID() == uid { + cstorVolumeReplica = c + } + return nil + }) + if cstorVolumeReplica == nil { + return xfer.ResponseErrorf("CStor volume replica not found: %s", uid) + } + return f(req, cstorVolumeReplica.Namespace(), cstorVolumeReplica.Name()) + } +} + +// CaptureCStorPool will return name of cstor pool +func (r *Reporter) CaptureCStorPool(f func(xfer.Request, string) xfer.Response) func(xfer.Request) xfer.Response { + return func(req xfer.Request) xfer.Response { + uid, ok := report.ParseCStorPoolNodeID(req.NodeID) + if !ok { + return xfer.ResponseErrorf("Invalid ID: %s", req.NodeID) + } + // find csp by UID + var cstorPool CStorPool + r.client.WalkCStorPools(func(c CStorPool) error { + if c.UID() == uid { + cstorPool = c + } + return nil + }) + if cstorPool == nil { + return xfer.ResponseErrorf("CStor pool not found: %s", uid) + } + return f(req, cstorPool.Name()) + } +} + +// CaptureStoragePoolClaim will return name of spc +func (r *Reporter) CaptureStoragePoolClaim(f func(xfer.Request, string) xfer.Response) func(xfer.Request) xfer.Response { + return func(req xfer.Request) xfer.Response { + uid, ok := report.ParseStoragePoolClaimNodeID(req.NodeID) + if !ok { + return xfer.ResponseErrorf("Invalid ID: %s", req.NodeID) + } + // find spc by UID + var spc StoragePoolClaim + r.client.WalkStoragePoolClaims(func(s StoragePoolClaim) error { + if s.UID() == uid { + spc = s + } + return nil + }) + if spc == nil { + return xfer.ResponseErrorf("Storage pool claim not found: %s", uid) + } + return f(req, spc.Name()) + } +} + +// CaptureDisk will return name of disk +func (r *Reporter) CaptureDisk(f func(xfer.Request, string) xfer.Response) func(xfer.Request) xfer.Response { + return func(req xfer.Request) xfer.Response { + uid, ok := report.ParseDiskNodeID(req.NodeID) + if !ok { + return xfer.ResponseErrorf("Invalid ID: %s", req.NodeID) + } + // find disk by UID + var disk Disk + r.client.WalkDisks(func(d Disk) error { + if d.UID() == uid { + disk = d + } + return nil + }) + if disk == nil { + return xfer.ResponseErrorf("Disk not found: %s", uid) + } + return f(req, disk.Name()) + } +} + +// CaptureBlockDevice will return name and namespace of block device +func (r *Reporter) CaptureBlockDevice(f func(xfer.Request, string, string) xfer.Response) func(xfer.Request) xfer.Response { + return func(req xfer.Request) xfer.Response { + uid, ok := report.ParseBlockDeviceNodeID(req.NodeID) + if !ok { + return xfer.ResponseErrorf("Invalid ID: %s", req.NodeID) + } + // find blockDevice by UID + var blockDevice BlockDevice + r.client.WalkBlockDevices(func(b BlockDevice) error { + if b.UID() == uid { + blockDevice = b + } + return nil + }) + if blockDevice == nil { + return xfer.ResponseErrorf("Block Device not found: %s", uid) + } + return f(req, blockDevice.Namespace(), blockDevice.Name()) + } +} + // ScaleUp is the control to scale up a deployment func (r *Reporter) ScaleUp(req xfer.Request, namespace, id string) xfer.Response { return xfer.ResponseError(r.client.ScaleUp(namespace, id)) diff --git a/probe/kubernetes/cstor_storage_pool.go b/probe/kubernetes/cstor_storage_pool.go index 659a9fb6fc..bdbef4d378 100644 --- a/probe/kubernetes/cstor_storage_pool.go +++ b/probe/kubernetes/cstor_storage_pool.go @@ -10,11 +10,13 @@ import ( // CStorPool interface type CStorPool interface { Meta - GetNode() report.Node + GetNode(probeID string) report.Node GetStatus() string GetNodeTagOnStatus(status string) string GetHost() string GetStoragePoolClaim() string + GetDiskList() string + GetBlockDeviceList() string } // cStorPool represents cStor Volume CSP @@ -29,14 +31,16 @@ func NewCStorPool(p *mayav1alpha1.CStorPool) CStorPool { } // GetNode returns updated node with CStor Volume details -func (p *cStorPool) GetNode() report.Node { +func (p *cStorPool) GetNode(probeID string) report.Node { status := p.GetStatus() latests := map[string]string{ - NodeType: "CStor Pool", - APIVersion: p.APIVersion, - DiskList: strings.Join(p.Spec.Disks.DiskList, "~p$"), - HostName: p.GetHost(), - StoragePoolClaimName: p.GetStoragePoolClaim(), + NodeType: "CStor Pool", + APIVersion: p.APIVersion, + DiskList: p.GetDiskList(), + BlockDeviceList: p.GetBlockDeviceList(), + HostName: p.GetHost(), + StoragePoolClaimName: p.GetStoragePoolClaim(), + report.ControlProbeID: probeID, } if status != "" { @@ -44,8 +48,28 @@ func (p *cStorPool) GetNode() report.Node { } return p.MetaNode(report.MakeCStorPoolNodeID(p.UID())). WithLatests(latests). - WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(status))) + WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(status))). + WithLatestActiveControls(Describe) +} + +func (p *cStorPool) GetDiskList() string { + if p.Spec.Disks.DiskList == nil { + return "" + } + return strings.Join(p.Spec.Disks.DiskList, report.ScopeDelim) +} +func (p *cStorPool) GetBlockDeviceList() string { + if p.Spec.Group == nil { + return "" + } + blockDeviceList := []string{} + for _, group := range p.Spec.Group { + for _, blockDevice := range group.Item { + blockDeviceList = append(blockDeviceList, blockDevice.Name) + } + } + return strings.Join(blockDeviceList, report.ScopeDelim) } func (p *cStorPool) GetStatus() string { diff --git a/probe/kubernetes/cstor_volume.go b/probe/kubernetes/cstor_volume.go index e1903ca4ba..6eb5b13661 100644 --- a/probe/kubernetes/cstor_volume.go +++ b/probe/kubernetes/cstor_volume.go @@ -11,7 +11,7 @@ import ( // CStorVolume interface type CStorVolume interface { Meta - GetNode() report.Node + GetNode(probeID string) report.Node GetPersistentVolumeName() string GetStatus() string GetNodeTagOnStatus(status string) string @@ -32,11 +32,12 @@ func NewCStorVolume(p *mayav1alpha1.CStorVolume) CStorVolume { } // GetNode returns updated node with CStor Volume details -func (p *cStorVolume) GetNode() report.Node { +func (p *cStorVolume) GetNode(probeID string) report.Node { status := p.GetStatus() latests := map[string]string{ - NodeType: "CStor Volume", - APIVersion: p.APIVersion, + NodeType: "CStor Volume", + APIVersion: p.APIVersion, + report.ControlProbeID: probeID, } if p.GetPersistentVolumeName() != "" { @@ -61,7 +62,8 @@ func (p *cStorVolume) GetNode() report.Node { return p.MetaNode(report.MakeCStorVolumeNodeID(p.Name())). WithLatests(latests). - WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(status))) + WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(status))). + WithLatestActiveControls(Describe) } func (p *cStorVolume) GetPersistentVolumeName() string { diff --git a/probe/kubernetes/cstor_volume_replica.go b/probe/kubernetes/cstor_volume_replica.go index 2e0ed98f76..876cd1e7a7 100644 --- a/probe/kubernetes/cstor_volume_replica.go +++ b/probe/kubernetes/cstor_volume_replica.go @@ -10,7 +10,7 @@ import ( // CStorVolumeReplica interface type CStorVolumeReplica interface { Meta - GetNode() report.Node + GetNode(probeID string) report.Node GetCStorVolume() string GetCStorPool() string GetStatus() string @@ -29,12 +29,13 @@ func NewCStorVolumeReplica(p *mayav1alpha1.CStorVolumeReplica) CStorVolumeReplic } // GetNode returns updated node with CStor Volume details -func (p *cStorVolumeReplica) GetNode() report.Node { +func (p *cStorVolumeReplica) GetNode(probeID string) report.Node { var cStorPoolNodeID string status := p.GetStatus() latests := map[string]string{ - NodeType: "CStor Volume Replica", - APIVersion: p.APIVersion, + NodeType: "CStor Volume Replica", + APIVersion: p.APIVersion, + report.ControlProbeID: probeID, } if p.GetCStorVolume() != "" { latests[CStorVolumeName] = p.GetCStorVolume() @@ -54,7 +55,8 @@ func (p *cStorVolumeReplica) GetNode() report.Node { return p.MetaNode(report.MakeCStorVolumeReplicaNodeID(p.UID())). WithLatests(latests). WithAdjacent(cStorPoolNodeID). - WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(status))) + WithNodeTag(p.GetNodeTagOnStatus(strings.ToLower(status))). + WithLatestActiveControls(Describe) } func (p *cStorVolumeReplica) GetCStorVolume() string { diff --git a/probe/kubernetes/disk.go b/probe/kubernetes/disk.go index dc4400c98a..35781fd25f 100644 --- a/probe/kubernetes/disk.go +++ b/probe/kubernetes/disk.go @@ -12,7 +12,7 @@ import ( // Disk represent NDM Disk interface type Disk interface { Meta - GetNode() report.Node + GetNode(probeID string) report.Node GetPath() []string GetNodeTagStatus(string) string } @@ -29,7 +29,7 @@ func NewDisk(p *maya1alpha1.Disk) Disk { } // GetNode returns Disk as Node -func (p *disk) GetNode() report.Node { +func (p *disk) GetNode(probeID string) report.Node { var diskStatus string diskStatus = p.Status.State @@ -44,7 +44,7 @@ func (p *disk) GetNode() report.Node { Serial: p.Spec.Details.Serial, Vendor: p.Spec.Details.Vendor, HostName: p.GetLabels()["kubernetes.io/hostname"], - DiskList: strings.Join(p.GetPath(), "~p$"), + DiskList: strings.Join(p.GetPath(), report.ScopeDelim), Status: diskStatus, CurrentTemperature: strconv.Itoa(int(p.Stats.TempInfo.CurrentTemperature)), HighestTemperature: strconv.Itoa(int(p.Stats.TempInfo.HighestTemperature)), @@ -54,11 +54,14 @@ func (p *disk) GetNode() report.Node { DeviceUtilizationRate: fmt.Sprintf("%.2f", p.Stats.DeviceUtilizationRate), PercentEnduranceUsed: fmt.Sprintf("%.2f", p.Stats.PercentEnduranceUsed), Created: p.ObjectMeta.CreationTimestamp.String(), + Path: p.Spec.Path, + report.ControlProbeID: probeID, } return p.MetaNode(report.MakeDiskNodeID(p.UID())). WithLatests(latests). - WithNodeTag(p.GetNodeTagStatus(diskStatus)) + WithNodeTag(p.GetNodeTagStatus(diskStatus)). + WithLatestActiveControls(Describe) } func (p *disk) GetPath() []string { diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index 34c6dec965..e6705066f2 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -24,6 +24,7 @@ const ( Type = report.KubernetesType Ports = report.KubernetesPorts VolumeClaim = report.KubernetesVolumeClaim + Storage = report.KubernetesStorage StorageClassName = report.KubernetesStorageClassName AccessModes = report.KubernetesAccessModes ReclaimPolicy = report.KubernetesReclaimPolicy @@ -66,6 +67,8 @@ const ( TotalBytesWritten = report.KubernetesTotalBytesWritten DeviceUtilizationRate = report.KubernetesDeviceUtilizationRate PercentEnduranceUsed = report.KubernetesPercentEnduranceUsed + BlockDeviceList = report.KubernetesBlockDeviceList + Path = report.KubernetesPath ) var ( @@ -222,6 +225,15 @@ var ( PercentEnduranceUsed: {ID: PercentEnduranceUsed, Label: "Percent Endurance Used", From: report.FromLatest, Priority: 18}, } + BlockDeviceMetadataTemplates = report.MetadataTemplates{ + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + Model: {ID: Model, Label: "Model", From: report.FromLatest, Priority: 2}, + Serial: {ID: Serial, Label: "Serial", From: report.FromLatest, Priority: 3}, + Vendor: {ID: Vendor, Label: "Vendor", From: report.FromLatest, Priority: 4}, + FirmwareRevision: {ID: FirmwareRevision, Label: "Firmware Revision", From: report.FromLatest, Priority: 5}, + LogicalSectorSize: {ID: LogicalSectorSize, Label: "Logical Sector Size", From: report.FromLatest, Priority: 6}, + } + StoragePoolClaimMetadataTemplates = report.MetadataTemplates{ NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, APIVersion: {ID: APIVersion, Label: "API Version", From: report.FromLatest, Priority: 2}, @@ -455,6 +467,11 @@ func (r *Reporter) Report() (report.Report, error) { return result, err } + blockDeviceTopology, _, err := r.blockDeviceTopology() + if err != nil { + return result, err + } + storagePoolClaimTopology, _, err := r.storagePoolClaimTopology() if err != nil { return result, err @@ -490,6 +507,7 @@ func (r *Reporter) Report() (report.Report, error) { result.CStorVolume = result.CStorVolume.Merge(cStorVolumeTopology) result.CStorVolumeReplica = result.CStorVolumeReplica.Merge(cStorVolumeReplicaTopology) result.CStorPool = result.CStorPool.Merge(cStorPoolTopology) + result.BlockDevice = result.BlockDevice.Merge(blockDeviceTopology) return result, nil } @@ -685,21 +703,37 @@ func (r *Reporter) diskTopology() (report.Topology, []Disk, error) { result := report.MakeTopology(). WithMetadataTemplates(DiskMetadataTemplates). WithTableTemplates(TableTemplates) + result.Controls.AddControl(DescribeControl) err := r.client.WalkDisks(func(p Disk) error { - result.AddNode(p.GetNode()) + result.AddNode(p.GetNode(r.probeID)) disks = append(disks, p) return nil }) return result, disks, err } +func (r *Reporter) blockDeviceTopology() (report.Topology, []BlockDevice, error) { + blockDevices := []BlockDevice{} + result := report.MakeTopology(). + WithMetadataTemplates(BlockDeviceMetadataTemplates). + WithTableTemplates(TableTemplates) + result.Controls.AddControl(DescribeControl) + err := r.client.WalkBlockDevices(func(p BlockDevice) error { + result.AddNode(p.GetNode(r.probeID)) + blockDevices = append(blockDevices, p) + return nil + }) + return result, blockDevices, err +} + func (r *Reporter) storagePoolClaimTopology() (report.Topology, []StoragePoolClaim, error) { storagePoolClaims := []StoragePoolClaim{} result := report.MakeTopology(). WithMetadataTemplates(StoragePoolClaimMetadataTemplates). WithTableTemplates(TableTemplates) + result.Controls.AddControl(DescribeControl) err := r.client.WalkStoragePoolClaims(func(p StoragePoolClaim) error { - result.AddNode(p.GetNode()) + result.AddNode(p.GetNode(r.probeID)) storagePoolClaims = append(storagePoolClaims, p) return nil }) @@ -711,8 +745,9 @@ func (r *Reporter) cStorVolumeTopology() (report.Topology, []CStorVolume, error) result := report.MakeTopology(). WithMetadataTemplates(CStorVolumeMetadataTemplates). WithTableTemplates(TableTemplates) + result.Controls.AddControl(DescribeControl) err := r.client.WalkCStorVolumes(func(p CStorVolume) error { - result.AddNode(p.GetNode()) + result.AddNode(p.GetNode(r.probeID)) cStorVolumes = append(cStorVolumes, p) return nil }) @@ -724,8 +759,9 @@ func (r *Reporter) cStorVolumeReplicaTopology() (report.Topology, []CStorVolumeR result := report.MakeTopology(). WithMetadataTemplates(CStorVolumeReplicaMetadataTemplates). WithTableTemplates(TableTemplates) + result.Controls.AddControl(DescribeControl) err := r.client.WalkCStorVolumeReplicas(func(p CStorVolumeReplica) error { - result.AddNode(p.GetNode()) + result.AddNode(p.GetNode(r.probeID)) cStorVolumeReplicas = append(cStorVolumeReplicas, p) return nil }) @@ -737,8 +773,9 @@ func (r *Reporter) cStorPoolTopology() (report.Topology, []CStorPool, error) { result := report.MakeTopology(). WithMetadataTemplates(CStorPoolMetadataTemplates). WithTableTemplates(TableTemplates) + result.Controls.AddControl(DescribeControl) err := r.client.WalkCStorPools(func(p CStorPool) error { - result.AddNode(p.GetNode()) + result.AddNode(p.GetNode(r.probeID)) cStorPool = append(cStorPool, p) return nil }) diff --git a/probe/kubernetes/reporter_test.go b/probe/kubernetes/reporter_test.go index 66fb0aeb74..3a747d1941 100644 --- a/probe/kubernetes/reporter_test.go +++ b/probe/kubernetes/reporter_test.go @@ -190,6 +190,9 @@ func (c *mockClient) WalkCStorVolumeReplicas(f func(kubernetes.CStorVolumeReplic func (c *mockClient) WalkCStorPools(f func(kubernetes.CStorPool) error) error { return nil } +func (c *mockClient) WalkBlockDevices(f func(kubernetes.BlockDevice) error) error { + return nil +} func (*mockClient) WatchPods(func(kubernetes.Event, kubernetes.Pod)) {} func (c *mockClient) GetLogs(namespaceID, podName string, _ []string) (io.ReadCloser, error) { r, ok := c.logs[namespaceID+";"+podName] diff --git a/probe/kubernetes/storagepoolclaim.go b/probe/kubernetes/storagepoolclaim.go index 83e389bf34..479fe4d5f8 100644 --- a/probe/kubernetes/storagepoolclaim.go +++ b/probe/kubernetes/storagepoolclaim.go @@ -11,7 +11,7 @@ import ( // StoragePoolClaim represent StoragePoolClaim interface type StoragePoolClaim interface { Meta - GetNode() report.Node + GetNode(probeID string) report.Node } // storagePoolClaim represent the StoragePoolClaims CRD of Kubernetes @@ -26,11 +26,12 @@ func NewStoragePoolClaim(p *mayav1alpha1.StoragePoolClaim) StoragePoolClaim { } // GetNode returns StoragePoolClaim as Node -func (p *storagePoolClaim) GetNode() report.Node { +func (p *storagePoolClaim) GetNode(probeID string) report.Node { return p.MetaNode(report.MakeStoragePoolClaimNodeID(p.UID())).WithLatests(map[string]string{ - NodeType: "Storage Pool Claim", - APIVersion: p.APIVersion, - MaxPools: strconv.Itoa(int(p.Spec.MaxPools)), - Status: p.Status.Phase, - }) + NodeType: "Storage Pool Claim", + APIVersion: p.APIVersion, + MaxPools: strconv.Itoa(int(p.Spec.MaxPools)), + Status: p.Status.Phase, + report.ControlProbeID: probeID, + }).WithLatestActiveControls(Describe) } diff --git a/render/detailed/node.go b/render/detailed/node.go index c626efb63d..4c8e94ab95 100644 --- a/render/detailed/node.go +++ b/render/detailed/node.go @@ -257,6 +257,13 @@ var nodeSummaryGroupSpecs = []struct { Columns: []Column{}, }, }, + { + topologyID: report.BlockDevice, + NodeSummaryGroup: NodeSummaryGroup{ + Label: "Block Device", + Columns: []Column{}, + }, + }, { topologyID: report.VolumeSnapshot, NodeSummaryGroup: NodeSummaryGroup{ diff --git a/render/detailed/summary.go b/render/detailed/summary.go index e5a1b43746..95f4d29a89 100644 --- a/render/detailed/summary.go +++ b/render/detailed/summary.go @@ -92,6 +92,7 @@ var renderers = map[string]func(BasicNodeSummary, report.Node) BasicNodeSummary{ report.VolumeSnapshot: volumeSnapshotNodeSummary, report.VolumeSnapshotData: volumeSnapshotDataNodeSummary, report.Disk: diskNodeSummary, + report.BlockDevice: blockDeviceNodeSummary, report.StoragePoolClaim: storagePoolClaimNodeSummary, report.CStorVolume: cStorVolumeNodeSummary, report.CStorVolumeReplica: cStorVolumeReplicaNodeSummary, @@ -124,6 +125,7 @@ var primaryAPITopology = map[string]string{ report.CStorVolume: "volumes", report.CStorVolumeReplica: "volumes", report.CStorPool: "volumes", + report.BlockDevice: "pools", } // MakeBasicNodeSummary returns a basic summary of a node, if @@ -437,6 +439,12 @@ func diskNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { return base } +func blockDeviceNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { + base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "Block Device" + return base +} + func storagePoolClaimNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { base = addKubernetesLabelAndRank(base, n) base.LabelMinor = "Storage pool claim" diff --git a/render/filters.go b/render/filters.go index 3a019f6183..cab5fe16ed 100644 --- a/render/filters.go +++ b/render/filters.go @@ -20,6 +20,7 @@ var storageComponents = map[string]string{ "persistent_volume_claim": "persistent_volume_claim", "storage_class": "storage_class", "storage_pool_claim": "storage_pool_claim", + "block_device": "block_device", "disk": "disk", "volume_snapshot": "volume_snapshot", "volume_snapshot_data": "volume_snapshot_data", @@ -29,6 +30,7 @@ var cStorComponents = map[string]string{ "cstor_volume": "cstor_volume", "cstor_volume_replica": "cstor_volume_replica", "cstor_pool": "cstor_pool", + "block_device": "block_device", "disk": "disk", } diff --git a/render/persistentvolume.go b/render/persistentvolume.go index b89997abac..0519294a83 100644 --- a/render/persistentvolume.go +++ b/render/persistentvolume.go @@ -17,7 +17,8 @@ var KubernetesVolumesRenderer = MakeReduce( PVCToStorageClassRenderer, PVToControllerRenderer, VolumeSnapshotRenderer, - CSPToDiskRenderer, + CSPToBdOrDiskRenderer, + BlockDeviceToDiskRenderer, MakeFilter( func(n report.Node) bool { value, _ := n.Latest.Lookup(kubernetes.VolumePod) diff --git a/render/selectors.go b/render/selectors.go index 8e82ea0598..0b5251778f 100644 --- a/render/selectors.go +++ b/render/selectors.go @@ -41,5 +41,6 @@ var ( SelectVolumeSnapshot = TopologySelector(report.VolumeSnapshot) SelectVolumeSnapshotData = TopologySelector(report.VolumeSnapshotData) SelectDisk = TopologySelector(report.Disk) + SelectBlockDevice = TopologySelector(report.BlockDevice) SelectStoragePoolClaim = TopologySelector(report.StoragePoolClaim) ) diff --git a/render/storagerenderer.go b/render/storagerenderer.go index 1127f4020c..e748b3b410 100644 --- a/render/storagerenderer.go +++ b/render/storagerenderer.go @@ -12,7 +12,8 @@ import ( // storage components such as CstorPools, storage pool claims and disks. var KubernetesStorageRenderer = MakeReduce( SPCToCSPRenderer, - CSPToDiskRenderer, + CSPToBdOrDiskRenderer, + BlockDeviceToDiskRenderer, ) // SPCToCSPRenderer is a Renderer which produces a renderable kubernetes CRD SPC @@ -40,39 +41,82 @@ func (v spcToCSPRenderer) Render(ctx context.Context, rpt report.Report) Nodes { return Nodes{Nodes: nodes} } -// CSPToDiskRenderer is a Renderer which produces a renderable kubernetes CRD Disk -var CSPToDiskRenderer = cspToDiskRenderer{} +// CSPToBdOrDiskRenderer is a Renderer which produces a renderable kubernetes CRD Disk +var CSPToBdOrDiskRenderer = cspToBdOrDiskRenderer{} -// cspToDiskRenderer is a Renderer to render CSP & Disk . -type cspToDiskRenderer struct{} +// cspToBdOrDiskRenderer is a Renderer to render CSP & Disk . +type cspToBdOrDiskRenderer struct{} // Render renders the CSP & Disk nodes with adjacency. -func (v cspToDiskRenderer) Render(ctx context.Context, rpt report.Report) Nodes { - // var disks []string - +func (v cspToBdOrDiskRenderer) Render(ctx context.Context, rpt report.Report) Nodes { nodes := make(report.Nodes) for cspID, cspNode := range rpt.CStorPool.Nodes { cspDiskPaths, _ := cspNode.Latest.Lookup(kubernetes.DiskList) + cspBlockDevice, _ := cspNode.Latest.Lookup(kubernetes.BlockDeviceList) cspHostname, _ := cspNode.Latest.Lookup(kubernetes.HostName) - diskList := strings.Split(cspDiskPaths, "~p$") - - for diskID, diskNode := range rpt.Disk.Nodes { - diskHostname, _ := diskNode.Latest.Lookup(kubernetes.HostName) - diskPaths, _ := diskNode.Latest.Lookup(kubernetes.DiskList) - diskPathList := strings.Split(diskPaths, "~p$") - for _, cspDiskPath := range diskList { - for _, diskPath := range diskPathList { - if (cspDiskPath == diskPath) && (cspHostname == diskHostname) { - cspNode.Adjacency = cspNode.Adjacency.Add(diskID) - cspNode.Children = cspNode.Children.Add(diskNode) + if cspDiskPaths != "" { + diskList := strings.Split(cspDiskPaths, report.ScopeDelim) + for diskNodeID, diskNode := range rpt.Disk.Nodes { + diskHostname, _ := diskNode.Latest.Lookup(kubernetes.HostName) + diskPaths, _ := diskNode.Latest.Lookup(kubernetes.DiskList) + diskPathList := strings.Split(diskPaths, report.ScopeDelim) + for _, cspDiskPath := range diskList { + for _, diskPath := range diskPathList { + if (cspDiskPath == diskPath) && (cspHostname == diskHostname) { + cspNode.Adjacency = cspNode.Adjacency.Add(diskNodeID) + cspNode.Children = cspNode.Children.Add(diskNode) + } + } + } + nodes[diskNodeID] = diskNode + } + } + + if cspBlockDevice != "" { + cspBlockDeviceList := strings.Split(cspBlockDevice, report.ScopeDelim) + for blockDeviceID, blockDeviceNode := range rpt.BlockDevice.Nodes { + blockDeviceName, _ := blockDeviceNode.Latest.Lookup(kubernetes.Name) + for _, cspBlockDeviceName := range cspBlockDeviceList { + if blockDeviceName == cspBlockDeviceName { + cspNode.Adjacency = cspNode.Adjacency.Add(blockDeviceID) + cspNode.Children = cspNode.Children.Add(blockDeviceNode) } } } - nodes[diskID] = diskNode } nodes[cspID] = cspNode } + return Nodes{Nodes: nodes} +} + +// BlockDeviceToDiskRenderer is a renderer which produces a renderable kubernetes block device and disk. +var BlockDeviceToDiskRenderer = blockDeviceToDiskRenderer{} +// blockDeviceToDiskRenderer is a renderer to render block device and disk. +type blockDeviceToDiskRenderer struct{} + +func (b blockDeviceToDiskRenderer) Render(ctx context.Context, rpt report.Report) Nodes { + nodes := make(report.Nodes) + for blockDeviceNodeID, blockDeviceNode := range rpt.BlockDevice.Nodes { + blockDevicePath, _ := blockDeviceNode.Latest.Lookup(kubernetes.Path) + blockDeviceHost, _ := blockDeviceNode.Latest.Lookup(kubernetes.HostName) + blockDeviceName, _ := blockDeviceNode.Latest.Lookup(kubernetes.Name) + + for diskNodeID, diskNode := range rpt.Disk.Nodes { + diskPath, _ := diskNode.Latest.Lookup(kubernetes.Path) + diskHost, _ := diskNode.Latest.Lookup(kubernetes.HostName) + diskName, _ := diskNode.Latest.Lookup(kubernetes.Name) + + if blockDevicePath == diskPath && blockDeviceHost == diskHost && + strings.Split(blockDeviceName, "-")[1] == strings.Split(diskName, "-")[1] { + blockDeviceNode.Adjacency = blockDeviceNode.Adjacency.Add(diskNodeID) + blockDeviceNode.Children = blockDeviceNode.Children.Add(diskNode) + } + + nodes[diskNodeID] = diskNode + } + nodes[blockDeviceNodeID] = blockDeviceNode + } return Nodes{Nodes: nodes} } diff --git a/report/id.go b/report/id.go index d6a6e45e8c..60e49538a0 100644 --- a/report/id.go +++ b/report/id.go @@ -200,6 +200,12 @@ var ( // ParseDiskNodeID parses a disk node ID ParseDiskNodeID = parseSingleComponentID("disk") + // MakeBlockDeviceNodeID produces a block device node ID from its composite parts. + MakeBlockDeviceNodeID = makeSingleComponentID("block_device") + + // ParseBlockDeviceNodeID parses a block device node ID + ParseBlockDeviceNodeID = parseSingleComponentID("block_device") + // MakeStoragePoolClaimNodeID produces a Stoage Pool Claim node ID from its composite parts. MakeStoragePoolClaimNodeID = makeSingleComponentID("storage_pool_claim") diff --git a/report/map_keys.go b/report/map_keys.go index bb8744a334..d2f0d53841 100644 --- a/report/map_keys.go +++ b/report/map_keys.go @@ -125,6 +125,9 @@ const ( KubernetesTotalBytesWritten = "kubernetes_total_bytes_written" KubernetesDeviceUtilizationRate = "kubernetes_device_utilization_rate" KubernetesPercentEnduranceUsed = "kubernetes_percent_endurance_used" + KubernetesStorage = "kubernetes_storage" + KubernetesBlockDeviceList = "kubernetes_block_device_list" + KubernetesPath = "kubernetes_path" // probe/awsecs ECSCluster = "ecs_cluster" ECSCreatedAt = "ecs_created_at" diff --git a/report/report.go b/report/report.go index 38c196b751..7a3594d04a 100644 --- a/report/report.go +++ b/report/report.go @@ -39,6 +39,7 @@ const ( CStorVolume = "cstor_volume" CStorVolumeReplica = "cstor_volume_replica" CStorPool = "cstor_pool" + BlockDevice = "block_device" // Shapes used for different nodes Circle = "circle" @@ -93,6 +94,7 @@ var topologyNames = []string{ CStorVolume, CStorVolumeReplica, CStorPool, + BlockDevice, } // Report is the core data type. It's produced by probes, and consumed and @@ -215,6 +217,10 @@ type Report struct { // Metadata is limited for now, more to come later. Disk Topology + // BlockDevice represent all NDM Block Devices on hosts running probes. + // Metadata is limited for now, more to come later. + BlockDevice Topology + // StoragePoolClaim represent all the CRD kubernetes Storage Pool Claims on hosts running probes. // Metadata is limited for now, more to come later. StoragePoolClaim Topology @@ -342,6 +348,10 @@ func MakeReport() Report { WithShape(Rectangle). WithLabel("disk", "disks"), + BlockDevice: MakeTopology(). + WithShape(Rectangle). + WithLabel("block device", "block devices"), + StoragePoolClaim: MakeTopology(). WithShape(DottedSquare). WithLabel("storage pool claim", "storage pool claims"), @@ -487,6 +497,8 @@ func (r *Report) topology(name string) *Topology { return &r.CStorVolumeReplica case CStorPool: return &r.CStorPool + case BlockDevice: + return &r.BlockDevice } return nil } diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device.go new file mode 100644 index 0000000000..95b00e6747 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device.go @@ -0,0 +1,93 @@ +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:noStatus +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=blockdevice + +// BlockDevice is the Schema for the devices API +type BlockDevice struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DeviceSpec `json:"spec,omitempty"` + Status DeviceStatus `json:"status,omitempty"` +} + +// DeviceSpec defines the desired state of BlockDevice +type DeviceSpec struct { + Path string `json:"path"` //Path contain devpath (e.g. /dev/sdb) + Capacity DeviceCapacity `json:"capacity"` //Capacity + Details DeviceDetails `json:"details"` //Details contains static attributes (model, serial ..) + ClaimRef *v1.ObjectReference `json:"claimRef,omitempty"` // Reference to the BDC which has claimed this BD + DevLinks []DeviceDevLink `json:"devlinks"` //DevLinks contains soft links of one disk + FileSystem FileSystemInfo `json:"filesystem,omitempty"` //FileSystem contains mountpoint and filesystem type + Partitioned string `json:"partitioned"` //BlockDevice has partions or not (YES/NO) + ParentDevice string `json:"parentDevice,omitempty"` //ParentDevice has the UUID of the parent device + AggregateDevice string `json:"aggregateDevice,omitempty"` //AggregateDevice has the UUID of the aggregate device created from this device +} + +// DeviceCapacity defines the physical and logical size of the block device +type DeviceCapacity struct { + Storage uint64 `json:"storage"` // blockdevice capacity in bytes + PhysicalSectorSize uint32 `json:"physicalSectorSize"` // blockdevice physical-Sector size in bytes + LogicalSectorSize uint32 `json:"logicalSectorSize"` // blockdevice logical-sector size in bytes +} + +// DeviceDetails represent certain hardware/static attributes of the block device +type DeviceDetails struct { + DeviceType string `json:"deviceType"` // DeviceType represents the type of drive like SSD, HDD etc., + Model string `json:"model"` // Model is model of disk + Compliance string `json:"compliance"` // Implemented standards/specifications version such as SPC-1, SPC-2, etc + Serial string `json:"serial"` // Serial is serial no of disk + Vendor string `json:"vendor"` // Vendor is vendor of disk + FirmwareRevision string `json:"firmwareRevision"` // disk firmware revision +} + +// FileSystemInfo defines the filesystem type and mountpoint of the device if it exists +type FileSystemInfo struct { + Type string `json:"fsType,omitempty"` //Type represents the FileSystem type of the block device + Mountpoint string `json:"mountPoint,omitempty"` //MountPoint represents the mountpoint of the block device. +} + +// DeviceDevLink holds the maping between type and links like by-id type or by-path type link +type DeviceDevLink struct { + Kind string `json:"kind,omitempty"` // Kind is the type of link like by-id or by-path. + Links []string `json:"links,omitempty"` // Links are the soft links of Type type +} + +// DeviceStatus defines the observed state of BlockDevice +type DeviceStatus struct { + ClaimState DeviceClaimState `json:"claimState"` // claim state of the block device + State string `json:"state"` // current state of the blockdevice (Active/Inactive) +} + +// DeviceClaimState defines the observed state of BlockDevice +type DeviceClaimState string + +const ( + // BlockDeviceUnclaimed represents that the block device is not bound to any BDC, + // all cleanup jobs have been completed and is available for claiming. + BlockDeviceUnclaimed DeviceClaimState = "Unclaimed" + // BlockDeviceReleased represents that the block device is released from the BDC, + // pending cleanup jobs + BlockDeviceReleased DeviceClaimState = "Released" + // BlockDeviceClaimed represents that the block device is bound to a BDC + BlockDeviceClaimed DeviceClaimState = "Claimed" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=blockdevices + +// BlockDeviceList contains a list of BlockDevice +type BlockDeviceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []BlockDevice `json:"items"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_pool.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_pool.go index f9eab2d0f7..c33829e73e 100644 --- a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_pool.go +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/cstor_pool.go @@ -37,8 +37,9 @@ type CStorPool struct { // CStorPoolSpec is the spec listing fields for a CStorPool resource. type CStorPoolSpec struct { - Disks DiskAttr `json:"disks"` - PoolSpec CStorPoolAttr `json:"poolSpec"` + Disks DiskAttr `json:"disks"` + Group []BlockDeviceGroup `json:"group"` + PoolSpec CStorPoolAttr `json:"poolSpec"` } // DiskAttr stores the disk related attributes. @@ -46,6 +47,29 @@ type DiskAttr struct { DiskList []string `json:"diskList"` } +// BlockDeviceGroup contains a collection of block device for a given pool topology in CSP. +type BlockDeviceGroup struct { + // Item contains a list of CspBlockDevice. + Item []CspBlockDevice `json:"blockDevice"` +} + +// CspBlockDevice contains the details of block device present on CSP. +type CspBlockDevice struct { + // Name is the name of the block device resource. + Name string `json:"name"` + // DeviceID is the device id of the block device resource. In case of sparse + // block device, it contains the device path. + DeviceID string `json:"deviceID"` + // InUseByPool tells whether the block device is present on spc. If block + // device is present on SPC, it is true else false. + InUseByPool bool `json:"inUseByPool"` +} + +// BlockDeviceAttr stores the block device related attributes. +type BlockDeviceAttr struct { + BlockDeviceList []string `json:"blockDeviceList"` +} + // CStorPoolAttr is to describe zpool related attributes. type CStorPoolAttr struct { CacheFile string `json:"cacheFile"` //optional, faster if specified @@ -57,11 +81,13 @@ type CStorPoolAttr struct { type CStorPoolPhase string // Status written onto CStorPool and CStorVolumeReplica objects. +// Resetting state to either Empty or Pending need to be done with care, +// as, label clear and pool creation depends on this state. const ( // CStorPoolStatusEmpty ensures the create operation is to be done, if import fails. CStorPoolStatusEmpty CStorPoolPhase = "" // CStorPoolStatusOnline signifies that the pool is online. - CStorPoolStatusOnline CStorPoolPhase = "Online" + CStorPoolStatusOnline CStorPoolPhase = "Healthy" // CStorPoolStatusOffline signifies that the pool is offline. CStorPoolStatusOffline CStorPoolPhase = "Offline" // CStorPoolStatusDegraded signifies that the pool is degraded. @@ -73,7 +99,7 @@ const ( // CStorPoolStatusUnavail signifies that the pool is not available. CStorPoolStatusUnavail CStorPoolPhase = "Unavail" // CStorPoolStatusDeletionFailed signifies that the pool status could not be fetched. - CStorPoolStatusUnknown CStorPoolPhase = "Unknown" + CStorPoolStatusError CStorPoolPhase = "Error" // CStorPoolStatusDeletionFailed ensures the resource deletion has failed. CStorPoolStatusDeletionFailed CStorPoolPhase = "DeletionFailed" // CStorPoolStatusInvalid ensures invalid resource. @@ -86,7 +112,14 @@ const ( // CStorPoolStatus is for handling status of pool. type CStorPoolStatus struct { - Phase CStorPoolPhase `json:"phase"` + Phase CStorPoolPhase `json:"phase"` + Capacity CStorPoolCapacityAttr `json:"capacity"` +} + +type CStorPoolCapacityAttr struct { + Total string `json:"total"` + Free string `json:"free"` + Used string `json:"used"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go index f73da9298c..f7b56220d3 100644 --- a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go @@ -5,7 +5,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "github.com/openebs/maya/pkg/apis/openebs.io" + openebsio "github.com/openebs/maya/pkg/apis/openebs.io" ) // SchemeGroupVersion is group version used to register these objects @@ -49,6 +49,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &CStorVolumeList{}, &Disk{}, &DiskList{}, + &BlockDevice{}, + &BlockDeviceList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool.go index 61633c0f82..8447786b41 100644 --- a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool.go +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool.go @@ -36,14 +36,15 @@ type StoragePool struct { // StoragePoolSpec is the spec for a StoragePool resource type StoragePoolSpec struct { - Name string `json:"name"` - Format string `json:"format"` - Mountpoint string `json:"mountpoint"` - Nodename string `json:"nodename"` - Message string `json:"message"` - Path string `json:"path"` - Disks DiskAttr `json:"disks"` - PoolSpec CStorPoolAttr `json:"poolSpec"` + Name string `json:"name"` + Format string `json:"format"` + Mountpoint string `json:"mountpoint"` + Nodename string `json:"nodename"` + Message string `json:"message"` + Path string `json:"path"` + Disks DiskAttr `json:"disks"` + BlockDevices BlockDeviceAttr `json:"blockdevices"` + PoolSpec CStorPoolAttr `json:"poolSpec"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool_claim.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool_claim.go index 28100a9335..1a00cd0c28 100644 --- a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool_claim.go +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/storage_pool_claim.go @@ -36,17 +36,18 @@ type StoragePoolClaim struct { // StoragePoolClaimSpec is the spec for a StoragePoolClaimSpec resource type StoragePoolClaimSpec struct { - Name string `json:"name"` - Format string `json:"format"` - Mountpoint string `json:"mountpoint"` - Path string `json:"path"` - Type string `json:"type"` - NodeSelector []string `json:"nodeSelector"` - Capacity string `json:"capacity"` - MaxPools int `json:"maxPools"` - MinPools int `json:"minPools"` - Disks DiskAttr `json:"disks"` - PoolSpec CStorPoolAttr `json:"poolSpec"` + Name string `json:"name"` + Format string `json:"format"` + Mountpoint string `json:"mountpoint"` + Path string `json:"path"` + Type string `json:"type"` + NodeSelector []string `json:"nodeSelector"` + Capacity string `json:"capacity"` + MaxPools int `json:"maxPools"` + MinPools int `json:"minPools"` + Disks DiskAttr `json:"disks"` + BlockDevices BlockDeviceAttr `json:"blockDevices"` + PoolSpec CStorPoolAttr `json:"poolSpec"` } // StoragePoolClaimStatus is for handling status of pool. diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go index e1e91a6bca..1a4b9fd73e 100644 --- a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,9 +21,113 @@ limitations under the License. package v1alpha1 import ( + v1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlockDevice) DeepCopyInto(out *BlockDevice) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockDevice. +func (in *BlockDevice) DeepCopy() *BlockDevice { + if in == nil { + return nil + } + out := new(BlockDevice) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BlockDevice) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlockDeviceAttr) DeepCopyInto(out *BlockDeviceAttr) { + *out = *in + if in.BlockDeviceList != nil { + in, out := &in.BlockDeviceList, &out.BlockDeviceList + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockDeviceAttr. +func (in *BlockDeviceAttr) DeepCopy() *BlockDeviceAttr { + if in == nil { + return nil + } + out := new(BlockDeviceAttr) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlockDeviceGroup) DeepCopyInto(out *BlockDeviceGroup) { + *out = *in + if in.Item != nil { + in, out := &in.Item, &out.Item + *out = make([]CspBlockDevice, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockDeviceGroup. +func (in *BlockDeviceGroup) DeepCopy() *BlockDeviceGroup { + if in == nil { + return nil + } + out := new(BlockDeviceGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlockDeviceList) DeepCopyInto(out *BlockDeviceList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BlockDevice, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockDeviceList. +func (in *BlockDeviceList) DeepCopy() *BlockDeviceList { + if in == nil { + return nil + } + out := new(BlockDeviceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BlockDeviceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CASSnapshot) DeepCopyInto(out *CASSnapshot) { *out = *in @@ -274,6 +378,22 @@ func (in *CStorPoolAttr) DeepCopy() *CStorPoolAttr { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CStorPoolCapacityAttr) DeepCopyInto(out *CStorPoolCapacityAttr) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CStorPoolCapacityAttr. +func (in *CStorPoolCapacityAttr) DeepCopy() *CStorPoolCapacityAttr { + if in == nil { + return nil + } + out := new(CStorPoolCapacityAttr) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CStorPoolList) DeepCopyInto(out *CStorPoolList) { *out = *in @@ -311,6 +431,13 @@ func (in *CStorPoolList) DeepCopyObject() runtime.Object { func (in *CStorPoolSpec) DeepCopyInto(out *CStorPoolSpec) { *out = *in in.Disks.DeepCopyInto(&out.Disks) + if in.Group != nil { + in, out := &in.Group, &out.Group + *out = make([]BlockDeviceGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } out.PoolSpec = in.PoolSpec return } @@ -328,6 +455,7 @@ func (in *CStorPoolSpec) DeepCopy() *CStorPoolSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CStorPoolStatus) DeepCopyInto(out *CStorPoolStatus) { *out = *in + out.Capacity = in.Capacity return } @@ -578,6 +706,122 @@ func (in *Config) DeepCopy() *Config { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CspBlockDevice) DeepCopyInto(out *CspBlockDevice) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CspBlockDevice. +func (in *CspBlockDevice) DeepCopy() *CspBlockDevice { + if in == nil { + return nil + } + out := new(CspBlockDevice) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceCapacity) DeepCopyInto(out *DeviceCapacity) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceCapacity. +func (in *DeviceCapacity) DeepCopy() *DeviceCapacity { + if in == nil { + return nil + } + out := new(DeviceCapacity) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceDetails) DeepCopyInto(out *DeviceDetails) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceDetails. +func (in *DeviceDetails) DeepCopy() *DeviceDetails { + if in == nil { + return nil + } + out := new(DeviceDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceDevLink) DeepCopyInto(out *DeviceDevLink) { + *out = *in + if in.Links != nil { + in, out := &in.Links, &out.Links + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceDevLink. +func (in *DeviceDevLink) DeepCopy() *DeviceDevLink { + if in == nil { + return nil + } + out := new(DeviceDevLink) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceSpec) DeepCopyInto(out *DeviceSpec) { + *out = *in + out.Capacity = in.Capacity + out.Details = in.Details + if in.ClaimRef != nil { + in, out := &in.ClaimRef, &out.ClaimRef + *out = new(v1.ObjectReference) + **out = **in + } + if in.DevLinks != nil { + in, out := &in.DevLinks, &out.DevLinks + *out = make([]DeviceDevLink, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + out.FileSystem = in.FileSystem + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceSpec. +func (in *DeviceSpec) DeepCopy() *DeviceSpec { + if in == nil { + return nil + } + out := new(DeviceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceStatus) DeepCopyInto(out *DeviceStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceStatus. +func (in *DeviceStatus) DeepCopy() *DeviceStatus { + if in == nil { + return nil + } + out := new(DeviceStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Disk) DeepCopyInto(out *Disk) { *out = *in @@ -772,6 +1016,22 @@ func (in *DiskStatus) DeepCopy() *DiskStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FileSystemInfo) DeepCopyInto(out *FileSystemInfo) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileSystemInfo. +func (in *FileSystemInfo) DeepCopy() *FileSystemInfo { + if in == nil { + return nil + } + out := new(FileSystemInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ReplicaStatus) DeepCopyInto(out *ReplicaStatus) { *out = *in @@ -1014,6 +1274,7 @@ func (in *StoragePoolClaimSpec) DeepCopyInto(out *StoragePoolClaimSpec) { copy(*out, *in) } in.Disks.DeepCopyInto(&out.Disks) + in.BlockDevices.DeepCopyInto(&out.BlockDevices) out.PoolSpec = in.PoolSpec return } @@ -1081,6 +1342,7 @@ func (in *StoragePoolList) DeepCopyObject() runtime.Object { func (in *StoragePoolSpec) DeepCopyInto(out *StoragePoolSpec) { *out = *in in.Disks.DeepCopyInto(&out.Disks) + in.BlockDevices.DeepCopyInto(&out.BlockDevices) out.PoolSpec = in.PoolSpec return } diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/clientset.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/clientset.go index 0927cc632a..95e67e9f1b 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/clientset.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/clientset.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/doc.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/doc.go index b00c45ec41..41721ca52d 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/doc.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/clientset_generated.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/clientset_generated.go index ef78ab9ecc..b08ea8b709 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/doc.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/doc.go index 7cb27603ee..9b99e71670 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/doc.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/register.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/register.go index e25808f756..fcf55be71c 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/register.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/fake/register.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/doc.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/doc.go index 6d9810cf81..7dc3756168 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/doc.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/register.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/register.go index 445e5f31b6..958da598df 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/register.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/scheme/register.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdevice.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdevice.go new file mode 100644 index 0000000000..c0019121fc --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdevice.go @@ -0,0 +1,164 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "time" + + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// BlockDevicesGetter has a method to return a BlockDeviceInterface. +// A group's client should implement this interface. +type BlockDevicesGetter interface { + BlockDevices() BlockDeviceInterface +} + +// BlockDeviceInterface has methods to work with BlockDevice resources. +type BlockDeviceInterface interface { + Create(*v1alpha1.BlockDevice) (*v1alpha1.BlockDevice, error) + Update(*v1alpha1.BlockDevice) (*v1alpha1.BlockDevice, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.BlockDevice, error) + List(opts v1.ListOptions) (*v1alpha1.BlockDeviceList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.BlockDevice, err error) + BlockDeviceExpansion +} + +// blockDevices implements BlockDeviceInterface +type blockDevices struct { + client rest.Interface +} + +// newBlockDevices returns a BlockDevices +func newBlockDevices(c *OpenebsV1alpha1Client) *blockDevices { + return &blockDevices{ + client: c.RESTClient(), + } +} + +// Get takes name of the blockDevice, and returns the corresponding blockDevice object, and an error if there is any. +func (c *blockDevices) Get(name string, options v1.GetOptions) (result *v1alpha1.BlockDevice, err error) { + result = &v1alpha1.BlockDevice{} + err = c.client.Get(). + Resource("blockdevices"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of BlockDevices that match those selectors. +func (c *blockDevices) List(opts v1.ListOptions) (result *v1alpha1.BlockDeviceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.BlockDeviceList{} + err = c.client.Get(). + Resource("blockdevices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested blockDevices. +func (c *blockDevices) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("blockdevices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a blockDevice and creates it. Returns the server's representation of the blockDevice, and an error, if there is any. +func (c *blockDevices) Create(blockDevice *v1alpha1.BlockDevice) (result *v1alpha1.BlockDevice, err error) { + result = &v1alpha1.BlockDevice{} + err = c.client.Post(). + Resource("blockdevices"). + Body(blockDevice). + Do(). + Into(result) + return +} + +// Update takes the representation of a blockDevice and updates it. Returns the server's representation of the blockDevice, and an error, if there is any. +func (c *blockDevices) Update(blockDevice *v1alpha1.BlockDevice) (result *v1alpha1.BlockDevice, err error) { + result = &v1alpha1.BlockDevice{} + err = c.client.Put(). + Resource("blockdevices"). + Name(blockDevice.Name). + Body(blockDevice). + Do(). + Into(result) + return +} + +// Delete takes name of the blockDevice and deletes it. Returns an error if one occurs. +func (c *blockDevices) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("blockdevices"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *blockDevices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("blockdevices"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched blockDevice. +func (c *blockDevices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.BlockDevice, err error) { + result = &v1alpha1.BlockDevice{} + err = c.client.Patch(pt). + Resource("blockdevices"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/castemplate.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/castemplate.go index 6d239e0201..36712313b3 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/castemplate.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/castemplate.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ limitations under the License. package v1alpha1 import ( + "time" + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -72,10 +74,15 @@ func (c *cASTemplates) Get(name string, options v1.GetOptions) (result *v1alpha1 // List takes label and field selectors, and returns the list of CASTemplates that match those selectors. func (c *cASTemplates) List(opts v1.ListOptions) (result *v1alpha1.CASTemplateList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } result = &v1alpha1.CASTemplateList{} err = c.client.Get(). Resource("castemplates"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Do(). Into(result) return @@ -83,10 +90,15 @@ func (c *cASTemplates) List(opts v1.ListOptions) (result *v1alpha1.CASTemplateLi // Watch returns a watch.Interface that watches the requested cASTemplates. func (c *cASTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } opts.Watch = true return c.client.Get(). Resource("castemplates"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Watch() } @@ -125,9 +137,14 @@ func (c *cASTemplates) Delete(name string, options *v1.DeleteOptions) error { // DeleteCollection deletes a collection of objects. func (c *cASTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } return c.client.Delete(). Resource("castemplates"). VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). Body(options). Do(). Error() diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorpool.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorpool.go index 8a622a3d7d..a7cc9b39d2 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorpool.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorpool.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ limitations under the License. package v1alpha1 import ( + "time" + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -72,10 +74,15 @@ func (c *cStorPools) Get(name string, options v1.GetOptions) (result *v1alpha1.C // List takes label and field selectors, and returns the list of CStorPools that match those selectors. func (c *cStorPools) List(opts v1.ListOptions) (result *v1alpha1.CStorPoolList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } result = &v1alpha1.CStorPoolList{} err = c.client.Get(). Resource("cstorpools"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Do(). Into(result) return @@ -83,10 +90,15 @@ func (c *cStorPools) List(opts v1.ListOptions) (result *v1alpha1.CStorPoolList, // Watch returns a watch.Interface that watches the requested cStorPools. func (c *cStorPools) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } opts.Watch = true return c.client.Get(). Resource("cstorpools"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Watch() } @@ -125,9 +137,14 @@ func (c *cStorPools) Delete(name string, options *v1.DeleteOptions) error { // DeleteCollection deletes a collection of objects. func (c *cStorPools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } return c.client.Delete(). Resource("cstorpools"). VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). Body(options). Do(). Error() diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolume.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolume.go index 8f0401e9d4..1ffa4c41ce 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolume.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolume.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ limitations under the License. package v1alpha1 import ( + "time" + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -75,11 +77,16 @@ func (c *cStorVolumes) Get(name string, options v1.GetOptions) (result *v1alpha1 // List takes label and field selectors, and returns the list of CStorVolumes that match those selectors. func (c *cStorVolumes) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } result = &v1alpha1.CStorVolumeList{} err = c.client.Get(). Namespace(c.ns). Resource("cstorvolumes"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Do(). Into(result) return @@ -87,11 +94,16 @@ func (c *cStorVolumes) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeLi // Watch returns a watch.Interface that watches the requested cStorVolumes. func (c *cStorVolumes) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } opts.Watch = true return c.client.Get(). Namespace(c.ns). Resource("cstorvolumes"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Watch() } @@ -133,10 +145,15 @@ func (c *cStorVolumes) Delete(name string, options *v1.DeleteOptions) error { // DeleteCollection deletes a collection of objects. func (c *cStorVolumes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } return c.client.Delete(). Namespace(c.ns). Resource("cstorvolumes"). VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). Body(options). Do(). Error() diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolumereplica.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolumereplica.go index 18186bb860..4087523530 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolumereplica.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/cstorvolumereplica.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ limitations under the License. package v1alpha1 import ( + "time" + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -75,11 +77,16 @@ func (c *cStorVolumeReplicas) Get(name string, options v1.GetOptions) (result *v // List takes label and field selectors, and returns the list of CStorVolumeReplicas that match those selectors. func (c *cStorVolumeReplicas) List(opts v1.ListOptions) (result *v1alpha1.CStorVolumeReplicaList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } result = &v1alpha1.CStorVolumeReplicaList{} err = c.client.Get(). Namespace(c.ns). Resource("cstorvolumereplicas"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Do(). Into(result) return @@ -87,11 +94,16 @@ func (c *cStorVolumeReplicas) List(opts v1.ListOptions) (result *v1alpha1.CStorV // Watch returns a watch.Interface that watches the requested cStorVolumeReplicas. func (c *cStorVolumeReplicas) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } opts.Watch = true return c.client.Get(). Namespace(c.ns). Resource("cstorvolumereplicas"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Watch() } @@ -133,10 +145,15 @@ func (c *cStorVolumeReplicas) Delete(name string, options *v1.DeleteOptions) err // DeleteCollection deletes a collection of objects. func (c *cStorVolumeReplicas) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } return c.client.Delete(). Namespace(c.ns). Resource("cstorvolumereplicas"). VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). Body(options). Do(). Error() diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/disk.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/disk.go index 41f0224330..df3d3133b5 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/disk.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/disk.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ limitations under the License. package v1alpha1 import ( + "time" + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -72,10 +74,15 @@ func (c *disks) Get(name string, options v1.GetOptions) (result *v1alpha1.Disk, // List takes label and field selectors, and returns the list of Disks that match those selectors. func (c *disks) List(opts v1.ListOptions) (result *v1alpha1.DiskList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } result = &v1alpha1.DiskList{} err = c.client.Get(). Resource("disks"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Do(). Into(result) return @@ -83,10 +90,15 @@ func (c *disks) List(opts v1.ListOptions) (result *v1alpha1.DiskList, err error) // Watch returns a watch.Interface that watches the requested disks. func (c *disks) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } opts.Watch = true return c.client.Get(). Resource("disks"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Watch() } @@ -125,9 +137,14 @@ func (c *disks) Delete(name string, options *v1.DeleteOptions) error { // DeleteCollection deletes a collection of objects. func (c *disks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } return c.client.Delete(). Resource("disks"). VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). Body(options). Do(). Error() diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/doc.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/doc.go index be8ef1127a..df51baa4d4 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/doc.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/doc.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/doc.go index 6527f84023..16f4439906 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/doc.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdevice.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdevice.go new file mode 100644 index 0000000000..0c3f625687 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdevice.go @@ -0,0 +1,120 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeBlockDevices implements BlockDeviceInterface +type FakeBlockDevices struct { + Fake *FakeOpenebsV1alpha1 +} + +var blockdevicesResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "blockdevices"} + +var blockdevicesKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "BlockDevice"} + +// Get takes name of the blockDevice, and returns the corresponding blockDevice object, and an error if there is any. +func (c *FakeBlockDevices) Get(name string, options v1.GetOptions) (result *v1alpha1.BlockDevice, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(blockdevicesResource, name), &v1alpha1.BlockDevice{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BlockDevice), err +} + +// List takes label and field selectors, and returns the list of BlockDevices that match those selectors. +func (c *FakeBlockDevices) List(opts v1.ListOptions) (result *v1alpha1.BlockDeviceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(blockdevicesResource, blockdevicesKind, opts), &v1alpha1.BlockDeviceList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.BlockDeviceList{ListMeta: obj.(*v1alpha1.BlockDeviceList).ListMeta} + for _, item := range obj.(*v1alpha1.BlockDeviceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested blockDevices. +func (c *FakeBlockDevices) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(blockdevicesResource, opts)) +} + +// Create takes the representation of a blockDevice and creates it. Returns the server's representation of the blockDevice, and an error, if there is any. +func (c *FakeBlockDevices) Create(blockDevice *v1alpha1.BlockDevice) (result *v1alpha1.BlockDevice, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(blockdevicesResource, blockDevice), &v1alpha1.BlockDevice{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BlockDevice), err +} + +// Update takes the representation of a blockDevice and updates it. Returns the server's representation of the blockDevice, and an error, if there is any. +func (c *FakeBlockDevices) Update(blockDevice *v1alpha1.BlockDevice) (result *v1alpha1.BlockDevice, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(blockdevicesResource, blockDevice), &v1alpha1.BlockDevice{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BlockDevice), err +} + +// Delete takes name of the blockDevice and deletes it. Returns an error if one occurs. +func (c *FakeBlockDevices) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(blockdevicesResource, name), &v1alpha1.BlockDevice{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBlockDevices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(blockdevicesResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.BlockDeviceList{}) + return err +} + +// Patch applies the patch and returns the patched blockDevice. +func (c *FakeBlockDevices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.BlockDevice, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(blockdevicesResource, name, pt, data, subresources...), &v1alpha1.BlockDevice{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BlockDevice), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_castemplate.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_castemplate.go index 9c279389e4..9363fa3936 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_castemplate.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_castemplate.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpool.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpool.go index f94f349366..4dfb1d10ab 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpool.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorpool.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolume.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolume.go index 6658841b12..337f750246 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolume.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolume.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumereplica.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumereplica.go index aa569368e6..6269d18211 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumereplica.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_cstorvolumereplica.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_disk.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_disk.go index 1be98203dd..dd6c4f37e3 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_disk.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_disk.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go index a65ce82df6..30f74bce89 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,6 +28,10 @@ type FakeOpenebsV1alpha1 struct { *testing.Fake } +func (c *FakeOpenebsV1alpha1) BlockDevices() v1alpha1.BlockDeviceInterface { + return &FakeBlockDevices{c} +} + func (c *FakeOpenebsV1alpha1) CASTemplates() v1alpha1.CASTemplateInterface { return &FakeCASTemplates{c} } diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_runtask.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_runtask.go index 8ae307ff81..667a2a66d3 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_runtask.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_runtask.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepool.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepool.go index ef49e6d340..1bd53f4c66 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepool.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepool.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepoolclaim.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepoolclaim.go index 9216c83019..5487584f36 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepoolclaim.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_storagepoolclaim.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go index 8736db0b10..2b2545b127 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ limitations under the License. package v1alpha1 +type BlockDeviceExpansion interface{} + type CASTemplateExpansion interface{} type CStorPoolExpansion interface{} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go index 364475b9f6..40d0ac3523 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import ( type OpenebsV1alpha1Interface interface { RESTClient() rest.Interface + BlockDevicesGetter CASTemplatesGetter CStorPoolsGetter CStorVolumesGetter @@ -42,6 +43,10 @@ type OpenebsV1alpha1Client struct { restClient rest.Interface } +func (c *OpenebsV1alpha1Client) BlockDevices() BlockDeviceInterface { + return newBlockDevices(c) +} + func (c *OpenebsV1alpha1Client) CASTemplates() CASTemplateInterface { return newCASTemplates(c) } diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/runtask.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/runtask.go index 60fd87ea5e..d60be95e17 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/runtask.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/runtask.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ limitations under the License. package v1alpha1 import ( + "time" + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -75,11 +77,16 @@ func (c *runTasks) Get(name string, options v1.GetOptions) (result *v1alpha1.Run // List takes label and field selectors, and returns the list of RunTasks that match those selectors. func (c *runTasks) List(opts v1.ListOptions) (result *v1alpha1.RunTaskList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } result = &v1alpha1.RunTaskList{} err = c.client.Get(). Namespace(c.ns). Resource("runtasks"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Do(). Into(result) return @@ -87,11 +94,16 @@ func (c *runTasks) List(opts v1.ListOptions) (result *v1alpha1.RunTaskList, err // Watch returns a watch.Interface that watches the requested runTasks. func (c *runTasks) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } opts.Watch = true return c.client.Get(). Namespace(c.ns). Resource("runtasks"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Watch() } @@ -133,10 +145,15 @@ func (c *runTasks) Delete(name string, options *v1.DeleteOptions) error { // DeleteCollection deletes a collection of objects. func (c *runTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } return c.client.Delete(). Namespace(c.ns). Resource("runtasks"). VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). Body(options). Do(). Error() diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepool.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepool.go index c5d0e57850..2dd97b42a4 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepool.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepool.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ limitations under the License. package v1alpha1 import ( + "time" + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -72,10 +74,15 @@ func (c *storagePools) Get(name string, options v1.GetOptions) (result *v1alpha1 // List takes label and field selectors, and returns the list of StoragePools that match those selectors. func (c *storagePools) List(opts v1.ListOptions) (result *v1alpha1.StoragePoolList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } result = &v1alpha1.StoragePoolList{} err = c.client.Get(). Resource("storagepools"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Do(). Into(result) return @@ -83,10 +90,15 @@ func (c *storagePools) List(opts v1.ListOptions) (result *v1alpha1.StoragePoolLi // Watch returns a watch.Interface that watches the requested storagePools. func (c *storagePools) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } opts.Watch = true return c.client.Get(). Resource("storagepools"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Watch() } @@ -125,9 +137,14 @@ func (c *storagePools) Delete(name string, options *v1.DeleteOptions) error { // DeleteCollection deletes a collection of objects. func (c *storagePools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } return c.client.Delete(). Resource("storagepools"). VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). Body(options). Do(). Error() diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepoolclaim.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepoolclaim.go index d9a0637989..e5495eb4b4 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepoolclaim.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/storagepoolclaim.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ limitations under the License. package v1alpha1 import ( + "time" + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -72,10 +74,15 @@ func (c *storagePoolClaims) Get(name string, options v1.GetOptions) (result *v1a // List takes label and field selectors, and returns the list of StoragePoolClaims that match those selectors. func (c *storagePoolClaims) List(opts v1.ListOptions) (result *v1alpha1.StoragePoolClaimList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } result = &v1alpha1.StoragePoolClaimList{} err = c.client.Get(). Resource("storagepoolclaims"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Do(). Into(result) return @@ -83,10 +90,15 @@ func (c *storagePoolClaims) List(opts v1.ListOptions) (result *v1alpha1.StorageP // Watch returns a watch.Interface that watches the requested storagePoolClaims. func (c *storagePoolClaims) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } opts.Watch = true return c.client.Get(). Resource("storagepoolclaims"). VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). Watch() } @@ -125,9 +137,14 @@ func (c *storagePoolClaims) Delete(name string, options *v1.DeleteOptions) error // DeleteCollection deletes a collection of objects. func (c *storagePoolClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } return c.client.Delete(). Resource("storagepoolclaims"). VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). Body(options). Do(). Error() diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/factory.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/factory.go index 7c47966a15..fb232b869b 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/factory.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/factory.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go index 134f4f6701..63ca798727 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -53,6 +53,8 @@ func (f *genericInformer) Lister() cache.GenericLister { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=openebs.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("blockdevices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().BlockDevices().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("castemplates"): return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().CASTemplates().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("cstorpools"): diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go index 28dd08203b..a1490889a8 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/interface.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/interface.go index 75104f73f2..0a8a1e519a 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/interface.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdevice.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdevice.go new file mode 100644 index 0000000000..81b2664342 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdevice.go @@ -0,0 +1,88 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + openebsiov1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// BlockDeviceInformer provides access to a shared informer and lister for +// BlockDevices. +type BlockDeviceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.BlockDeviceLister +} + +type blockDeviceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewBlockDeviceInformer constructs a new informer for BlockDevice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewBlockDeviceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredBlockDeviceInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredBlockDeviceInformer constructs a new informer for BlockDevice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredBlockDeviceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().BlockDevices().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().BlockDevices().Watch(options) + }, + }, + &openebsiov1alpha1.BlockDevice{}, + resyncPeriod, + indexers, + ) +} + +func (f *blockDeviceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredBlockDeviceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *blockDeviceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&openebsiov1alpha1.BlockDevice{}, f.defaultInformer) +} + +func (f *blockDeviceInformer) Lister() v1alpha1.BlockDeviceLister { + return v1alpha1.NewBlockDeviceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/castemplate.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/castemplate.go index a050c2ec2f..0e9e63dff7 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/castemplate.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/castemplate.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorpool.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorpool.go index 6db3865794..1c005e565c 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorpool.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorpool.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolume.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolume.go index f898d11dc0..0d7c718f74 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolume.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolume.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolumereplica.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolumereplica.go index ec8cca51aa..f0e4b70098 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolumereplica.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/cstorvolumereplica.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/disk.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/disk.go index c91e6d0d38..a4db17ade0 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/disk.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/disk.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go index 012100bfde..ec0e553a82 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,6 +24,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { + // BlockDevices returns a BlockDeviceInformer. + BlockDevices() BlockDeviceInformer // CASTemplates returns a CASTemplateInformer. CASTemplates() CASTemplateInformer // CStorPools returns a CStorPoolInformer. @@ -53,6 +55,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// BlockDevices returns a BlockDeviceInformer. +func (v *version) BlockDevices() BlockDeviceInformer { + return &blockDeviceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // CASTemplates returns a CASTemplateInformer. func (v *version) CASTemplates() CASTemplateInformer { return &cASTemplateInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/runtask.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/runtask.go index 5253e5fc1d..b3ae4eac0c 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/runtask.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/runtask.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepool.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepool.go index 346e84de4f..22099dffc7 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepool.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepool.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepoolclaim.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepoolclaim.go index 875c4c1dea..8b4174917c 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepoolclaim.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/storagepoolclaim.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdevice.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdevice.go new file mode 100644 index 0000000000..f10dc88bcd --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdevice.go @@ -0,0 +1,65 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// BlockDeviceLister helps list BlockDevices. +type BlockDeviceLister interface { + // List lists all BlockDevices in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.BlockDevice, err error) + // Get retrieves the BlockDevice from the index for a given name. + Get(name string) (*v1alpha1.BlockDevice, error) + BlockDeviceListerExpansion +} + +// blockDeviceLister implements the BlockDeviceLister interface. +type blockDeviceLister struct { + indexer cache.Indexer +} + +// NewBlockDeviceLister returns a new BlockDeviceLister. +func NewBlockDeviceLister(indexer cache.Indexer) BlockDeviceLister { + return &blockDeviceLister{indexer: indexer} +} + +// List lists all BlockDevices in the indexer. +func (s *blockDeviceLister) List(selector labels.Selector) (ret []*v1alpha1.BlockDevice, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.BlockDevice)) + }) + return ret, err +} + +// Get retrieves the BlockDevice from the index for a given name. +func (s *blockDeviceLister) Get(name string) (*v1alpha1.BlockDevice, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("blockdevice"), name) + } + return obj.(*v1alpha1.BlockDevice), nil +} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/castemplate.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/castemplate.go index 3fa9c7f60d..9c5b7d57b6 100644 --- a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/castemplate.go +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/castemplate.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorpool.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorpool.go index 1b5da3e37e..13ee2e9ad2 100644 --- a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorpool.go +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorpool.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolume.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolume.go index e70440310f..0a970304d6 100644 --- a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolume.go +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolume.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolumereplica.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolumereplica.go index ab4de92d69..b7f42a743d 100644 --- a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolumereplica.go +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/cstorvolumereplica.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/disk.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/disk.go index dc88a03c44..daf7b48829 100644 --- a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/disk.go +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/disk.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go index 6be51e29ec..e77d650622 100644 --- a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,6 +18,10 @@ limitations under the License. package v1alpha1 +// BlockDeviceListerExpansion allows custom methods to be added to +// BlockDeviceLister. +type BlockDeviceListerExpansion interface{} + // CASTemplateListerExpansion allows custom methods to be added to // CASTemplateLister. type CASTemplateListerExpansion interface{} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/runtask.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/runtask.go index 5ebc3784ee..e510bc1c76 100644 --- a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/runtask.go +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/runtask.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepool.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepool.go index 4b05493f1a..0d4f89e9cf 100644 --- a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepool.go +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepool.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepoolclaim.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepoolclaim.go index 985d1f1efc..c02b26dd96 100644 --- a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepoolclaim.go +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/storagepoolclaim.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The OpenEBS Authors +Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 0d0b8e0e43f5fdfa25efeaa1d355881d900c3e56 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Fri, 5 Jul 2019 16:35:44 +0530 Subject: [PATCH 35/45] Update webpack and package.json Signed-off-by: Akash Srivastava --- client/app/html/index.html | 2 +- client/app/scripts/components/app.js | 9 --------- client/package.json | 2 +- client/webpack.production.config.js | 2 +- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/client/app/html/index.html b/client/app/html/index.html index 9b88bb1eb2..ec0381c48c 100644 --- a/client/app/html/index.html +++ b/client/app/html/index.html @@ -2,7 +2,7 @@ - MayaOnline - Topology + Topology diff --git a/client/app/scripts/components/app.js b/client/app/scripts/components/app.js index 0b616cfc60..7385b582b8 100644 --- a/client/app/scripts/components/app.js +++ b/client/app/scripts/components/app.js @@ -8,7 +8,6 @@ import { debounce, isEqual } from 'lodash'; import { ThemeProvider } from 'styled-components'; import theme from 'weaveworks-ui-components/lib/theme'; -import Logo from './logo'; import Footer from './footer'; import Sidebar from './sidebar'; import HelpPanel from './help-panel'; @@ -199,7 +198,6 @@ class App extends React.Component { 'contrast-mode': contrastMode, 'time-travel-open': timeTravelSupported, }); - const isIframe = window !== window.top; return ( @@ -218,13 +216,6 @@ class App extends React.Component { {timeTravelSupported && this.props.renderTimeTravel()}
-
- {!isIframe && - - - - } -
diff --git a/client/package.json b/client/package.json index 616d660a87..95cd074083 100644 --- a/client/package.json +++ b/client/package.json @@ -43,7 +43,7 @@ "reselect": "3.0.1", "reselect-map": "1.0.3", "styled-components": "3.4.10", - "weaveworks-ui-components": "0.20.0", + "weaveworks-ui-components": "https://github.com/openebs/ui-components.git#rebase", "whatwg-fetch": "2.0.3", "xterm": "3.10.1" }, diff --git a/client/webpack.production.config.js b/client/webpack.production.config.js index 4dd2aeea21..1627d1594d 100644 --- a/client/webpack.production.config.js +++ b/client/webpack.production.config.js @@ -49,7 +49,7 @@ module.exports = { }, plugins: [ - new CleanWebpackPlugin([OUTPUT_PATH]), + new CleanWebpackPlugin(['build-external']), new webpack.DefinePlugin(GLOBALS), new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), new webpack.IgnorePlugin(/.*\.map$/, /xterm\/lib\/addons/), From bb8aa4a0a4699972494bfc4ab9313e8eaf973639 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Fri, 5 Jul 2019 18:09:13 +0530 Subject: [PATCH 36/45] Update ui-components dependency from openebs to mayadata Signed-off-by: Akash Srivastava --- client/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/package.json b/client/package.json index 95cd074083..343508ca7b 100644 --- a/client/package.json +++ b/client/package.json @@ -43,7 +43,7 @@ "reselect": "3.0.1", "reselect-map": "1.0.3", "styled-components": "3.4.10", - "weaveworks-ui-components": "https://github.com/openebs/ui-components.git#rebase", + "weaveworks-ui-components": "https://github.com/mayadata-io/ui-components.git", "whatwg-fetch": "2.0.3", "xterm": "3.10.1" }, From b675485d990a06b39c5121b54378610bf83af067 Mon Sep 17 00:00:00 2001 From: A V RAHUL Date: Thu, 22 Nov 2018 21:40:36 +0530 Subject: [PATCH 37/45] Fix table view --- .../node-details-table-headers.js | 2 +- client/app/scripts/constants/styles.js | 58 ++++++++++++++----- .../app/scripts/utils/node-details-utils.js | 4 +- client/app/styles/_base.scss | 11 +++- 4 files changed, 53 insertions(+), 22 deletions(-) diff --git a/client/app/scripts/components/node-details/node-details-table-headers.js b/client/app/scripts/components/node-details/node-details-table-headers.js index 37a4a77792..6116d7235b 100644 --- a/client/app/scripts/components/node-details/node-details-table-headers.js +++ b/client/app/scripts/components/node-details/node-details-table-headers.js @@ -34,7 +34,7 @@ export default class NodeDetailsTableHeaders extends React.Component { const style = colStyles[index]; const label = - (style.width === NODE_DETAILS_TABLE_CW.XS && NODE_DETAILS_TABLE_XS_LABEL[header.id]) ? + (style.width === NODE_DETAILS_TABLE_CW && NODE_DETAILS_TABLE_XS_LABEL[header.id]) ? NODE_DETAILS_TABLE_XS_LABEL[header.id] : header.label; return ( diff --git a/client/app/scripts/constants/styles.js b/client/app/scripts/constants/styles.js index 8e8c88ba8b..a497f71125 100644 --- a/client/app/scripts/constants/styles.js +++ b/client/app/scripts/constants/styles.js @@ -1,5 +1,4 @@ -import { GRAPH_VIEW_MODE, RESOURCE_VIEW_MODE } from './naming'; - +import { GRAPH_VIEW_MODE, TABLE_VIEW_MODE, RESOURCE_VIEW_MODE } from './naming'; export const DETAILS_PANEL_WIDTH = 420; export const DETAILS_PANEL_OFFSET = 8; @@ -57,45 +56,74 @@ export const CANVAS_MARGINS = { [RESOURCE_VIEW_MODE]: { bottom: 150, left: 210, right: 40, top: 200 }, + [TABLE_VIEW_MODE]: { + bottom: 30, left: 40, right: 40, top: 220 + }, }; // Node details table constants export const NODE_DETAILS_TABLE_CW = { L: '85px', M: '70px', - // 6 chars wide with our current font choices, (pids can be 6, ports only 5). S: '56px', - XL: '120px', - XS: '32px', - XXL: '140px', - XXXL: '170px', + XL: '100px', + XS: '42px', + // 6 chars wide with our current font choices, (pids can be 6, ports only 5). + XXL: '120px', + XXXL: '140px', + XXXXL: '170px', }; export const NODE_DETAILS_TABLE_COLUMN_WIDTHS = { + container: NODE_DETAILS_TABLE_CW.XS, count: NODE_DETAILS_TABLE_CW.XS, - docker_container_created: NODE_DETAILS_TABLE_CW.XXXL, + CPU: NODE_DETAILS_TABLE_CW.L, + docker_container_created: NODE_DETAILS_TABLE_CW.XXXXL, + docker_container_hostname: NODE_DETAILS_TABLE_CW.M, docker_container_restart_count: NODE_DETAILS_TABLE_CW.M, - docker_container_state_human: NODE_DETAILS_TABLE_CW.XXXL, + docker_container_state_human: NODE_DETAILS_TABLE_CW.XXXXL, docker_container_uptime: NODE_DETAILS_TABLE_CW.L, docker_cpu_total_usage: NODE_DETAILS_TABLE_CW.M, docker_memory_usage: NODE_DETAILS_TABLE_CW.M, + hosts: NODE_DETAILS_TABLE_CW.XL, // e.g. details panel > pods - kubernetes_ip: NODE_DETAILS_TABLE_CW.XL, + 'kube-containers': NODE_DETAILS_TABLE_CW.M, + kubernetes_access_modes: NODE_DETAILS_TABLE_CW.XL, + kubernetes_created: NODE_DETAILS_TABLE_CW.M, + kubernetes_ip: NODE_DETAILS_TABLE_CW.XXL, + kubernetes_labels_: NODE_DETAILS_TABLE_CW.XL, + kubernetes_message: NODE_DETAILS_TABLE_CW.M, + kubernetes_name: NODE_DETAILS_TABLE_CW.M, + kubernetes_namespace: NODE_DETAILS_TABLE_CW.L, + kubernetes_node_type: NODE_DETAILS_TABLE_CW.XL, + kubernetes_provisioner: NODE_DETAILS_TABLE_CW.L, + kubernetes_reclaim_policy: NODE_DETAILS_TABLE_CW.XL, + kubernetes_restart_count: NODE_DETAILS_TABLE_CW.L, kubernetes_state: NODE_DETAILS_TABLE_CW.M, + kubernetes_status: NODE_DETAILS_TABLE_CW.XL, + kubernetes_storage_class_name: NODE_DETAILS_TABLE_CW.XL, + kubernetes_storage_driver: NODE_DETAILS_TABLE_CW.XL, + kubernetes_throughput_r: NODE_DETAILS_TABLE_CW.XL, + kubernetes_throughput_w: NODE_DETAILS_TABLE_CW.XL, + kubernetes_volume_claim: NODE_DETAILS_TABLE_CW.XXL, + kubernetes_volume_name: NODE_DETAILS_TABLE_CW.XXL, + kubernetes_volumesnapshotdata: NODE_DETAILS_TABLE_CW.XL, + label: NODE_DETAILS_TABLE_CW.XL, + lops: NODE_DETAILS_TABLE_CW.M, open_files_count: NODE_DETAILS_TABLE_CW.M, pid: NODE_DETAILS_TABLE_CW.S, port: NODE_DETAILS_TABLE_CW.S, - // Label "Parent PID" needs more space - ppid: NODE_DETAILS_TABLE_CW.M, + ppid: NODE_DETAILS_TABLE_CW.S, process_cpu_usage_percent: NODE_DETAILS_TABLE_CW.M, - process_memory_usage_bytes: NODE_DETAILS_TABLE_CW.M, + r: NODE_DETAILS_TABLE_CW.M, + services: NODE_DETAILS_TABLE_CW.XL, threads: NODE_DETAILS_TABLE_CW.M, // weave connections - weave_connection_connection: NODE_DETAILS_TABLE_CW.XXL, - weave_connection_info: NODE_DETAILS_TABLE_CW.XL, + weave_connection_connection: NODE_DETAILS_TABLE_CW.XXXL, + weave_connection_info: NODE_DETAILS_TABLE_CW.XXL, weave_connection_state: NODE_DETAILS_TABLE_CW.L, }; diff --git a/client/app/scripts/utils/node-details-utils.js b/client/app/scripts/utils/node-details-utils.js index 7a3975cfbb..ab20c877c5 100644 --- a/client/app/scripts/utils/node-details-utils.js +++ b/client/app/scripts/utils/node-details-utils.js @@ -1,5 +1,3 @@ -import { NODE_DETAILS_TABLE_COLUMN_WIDTHS } from '../constants/styles'; - export function isGenericTable(table) { return (table.type || (table.get && table.get('type'))) === 'multicolumn-table'; } @@ -36,6 +34,6 @@ export function getTableColumnsStyles(headers) { textAlign: isNumber(header) ? 'right' : 'left', // More beauty hacking, ports and counts can only get // so big, free up WS for other longer fields like IPs! - width: NODE_DETAILS_TABLE_COLUMN_WIDTHS[header.id] + width: isNumber(header.id) ? '85px' : '120px' })); } diff --git a/client/app/styles/_base.scss b/client/app/styles/_base.scss index b55831f411..4c0e70ac5d 100644 --- a/client/app/styles/_base.scss +++ b/client/app/styles/_base.scss @@ -169,7 +169,6 @@ a { left: 0; line-height: 150%; margin: 0; - overflow: auto; position: fixed; right: 0; top: 0; @@ -388,7 +387,6 @@ a { color: $text-secondary-color; width: 33%; height: 550px; - display: flex; flex-direction: column; justify-content: center; @@ -1669,6 +1667,12 @@ a { } } + .node-details-table{ + overflow-x: auto; + overflow-y: auto; + width: 100%; + } + .node-details-table-wrapper-wrapper { flex: 1; @@ -1679,6 +1683,8 @@ a { .node-details-table-wrapper { margin: 0; flex: 1; + overflow-x: auto; + overflow-y: auto; } .nodes-grid-graph { @@ -1741,7 +1747,6 @@ a { tbody { display: block; - overflow-y: scroll; } } } From c40d3feb0a31ae80cd16cb19f64c59fb02c10173 Mon Sep 17 00:00:00 2001 From: A V RAHUL Date: Thu, 13 Dec 2018 00:34:59 +0530 Subject: [PATCH 38/45] fixed the table view for larger table headers and sidebar issue --- client/app/scripts/utils/node-details-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/scripts/utils/node-details-utils.js b/client/app/scripts/utils/node-details-utils.js index ab20c877c5..b0f635ca07 100644 --- a/client/app/scripts/utils/node-details-utils.js +++ b/client/app/scripts/utils/node-details-utils.js @@ -34,6 +34,6 @@ export function getTableColumnsStyles(headers) { textAlign: isNumber(header) ? 'right' : 'left', // More beauty hacking, ports and counts can only get // so big, free up WS for other longer fields like IPs! - width: isNumber(header.id) ? '85px' : '120px' + width: isNumber(header.id) > '120px' ? '100px' : '160px' })); } From 53d5002266618aef710198a4c01ada6e96fbbe8c Mon Sep 17 00:00:00 2001 From: AVRahul Date: Tue, 12 Mar 2019 15:08:29 +0530 Subject: [PATCH 39/45] fixes the table header when scrolled --- client/app/styles/_base.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/app/styles/_base.scss b/client/app/styles/_base.scss index 4c0e70ac5d..e8085a808e 100644 --- a/client/app/styles/_base.scss +++ b/client/app/styles/_base.scss @@ -1743,6 +1743,10 @@ a { thead { box-shadow: 0 4px 2px -2px transparentize($color-black, 0.84); border-bottom: 1px solid $color-gray-600; + top: 0px; + position: sticky; + z-index: $layer-modal; + background: $color-white; } tbody { From 79b63ce365cde1018cc1b9cde75ffaf8cf4926f7 Mon Sep 17 00:00:00 2001 From: AVRahul Date: Tue, 12 Mar 2019 15:18:44 +0530 Subject: [PATCH 40/45] fixes the table header z-index issues --- client/app/styles/_base.scss | 2 +- client/app/styles/_default-theme.scss | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client/app/styles/_base.scss b/client/app/styles/_base.scss index e8085a808e..57531ade62 100644 --- a/client/app/styles/_base.scss +++ b/client/app/styles/_base.scss @@ -1745,7 +1745,7 @@ a { border-bottom: 1px solid $color-gray-600; top: 0px; position: sticky; - z-index: $layer-modal; + z-index: $z-index-table; background: $color-white; } diff --git a/client/app/styles/_default-theme.scss b/client/app/styles/_default-theme.scss index 6b25ce4563..d3d338f6e1 100644 --- a/client/app/styles/_default-theme.scss +++ b/client/app/styles/_default-theme.scss @@ -42,6 +42,8 @@ $search-border-width: 1px; $timeline-height: 55px; +$z-index-table: 1; + /* specific elements */ $body-background-color: $color-purple-25; $label-background-color: transparentize($color-purple-25, 0.3); From ddb78d4546c703a1b74f0ee2929456c35d29419c Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Tue, 9 Jul 2019 14:20:30 +0530 Subject: [PATCH 41/45] Update circle ci config (#165) * Update package.json to exclude building external client Signed-off-by: Akash Srivastava * Update circle ci config yaml - Builds were failing because of ci cache. Update it to use new files instead of cached ones. Signed-off-by: Akash Srivastava --- .circleci/config.yml | 11 +++++++++-- client/package.json | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 35a1759633..74b5ae4ae7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -79,7 +79,10 @@ jobs: steps: - checkout # Convoluted set of steps here to mimic Makefile actions of bind-mounting different dirs into container - - run: mv client/* /home/weave/ + # CI is using cached files and it was failing. + # - run: mv client/* /home/weave/ + - run: cp -rv client/* /home/weave/ + - run: cp client/.babelrc /home/weave/ - run: cd /home/weave; mkdir build ; yarn install; yarn run build ; mv build scope/client - run: cd /home/weave; mkdir build-external; yarn install; yarn run build-external; mv build-external scope/client - run: cd /home/weave; mkdir tmp ; yarn install; yarn run bundle ; mv tmp scope @@ -93,9 +96,13 @@ jobs: client-test: <<: *client-defaults steps: + # CI is using cached files and it was failing. - checkout - run: | - mv client/app client/test /home/weave/ + cp -r client/* /home/weave/ + cp client/.babelrc /home/weave + rm -rf /home/weave/node_modules + cd /home/weave; yarn install cd /home/weave; yarn run lint cd /home/weave; yarn test diff --git a/client/package.json b/client/package.json index 343508ca7b..02953bc981 100644 --- a/client/package.json +++ b/client/package.json @@ -100,7 +100,7 @@ }, "scripts": { "build": "webpack --config webpack.production.config.js", - "build-external": "EXTERNAL=true webpack --config webpack.production.config.js", + "build-external": "EXTERNAL=false webpack --config webpack.production.config.js", "copy-pkg-files": "cp package.json build-pkg/ && cp -R app/styles build-pkg/", "build-pkg": "mkdir -p build-pkg && node node_modules/.bin/babel app/scripts --ignore __tests__ --out-dir build-pkg && yarn run copy-pkg-files", "bundle": "mkdir -p bundle && yarn run build-pkg && cd ./build-pkg && yarn pack --filename ../bundle/weave-scope.tgz", From 2ac6bbd770ec3b17cfc6f9a69e2a56f6f646fd0b Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Wed, 24 Jul 2019 20:52:58 +0530 Subject: [PATCH 42/45] Update pvc size to read from status (#166) Signed-off-by: Akash Srivastava --- probe/kubernetes/persistentvolumeclaim.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/probe/kubernetes/persistentvolumeclaim.go b/probe/kubernetes/persistentvolumeclaim.go index 2bd1eab449..d51bbb108a 100644 --- a/probe/kubernetes/persistentvolumeclaim.go +++ b/probe/kubernetes/persistentvolumeclaim.go @@ -53,7 +53,7 @@ func (p *persistentVolumeClaim) GetStorageClass() string { // GetCapacity returns the storage size of PVC func (p *persistentVolumeClaim) GetCapacity() string { - capacity := p.Spec.Resources.Requests[apiv1.ResourceStorage] + capacity := p.Status.Capacity[apiv1.ResourceStorage] if capacity.String() != "" { return capacity.String() } From 12c6a97c6a588b4855c362d16d1d513e5a0c43d6 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Fri, 26 Jul 2019 21:38:34 +0530 Subject: [PATCH 43/45] Add spec and clientset of bdc Signed-off-by: Akash Srivastava --- .../apis/openebs.io/v1alpha1/block_device.go | 1 - .../openebs.io/v1alpha1/block_device_claim.go | 118 ++++++++++++ .../pkg/apis/openebs.io/v1alpha1/register.go | 2 + .../v1alpha1/zz_generated.deepcopy.go | 134 ++++++++++++++ .../typed/openebs.io/v1alpha1/blockdevice.go | 14 +- .../openebs.io/v1alpha1/blockdeviceclaim.go | 174 ++++++++++++++++++ .../v1alpha1/fake/fake_blockdevice.go | 24 ++- .../v1alpha1/fake/fake_blockdeviceclaim.go | 128 +++++++++++++ .../v1alpha1/fake/fake_openebs.io_client.go | 8 +- .../v1alpha1/generated_expansion.go | 2 + .../openebs.io/v1alpha1/openebs.io_client.go | 9 +- .../informers/externalversions/generic.go | 2 + .../openebs.io/v1alpha1/blockdevice.go | 13 +- .../openebs.io/v1alpha1/blockdeviceclaim.go | 89 +++++++++ .../openebs.io/v1alpha1/interface.go | 9 +- .../openebs.io/v1alpha1/blockdevice.go | 39 +++- .../openebs.io/v1alpha1/blockdeviceclaim.go | 94 ++++++++++ .../v1alpha1/expansion_generated.go | 12 ++ 18 files changed, 845 insertions(+), 27 deletions(-) create mode 100644 vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device_claim.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdeviceclaim.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdeviceclaim.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdeviceclaim.go create mode 100644 vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdeviceclaim.go diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device.go index 95b00e6747..7789f470ed 100644 --- a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device.go +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device.go @@ -7,7 +7,6 @@ import ( // +genclient // +genclient:noStatus -// +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +resource:path=blockdevice diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device_claim.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device_claim.go new file mode 100644 index 0000000000..23548ef3b1 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/block_device_claim.go @@ -0,0 +1,118 @@ +/* +Copyright 2019 The OpenEBS Authors +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster +// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file + +// DeviceClaimSpec defines the desired state of BlockDeviceClaim +type DeviceClaimSpec struct { + Resources DeviceClaimResources `json:"resources"` // the resources in the claim like Capacity, IOPS + DeviceType string `json:"deviceType"` // DeviceType represents the type of drive like SSD, HDD etc., + HostName string `json:"hostName"` // Node name from where blockdevice has to be claimed. + Details DeviceClaimDetails `json:"deviceClaimDetails,omitempty"` // Details of the device to be claimed + BlockDeviceName string `json:"blockDeviceName,omitempty"` // BlockDeviceName is the reference to the block-device backing this claim +} + +// DeviceClaimStatus defines the observed state of BlockDeviceClaim +type DeviceClaimStatus struct { + Phase DeviceClaimPhase `json:"phase"` +} + +// DeviceClaimPhase is a typed string for phase field of BlockDeviceClaim. +type DeviceClaimPhase string + +// BlockDeviceClaim CR, when created pass through phases before it got some Devices Assigned. +// Given below table, have all phases which BlockDeviceClaim CR can go before it is marked done. +const ( + // BlockDeviceClaimStatusEmpty represents that the BlockDeviceClaim was just created. + BlockDeviceClaimStatusEmpty DeviceClaimPhase = "" + + // BlockDeviceClaimStatusPending represents BlockDeviceClaim has not been assigned devices yet. Rather + // search is going on for matching devices. + BlockDeviceClaimStatusPending DeviceClaimPhase = "Pending" + + // BlockDeviceClaimStatusInvalidCapacity represents BlockDeviceClaim has invalid capacity request i.e. 0/-1 + BlockDeviceClaimStatusInvalidCapacity DeviceClaimPhase = "Invalid Capacity Request" + + // BlockDeviceClaimStatusDone represents BlockDeviceClaim has been assigned backing blockdevice and ready for use. + BlockDeviceClaimStatusDone DeviceClaimPhase = "Bound" +) + +// DeviceClaimResources defines the request by the claim, eg, Storage, IOPS +type DeviceClaimResources struct { + // Requests describes the minimum resources required. eg: if storage resource of 10G is + // requested minimum capacity of 10G should be available + Requests v1.ResourceList `json:"requests"` +} + +const ( + // ResourceStorage defines the storage required as v1.Quantity + ResourceStorage v1.ResourceName = "storage" +) + +// DeviceClaimDetails defines the details of the block device that should be claimed +type DeviceClaimDetails struct { + // BlockVolumeMode represents whether to claim a device in Block mode or Filesystem mode. + // These are use cases of BlockVolumeMode: + // 1) Not specified: DeviceFormat and MountPoint will not be considered + // 2) VolumeModeBlock: DeviceFormat and MountPoint checks will be used as empty strings irrespective + // of the value they hold + // 3) VolumeModeFileSystem: DeviceFormat and MountPoint will be used for exact matches + BlockVolumeMode BlockDeviceVolumeMode `json:"blockVolumeMode,omitempty"` + DeviceFormat string `json:"formatType,omitempty"` //Format of the device required, eg:ext4, xfs + AllowPartition bool `json:"allowPartition,omitempty"` //AllowPartition represents whether to claim a full block device or a device that is a partition +} + +// BlockDeviceVolumeMode specifies the type in which the BlockDevice can be used +type BlockDeviceVolumeMode string + +const ( + // VolumeModeBlock specifies that the block device needs to be used as a raw block + VolumeModeBlock BlockDeviceVolumeMode = "Block" + // VolumeModeFileSystem specifies that block device will be used with a filesystem already existing + VolumeModeFileSystem BlockDeviceVolumeMode = "FileSystem" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=blockdeviceclaim + +// BlockDeviceClaim is the Schema for the block device claim API +type BlockDeviceClaim struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DeviceClaimSpec `json:"spec,omitempty"` + Status DeviceClaimStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +resource:path=blockdeviceclaims + +// BlockDeviceClaimList contains a list of BlockDeviceClaim +type BlockDeviceClaimList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []BlockDeviceClaim `json:"items"` +} diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go index f7b56220d3..26c2d53ec2 100644 --- a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/register.go @@ -51,6 +51,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &DiskList{}, &BlockDevice{}, &BlockDeviceList{}, + &BlockDeviceClaim{}, + &BlockDeviceClaimList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go index 1a4b9fd73e..48d8c9a12a 100644 --- a/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go @@ -74,6 +74,67 @@ func (in *BlockDeviceAttr) DeepCopy() *BlockDeviceAttr { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlockDeviceClaim) DeepCopyInto(out *BlockDeviceClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockDeviceClaim. +func (in *BlockDeviceClaim) DeepCopy() *BlockDeviceClaim { + if in == nil { + return nil + } + out := new(BlockDeviceClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BlockDeviceClaim) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlockDeviceClaimList) DeepCopyInto(out *BlockDeviceClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BlockDeviceClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockDeviceClaimList. +func (in *BlockDeviceClaimList) DeepCopy() *BlockDeviceClaimList { + if in == nil { + return nil + } + out := new(BlockDeviceClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BlockDeviceClaimList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BlockDeviceGroup) DeepCopyInto(out *BlockDeviceGroup) { *out = *in @@ -738,6 +799,79 @@ func (in *DeviceCapacity) DeepCopy() *DeviceCapacity { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceClaimDetails) DeepCopyInto(out *DeviceClaimDetails) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceClaimDetails. +func (in *DeviceClaimDetails) DeepCopy() *DeviceClaimDetails { + if in == nil { + return nil + } + out := new(DeviceClaimDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceClaimResources) DeepCopyInto(out *DeviceClaimResources) { + *out = *in + if in.Requests != nil { + in, out := &in.Requests, &out.Requests + *out = make(v1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceClaimResources. +func (in *DeviceClaimResources) DeepCopy() *DeviceClaimResources { + if in == nil { + return nil + } + out := new(DeviceClaimResources) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceClaimSpec) DeepCopyInto(out *DeviceClaimSpec) { + *out = *in + in.Resources.DeepCopyInto(&out.Resources) + out.Details = in.Details + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceClaimSpec. +func (in *DeviceClaimSpec) DeepCopy() *DeviceClaimSpec { + if in == nil { + return nil + } + out := new(DeviceClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceClaimStatus) DeepCopyInto(out *DeviceClaimStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceClaimStatus. +func (in *DeviceClaimStatus) DeepCopy() *DeviceClaimStatus { + if in == nil { + return nil + } + out := new(DeviceClaimStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DeviceDetails) DeepCopyInto(out *DeviceDetails) { *out = *in diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdevice.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdevice.go index c0019121fc..bbfd88434a 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdevice.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdevice.go @@ -32,7 +32,7 @@ import ( // BlockDevicesGetter has a method to return a BlockDeviceInterface. // A group's client should implement this interface. type BlockDevicesGetter interface { - BlockDevices() BlockDeviceInterface + BlockDevices(namespace string) BlockDeviceInterface } // BlockDeviceInterface has methods to work with BlockDevice resources. @@ -51,12 +51,14 @@ type BlockDeviceInterface interface { // blockDevices implements BlockDeviceInterface type blockDevices struct { client rest.Interface + ns string } // newBlockDevices returns a BlockDevices -func newBlockDevices(c *OpenebsV1alpha1Client) *blockDevices { +func newBlockDevices(c *OpenebsV1alpha1Client, namespace string) *blockDevices { return &blockDevices{ client: c.RESTClient(), + ns: namespace, } } @@ -64,6 +66,7 @@ func newBlockDevices(c *OpenebsV1alpha1Client) *blockDevices { func (c *blockDevices) Get(name string, options v1.GetOptions) (result *v1alpha1.BlockDevice, err error) { result = &v1alpha1.BlockDevice{} err = c.client.Get(). + Namespace(c.ns). Resource("blockdevices"). Name(name). VersionedParams(&options, scheme.ParameterCodec). @@ -80,6 +83,7 @@ func (c *blockDevices) List(opts v1.ListOptions) (result *v1alpha1.BlockDeviceLi } result = &v1alpha1.BlockDeviceList{} err = c.client.Get(). + Namespace(c.ns). Resource("blockdevices"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). @@ -96,6 +100,7 @@ func (c *blockDevices) Watch(opts v1.ListOptions) (watch.Interface, error) { } opts.Watch = true return c.client.Get(). + Namespace(c.ns). Resource("blockdevices"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). @@ -106,6 +111,7 @@ func (c *blockDevices) Watch(opts v1.ListOptions) (watch.Interface, error) { func (c *blockDevices) Create(blockDevice *v1alpha1.BlockDevice) (result *v1alpha1.BlockDevice, err error) { result = &v1alpha1.BlockDevice{} err = c.client.Post(). + Namespace(c.ns). Resource("blockdevices"). Body(blockDevice). Do(). @@ -117,6 +123,7 @@ func (c *blockDevices) Create(blockDevice *v1alpha1.BlockDevice) (result *v1alph func (c *blockDevices) Update(blockDevice *v1alpha1.BlockDevice) (result *v1alpha1.BlockDevice, err error) { result = &v1alpha1.BlockDevice{} err = c.client.Put(). + Namespace(c.ns). Resource("blockdevices"). Name(blockDevice.Name). Body(blockDevice). @@ -128,6 +135,7 @@ func (c *blockDevices) Update(blockDevice *v1alpha1.BlockDevice) (result *v1alph // Delete takes name of the blockDevice and deletes it. Returns an error if one occurs. func (c *blockDevices) Delete(name string, options *v1.DeleteOptions) error { return c.client.Delete(). + Namespace(c.ns). Resource("blockdevices"). Name(name). Body(options). @@ -142,6 +150,7 @@ func (c *blockDevices) DeleteCollection(options *v1.DeleteOptions, listOptions v timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second } return c.client.Delete(). + Namespace(c.ns). Resource("blockdevices"). VersionedParams(&listOptions, scheme.ParameterCodec). Timeout(timeout). @@ -154,6 +163,7 @@ func (c *blockDevices) DeleteCollection(options *v1.DeleteOptions, listOptions v func (c *blockDevices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.BlockDevice, err error) { result = &v1alpha1.BlockDevice{} err = c.client.Patch(pt). + Namespace(c.ns). Resource("blockdevices"). SubResource(subresources...). Name(name). diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdeviceclaim.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdeviceclaim.go new file mode 100644 index 0000000000..acd19debd3 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/blockdeviceclaim.go @@ -0,0 +1,174 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "time" + + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + scheme "github.com/openebs/maya/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// BlockDeviceClaimsGetter has a method to return a BlockDeviceClaimInterface. +// A group's client should implement this interface. +type BlockDeviceClaimsGetter interface { + BlockDeviceClaims(namespace string) BlockDeviceClaimInterface +} + +// BlockDeviceClaimInterface has methods to work with BlockDeviceClaim resources. +type BlockDeviceClaimInterface interface { + Create(*v1alpha1.BlockDeviceClaim) (*v1alpha1.BlockDeviceClaim, error) + Update(*v1alpha1.BlockDeviceClaim) (*v1alpha1.BlockDeviceClaim, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.BlockDeviceClaim, error) + List(opts v1.ListOptions) (*v1alpha1.BlockDeviceClaimList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.BlockDeviceClaim, err error) + BlockDeviceClaimExpansion +} + +// blockDeviceClaims implements BlockDeviceClaimInterface +type blockDeviceClaims struct { + client rest.Interface + ns string +} + +// newBlockDeviceClaims returns a BlockDeviceClaims +func newBlockDeviceClaims(c *OpenebsV1alpha1Client, namespace string) *blockDeviceClaims { + return &blockDeviceClaims{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the blockDeviceClaim, and returns the corresponding blockDeviceClaim object, and an error if there is any. +func (c *blockDeviceClaims) Get(name string, options v1.GetOptions) (result *v1alpha1.BlockDeviceClaim, err error) { + result = &v1alpha1.BlockDeviceClaim{} + err = c.client.Get(). + Namespace(c.ns). + Resource("blockdeviceclaims"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of BlockDeviceClaims that match those selectors. +func (c *blockDeviceClaims) List(opts v1.ListOptions) (result *v1alpha1.BlockDeviceClaimList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.BlockDeviceClaimList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("blockdeviceclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested blockDeviceClaims. +func (c *blockDeviceClaims) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("blockdeviceclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a blockDeviceClaim and creates it. Returns the server's representation of the blockDeviceClaim, and an error, if there is any. +func (c *blockDeviceClaims) Create(blockDeviceClaim *v1alpha1.BlockDeviceClaim) (result *v1alpha1.BlockDeviceClaim, err error) { + result = &v1alpha1.BlockDeviceClaim{} + err = c.client.Post(). + Namespace(c.ns). + Resource("blockdeviceclaims"). + Body(blockDeviceClaim). + Do(). + Into(result) + return +} + +// Update takes the representation of a blockDeviceClaim and updates it. Returns the server's representation of the blockDeviceClaim, and an error, if there is any. +func (c *blockDeviceClaims) Update(blockDeviceClaim *v1alpha1.BlockDeviceClaim) (result *v1alpha1.BlockDeviceClaim, err error) { + result = &v1alpha1.BlockDeviceClaim{} + err = c.client.Put(). + Namespace(c.ns). + Resource("blockdeviceclaims"). + Name(blockDeviceClaim.Name). + Body(blockDeviceClaim). + Do(). + Into(result) + return +} + +// Delete takes name of the blockDeviceClaim and deletes it. Returns an error if one occurs. +func (c *blockDeviceClaims) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("blockdeviceclaims"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *blockDeviceClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("blockdeviceclaims"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched blockDeviceClaim. +func (c *blockDeviceClaims) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.BlockDeviceClaim, err error) { + result = &v1alpha1.BlockDeviceClaim{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("blockdeviceclaims"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdevice.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdevice.go index 0c3f625687..5adaa30fc3 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdevice.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdevice.go @@ -31,6 +31,7 @@ import ( // FakeBlockDevices implements BlockDeviceInterface type FakeBlockDevices struct { Fake *FakeOpenebsV1alpha1 + ns string } var blockdevicesResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "blockdevices"} @@ -40,7 +41,8 @@ var blockdevicesKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1 // Get takes name of the blockDevice, and returns the corresponding blockDevice object, and an error if there is any. func (c *FakeBlockDevices) Get(name string, options v1.GetOptions) (result *v1alpha1.BlockDevice, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(blockdevicesResource, name), &v1alpha1.BlockDevice{}) + Invokes(testing.NewGetAction(blockdevicesResource, c.ns, name), &v1alpha1.BlockDevice{}) + if obj == nil { return nil, err } @@ -50,7 +52,8 @@ func (c *FakeBlockDevices) Get(name string, options v1.GetOptions) (result *v1al // List takes label and field selectors, and returns the list of BlockDevices that match those selectors. func (c *FakeBlockDevices) List(opts v1.ListOptions) (result *v1alpha1.BlockDeviceList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(blockdevicesResource, blockdevicesKind, opts), &v1alpha1.BlockDeviceList{}) + Invokes(testing.NewListAction(blockdevicesResource, blockdevicesKind, c.ns, opts), &v1alpha1.BlockDeviceList{}) + if obj == nil { return nil, err } @@ -71,13 +74,15 @@ func (c *FakeBlockDevices) List(opts v1.ListOptions) (result *v1alpha1.BlockDevi // Watch returns a watch.Interface that watches the requested blockDevices. func (c *FakeBlockDevices) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(blockdevicesResource, opts)) + InvokesWatch(testing.NewWatchAction(blockdevicesResource, c.ns, opts)) + } // Create takes the representation of a blockDevice and creates it. Returns the server's representation of the blockDevice, and an error, if there is any. func (c *FakeBlockDevices) Create(blockDevice *v1alpha1.BlockDevice) (result *v1alpha1.BlockDevice, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(blockdevicesResource, blockDevice), &v1alpha1.BlockDevice{}) + Invokes(testing.NewCreateAction(blockdevicesResource, c.ns, blockDevice), &v1alpha1.BlockDevice{}) + if obj == nil { return nil, err } @@ -87,7 +92,8 @@ func (c *FakeBlockDevices) Create(blockDevice *v1alpha1.BlockDevice) (result *v1 // Update takes the representation of a blockDevice and updates it. Returns the server's representation of the blockDevice, and an error, if there is any. func (c *FakeBlockDevices) Update(blockDevice *v1alpha1.BlockDevice) (result *v1alpha1.BlockDevice, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(blockdevicesResource, blockDevice), &v1alpha1.BlockDevice{}) + Invokes(testing.NewUpdateAction(blockdevicesResource, c.ns, blockDevice), &v1alpha1.BlockDevice{}) + if obj == nil { return nil, err } @@ -97,13 +103,14 @@ func (c *FakeBlockDevices) Update(blockDevice *v1alpha1.BlockDevice) (result *v1 // Delete takes name of the blockDevice and deletes it. Returns an error if one occurs. func (c *FakeBlockDevices) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(blockdevicesResource, name), &v1alpha1.BlockDevice{}) + Invokes(testing.NewDeleteAction(blockdevicesResource, c.ns, name), &v1alpha1.BlockDevice{}) + return err } // DeleteCollection deletes a collection of objects. func (c *FakeBlockDevices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(blockdevicesResource, listOptions) + action := testing.NewDeleteCollectionAction(blockdevicesResource, c.ns, listOptions) _, err := c.Fake.Invokes(action, &v1alpha1.BlockDeviceList{}) return err @@ -112,7 +119,8 @@ func (c *FakeBlockDevices) DeleteCollection(options *v1.DeleteOptions, listOptio // Patch applies the patch and returns the patched blockDevice. func (c *FakeBlockDevices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.BlockDevice, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(blockdevicesResource, name, pt, data, subresources...), &v1alpha1.BlockDevice{}) + Invokes(testing.NewPatchSubresourceAction(blockdevicesResource, c.ns, name, pt, data, subresources...), &v1alpha1.BlockDevice{}) + if obj == nil { return nil, err } diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdeviceclaim.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdeviceclaim.go new file mode 100644 index 0000000000..f391417762 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_blockdeviceclaim.go @@ -0,0 +1,128 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeBlockDeviceClaims implements BlockDeviceClaimInterface +type FakeBlockDeviceClaims struct { + Fake *FakeOpenebsV1alpha1 + ns string +} + +var blockdeviceclaimsResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "blockdeviceclaims"} + +var blockdeviceclaimsKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "BlockDeviceClaim"} + +// Get takes name of the blockDeviceClaim, and returns the corresponding blockDeviceClaim object, and an error if there is any. +func (c *FakeBlockDeviceClaims) Get(name string, options v1.GetOptions) (result *v1alpha1.BlockDeviceClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(blockdeviceclaimsResource, c.ns, name), &v1alpha1.BlockDeviceClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BlockDeviceClaim), err +} + +// List takes label and field selectors, and returns the list of BlockDeviceClaims that match those selectors. +func (c *FakeBlockDeviceClaims) List(opts v1.ListOptions) (result *v1alpha1.BlockDeviceClaimList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(blockdeviceclaimsResource, blockdeviceclaimsKind, c.ns, opts), &v1alpha1.BlockDeviceClaimList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.BlockDeviceClaimList{ListMeta: obj.(*v1alpha1.BlockDeviceClaimList).ListMeta} + for _, item := range obj.(*v1alpha1.BlockDeviceClaimList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested blockDeviceClaims. +func (c *FakeBlockDeviceClaims) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(blockdeviceclaimsResource, c.ns, opts)) + +} + +// Create takes the representation of a blockDeviceClaim and creates it. Returns the server's representation of the blockDeviceClaim, and an error, if there is any. +func (c *FakeBlockDeviceClaims) Create(blockDeviceClaim *v1alpha1.BlockDeviceClaim) (result *v1alpha1.BlockDeviceClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(blockdeviceclaimsResource, c.ns, blockDeviceClaim), &v1alpha1.BlockDeviceClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BlockDeviceClaim), err +} + +// Update takes the representation of a blockDeviceClaim and updates it. Returns the server's representation of the blockDeviceClaim, and an error, if there is any. +func (c *FakeBlockDeviceClaims) Update(blockDeviceClaim *v1alpha1.BlockDeviceClaim) (result *v1alpha1.BlockDeviceClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(blockdeviceclaimsResource, c.ns, blockDeviceClaim), &v1alpha1.BlockDeviceClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BlockDeviceClaim), err +} + +// Delete takes name of the blockDeviceClaim and deletes it. Returns an error if one occurs. +func (c *FakeBlockDeviceClaims) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(blockdeviceclaimsResource, c.ns, name), &v1alpha1.BlockDeviceClaim{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBlockDeviceClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(blockdeviceclaimsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.BlockDeviceClaimList{}) + return err +} + +// Patch applies the patch and returns the patched blockDeviceClaim. +func (c *FakeBlockDeviceClaims) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.BlockDeviceClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(blockdeviceclaimsResource, c.ns, name, pt, data, subresources...), &v1alpha1.BlockDeviceClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BlockDeviceClaim), err +} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go index 30f74bce89..a54ec9b2a4 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/fake/fake_openebs.io_client.go @@ -28,8 +28,12 @@ type FakeOpenebsV1alpha1 struct { *testing.Fake } -func (c *FakeOpenebsV1alpha1) BlockDevices() v1alpha1.BlockDeviceInterface { - return &FakeBlockDevices{c} +func (c *FakeOpenebsV1alpha1) BlockDevices(namespace string) v1alpha1.BlockDeviceInterface { + return &FakeBlockDevices{c, namespace} +} + +func (c *FakeOpenebsV1alpha1) BlockDeviceClaims(namespace string) v1alpha1.BlockDeviceClaimInterface { + return &FakeBlockDeviceClaims{c, namespace} } func (c *FakeOpenebsV1alpha1) CASTemplates() v1alpha1.CASTemplateInterface { diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go index 2b2545b127..0f887aae20 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/generated_expansion.go @@ -20,6 +20,8 @@ package v1alpha1 type BlockDeviceExpansion interface{} +type BlockDeviceClaimExpansion interface{} + type CASTemplateExpansion interface{} type CStorPoolExpansion interface{} diff --git a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go index 40d0ac3523..7dc04c444e 100644 --- a/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go +++ b/vendor/github.com/openebs/maya/pkg/client/clientset/versioned/typed/openebs.io/v1alpha1/openebs.io_client.go @@ -28,6 +28,7 @@ import ( type OpenebsV1alpha1Interface interface { RESTClient() rest.Interface BlockDevicesGetter + BlockDeviceClaimsGetter CASTemplatesGetter CStorPoolsGetter CStorVolumesGetter @@ -43,8 +44,12 @@ type OpenebsV1alpha1Client struct { restClient rest.Interface } -func (c *OpenebsV1alpha1Client) BlockDevices() BlockDeviceInterface { - return newBlockDevices(c) +func (c *OpenebsV1alpha1Client) BlockDevices(namespace string) BlockDeviceInterface { + return newBlockDevices(c, namespace) +} + +func (c *OpenebsV1alpha1Client) BlockDeviceClaims(namespace string) BlockDeviceClaimInterface { + return newBlockDeviceClaims(c, namespace) } func (c *OpenebsV1alpha1Client) CASTemplates() CASTemplateInterface { diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go index 63ca798727..10bb7d64f2 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/generic.go @@ -55,6 +55,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=openebs.io, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithResource("blockdevices"): return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().BlockDevices().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("blockdeviceclaims"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().BlockDeviceClaims().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("castemplates"): return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().CASTemplates().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("cstorpools"): diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdevice.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdevice.go index 81b2664342..db3c722dfa 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdevice.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdevice.go @@ -41,32 +41,33 @@ type BlockDeviceInformer interface { type blockDeviceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string } // NewBlockDeviceInformer constructs a new informer for BlockDevice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewBlockDeviceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredBlockDeviceInformer(client, resyncPeriod, indexers, nil) +func NewBlockDeviceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredBlockDeviceInformer(client, namespace, resyncPeriod, indexers, nil) } // NewFilteredBlockDeviceInformer constructs a new informer for BlockDevice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewFilteredBlockDeviceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +func NewFilteredBlockDeviceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.OpenebsV1alpha1().BlockDevices().List(options) + return client.OpenebsV1alpha1().BlockDevices(namespace).List(options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.OpenebsV1alpha1().BlockDevices().Watch(options) + return client.OpenebsV1alpha1().BlockDevices(namespace).Watch(options) }, }, &openebsiov1alpha1.BlockDevice{}, @@ -76,7 +77,7 @@ func NewFilteredBlockDeviceInformer(client versioned.Interface, resyncPeriod tim } func (f *blockDeviceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredBlockDeviceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewFilteredBlockDeviceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *blockDeviceInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdeviceclaim.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdeviceclaim.go new file mode 100644 index 0000000000..3fc3ccf0f8 --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/blockdeviceclaim.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + time "time" + + openebsiov1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + versioned "github.com/openebs/maya/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/maya/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// BlockDeviceClaimInformer provides access to a shared informer and lister for +// BlockDeviceClaims. +type BlockDeviceClaimInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.BlockDeviceClaimLister +} + +type blockDeviceClaimInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewBlockDeviceClaimInformer constructs a new informer for BlockDeviceClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewBlockDeviceClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredBlockDeviceClaimInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredBlockDeviceClaimInformer constructs a new informer for BlockDeviceClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredBlockDeviceClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().BlockDeviceClaims(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpenebsV1alpha1().BlockDeviceClaims(namespace).Watch(options) + }, + }, + &openebsiov1alpha1.BlockDeviceClaim{}, + resyncPeriod, + indexers, + ) +} + +func (f *blockDeviceClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredBlockDeviceClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *blockDeviceClaimInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&openebsiov1alpha1.BlockDeviceClaim{}, f.defaultInformer) +} + +func (f *blockDeviceClaimInformer) Lister() v1alpha1.BlockDeviceClaimLister { + return v1alpha1.NewBlockDeviceClaimLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go index ec0e553a82..25a1169587 100644 --- a/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go +++ b/vendor/github.com/openebs/maya/pkg/client/informers/externalversions/openebs.io/v1alpha1/interface.go @@ -26,6 +26,8 @@ import ( type Interface interface { // BlockDevices returns a BlockDeviceInformer. BlockDevices() BlockDeviceInformer + // BlockDeviceClaims returns a BlockDeviceClaimInformer. + BlockDeviceClaims() BlockDeviceClaimInformer // CASTemplates returns a CASTemplateInformer. CASTemplates() CASTemplateInformer // CStorPools returns a CStorPoolInformer. @@ -57,7 +59,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList // BlockDevices returns a BlockDeviceInformer. func (v *version) BlockDevices() BlockDeviceInformer { - return &blockDeviceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} + return &blockDeviceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// BlockDeviceClaims returns a BlockDeviceClaimInformer. +func (v *version) BlockDeviceClaims() BlockDeviceClaimInformer { + return &blockDeviceClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // CASTemplates returns a CASTemplateInformer. diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdevice.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdevice.go index f10dc88bcd..314cc5a058 100644 --- a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdevice.go +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdevice.go @@ -29,8 +29,8 @@ import ( type BlockDeviceLister interface { // List lists all BlockDevices in the indexer. List(selector labels.Selector) (ret []*v1alpha1.BlockDevice, err error) - // Get retrieves the BlockDevice from the index for a given name. - Get(name string) (*v1alpha1.BlockDevice, error) + // BlockDevices returns an object that can list and get BlockDevices. + BlockDevices(namespace string) BlockDeviceNamespaceLister BlockDeviceListerExpansion } @@ -52,9 +52,38 @@ func (s *blockDeviceLister) List(selector labels.Selector) (ret []*v1alpha1.Bloc return ret, err } -// Get retrieves the BlockDevice from the index for a given name. -func (s *blockDeviceLister) Get(name string) (*v1alpha1.BlockDevice, error) { - obj, exists, err := s.indexer.GetByKey(name) +// BlockDevices returns an object that can list and get BlockDevices. +func (s *blockDeviceLister) BlockDevices(namespace string) BlockDeviceNamespaceLister { + return blockDeviceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// BlockDeviceNamespaceLister helps list and get BlockDevices. +type BlockDeviceNamespaceLister interface { + // List lists all BlockDevices in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.BlockDevice, err error) + // Get retrieves the BlockDevice from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.BlockDevice, error) + BlockDeviceNamespaceListerExpansion +} + +// blockDeviceNamespaceLister implements the BlockDeviceNamespaceLister +// interface. +type blockDeviceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all BlockDevices in the indexer for a given namespace. +func (s blockDeviceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.BlockDevice, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.BlockDevice)) + }) + return ret, err +} + +// Get retrieves the BlockDevice from the indexer for a given namespace and name. +func (s blockDeviceNamespaceLister) Get(name string) (*v1alpha1.BlockDevice, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdeviceclaim.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdeviceclaim.go new file mode 100644 index 0000000000..66c499e86c --- /dev/null +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/blockdeviceclaim.go @@ -0,0 +1,94 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// BlockDeviceClaimLister helps list BlockDeviceClaims. +type BlockDeviceClaimLister interface { + // List lists all BlockDeviceClaims in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.BlockDeviceClaim, err error) + // BlockDeviceClaims returns an object that can list and get BlockDeviceClaims. + BlockDeviceClaims(namespace string) BlockDeviceClaimNamespaceLister + BlockDeviceClaimListerExpansion +} + +// blockDeviceClaimLister implements the BlockDeviceClaimLister interface. +type blockDeviceClaimLister struct { + indexer cache.Indexer +} + +// NewBlockDeviceClaimLister returns a new BlockDeviceClaimLister. +func NewBlockDeviceClaimLister(indexer cache.Indexer) BlockDeviceClaimLister { + return &blockDeviceClaimLister{indexer: indexer} +} + +// List lists all BlockDeviceClaims in the indexer. +func (s *blockDeviceClaimLister) List(selector labels.Selector) (ret []*v1alpha1.BlockDeviceClaim, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.BlockDeviceClaim)) + }) + return ret, err +} + +// BlockDeviceClaims returns an object that can list and get BlockDeviceClaims. +func (s *blockDeviceClaimLister) BlockDeviceClaims(namespace string) BlockDeviceClaimNamespaceLister { + return blockDeviceClaimNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// BlockDeviceClaimNamespaceLister helps list and get BlockDeviceClaims. +type BlockDeviceClaimNamespaceLister interface { + // List lists all BlockDeviceClaims in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.BlockDeviceClaim, err error) + // Get retrieves the BlockDeviceClaim from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.BlockDeviceClaim, error) + BlockDeviceClaimNamespaceListerExpansion +} + +// blockDeviceClaimNamespaceLister implements the BlockDeviceClaimNamespaceLister +// interface. +type blockDeviceClaimNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all BlockDeviceClaims in the indexer for a given namespace. +func (s blockDeviceClaimNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.BlockDeviceClaim, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.BlockDeviceClaim)) + }) + return ret, err +} + +// Get retrieves the BlockDeviceClaim from the indexer for a given namespace and name. +func (s blockDeviceClaimNamespaceLister) Get(name string) (*v1alpha1.BlockDeviceClaim, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("blockdeviceclaim"), name) + } + return obj.(*v1alpha1.BlockDeviceClaim), nil +} diff --git a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go index e77d650622..50162d5597 100644 --- a/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go +++ b/vendor/github.com/openebs/maya/pkg/client/listers/openebs.io/v1alpha1/expansion_generated.go @@ -22,6 +22,18 @@ package v1alpha1 // BlockDeviceLister. type BlockDeviceListerExpansion interface{} +// BlockDeviceNamespaceListerExpansion allows custom methods to be added to +// BlockDeviceNamespaceLister. +type BlockDeviceNamespaceListerExpansion interface{} + +// BlockDeviceClaimListerExpansion allows custom methods to be added to +// BlockDeviceClaimLister. +type BlockDeviceClaimListerExpansion interface{} + +// BlockDeviceClaimNamespaceListerExpansion allows custom methods to be added to +// BlockDeviceClaimNamespaceLister. +type BlockDeviceClaimNamespaceListerExpansion interface{} + // CASTemplateListerExpansion allows custom methods to be added to // CASTemplateLister. type CASTemplateListerExpansion interface{} From 17da83a9c895a512648e0fc8be4b21eddbfda8f2 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Sat, 27 Jul 2019 21:21:08 +0530 Subject: [PATCH 44/45] Add support to visualize bdc Signed-off-by: Akash Srivastava --- probe/kubernetes/blockdeviceclaim.go | 33 ++++++++++++++++++++++++++ probe/kubernetes/client.go | 15 ++++++++++++ probe/kubernetes/controls.go | 35 ++++++++++++++++++++++++++++ probe/kubernetes/reporter.go | 31 +++++++++++++++++++++++- probe/kubernetes/reporter_test.go | 3 +++ render/detailed/node.go | 7 ++++++ render/detailed/summary.go | 8 +++++++ render/filters.go | 2 ++ render/persistentvolume.go | 1 + render/selectors.go | 1 + render/storagerenderer.go | 26 +++++++++++++++++++++ report/id.go | 6 +++++ report/map_keys.go | 1 + report/report.go | 12 +++++++++- 14 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 probe/kubernetes/blockdeviceclaim.go diff --git a/probe/kubernetes/blockdeviceclaim.go b/probe/kubernetes/blockdeviceclaim.go new file mode 100644 index 0000000000..85a48d808d --- /dev/null +++ b/probe/kubernetes/blockdeviceclaim.go @@ -0,0 +1,33 @@ +package kubernetes + +import ( + mayav1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1" + "github.com/weaveworks/scope/report" +) + +// BlockDeviceClaim represent NDM BlockDeviceClaim interface +type BlockDeviceClaim interface { + Meta + GetNode(probeID string) report.Node +} + +type blockDeviceClaim struct { + *mayav1alpha1.BlockDeviceClaim + Meta +} + +// NewBlockDeviceClaim returns new block device claim type +func NewBlockDeviceClaim(b *mayav1alpha1.BlockDeviceClaim) BlockDeviceClaim { + return &blockDeviceClaim{BlockDeviceClaim: b, Meta: meta{b.ObjectMeta}} +} + +// GetNode returns Block Device Claim as Node +func (b *blockDeviceClaim) GetNode(probeID string) report.Node { + return b.MetaNode(report.MakeBlockDeviceClaimNodeID(b.UID())).WithLatests(map[string]string{ + NodeType: "Block Device Claim", + BlockDeviceName: b.Spec.BlockDeviceName, + HostName: b.Spec.HostName, + Status: string(b.Status.Phase), + report.ControlProbeID: probeID, + }).WithLatestActiveControls(Describe) +} diff --git a/probe/kubernetes/client.go b/probe/kubernetes/client.go index 85ab10fe83..ccd58150c1 100644 --- a/probe/kubernetes/client.go +++ b/probe/kubernetes/client.go @@ -66,6 +66,7 @@ type Client interface { WalkCStorVolumeReplicas(f func(CStorVolumeReplica) error) error WalkCStorPools(f func(CStorPool) error) error WalkBlockDevices(f func(BlockDevice) error) error + WalkBlockDeviceClaims(f func(BlockDeviceClaim) error) error WatchPods(f func(Event, Pod)) CloneVolumeSnapshot(namespaceID, volumeSnapshotID, persistentVolumeClaimID, capacity string) error @@ -118,6 +119,7 @@ type client struct { cStorvolumeReplicaStore cache.Store cStorPoolStore cache.Store blockDeviceStore cache.Store + blockDeviceClaimStore cache.Store podWatchesMutex sync.Mutex podWatches []func(Event, Pod) @@ -225,6 +227,7 @@ func NewClient(config ClientConfig) (Client, error) { result.cStorvolumeReplicaStore = result.setupStore("cstorvolumereplicas") result.cStorPoolStore = result.setupStore("cstorpools") result.blockDeviceStore = result.setupStore("blockdevices") + result.blockDeviceClaimStore = result.setupStore("blockdeviceclaims") return result, nil } @@ -293,6 +296,8 @@ func (c *client) clientAndType(resource string) (rest.Interface, interface{}, er return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.CStorPool{}, nil case "blockdevices": return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.BlockDevice{}, nil + case "blockdeviceclaims": + return c.mayaClient.OpenebsV1alpha1().RESTClient(), &mayav1alpha1.BlockDeviceClaim{}, nil case "cronjobs": ok, err := c.isResourceSupported(c.client.BatchV1beta1().RESTClient().APIVersion(), resource) if err != nil { @@ -567,6 +572,16 @@ func (c *client) WalkCStorPools(f func(CStorPool) error) error { return nil } +func (c *client) WalkBlockDeviceClaims(f func(BlockDeviceClaim) error) error { + for _, m := range c.blockDeviceClaimStore.List() { + blockDeviceClaim := m.(*mayav1alpha1.BlockDeviceClaim) + if err := f(NewBlockDeviceClaim(blockDeviceClaim)); err != nil { + return err + } + } + return nil +} + func (c *client) CloneVolumeSnapshot(namespaceID, volumeSnapshotID, persistentVolumeClaimID, capacity string) error { var scName string var claimSize string diff --git a/probe/kubernetes/controls.go b/probe/kubernetes/controls.go index 96e79f022a..478dd4d79b 100644 --- a/probe/kubernetes/controls.go +++ b/probe/kubernetes/controls.go @@ -185,6 +185,17 @@ func (r *Reporter) describeBlockDevice(req xfer.Request, namespaceID, blockDevic return r.describe(req, namespaceID, blockDeviceID, schema.GroupKind{}, restMapping) } +func (r *Reporter) describeBlockDeviceClaim(req xfer.Request, namespaceID, blockDeviceClaimID string) xfer.Response { + restMapping := apimeta.RESTMapping{ + Resource: schema.GroupVersionResource{ + Group: OpenEBSGroupName, + Version: OpenEBSVersion, + Resource: "blockdeviceclaims", + }, + } + return r.describe(req, namespaceID, blockDeviceClaimID, schema.GroupKind{}, restMapping) +} + // GetLogs is the control to get the logs for a kubernetes pod func (r *Reporter) describe(req xfer.Request, namespaceID, resourceID string, groupKind schema.GroupKind, restMapping apimeta.RESTMapping) xfer.Response { readCloser, err := r.client.Describe(namespaceID, resourceID, groupKind, restMapping) @@ -290,6 +301,8 @@ func (r *Reporter) Describe() func(xfer.Request) xfer.Response { f = r.CaptureDisk(r.describeDisk) case "": f = r.CaptureBlockDevice(r.describeBlockDevice) + case "": + f = r.CaptureBlockDeviceClaim(r.describeBlockDeviceClaim) default: return xfer.ResponseErrorf("Node not found: %s", req.NodeID) } @@ -686,6 +699,28 @@ func (r *Reporter) CaptureBlockDevice(f func(xfer.Request, string, string) xfer. } } +// CaptureBlockDeviceClaim will return name and namespace of block device claim +func (r *Reporter) CaptureBlockDeviceClaim(f func(xfer.Request, string, string) xfer.Response) func(xfer.Request) xfer.Response { + return func(req xfer.Request) xfer.Response { + uid, ok := report.ParseBlockDeviceClaimNodeID(req.NodeID) + if !ok { + return xfer.ResponseErrorf("Invalid ID: %s", req.NodeID) + } + // find blockDeviceClaim by UID + var blockDeviceClaim BlockDeviceClaim + r.client.WalkBlockDeviceClaims(func(b BlockDeviceClaim) error { + if b.UID() == uid { + blockDeviceClaim = b + } + return nil + }) + if blockDeviceClaim == nil { + return xfer.ResponseErrorf("Block Device Claim not found: %s", uid) + } + return f(req, blockDeviceClaim.Namespace(), blockDeviceClaim.Name()) + } +} + // ScaleUp is the control to scale up a deployment func (r *Reporter) ScaleUp(req xfer.Request, namespace, id string) xfer.Response { return xfer.ResponseError(r.client.ScaleUp(namespace, id)) diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index e6705066f2..1923f95c52 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -69,6 +69,7 @@ const ( PercentEnduranceUsed = report.KubernetesPercentEnduranceUsed BlockDeviceList = report.KubernetesBlockDeviceList Path = report.KubernetesPath + BlockDeviceName = report.KubernetesBlockDeviceName ) var ( @@ -254,11 +255,20 @@ var ( VolumeName: {ID: CStorVolumeReplicaName, Label: "CStor Volume Replica", From: report.FromLatest, Priority: 2}, Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 3}, } + CStorPoolMetadataTemplates = report.MetadataTemplates{ NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, VolumeName: {ID: CStorPoolName, Label: "CStor Pool", From: report.FromLatest, Priority: 2}, Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 3}, } + + BlockDeviceClaimMetadataTemplates = report.MetadataTemplates{ + NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1}, + BlockDeviceName: {ID: BlockDeviceName, Label: "Block device name", From: report.FromLatest, Priority: 2}, + HostName: {ID: HostName, Label: "Host", From: report.FromLatest, Priority: 3}, + Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 4}, + } + TableTemplates = report.TableTemplates{ LabelPrefix: { ID: LabelPrefix, @@ -489,6 +499,10 @@ func (r *Reporter) Report() (report.Report, error) { if err != nil { return result, err } + blockDeviceClaimTopology, _, err := r.blockDeviceClaimTopology() + if err != nil { + return result, err + } result.Pod = result.Pod.Merge(podTopology) result.Service = result.Service.Merge(serviceTopology) result.DaemonSet = result.DaemonSet.Merge(daemonSetTopology) @@ -508,6 +522,7 @@ func (r *Reporter) Report() (report.Report, error) { result.CStorVolumeReplica = result.CStorVolumeReplica.Merge(cStorVolumeReplicaTopology) result.CStorPool = result.CStorPool.Merge(cStorPoolTopology) result.BlockDevice = result.BlockDevice.Merge(blockDeviceTopology) + result.BlockDeviceClaim = result.BlockDeviceClaim.Merge(blockDeviceClaimTopology) return result, nil } @@ -658,7 +673,7 @@ func (r *Reporter) volumeSnapshotTopology() (report.Topology, []VolumeSnapshot, Human: "Delete", Category: report.AdminControl, Icon: "far fa-trash-alt", - Rank: 1, + Rank: 3, }) result.Controls.AddControl(DescribeControl) err := r.client.WalkVolumeSnapshots(func(p VolumeSnapshot) error { @@ -782,6 +797,20 @@ func (r *Reporter) cStorPoolTopology() (report.Topology, []CStorPool, error) { return result, cStorPool, err } +func (r *Reporter) blockDeviceClaimTopology() (report.Topology, []BlockDeviceClaim, error) { + blockDeviceClaims := []BlockDeviceClaim{} + result := report.MakeTopology(). + WithMetadataTemplates(BlockDeviceClaimMetadataTemplates). + WithTableTemplates(TableTemplates) + result.Controls.AddControl(DescribeControl) + err := r.client.WalkBlockDeviceClaims(func(p BlockDeviceClaim) error { + result.AddNode(p.GetNode(r.probeID)) + blockDeviceClaims = append(blockDeviceClaims, p) + return nil + }) + return result, blockDeviceClaims, err +} + type labelledChild interface { Labels() map[string]string AddParent(string, string) diff --git a/probe/kubernetes/reporter_test.go b/probe/kubernetes/reporter_test.go index 3a747d1941..acb91a5b4c 100644 --- a/probe/kubernetes/reporter_test.go +++ b/probe/kubernetes/reporter_test.go @@ -193,6 +193,9 @@ func (c *mockClient) WalkCStorPools(f func(kubernetes.CStorPool) error) error { func (c *mockClient) WalkBlockDevices(f func(kubernetes.BlockDevice) error) error { return nil } +func (c *mockClient) WalkBlockDeviceClaims(f func(kubernetes.BlockDeviceClaim) error) error { + return nil +} func (*mockClient) WatchPods(func(kubernetes.Event, kubernetes.Pod)) {} func (c *mockClient) GetLogs(namespaceID, podName string, _ []string) (io.ReadCloser, error) { r, ok := c.logs[namespaceID+";"+podName] diff --git a/render/detailed/node.go b/render/detailed/node.go index 4c8e94ab95..78d6f10689 100644 --- a/render/detailed/node.go +++ b/render/detailed/node.go @@ -292,6 +292,13 @@ var nodeSummaryGroupSpecs = []struct { Columns: []Column{}, }, }, + { + topologyID: report.BlockDeviceClaim, + NodeSummaryGroup: NodeSummaryGroup{ + Label: "Block Device Claim", + Columns: []Column{}, + }, + }, } func children(rc RenderContext, n report.Node) []NodeSummaryGroup { diff --git a/render/detailed/summary.go b/render/detailed/summary.go index 95f4d29a89..19f6667226 100644 --- a/render/detailed/summary.go +++ b/render/detailed/summary.go @@ -97,6 +97,7 @@ var renderers = map[string]func(BasicNodeSummary, report.Node) BasicNodeSummary{ report.CStorVolume: cStorVolumeNodeSummary, report.CStorVolumeReplica: cStorVolumeReplicaNodeSummary, report.CStorPool: cStorPoolNodeSummary, + report.BlockDeviceClaim: blockDeviceClaimNodeSummary, } // For each report.Topology, map to a 'primary' API topology. This can then be used in a variety of places. @@ -126,6 +127,7 @@ var primaryAPITopology = map[string]string{ report.CStorVolumeReplica: "volumes", report.CStorPool: "volumes", report.BlockDevice: "pools", + report.BlockDeviceClaim: "pools", } // MakeBasicNodeSummary returns a basic summary of a node, if @@ -471,6 +473,12 @@ func cStorPoolNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary return base } +func blockDeviceClaimNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary { + base = addKubernetesLabelAndRank(base, n) + base.LabelMinor = "Block Device Claim" + return base +} + // groupNodeSummary renders the summary for a group node. n.Topology is // expected to be of the form: group:container:hostname func groupNodeSummary(base BasicNodeSummary, r report.Report, n report.Node) BasicNodeSummary { diff --git a/render/filters.go b/render/filters.go index cab5fe16ed..60c99873e4 100644 --- a/render/filters.go +++ b/render/filters.go @@ -24,6 +24,7 @@ var storageComponents = map[string]string{ "disk": "disk", "volume_snapshot": "volume_snapshot", "volume_snapshot_data": "volume_snapshot_data", + "block_device_claim": "block_device_claim", } var cStorComponents = map[string]string{ @@ -32,6 +33,7 @@ var cStorComponents = map[string]string{ "cstor_pool": "cstor_pool", "block_device": "block_device", "disk": "disk", + "block_device_claim": "block_device_claim", } // CustomRenderer allow for mapping functions that received the entire topology diff --git a/render/persistentvolume.go b/render/persistentvolume.go index 0519294a83..4942373727 100644 --- a/render/persistentvolume.go +++ b/render/persistentvolume.go @@ -18,6 +18,7 @@ var KubernetesVolumesRenderer = MakeReduce( PVToControllerRenderer, VolumeSnapshotRenderer, CSPToBdOrDiskRenderer, + BlockDeviceClaimToBlockDeviceRenderer, BlockDeviceToDiskRenderer, MakeFilter( func(n report.Node) bool { diff --git a/render/selectors.go b/render/selectors.go index 0b5251778f..dda7ea4a38 100644 --- a/render/selectors.go +++ b/render/selectors.go @@ -43,4 +43,5 @@ var ( SelectDisk = TopologySelector(report.Disk) SelectBlockDevice = TopologySelector(report.BlockDevice) SelectStoragePoolClaim = TopologySelector(report.StoragePoolClaim) + SelectBlockDeviceClaim = TopologySelector(report.BlockDeviceClaim) ) diff --git a/render/storagerenderer.go b/render/storagerenderer.go index e748b3b410..13cdbaceb0 100644 --- a/render/storagerenderer.go +++ b/render/storagerenderer.go @@ -13,6 +13,7 @@ import ( var KubernetesStorageRenderer = MakeReduce( SPCToCSPRenderer, CSPToBdOrDiskRenderer, + BlockDeviceClaimToBlockDeviceRenderer, BlockDeviceToDiskRenderer, ) @@ -120,3 +121,28 @@ func (b blockDeviceToDiskRenderer) Render(ctx context.Context, rpt report.Report } return Nodes{Nodes: nodes} } + +// BlockDeviceClaimToBlockDeviceRenderer is a renderer which produces renderable k8s object of block device claim. +var BlockDeviceClaimToBlockDeviceRenderer blockDeviceClaimToBlockDeviceRenderer + +// blockDeviceClaimToBlockDeviceRenderer is a renderer to render BDC and BD. +type blockDeviceClaimToBlockDeviceRenderer struct{} + +func (b blockDeviceClaimToBlockDeviceRenderer) Render(ctx context.Context, rpt report.Report) Nodes { + nodes := make(report.Nodes) + for bdcID, bdcNode := range rpt.BlockDeviceClaim.Nodes { + bdcNamespace, _ := bdcNode.Latest.Lookup(kubernetes.Namespace) + bdNameFromBdc, _ := bdcNode.Latest.Lookup(kubernetes.BlockDeviceName) + for bdID, bdNode := range rpt.BlockDevice.Nodes { + bdName, _ := bdNode.Latest.Lookup(kubernetes.Name) + bdNamespace, _ := bdNode.Latest.Lookup(kubernetes.Namespace) + if bdName == bdNameFromBdc && bdNamespace == bdcNamespace { + bdcNode.Adjacency = bdcNode.Adjacency.Add(bdID) + bdcNode.Children = bdcNode.Children.Add(bdNode) + break + } + } + nodes[bdcID] = bdcNode + } + return Nodes{Nodes: nodes} +} diff --git a/report/id.go b/report/id.go index 60e49538a0..90bc2d332d 100644 --- a/report/id.go +++ b/report/id.go @@ -228,6 +228,12 @@ var ( // ParseCStorPoolNodeID parses a CStor Volume node ID ParseCStorPoolNodeID = parseSingleComponentID("cstor_pool") + + // MakeBlockDeviceClaimNodeID produces a block device claim node ID from its composite parts. + MakeBlockDeviceClaimNodeID = makeSingleComponentID("block_device_claim") + + // ParseBlockDeviceClaimNodeID parses a block device claim node ID + ParseBlockDeviceClaimNodeID = parseSingleComponentID("block_device_claim") ) // makeSingleComponentID makes a single-component node id encoder diff --git a/report/map_keys.go b/report/map_keys.go index d2f0d53841..ab74a92ae4 100644 --- a/report/map_keys.go +++ b/report/map_keys.go @@ -128,6 +128,7 @@ const ( KubernetesStorage = "kubernetes_storage" KubernetesBlockDeviceList = "kubernetes_block_device_list" KubernetesPath = "kubernetes_path" + KubernetesBlockDeviceName = "kubernetes_block_device_name" // probe/awsecs ECSCluster = "ecs_cluster" ECSCreatedAt = "ecs_created_at" diff --git a/report/report.go b/report/report.go index 7a3594d04a..0015a1f26c 100644 --- a/report/report.go +++ b/report/report.go @@ -40,6 +40,7 @@ const ( CStorVolumeReplica = "cstor_volume_replica" CStorPool = "cstor_pool" BlockDevice = "block_device" + BlockDeviceClaim = "block_device_claim" // Shapes used for different nodes Circle = "circle" @@ -95,6 +96,7 @@ var topologyNames = []string{ CStorVolumeReplica, CStorPool, BlockDevice, + BlockDeviceClaim, } // Report is the core data type. It's produced by probes, and consumed and @@ -225,6 +227,9 @@ type Report struct { // Metadata is limited for now, more to come later. StoragePoolClaim Topology + // BlockDeviceClaim represent all NDM BDCs on hosts running probes. + BlockDeviceClaim Topology + DNS DNSRecords // Sampling data for this report. @@ -356,7 +361,6 @@ func MakeReport() Report { WithShape(DottedSquare). WithLabel("storage pool claim", "storage pool claims"), - //FIXME: Change shape to actual CV shape CStorVolume: MakeTopology(). WithShape(Controller). WithLabel("cStor Volume", "cStor Volumes"), @@ -369,6 +373,10 @@ func MakeReport() Report { WithShape(Square). WithLabel("cStor Pool", "cStor Pool"), + BlockDeviceClaim: MakeTopology(). + WithShape(Rectangle). + WithLabel("block device claim", "block device claims"), + DNS: DNSRecords{}, Sampling: Sampling{}, @@ -499,6 +507,8 @@ func (r *Report) topology(name string) *Topology { return &r.CStorPool case BlockDevice: return &r.BlockDevice + case BlockDeviceClaim: + return &r.BlockDeviceClaim } return nil } From c0ecd7f6e34e1deebbea7f3780d5b94a7123face Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Sat, 27 Jul 2019 21:19:41 +0530 Subject: [PATCH 45/45] Add adjacency between pv and bdc Signed-off-by: Akash Srivastava --- probe/kubernetes/persistentvolume.go | 27 ++++++++++++++++++++ probe/kubernetes/reporter.go | 2 ++ render/persistentvolume.go | 13 ++++++++++ report/map_keys.go | 2 ++ report/report.go | 37 ++++++++++++++-------------- 5 files changed, 63 insertions(+), 18 deletions(-) diff --git a/probe/kubernetes/persistentvolume.go b/probe/kubernetes/persistentvolume.go index 1afd5c1665..fba53db0ff 100644 --- a/probe/kubernetes/persistentvolume.go +++ b/probe/kubernetes/persistentvolume.go @@ -7,6 +7,11 @@ import ( apiv1 "k8s.io/api/core/v1" ) +const ( + casTypeLabel = "openebs.io/cas-type" + bdcAnnotation = "local.openebs.io/blockdeviceclaim" +) + // PersistentVolume represent kubernetes PersistentVolume interface type PersistentVolume interface { Meta @@ -14,6 +19,8 @@ type PersistentVolume interface { GetAccessMode() string GetVolume() string GetStorageDriver() string + GetCASType() string + GetBDCName() string } // persistentVolume represents kubernetes persistent volume @@ -63,6 +70,18 @@ func (p *persistentVolume) GetStorageDriver() string { return "" } +func (p *persistentVolume) GetCASType() string { + casType := p.GetLabels()[casTypeLabel] + if casType == "local-device" { + return "local-device" + } + return "" +} + +func (p *persistentVolume) GetBDCName() string { + return p.GetAnnotations()[bdcAnnotation] +} + // GetNode returns Persistent Volume as Node func (p *persistentVolume) GetNode(probeID string) report.Node { latests := map[string]string{ @@ -78,6 +97,14 @@ func (p *persistentVolume) GetNode(probeID string) report.Node { latests[StorageDriver] = p.GetStorageDriver() } + if p.GetCASType() != "" { + latests[CASType] = p.GetCASType() + } + + if p.GetBDCName() != "" { + latests[BlockDeviceClaimName] = p.GetBDCName() + } + return p.MetaNode(report.MakePersistentVolumeNodeID(p.UID())). WithLatests(latests). WithLatestActiveControls(Describe) diff --git a/probe/kubernetes/reporter.go b/probe/kubernetes/reporter.go index 1923f95c52..74bba7e398 100644 --- a/probe/kubernetes/reporter.go +++ b/probe/kubernetes/reporter.go @@ -70,6 +70,8 @@ const ( BlockDeviceList = report.KubernetesBlockDeviceList Path = report.KubernetesPath BlockDeviceName = report.KubernetesBlockDeviceName + BlockDeviceClaimName = report.KubernetesBlockDeviceClaimName + CASType = report.KubernetesCASType ) var ( diff --git a/render/persistentvolume.go b/render/persistentvolume.go index 4942373727..8d725a75a6 100644 --- a/render/persistentvolume.go +++ b/render/persistentvolume.go @@ -166,6 +166,19 @@ func (v pvToControllerRenderer) Render(ctx context.Context, rpt report.Report) N } } + _, casOk := p.Latest.Lookup(kubernetes.CASType) + bdcNameFromPV, bdcOk := p.Latest.Lookup(kubernetes.BlockDeviceClaimName) + if casOk && bdcOk { + for bdcID, bdcNode := range rpt.BlockDeviceClaim.Nodes { + bdcName, _ := bdcNode.Latest.Lookup(kubernetes.Name) + if bdcName == bdcNameFromPV { + p.Adjacency = p.Adjacency.Add(bdcID) + p.Children = p.Children.Add(bdcNode) + break + } + } + } + if p.ID != "" { nodes[pvNodeID] = p } diff --git a/report/map_keys.go b/report/map_keys.go index ab74a92ae4..7fb3c792a1 100644 --- a/report/map_keys.go +++ b/report/map_keys.go @@ -129,6 +129,8 @@ const ( KubernetesBlockDeviceList = "kubernetes_block_device_list" KubernetesPath = "kubernetes_path" KubernetesBlockDeviceName = "kubernetes_block_device_name" + KubernetesBlockDeviceClaimName = "kubernetes_block_device_claim_name" + KubernetesCASType = "kubernetes_cas_type" // probe/awsecs ECSCluster = "ecs_cluster" ECSCreatedAt = "ecs_created_at" diff --git a/report/report.go b/report/report.go index 0015a1f26c..1e66b22931 100644 --- a/report/report.go +++ b/report/report.go @@ -43,23 +43,24 @@ const ( BlockDeviceClaim = "block_device_claim" // Shapes used for different nodes - Circle = "circle" - Triangle = "triangle" - Square = "square" - Pentagon = "pentagon" - Hexagon = "hexagon" - Heptagon = "heptagon" - Octagon = "octagon" - Cloud = "cloud" - Cylinder = "cylinder" - DottedCylinder = "dottedcylinder" - StorageSheet = "sheet" - Camera = "camera" - DottedTriangle = "dottedtriangle" - DottedSquare = "dottedsquare" - Controller = "controller" - Replica = "replica" - Rectangle = "rectangle" + Circle = "circle" + Triangle = "triangle" + Square = "square" + Pentagon = "pentagon" + Hexagon = "hexagon" + Heptagon = "heptagon" + Octagon = "octagon" + Cloud = "cloud" + Cylinder = "cylinder" + DottedCylinder = "dottedcylinder" + StorageSheet = "sheet" + Camera = "camera" + DottedTriangle = "dottedtriangle" + DottedSquare = "dottedsquare" + Controller = "controller" + Replica = "replica" + Rectangle = "rectangle" + DottedRectangle = "dottedrectangle" // Used when counting the number of containers ContainersKey = "containers" @@ -374,7 +375,7 @@ func MakeReport() Report { WithLabel("cStor Pool", "cStor Pool"), BlockDeviceClaim: MakeTopology(). - WithShape(Rectangle). + WithShape(DottedRectangle). WithLabel("block device claim", "block device claims"), DNS: DNSRecords{},