Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Merge dev GA v1.0.0 to master branch #176

Merged
merged 118 commits into from
Dec 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
d84b6cc
first running container from alpine with multi-stage build
midoblgsm Sep 5, 2017
2641c46
First ubiquity deployment
midoblgsm Sep 5, 2017
58a4203
used nodePort for the service
midoblgsm Sep 5, 2017
92bae3c
#90: configurable database
Sep 1, 2017
f1b7752
Merge pull request #92 from IBM/feature/liort_db
Sep 7, 2017
146ac06
updated ubiquity deployment and added postgresql statefulset
midoblgsm Sep 7, 2017
6dee001
#90: configurable database
Sep 7, 2017
4438d0d
Merge pull request #93 from IBM/feature/liort_db_conf
Sep 7, 2017
443998e
#90: configurable database
Sep 8, 2017
2f715d5
Merge pull request #94 from IBM/feature/liort_db_ws
Sep 8, 2017
15159ab
Added ingress to have an IP for ubiquity that flex can use
midoblgsm Sep 8, 2017
2cf0296
#99: add credentials to all requests
Sep 10, 2017
5f6756b
Merge pull request #100 from IBM/feature/liort_user_pass
Sep 10, 2017
949597f
#89 : split ubiquity service to a file, add namespace and scbe deploy…
shay-berman Sep 11, 2017
d7f243c
#99: add credentials to all requests
Sep 11, 2017
60d9afd
Merge pull request #101 from IBM/feature/liort_user_pass
Sep 11, 2017
fb78476
#99: add credentials to all requests
Sep 12, 2017
87a0735
Merge pull request #102 from IBM/feature/liort_user_pass
Sep 12, 2017
8a74b61
#99: fix scbe unittest
Sep 12, 2017
dff7741
Fixed config loading
midoblgsm Sep 12, 2017
017e795
fixed loadEnv and removed ingress
midoblgsm Sep 12, 2017
350743e
changed service to LoadBalancer
midoblgsm Sep 13, 2017
36cddd4
#104: use TLS certificates in server
Sep 13, 2017
d9d1ff3
Merge pull request #105 from IBM/feature/liort_tls
Sep 13, 2017
067fcc6
#104: use TLS certificates in plugin
Sep 13, 2017
dc718f5
Merge pull request #106 from IBM/feature/liort_client_tls
Sep 13, 2017
4d583ca
#107 - create image for secured postgresql
Sep 14, 2017
c115949
Added default scbe port and skipVSSL
midoblgsm Sep 14, 2017
6763adf
#90: fix db volume fstype
Sep 14, 2017
5d10fd8
#90: fix db volume fstype
Sep 14, 2017
2145672
#104: add log info to use TLS certificates in plugin
Sep 15, 2017
a9b1e4a
#107 - fixes following code review
Sep 17, 2017
3c99c66
#107 - take db, user and password from environment variables
Sep 17, 2017
2c74ceb
Merge pull request #108 from IBM/feature/postgresql_ssl
shay-berman Sep 17, 2017
44e558e
Fixed export NFS in ssh connector (#85)
yadaven Sep 18, 2017
71a5d5a
#104: use TLS certificates in scbe backend
Sep 19, 2017
a3172ad
fix for tcp connection not closed
hfeish Sep 19, 2017
16e6feb
#104: use TLS certificates in scbe backend, add unit tests
Sep 19, 2017
424c761
Merge pull request #111 from IBM/feature/liort_scb_tls
Sep 19, 2017
6d8de7e
Merge pull request #112 from IBM/dev
shay-berman Sep 19, 2017
88831b1
#76 : remove SkipVerifySSL env (instead ubiquity uses UBIQUITY_SERVER…
shay-berman Sep 19, 2017
2ff56bd
Fixes #113:
midoblgsm Sep 20, 2017
cb0edca
Merge pull request #110 from IBM/fix/UB_103_tcp_connection_not_closed
hfeish Sep 20, 2017
d70cb88
#90: add connection params to psql init
Sep 20, 2017
6c33a0e
Merge pull request #115 from IBM/feature/liort_db_params
Sep 20, 2017
a7f0f51
#90: add connection params to psql init
Sep 20, 2017
a8586f1
Merge pull request #116 from IBM/feature/liort_db_ssl
Sep 20, 2017
bad2d86
#90: add connection params to psql init
Sep 20, 2017
17df9ee
Merge pull request #117 from IBM/dev
shay-berman Sep 24, 2017
4984e28
a
Sep 24, 2017
7e917fd
a
Sep 24, 2017
97f025f
Merge pull request #118 from IBM/feature/liort_add_psql_log
Sep 24, 2017
e628ea3
#90: add connection params to psql init
Sep 24, 2017
94ec806
Merge pull request #95 from IBM/containerized-ubiquity
shay-berman Sep 25, 2017
83b4ad9
#104: use TLS certificates in flex
Sep 27, 2017
9b68138
Merge pull request #120 from IBM/feature/liort_ssl_flex
Sep 27, 2017
d365b35
#121: fixed umount error by removing duplicate umount call
Tzur-i Sep 28, 2017
b8e60a7
Merge pull request #122 from IBM/feature/fix_umount
Sep 28, 2017
5aa7603
#123 - generate CA signed certificate if not provided (#124)
ranhrl Oct 1, 2017
ba48619
#107 - change to SSL only after files are created successfully
Oct 10, 2017
8e22ff0
#107 - postgresql image corrections - create ssl directory with proper
Oct 10, 2017
555dd86
Feature/ssl updates to images (#132)
ranhrl Oct 18, 2017
5b2dbf2
#131 - comment out since this indicates verifying the certificates
Oct 18, 2017
7b79335
#131 - comment not supported in a middle of a line :-(
Oct 18, 2017
ffb8896
#133 : UseSSL is true by default + SSL_MODE setting with require defa…
shay-berman Oct 26, 2017
7357d5e
#99: add scbe rest client map for authentication
Sep 12, 2017
52ae0fe
Merge pull request #136 from IBM/feature/liort_user_pass
Oct 26, 2017
377cfd8
refactor remote client attach/detach to not mount/unmount
Oct 25, 2017
8da35c5
executor return stdout upon failure
Oct 27, 2017
737f679
add host attach info to GetVolumeConfig
Oct 29, 2017
24fceb6
implement GetVolMapping
Oct 29, 2017
e305722
init only stdout logger
Nov 6, 2017
8ae6c93
move client to new logger
Nov 6, 2017
c957512
UB-392: align glide versions
alonm Nov 6, 2017
c8949a6
Merge pull request #140 from IBM/feature/UB-392_align_glide_versions
alonm Nov 8, 2017
8abdb2b
Merge pull request #139 from IBM/feature/UB-421_log_improve_liort
Nov 9, 2017
23d1a1c
added comments based on code review
Nov 13, 2017
21cdcbe
get host attach from scbe instead of database (#141)
Nov 14, 2017
b5654e7
remove AttachTo from ScbeVolume db object
Nov 15, 2017
c2ffe2e
init only stdout logger
Nov 15, 2017
d4feb09
Update ubiqutiy to use the new Logger (drop the old one) (#142)
Nov 16, 2017
b407f67
use ISCSI config in rescan for cleanup (#145)
Nov 16, 2017
8960613
modify error messages (#148)
Nov 21, 2017
6e257cc
hide db passowrd in the log print (#146)
Nov 21, 2017
0f10183
hide password in the log print (#147)
Nov 21, 2017
520a308
UB-379: update SCB interface name to Containers (#144)
alonm Nov 21, 2017
0d8ab70
Get map ut liort (#150)
Nov 23, 2017
f94be03
replace rescan and mpath mutex with filelock (#151)
Nov 23, 2017
62d3af3
replace rescan and mpath mutex with filelock (#152)
Nov 23, 2017
3e71adf
move from vendor syncmap to native golang syncmap (#153)
Nov 24, 2017
0305062
update golang 1.9.0 -> 1.9.1 (#154)
Nov 24, 2017
07849f5
fix rest client action without token (#155)
Nov 28, 2017
2e72616
fix error msg to be native type (#156)
Nov 28, 2017
bfa57f1
fix double close on error messages and leaks in body response not clo…
Nov 28, 2017
cf67463
fix double close on error messages and leaks in body response not clo…
Nov 29, 2017
9db402f
Added sg_inq call to identify the right wwn even if mpath can't find it
tzurE Nov 29, 2017
3f7871a
fix leak in body response (#160)
Nov 30, 2017
cbfac54
Added more debugging issues, and an error in case of wwn not found in…
tzurE Nov 30, 2017
a065c13
More debugging logs.
tzurE Nov 30, 2017
9bf5030
More debugging logs.
tzurE Nov 30, 2017
4816f9a
small fix in getwwn check
tzurE Nov 30, 2017
884048e
fixed checking if wwn equals
tzurE Dec 1, 2017
eb3635a
Merge branch 'dev' of https://github.com/IBM/ubiquity into fix/discov…
tzurE Dec 3, 2017
04a7e19
Added dmsetup sleep
tzurE Dec 4, 2017
bace674
review issues
tzurE Dec 4, 2017
20394ec
review issues + ubuntu small bug fix
tzurE Dec 5, 2017
e076dc0
Merge pull request #159 from IBM/fix/discover_wwn_by_sg_inq
tzurE Dec 5, 2017
0b13f4c
Improve umount flow tolerance (#163)
shay-berman Dec 6, 2017
838801b
Added a double validation for multipath device WWN discovered via mul…
tzurE Dec 7, 2017
2cd2243
Added a timeout for an execute call, and a timeout for sg_inq. + unit…
tzurE Dec 11, 2017
fb679e5
Fix/increase locks sleep and run discover only in mount flow (not in …
shay-berman Dec 12, 2017
7b4916d
Align text in debug messages during sg_inq flow. Use Debug instead of…
shay-berman Dec 13, 2017
ca9d27c
Merge pull request #168 from IBM/fix/messages_improvments_for_mpath_s…
shay-berman Dec 13, 2017
c6dd8f8
Legal stuff in docker images (#169)
shay-berman Dec 13, 2017
1cc67fe
Add Apache LICENSE and NOTICES files into / of the ubiquity-db image …
shay-berman Dec 14, 2017
f25d1b4
Merge pull request #172 from IBM/legal_stuff_in_ubiquity_DB
shay-berman Dec 14, 2017
97a284a
Update README.md for GA v1 (PR #173)
shay-berman Dec 17, 2017
c94b05f
Improve performance for multipathing Discovery AND do deep Discovery …
shay-berman Dec 17, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- 1.7
- 1.9

install:
- sh scripts/run_glide_up
Expand Down
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM golang:1.9.1
WORKDIR /go/src/github.com/IBM/ubiquity/
COPY . .
RUN go get -v github.com/Masterminds/glide
RUN glide up
RUN CGO_ENABLED=1 GOOS=linux go build -tags netgo -v -a --ldflags '-w -linkmode external -extldflags "-static"' -installsuffix cgo -o ubiquity main.go


FROM alpine:latest
RUN apk --no-cache add ca-certificates=20161130-r2 openssl=1.0.2k-r0
WORKDIR /root/
COPY --from=0 /go/src/github.com/IBM/ubiquity/ubiquity .
COPY --from=0 /go/src/github.com/IBM/ubiquity/LICENSE .
COPY --from=0 /go/src/github.com/IBM/ubiquity/scripts/notices_file_for_ibm_storage_enabler_for_containers ./NOTICES

COPY docker-entrypoint.sh .
RUN chmod 755 docker-entrypoint.sh

# comments below should be removed when we implement the new SSL_MODE env variable
ENV PATH=/root:$PATH \
UBIQUITY_SERVER_CERT_PRIVATE=/var/lib/ubiquity/ssl/private/ubiquity.key \
UBIQUITY_SERVER_CERT_PUBLIC=/var/lib/ubiquity/ssl/private/ubiquity.crt \
UBIQUITY_SERVER_VERIFY_SCBE_CERT=/var/lib/ubiquity/ssl/public/scbe-trusted-ca.crt \
UBIQUITY_DB_SSL_ROOT_CERT=/var/lib/ubiquity/ssl/public/ubiquity-db-trusted-ca.crt \
SSL_MODE=verify-full

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["ubiquity"]

90 changes: 16 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,99 +5,41 @@
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
[![Go Report Card](https://goreportcard.com/badge/github.com/IBM/ubiquity)](https://goreportcard.com/report/github.com/IBM/ubiquity)

The Ubiquity project enables persistent storage for the Kubernetes and Docker container frameworks.
It is a pluggable framework available for different storage systems. The framework interfaces with the storage systems, using their plugins. The [Available Storage Systems](supportedStorage.md) section describes the storage system configuration and deployment options. Different container frameworks can use Ubiquity concurrently, allowing access to different storage systems.


![Ubiquity Overview](images/UbiquityOverview.jpg)
The Ubiquity project enables persistent storage for the Kubernetes and Docker container frameworks. It is a pluggable framework available for different storage systems. The framework interfaces with the storage systems, using their plugins. Different container frameworks can use Ubiquity concurrently, allowing access to different storage systems.
Ubiquity supports the Kubernetes and Docker frameworks, using the following plugins:

Ubiquity supports the Kubernetes and Docker frameworks, using the following plugins:

- [Ubiquity Docker volume plugin](https://github.com/IBM/ubiquity-docker-plugin)
- [Ubiquity plugin for Kubernetes](https://github.com/IBM/ubiquity-k8s) (Dynamic Provisioner and FlexVolume)
- [Ubiquity Docker volume plugin](https://github.com/IBM/ubiquity-docker-plugin), for testing only.

The code is provided as is, without warranty. Any issue will be handled on a best-effort basis.
Currently, the following storage systems use Ubiquity:
* IBM block storage.

## Installing the Ubiquity service

### 1. Prerequisites
* Ubiquity is available on the following operating systems:
- RHEL 7+
- SUSE 12+
- Ubuntu 16+
* The following sudoers configuration `/etc/sudoers` is required to run the Ubiquity process as root user:

```
Defaults !requiretty
```
For non-root users, such as USER, configure the sudoers as follows:

```
USER ALL= NOPASSWD: /usr/bin/, /bin/
Defaults:%USER !requiretty
Defaults:%USER secure_path = /sbin:/bin:/usr/sbin:/usr/bin
```


* Configure your [storage backend](supportedStorage.md).

### 2. Downloading and installing the Ubiquity service

* Download and unpack the application package.
```bash
mkdir -p /etc/ubiquity
cd /etc/ubiquity
curl -L https://github.com/IBM/ubiquity/releases/download/v0.4.0/ubiquity-0.4.0.tar.gz | tar xzf -
chmod u+x ubiquity
cp ubiquity /usr/bin/ubiquity
#chown USER:GROUP /usr/bin/ubiquity # Run this command only if non-root should run ubiquity (fill up the USER and GROUP)
cp ubiquity.service /usr/lib/systemd/system/
```
* To run the ubiquity as non-root users, you must add to the `/usr/lib/systemd/system/ubiquity.service` file this line `User=USER` under the [Service] item.

* Enable the Ubiquity service
The IBM block storage is supported for Kubernetes via IBM Spectrum Control Base Edition (SCBE) version 3.3.0 and later. Ubiquity communicates with the IBM storage systems through SCBE. SCBE creates a storage profile (for example, gold, silver or bronze) and makes it available for Kubernetes. For details about supported storage systems, refer to the latest SCBE release notes.

```bash
systemctl enable ubiquity.service
```
The IBM official solution for Kubernetes, based on the Ubiquity project, is referred to as IBM Storage Enabler for Containers. You can download the installation package and its documentation from [IBM Fix Central](https://www-945.ibm.com/support/fixcentral/swg/selectFixes?parent=Software%2Bdefined%2Bstorage&product=ibm/StorageSoftware/IBM+Spectrum+Control&release=All&platform=Linux&function=all). For details on the IBM Storage Enabler for Containers, see the relevant sections in the SCBE user guide.

### 3. Configuring the Ubiquity service
Before running the Ubiquity service, you must create and configure the `/etc/ubiquity/ubiquity-server.conf` file, according to your storage system type.
Follow the configuration procedures detailed in the [Available Storage Systems](supportedStorage.md) section.


### 4. Running the Ubiquity service
* Run the service.
```bash
systemctl start ubiquity
```
* IBM Spectrum Scale, for testing only.

The code is provided as is, without warranty. Any issue will be handled on a best-effort basis.

### 5. Installing Ubiquity plugins for Docker or Kubernetes
To use the active Ubiquity service, install Ubiquity plugins for the relevant container framework. The plugin packages and installation instructions are available in seperate github repositories.
* [Ubiquity Docker volume plugin](https://github.com/IBM/ubiquity-docker-plugin)
* [Ubiquity Kubernetes plugin](https://github.com/IBM/ubiquity-k8s)
## Solution overview

![Ubiquity Overview](images/ubiquity_architecture_draft_for_github.jpg)

## Roadmap
* Make Ubiquity Docker volume plugin in Docker store
* Containerize Ubiquity service for Docker and Kubernetes
* Add more IBM storage systems as Ubiquity backends
* Add OpenStack Manila storage as Ubiquity backend
* Add Cloud Foundry, as a container framework
* Secure communication between plugins and Ubiquity service, using certificates
* Enable volume sharing between multiple nodes
* And more goodies to come...
Description of Ubiquity Kubernetes deployment:
* Ubiquity Kubernetes Dynamic Provisioner (ubiquity-k8s-provisioner) runs as a Kubernetes deployment with replica=1.
* Ubiquity Kubernetes FlexVolume (ubiquity-k8s-flex) runs as a Kubernetes daemonset on all the worker and master nodes.
* Ubiquity (ubiquity) runs as a Kubernetes deployment with replica=1.
* Ubiquity database (ubiquity-db) runs as a Kubernetes deployment with replica=1.


## Contribution
To contribute, follow the guidelines in [Contribution guide](contribution-guide.md)


## Troubleshooting
* Review the Ubiquity logs for any issues:
* [logPath]/ubiquity.log ([logPath] configured in the ubiquity-server.conf)
* /var/log/messages

## Support
For any questions, suggestions, or issues, use github.
Expand Down
123 changes: 123 additions & 0 deletions database/connection.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/**
* Copyright 2017 IBM Corp.
*
* 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 database

import (
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"github.com/IBM/ubiquity/utils/logs"
"errors"
)

var globalConnectionFactory ConnectionFactory = nil

func initConnectionFactory(connectionFactory ConnectionFactory) func() {
if globalConnectionFactory != nil {
panic("globalConnectionFactory already initialized")
}
globalConnectionFactory = connectionFactory
return func() { globalConnectionFactory = nil }
}

type ConnectionFactory interface {
newConnection() (*gorm.DB, error)
}

type postgresFactory struct {
psql string
psqlLog string
}

type sqliteFactory struct {
path string
}

type testErrorFactory struct {
}

func (f *postgresFactory) newConnection() (*gorm.DB, error) {
logger := logs.GetLogger()
logger.Debug("", logs.Args{{"psql", f.psqlLog}})
return gorm.Open("postgres", f.psql)
}

func (f *sqliteFactory) newConnection() (*gorm.DB, error) {
return gorm.Open("sqlite3", f.path)
}

func (f *testErrorFactory) newConnection() (*gorm.DB, error) {
return nil, errors.New("testErrorFactory")
}

type Connection struct {
factory ConnectionFactory
logger logs.Logger
db *gorm.DB
}

func NewConnection() Connection {
return Connection{logger: logs.GetLogger(), factory: globalConnectionFactory}
}

func (c *Connection) Open() (error) {
defer c.logger.Trace(logs.DEBUG)()
var err error

// sanity
if c.db != nil {
return c.logger.ErrorRet(errors.New("Connection already open"), "failed")
}

// open db connection
if c.db, err = c.factory.newConnection(); err != nil {
return c.logger.ErrorRet(err, "failed")
}

// do migrations
if err = doMigrations(*c); err != nil {
defer c.Close()
return c.logger.ErrorRet(err, "doMigrations failed")
}

return nil
}

func (c *Connection) Close() (error) {
defer c.logger.Trace(logs.DEBUG)()
var err error

// sanity
if c.db == nil {
return c.logger.ErrorRet(errors.New("Connection already closed"), "failed")
}

// close db connection
err = c.db.Close()
c.db = nil
if err != nil {
return c.logger.ErrorRet(err, "failed")
}

return nil
}

func (c *Connection) GetDb() (*gorm.DB) {
defer c.logger.Trace(logs.DEBUG)()

return c.db
}
64 changes: 64 additions & 0 deletions database/connection_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Copyright 2017 IBM Corp.
*
* 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 database_test


import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/IBM/ubiquity/database"
)


var _ = Describe("Connection", func() {
var (
err error
)
BeforeEach(func() {
})

Context(".Open and Close", func() {
It("open and close success", func() {
dbConnection := database.NewConnection()
Expect(dbConnection.GetDb()).To(BeNil())
err = dbConnection.Open()
Expect(err).To(Not(HaveOccurred()))
Expect(dbConnection.GetDb()).To(Not(BeNil()))
err = dbConnection.Close()
Expect(err).To(Not(HaveOccurred()))
Expect(dbConnection.GetDb()).To(BeNil())
})
It("open fail", func() {
dbConnection := database.NewConnection()
Expect(dbConnection.GetDb()).To(BeNil())
err = dbConnection.Open()
Expect(err).To(Not(HaveOccurred()))
Expect(dbConnection.GetDb()).To(Not(BeNil()))
err = dbConnection.Open()
Expect(err).To(HaveOccurred())
err = dbConnection.Close()
Expect(err).To(Not(HaveOccurred()))
Expect(dbConnection.GetDb()).To(BeNil())
})
It("close fail", func() {
dbConnection := database.NewConnection()
Expect(dbConnection.GetDb()).To(BeNil())
err = dbConnection.Close()
Expect(err).To(HaveOccurred())
})
})
})
Loading