Skip to content

Commit

Permalink
update organization
Browse files Browse the repository at this point in the history
  • Loading branch information
niqdev committed Jul 11, 2019
1 parent c240d72 commit f1ee78a
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CMD_GO := $(shell command -v go 2> /dev/null)
CMD_DEP := $(shell command -v dep 2> /dev/null)
CMD_OPERATOR_SDK := $(shell command -v operator-sdk 2> /dev/null)

DOCKER_USERNAME := niqdev
DOCKER_USERNAME := edgelevel
DOCKER_IMAGE := $(DOCKER_USERNAME)/lastpass-operator

.PHONY: requirements
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[![docker-tag][tag-image]][tag-url]

[tag-image]: https://img.shields.io/github/tag/niqdev/lastpass-operator.svg?style=popout-square&color=e53935
[tag-url]: https://hub.docker.com/r/niqdev/lastpass-operator
[tag-image]: https://img.shields.io/github/tag/edgelevel/lastpass-operator.svg?style=popout-square&color=e53935
[tag-url]: https://hub.docker.com/r/edgelevel/lastpass-operator

A Kubernetes Operator to manage [secrets](https://kubernetes.io/docs/concepts/configuration/secret) stored in [LastPass](https://www.lastpass.com) password manager

Expand All @@ -30,8 +30,8 @@ $ lpass show example/my-secret --json

Define a `LastPass` [Custom Resource](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources) to automatically manage the lifecycle of your secrets in Kubernetes
```bash
$ cat example/niqdev_v1alpha1_lastpass_cr.yaml
apiVersion: niqdev.com/v1alpha1
$ cat example/edgelevel_v1alpha1_lastpass_cr.yaml
apiVersion: edgelevel.com/v1alpha1
kind: LastPass
metadata:
name: example-lastpass
Expand All @@ -48,7 +48,7 @@ spec:
refresh: 10

# create a custom resource
$ kubectl apply -f example/niqdev_v1alpha1_lastpass_cr.yaml
$ kubectl apply -f example/edgelevel_v1alpha1_lastpass_cr.yaml
```

The operator will take care of create native Kubernetes secrets and keep them up to date that if they change
Expand Down Expand Up @@ -80,7 +80,7 @@ metadata:
name: example-lastpass-8190226423897406876
namespace: default
ownerReferences:
- apiVersion: niqdev.com/v1alpha1
- apiVersion: edgelevel.com/v1alpha1
blockOwnerDeletion: true
controller: true
kind: LastPass
Expand Down Expand Up @@ -109,7 +109,7 @@ http :8080/metrics

## Considerations

* If you want to understand how the operator works, you should have a look at the `Reconcile` method defined in [lastpass_controller](https://github.com/niqdev/lastpass-operator/blob/master/pkg/controller/lastpass/lastpass_controller.go) and at the [CustomResourceDefinition](https://github.com/niqdev/lastpass-operator/blob/master/chart/templates/crd.yaml)
* If you want to understand how the operator works, you should have a look at the `Reconcile` method defined in [lastpass_controller](https://github.com/edgelevel/lastpass-operator/blob/master/pkg/controller/lastpass/lastpass_controller.go) and at the [CustomResourceDefinition](https://github.com/edgelevel/lastpass-operator/blob/master/chart/templates/crd.yaml)
* The diagram below explains the core logic of the reconcile loop

<p align="center">
Expand All @@ -131,8 +131,8 @@ http :8080/metrics

```bash
# download source
mkdir -p $GOPATH/src/github.com/niqdev && cd $_
git clone git@github.com:niqdev/lastpass-operator.git
mkdir -p $GOPATH/src/github.com/edgelevel && cd $_
git clone git@github.com:edgelevel/lastpass-operator.git
cd lastpass-operator

# install dependencies
Expand All @@ -157,7 +157,7 @@ operator-sdk up local --namespace=default --verbose
Run as a Deployment inside the cluster
```bash
# build and publish
# https://hub.docker.com/u/niqdev
# https://hub.docker.com/u/edgelevel
make docker-push tag=X.Y.Z

# apply chart
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: lastpass.niqdev.com
name: lastpass.edgelevel.com
spec:
group: niqdev.com
group: edgelevel.com
scope: Namespaced
version: v1alpha1
names:
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ rules:
verbs:
- '*'
- apiGroups:
- niqdev.com
- edgelevel.com
resources:
- '*'
verbs:
Expand Down
2 changes: 1 addition & 1 deletion chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: lastpass-operator
namespace: lastpass

image:
repository: niqdev/lastpass-operator
repository: edgelevel/lastpass-operator
tag: 0.4.0

replicas: 1
Expand Down
4 changes: 2 additions & 2 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
_ "k8s.io/client-go/plugin/pkg/client/auth"

"github.com/niqdev/lastpass-operator/pkg/apis"
"github.com/niqdev/lastpass-operator/pkg/controller"
"github.com/edgelevel/lastpass-operator/pkg/apis"
"github.com/edgelevel/lastpass-operator/pkg/controller"

"github.com/operator-framework/operator-sdk/pkg/k8sutil"
"github.com/operator-framework/operator-sdk/pkg/leader"
Expand Down
10 changes: 5 additions & 5 deletions docs/golang.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

```bash
# download source
mkdir -p $GOPATH/src/github.com/niqdev && cd $_
git clone git@github.com:niqdev/lastpass-operator.git
mkdir -p $GOPATH/src/github.com/edgelevel && cd $_
git clone git@github.com:edgelevel/lastpass-operator.git

# first time only
dep init
Expand All @@ -33,11 +33,11 @@ cobra init . --pkg-name lastpass-operator
go run main.go

# compile
go build $GOPATH/src/github.com/niqdev/lastpass-operator
go build $GOPATH/src/github.com/edgelevel/lastpass-operator

# compile and build executable
go install $GOPATH/src/github.com/niqdev/lastpass-operator
go install $GOPATH/src/github.com/edgelevel/lastpass-operator

# test
go test $GOPATH/src/github.com/niqdev/lastpass-operator
go test $GOPATH/src/github.com/edgelevel/lastpass-operator
```
10 changes: 5 additions & 5 deletions docs/lastpass.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ lpass logout --force
Docker Alpine (8.07MB)
```bash
# build image
docker build -t niqdev/lastpass-cli -f example/lastpass-alpine .
docker build -t edgelevel/lastpass-cli -f example/lastpass-alpine .

# temporary container
docker run --rm -it niqdev/lastpass-cli /bin/sh
docker run --rm -it edgelevel/lastpass-cli /bin/sh
echo <PASSWORD> | LPASS_DISABLE_PINENTRY=1 lpass login --trust <USERNAME>
echo <PASSWORD> | lpass show <GROUP>/<NAME> --json --expand-multi
```

Docker Ubuntu (673MB)
```bash
# build image
docker build -t niqdev/lastpass-cli -f example/lastpass-ubuntu .
docker build -t edgelevel/lastpass-cli -f example/lastpass-ubuntu .

# temporary container
docker run --rm --name lastpass-cli niqdev/lastpass-cli
docker run --rm --name lastpass-cli edgelevel/lastpass-cli

# access container
docker exec -it lastpass-cli bash
lpass --version

# execute command inline
docker run --rm -it niqdev/lastpass-cli lpass --version
docker run --rm -it edgelevel/lastpass-cli lpass --version
```
6 changes: 3 additions & 3 deletions docs/operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export PATH=$PATH:$(go env GOPATH)/bin
Initialize project
```bash
# create project
mkdir -p $GOPATH/src/github.com/niqdev && cd $_
mkdir -p $GOPATH/src/github.com/edgelevel && cd $_
operator-sdk new lastpass-operator --dep-manager=dep

# add crd
operator-sdk add api --api-version=niqdev.com/v1alpha1 --kind=LastPass
operator-sdk add api --api-version=edgelevel.com/v1alpha1 --kind=LastPass
operator-sdk generate k8s

# add controller
operator-sdk add controller --api-version=niqdev.com/v1alpha1 --kind=LastPass
operator-sdk add controller --api-version=edgelevel.com/v1alpha1 --kind=LastPass
```
2 changes: 1 addition & 1 deletion example/niqdev_v1alpha1_lastpass_cr.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: niqdev.com/v1alpha1
apiVersion: edgelevel.com/v1alpha1
kind: LastPass
metadata:
name: example-lastpass
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/addtoscheme_niqdev_v1alpha1.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package apis

import (
"github.com/niqdev/lastpass-operator/pkg/apis/niqdev/v1alpha1"
"github.com/edgelevel/lastpass-operator/pkg/apis/edgelevel/v1alpha1"
)

func init() {
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/niqdev/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package v1alpha1 contains API Schema definitions for the niqdev v1alpha1 API group
// Package v1alpha1 contains API Schema definitions for the edgelevel v1alpha1 API group
// +k8s:deepcopy-gen=package,register
// +groupName=niqdev.com
// +groupName=edgelevel.com
package v1alpha1
6 changes: 3 additions & 3 deletions pkg/apis/niqdev/v1alpha1/register.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// NOTE: Boilerplate only. Ignore this file.

// Package v1alpha1 contains API Schema definitions for the niqdev v1alpha1 API group
// Package v1alpha1 contains API Schema definitions for the edgelevel v1alpha1 API group
// +k8s:deepcopy-gen=package,register
// +groupName=niqdev.com
// +groupName=edgelevel.com
package v1alpha1

import (
Expand All @@ -12,7 +12,7 @@ import (

var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "niqdev.com", Version: "v1alpha1"}
SchemeGroupVersion = schema.GroupVersion{Group: "edgelevel.com", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
Expand Down
18 changes: 9 additions & 9 deletions pkg/apis/niqdev/v1alpha1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/controller/add_lastpass.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package controller

import (
"github.com/niqdev/lastpass-operator/pkg/controller/lastpass"
"github.com/edgelevel/lastpass-operator/pkg/controller/lastpass"
)

func init() {
Expand Down
14 changes: 7 additions & 7 deletions pkg/controller/lastpass/lastpass_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"time"

niqdevv1alpha1 "github.com/niqdev/lastpass-operator/pkg/apis/niqdev/v1alpha1"
"github.com/niqdev/lastpass-operator/pkg/lastpass"
"github.com/niqdev/lastpass-operator/pkg/utils"
edgelevelv1alpha1 "github.com/edgelevel/lastpass-operator/pkg/apis/edgelevel/v1alpha1"
"github.com/edgelevel/lastpass-operator/pkg/lastpass"
"github.com/edgelevel/lastpass-operator/pkg/utils"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -44,15 +44,15 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
}

// Watch for changes to primary resource LastPass
err = c.Watch(&source.Kind{Type: &niqdevv1alpha1.LastPass{}}, &handler.EnqueueRequestForObject{})
err = c.Watch(&source.Kind{Type: &edgelevelv1alpha1.LastPass{}}, &handler.EnqueueRequestForObject{})
if err != nil {
return err
}

// Watch for changes to secondary resource Secrets and requeue the owner LastPass
err = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForOwner{
IsController: true,
OwnerType: &niqdevv1alpha1.LastPass{},
OwnerType: &edgelevelv1alpha1.LastPass{},
})
if err != nil {
return err
Expand Down Expand Up @@ -95,7 +95,7 @@ func (r *ReconcileLastPass) Reconcile(request reconcile.Request) (reconcile.Resu
}

// Fetch the LastPass instance
instance := &niqdevv1alpha1.LastPass{}
instance := &edgelevelv1alpha1.LastPass{}
err := r.client.Get(context.TODO(), request.NamespacedName, instance)
if err != nil {
if errors.IsNotFound(err) {
Expand Down Expand Up @@ -174,7 +174,7 @@ func (r *ReconcileLastPass) Reconcile(request reconcile.Request) (reconcile.Resu
}

// newSecretForCR creates a new secret
func newSecretForCR(cr *niqdevv1alpha1.LastPass, secret lastpass.LastPassSecret) *corev1.Secret {
func newSecretForCR(cr *edgelevelv1alpha1.LastPass, secret lastpass.LastPassSecret) *corev1.Secret {
labels := map[string]string{
"app": "lastpass-operator",
}
Expand Down

0 comments on commit f1ee78a

Please sign in to comment.