Skip to content

Commit dbfd5be

Browse files
authored
Merge pull request #130 from lpabon/component-install-again
Component install again
2 parents 9346177 + 9f407fd commit dbfd5be

File tree

11 files changed

+105
-11
lines changed

11 files changed

+105
-11
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ script:
99
- make install
1010
- make test
1111
- make docs
12-
- cd example-component && make verify
12+
- cd example-component/golang && make verify

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ test:
7474
verify: all test
7575
go fmt $(go list ./... | grep -v vendor) | wc -l | grep 0
7676
go vet $(go list ./... | grep -v vendor)
77-
$(MAKE) -C example-component verify
77+
$(MAKE) -C example-component/golang verify
7878

7979
$(PLUGIN_PKG_NAME): pxc
8080
cp pxc $(PLUGIN_PKG_NAME)

example-component/bash/pxc-install

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
#
3+
# Copyright © 2020 Portworx
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# Example installer for components
18+
#
19+
20+
if [ $# -lt 1 ] ; then
21+
echo "Must supply a url or filename"
22+
exit 1
23+
fi
24+
STAGING_DIR=/tmp/pxc-staging
25+
plugin=$STAGING_DIR/pxc-plugin.tar.gz
26+
27+
mkdir -p $STAGING_DIR
28+
29+
if echo $1 | egrep "^http://|^https://" > /dev/null 2>&1 ; then
30+
echo "--> Downloading"
31+
curl -L -s -o $STAGING_DIR/pxc-plugin.tar.gz $1
32+
else
33+
if [ ! -f $1 ] ; then
34+
echo "File $1 does not exist"
35+
fi
36+
cp $1 $plugin
37+
fi
38+
39+
echo "--> Unpacking"
40+
( cd $STAGING_DIR ; tar xzf $plugin )
41+
42+
echo "--> Installing"
43+
( cd $STAGING_DIR ; cp -r */* $HOME/.pxc )
44+
45+
echo "Done"
46+
47+
rm -rf $STAGING_DIR

example-component/bash/pxc-shellenv

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
#
3+
# Copyright © 2020 Portworx
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# Shows PXC environment variables
18+
#
19+
env | grep PXC

example-component/bash/pxc-status

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
#
3+
# Copyright © 2020 Portworx
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# Emulate pxctl status
18+
#
19+
20+
id=$(kubectl pxc node list -o json | jq -r '.[].id' | head -1)
21+
kubectl pxc node describe $id
22+
kubectl pxc cluster describe

example-component/Makefile example-component/golang/Makefile

+13-7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ VER := $(shell git describe --tags)
88
ARCH := $(shell go env GOARCH)
99
GOOS := $(shell go env GOOS)
1010
DIR=.
11+
TMP=$(DIR)/tmp
12+
PKGDIR=$(TMP)/$(PXC_COMPONENT)
1113

1214
ifdef APP_SUFFIX
1315
VERSION = $(VER)-$(subst /,-,$(APP_SUFFIX))
@@ -82,20 +84,24 @@ $(COMPONENT_PKG_NAME): $(PKG_NAME)
8284

8385
$(ZIPPACKAGE): all
8486
@echo Packaging binaries...
87+
@mkdir -p $(PKGDIR)/bin
88+
@cp $(COMPONENT_PKG_NAME) $(PKGDIR)/bin
8589
@mkdir -p dist
86-
@zip dist/$@ $(COMPONENT_PKG_NAME)
87-
@rm -f $(PKG_NAME)
90+
( cd $(DIR)/tmp && zip -r ../dist/$@ $(PXC_COMPONENT) )
91+
@rm -rf $(TMP)
92+
@rm -f $(PKG_NAME) $(COMPONENT_PKG_NAME) $(CLINAME).exe $(PXC_COMPONENT).exe
8893

8994
$(TGZPACKAGE): all
9095
@echo Packaging binaries...
91-
@mkdir -p tmp/$(PKG_NAME)
92-
@cp $(COMPONENT_PKG_NAME) tmp/$(PKG_NAME)/
96+
@mkdir -p $(PKGDIR)/bin
97+
@cp $(COMPONENT_PKG_NAME) $(PKGDIR)/bin
9398
@mkdir -p $(DIR)/dist/
94-
tar -czf $(DIR)/dist/$@ -C tmp $(PKG_NAME)
95-
@rm -rf tmp
99+
tar -czf $(DIR)/dist/$@ -C $(DIR)/tmp $(PXC_COMPONENT)
100+
@rm -rf $(TMP)
101+
@rm -f $(PKG_NAME) $(COMPONENT_PKG_NAME) $(CLINAME).exe $(PXC_COMPONENT).exe
96102

97103
clean:
98-
rm -f $(PKG_NAME) $(COMPONENT_PKG_NAME)
104+
rm -f $(PKG_NAME) $(COMPONENT_PKG_NAME) $(CLINAME).exe $(PXC_COMPONENT).exe
99105
rm -rf dist
100106

101107
.PHONY: dist all clean darwin_amd64_dist windows_amd64_dist linux_amd64_dist \

example-component/handler/handler.go example-component/golang/handler/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ limitations under the License.
1616
package handler
1717

1818
import (
19-
_ "github.com/portworx/pxc/example-component/handler/cluster"
19+
_ "github.com/portworx/pxc/example-component/golang/handler/cluster"
2020
)

example-component/main.go example-component/golang/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616
package main
1717

1818
import (
19-
_ "github.com/portworx/pxc/example-component/handler"
19+
_ "github.com/portworx/pxc/example-component/golang/handler"
2020
pxc "github.com/portworx/pxc/pkg/component"
2121
)
2222

0 commit comments

Comments
 (0)