mirror of
https://github.com/1Password/onepassword-operator.git
synced 2025-10-24 00:10:46 +00:00
Compare commits
1 Commits
deploy-1.2
...
goreleaser
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ee4478c46 |
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,36 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Report bugs and errors found while using the Operator.
|
|
||||||
title: ''
|
|
||||||
labels: bug
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Your environment
|
|
||||||
|
|
||||||
<!-- Version of the Operator when the error occurred -->
|
|
||||||
Operator Version:
|
|
||||||
|
|
||||||
<!-- What version of the Connect server are you running?
|
|
||||||
You can get this information from the Integrations section in 1Password
|
|
||||||
https://start.1password.com/integrations/active
|
|
||||||
-->
|
|
||||||
Connect Server Version:
|
|
||||||
|
|
||||||
<!-- What version of Kubernetes have you deployed the operator to? -->
|
|
||||||
Kubernetes Version:
|
|
||||||
|
|
||||||
## What happened?
|
|
||||||
<!-- Describe the bug or error -->
|
|
||||||
|
|
||||||
## What did you expect to happen?
|
|
||||||
<!-- Describe what should have happened -->
|
|
||||||
|
|
||||||
## Steps to reproduce
|
|
||||||
1. <!-- Describe Steps to reproduce the issue -->
|
|
||||||
|
|
||||||
|
|
||||||
## Notes & Logs
|
|
||||||
<!-- Paste any logs here that may help with debugging.
|
|
||||||
Remember to remove any sensitive information before sharing! -->
|
|
||||||
9
.github/ISSUE_TEMPLATE/config.yml
vendored
9
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,9 +0,0 @@
|
|||||||
# docs: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
|
|
||||||
blank_issues_enabled: true
|
|
||||||
contact_links:
|
|
||||||
- name: 1Password Community
|
|
||||||
url: https://1password.community/categories/secrets-automation
|
|
||||||
about: Please ask general Secrets Automation questions here.
|
|
||||||
- name: 1Password Security Bug Bounty
|
|
||||||
url: https://bugcrowd.com/agilebits
|
|
||||||
about: Please report security vulnerabilities here.
|
|
||||||
32
.github/ISSUE_TEMPLATE/feature_request.md
vendored
32
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,32 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for the Operator
|
|
||||||
title: ''
|
|
||||||
labels: feature-request
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Summary
|
|
||||||
<!-- Briefly describe the feature in one or two sentences. You can include more details later. -->
|
|
||||||
|
|
||||||
### Use cases
|
|
||||||
<!-- Describe the use cases that make this feature useful to others.
|
|
||||||
The description should help the reader understand why the feature is necessary.
|
|
||||||
The better we understand your use case, the better we can help create an appropriate solution. -->
|
|
||||||
|
|
||||||
### Proposed solution
|
|
||||||
<!-- If you already have an idea for how the feature should work, use this space to describe it.
|
|
||||||
We'll work with you to find a workable approach, and any implementation details are appreciated.
|
|
||||||
-->
|
|
||||||
|
|
||||||
### Is there a workaround to accomplish this today?
|
|
||||||
<!-- If there's a way to accomplish this feature request without changes to the codebase, we'd like to hear it.
|
|
||||||
-->
|
|
||||||
|
|
||||||
### References & Prior Work
|
|
||||||
<!-- If a similar feature was implemented in another project or tool, add a link so we can better understand your request.
|
|
||||||
Links to relevant documentation or RFCs are also appreciated. -->
|
|
||||||
|
|
||||||
* <!-- Reference 1 -->
|
|
||||||
* <!-- Reference 2, etc -->
|
|
||||||
52
.github/workflows/release.yml
vendored
52
.github/workflows/release.yml
vendored
@@ -1,15 +1,13 @@
|
|||||||
name: release
|
name: goreleaser
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release-docker:
|
goreleaser:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
@@ -17,41 +15,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Set up Go
|
||||||
id: meta
|
uses: actions/setup-go@v2
|
||||||
uses: crazy-max/ghaction-docker-meta@v2
|
|
||||||
with:
|
with:
|
||||||
images: |
|
go-version: 1.15
|
||||||
1password/onepassword-operator
|
|
||||||
# Publish image for x.y.z and x.y
|
|
||||||
# The latest tag is automatically added for semver tags
|
|
||||||
tags: |
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
- name: Get the version from tag
|
|
||||||
id: get_version
|
|
||||||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
|
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Run GoReleaser
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: goreleaser/goreleaser-action@v2
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
-
|
|
||||||
name: Docker Login
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
version: latest
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
args: release --rm-dist
|
||||||
-
|
env:
|
||||||
name: Build and push
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
build-args: |
|
|
||||||
operator_version=${{ steps.get_version.outputs.VERSION }}
|
|
||||||
|
|||||||
55
.goreleaser.yml
Normal file
55
.goreleaser.yml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
project_name: onepassword-operator
|
||||||
|
builds:
|
||||||
|
- env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
binary: manager
|
||||||
|
main: ./cmd/manager/main.go
|
||||||
|
flags:
|
||||||
|
- -mod=vendor
|
||||||
|
- -trimpath
|
||||||
|
ldflags:
|
||||||
|
- -s -w -X "github.com/1Password/onepassword-operator/version.Version={{ .Version }}"
|
||||||
|
mod_timestamp: '{{ .CommitTimestamp }}'
|
||||||
|
goos:
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
dockers:
|
||||||
|
- image_templates: ["1password/{{ .ProjectName }}:{{ .Version }}-amd64"]
|
||||||
|
goos: linux
|
||||||
|
goarch: amd64
|
||||||
|
dockerfile: Dockerfile-goreleaser
|
||||||
|
use_buildx: true
|
||||||
|
extra_files:
|
||||||
|
- deploy/connect/
|
||||||
|
build_flag_templates:
|
||||||
|
- --platform=linux/amd64
|
||||||
|
- --label=org.opencontainers.image.title={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.description={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.url=https://github.com/1Password/onepassword-operator
|
||||||
|
- --label=org.opencontainers.image.source=https://github.com/1Password/onepassword-operator
|
||||||
|
- --label=org.opencontainers.image.version={{ .Version }}
|
||||||
|
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
||||||
|
- --label=org.opencontainers.image.licenses=MIT
|
||||||
|
- image_templates: ["1password/{{ .ProjectName }}:{{ .Version }}-arm64v8"]
|
||||||
|
goos: linux
|
||||||
|
goarch: arm64
|
||||||
|
dockerfile: Dockerfile-goreleaser
|
||||||
|
use_buildx: true
|
||||||
|
extra_files:
|
||||||
|
- deploy/connect/
|
||||||
|
build_flag_templates:
|
||||||
|
- --platform=linux/arm64/v8
|
||||||
|
- --label=org.opencontainers.image.title={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.description={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.url=https://github.com/1Password/onepassword-operator
|
||||||
|
- --label=org.opencontainers.image.source=https://github.com/1Password/onepassword-operator
|
||||||
|
- --label=org.opencontainers.image.version={{ .Version }}
|
||||||
|
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
||||||
|
- --label=org.opencontainers.image.licenses=MIT
|
||||||
|
docker_manifests:
|
||||||
|
- name_template: 1password/{{ .ProjectName }}:{{ .Version }}
|
||||||
|
image_templates:
|
||||||
|
- 1password/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||||
|
- 1password/{{ .ProjectName }}:{{ .Version }}-arm64v8
|
||||||
@@ -12,15 +12,6 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
[//]: # (START/v1.0.1)
|
|
||||||
# v1.0.1
|
|
||||||
|
|
||||||
## Features
|
|
||||||
* This release also contains an arm64 Docker image. {#20}
|
|
||||||
* Docker images are also pushed to the :latest and :<major>.<minor> tags.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
[//]: # (START/v1.0.0)
|
[//]: # (START/v1.0.0)
|
||||||
# v1.0.0
|
# v1.0.0
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ COPY vendor/ vendor/
|
|||||||
# Build
|
# Build
|
||||||
ARG operator_version=dev
|
ARG operator_version=dev
|
||||||
RUN CGO_ENABLED=0 \
|
RUN CGO_ENABLED=0 \
|
||||||
|
GOOS=linux \
|
||||||
|
GOARCH=amd64 \
|
||||||
GO111MODULE=on \
|
GO111MODULE=on \
|
||||||
go build \
|
go build \
|
||||||
-ldflags "-X \"github.com/1Password/onepassword-operator/version.Version=$operator_version\"" \
|
-ldflags "-X version.Version=$operator_version" \
|
||||||
-mod vendor \
|
-mod vendor \
|
||||||
-a -o manager main.go
|
-a -o manager main.go
|
||||||
|
|
||||||
|
|||||||
9
Dockerfile-goreleaser
Normal file
9
Dockerfile-goreleaser
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Use distroless as minimal base image to package the manager binary
|
||||||
|
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
||||||
|
FROM gcr.io/distroless/static:nonroot
|
||||||
|
WORKDIR /
|
||||||
|
COPY ./manager .
|
||||||
|
USER nonroot:nonroot
|
||||||
|
COPY deploy/connect/ deploy/connect/
|
||||||
|
|
||||||
|
ENTRYPOINT ["/manager"]
|
||||||
25
README.md
25
README.md
@@ -13,8 +13,8 @@ Prerequisites:
|
|||||||
- [1Password Command Line Tool Installed](https://1password.com/downloads/command-line/)
|
- [1Password Command Line Tool Installed](https://1password.com/downloads/command-line/)
|
||||||
- [kubectl installed](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
|
- [kubectl installed](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
|
||||||
- [docker installed](https://docs.docker.com/get-docker/)
|
- [docker installed](https://docs.docker.com/get-docker/)
|
||||||
- [Generated a 1password-credentials.json file and issued a 1Password Connect API Token for the K8s Operator integration](https://support.1password.com/secrets-automation/)
|
- [Generated a 1password-credentials.json file and issued a 1Password Connect API Token for the K8s Operator integration](https://support.b5dev.com/cs/connect)
|
||||||
- [1Password Connect deployed to Kubernetes](https://support.1password.com/connect-deploy-kubernetes/#step-2-deploy-a-1password-connect-server). **NOTE**: If customization of the 1Password Connect deployment is not required you can skip this prerequisite.
|
- [1Password Connect deployed to Kubernetes](https://support.b5dev.com/cs/connect-deploy-kubernetes/#step-2-deploy-a-connect-server). **NOTE**: If customization of the 1Password Connect deployment is not required you can skip this prerequisite.
|
||||||
|
|
||||||
### Quickstart for Deploying 1Password Connect to Kubernetes
|
### Quickstart for Deploying 1Password Connect to Kubernetes
|
||||||
|
|
||||||
@@ -53,15 +53,15 @@ Adding this environment variable will have the operator automatically deploy a d
|
|||||||
"Create a Connect token for the operator and save it as a Kubernetes Secret:
|
"Create a Connect token for the operator and save it as a Kubernetes Secret:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ kubectl create secret generic onepassword-token --from-literal=token=<OP_CONNECT_TOKEN>"
|
$ kubectl create secret generic op-operator-connect-token --from-literal=token=<OP_CONNECT_TOKEN>"
|
||||||
```
|
```
|
||||||
|
|
||||||
If you do not have a token for the operator, you can generate a token and save it to kubernetes with the following command:
|
If you do not have a token for the operator, you can generate a token and save it to kubernetes with the following command:
|
||||||
```bash
|
```bash
|
||||||
$ kubectl create secret generic onepassword-token --from-literal=token=$(op create connect token <server> op-k8s-operator --vault <vault>)
|
$ kubectl create secret generic op-operator-connect-token --from-literal=token=$(op create connect token <server> op-k8s-operator --vault <vault>)
|
||||||
```
|
```
|
||||||
|
|
||||||
[More information on generating a token can be found here](https://support.1password.com/secrets-automation/#appendix-issue-additional-access-tokens)
|
[More information on generating a token can be found here](https://support.1password.com/cs/secrets-automation/#appendix-issue-additional-access-tokens)
|
||||||
|
|
||||||
**Set Permissions For Operator**
|
**Set Permissions For Operator**
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ To create a Kubernetes Secret from a 1Password item, create a yaml file with the
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: onepassword.com/v1
|
apiVersion: onepassword.com/v1
|
||||||
kind: OnePasswordItem
|
kind: OnePasswordItem # {insert_new_name}
|
||||||
metadata:
|
metadata:
|
||||||
name: <item_name> #this name will also be used for naming the generated kubernetes secret
|
name: <item_name> #this name will also be used for naming the generated kubernetes secret
|
||||||
spec:
|
spec:
|
||||||
@@ -131,8 +131,8 @@ kind: Deployment
|
|||||||
metadata:
|
metadata:
|
||||||
name: deployment-example
|
name: deployment-example
|
||||||
annotations:
|
annotations:
|
||||||
operator.1password.io/item-path: "vaults/<vault_id_or_title>/items/<item_id_or_title>"
|
operator.1password.io/item-path: "vaults/{vault_id_or_title}/items/{item_id_or_title}"
|
||||||
operator.1password.io/item-name: "<secret_name>"
|
operator.1password.io/item-name: "{secret_name}"
|
||||||
```
|
```
|
||||||
|
|
||||||
Applying this yaml file will create a Kubernetes Secret with the name `<secret_name>` and contents from the location specified at the specified Item Path.
|
Applying this yaml file will create a Kubernetes Secret with the name `<secret_name>` and contents from the location specified at the specified Item Path.
|
||||||
@@ -163,8 +163,7 @@ apiVersion: v1
|
|||||||
kind: Namespace
|
kind: Namespace
|
||||||
metadata:
|
metadata:
|
||||||
name: "example-namespace"
|
name: "example-namespace"
|
||||||
annotations:
|
operator.1password.io/auto-restart: "true"
|
||||||
operator.1password.io/auto-restart: "true"
|
|
||||||
```
|
```
|
||||||
If the value is not set, the auto reset settings on the operator will be used. This value can be overwritten by deployment.
|
If the value is not set, the auto reset settings on the operator will be used. This value can be overwritten by deployment.
|
||||||
|
|
||||||
@@ -176,8 +175,7 @@ apiVersion: v1
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: "example-deployment"
|
name: "example-deployment"
|
||||||
annotations:
|
operator.1password.io/auto-restart: "true"
|
||||||
operator.1password.io/auto-restart: "true"
|
|
||||||
```
|
```
|
||||||
If the value is not set, the auto reset settings on the namespace will be used.
|
If the value is not set, the auto reset settings on the namespace will be used.
|
||||||
|
|
||||||
@@ -189,8 +187,7 @@ apiVersion: onepassword.com/v1
|
|||||||
kind: OnePasswordItem
|
kind: OnePasswordItem
|
||||||
metadata:
|
metadata:
|
||||||
name: example
|
name: example
|
||||||
annotations:
|
operator.1password.io/auto-restart: "true"
|
||||||
operator.1password.io/auto-restart: "true"
|
|
||||||
```
|
```
|
||||||
If the value is not set, the auto reset settings on the deployment will be used.
|
If the value is not set, the auto reset settings on the deployment will be used.
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: onepassword-connect
|
app: onepassword-connect
|
||||||
version: "1.2.0"
|
version: "1.0.0"
|
||||||
spec:
|
spec:
|
||||||
volumes:
|
volumes:
|
||||||
- name: shared-data
|
- name: shared-data
|
||||||
|
|||||||
Reference in New Issue
Block a user