Skip to content

Commit 9828c46

Browse files
authored
Merge branch '1Password:main' into feat/add-empty-value-field
2 parents a32542e + 0f1dcdd commit 9828c46

File tree

4,187 files changed

+1862
-1497309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,187 files changed

+1862
-1497309
lines changed

.VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8.1
1+
1.9.0
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Check signed commits in PR
2+
on: pull_request_target
3+
4+
jobs:
5+
build:
6+
name: Check signed commits in PR
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check signed commits in PR
13+
uses: 1Password/check-signed-commits-action@v1

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@
1212

1313
---
1414

15+
[//]: # (START/v1.9.0)
16+
# v1.9.0
17+
18+
## Features
19+
* Enable the Operator to authenticate to 1Password using service accounts. {#160}
20+
21+
## Fixes
22+
* Update Operator to use SDK v1.34.1. {#185}
23+
* Pass Kubernetes context down to SDK/Connect. {#199}
24+
25+
---
26+
1527
[//]: # (START/v1.8.1)
1628
# v1.8.1
1729

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.21 as builder
2+
FROM golang:1.24 as builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

@@ -8,13 +8,15 @@ WORKDIR /workspace
88
COPY go.mod go.mod
99
COPY go.sum go.sum
1010

11+
# Download dependencies
12+
RUN go mod download
13+
1114
# Copy the go source
1215
COPY cmd/main.go cmd/main.go
1316
COPY api/ api/
1417
COPY internal/controller/ internal/controller/
1518
COPY pkg/ pkg/
1619
COPY version/ version/
17-
COPY vendor/ vendor/
1820

1921
# Build
2022
# the GOARCH has not a default value to allow the binary be built according to the host where the command
@@ -25,7 +27,6 @@ RUN CGO_ENABLED=0 \
2527
GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} \
2628
go build \
2729
-ldflags "-X \"github.com/1Password/onepassword-operator/version.Version=$operator_version\"" \
28-
-mod vendor \
2930
-a -o manager cmd/main.go
3031

3132
# Use distroless as minimal base image to package the manager binary

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export MAIN_BRANCH ?= main
55
# To re-generate a bundle for another specific version without changing the standard setup, you can:
66
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
77
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
8-
VERSION ?= 1.8.1
8+
VERSION ?= 1.9.0
99

1010
# CHANNELS define the bundle channels used in the bundle.
1111
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,39 @@ The 1Password Connect Kubernetes Operator provides the ability to integrate Kube
1717

1818
### 🚀 Quickstart
1919

20-
1. Add the [1Passsword Helm Chart](https://github.com/1Password/connect-helm-charts) to your repository.
20+
1. Add the [1Password Helm Chart](https://github.com/1Password/connect-helm-charts) to your repository.
2121

2222
2. Run the following command to install Connect and the 1Password Kubernetes Operator in your infrastructure:
23+
2324
```
2425
helm install connect 1password/connect --set-file connect.credentials=1password-credentials-demo.json --set operator.create=true --set operator.token.value = <your connect token>
2526
```
2627

2728
3. Create a Kubernetes Secret from a 1Password item:
28-
```apiVersion: onepassword.com/v1
29+
30+
```
31+
apiVersion: onepassword.com/v1
2932
kind: OnePasswordItem
3033
metadata:
3134
name: <item_name> #this name will also be used for naming the generated kubernetes secret
3235
spec:
3336
itemPath: "vaults/<vault_id_or_title>/items/<item_id_or_title>"
3437
```
38+
3539
Deploy the OnePasswordItem to Kubernetes:
40+
3641
```
3742
kubectl apply -f <your_item>.yaml
3843
```
44+
3945
Check that the Kubernetes Secret has been generated:
4046

4147
```
4248
kubectl get secret <secret_name>
4349
```
4450

4551
### 📄 Usage
52+
4653
Refer to the [Usage Guide](USAGEGUIDE.md) for documentation on how to deploy and use the 1Password Operator.
4754

4855
## 💙 Community & Support
@@ -55,6 +62,4 @@ Refer to the [Usage Guide](USAGEGUIDE.md) for documentation on how to deploy and
5562

5663
1Password requests you practice responsible disclosure if you discover a vulnerability.
5764

58-
Please file requests via [**BugCrowd**](https://bugcrowd.com/agilebits).
59-
60-
For information about security practices, please visit the [1Password Bug Bounty Program](https://bugcrowd.com/agilebits).
65+
Please file requests by sending an email to [email protected].

USAGEGUIDE.md

Lines changed: 58 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -5,80 +5,71 @@
55

66
## Table of Contents
77

8-
- [Prerequisites](#prerequisites)
9-
- [Deploying 1Password Connect to Kubernetes](#deploying-1password-connect-to-kubernetes)
10-
- [Kubernetes Operator Deployment](#kubernetes-operator-deployment)
11-
- [Usage](#usage)
12-
- [Configuring Automatic Rolling Restarts of Deployments](#configuring-automatic-rolling-restarts-of-deployments)
13-
- [Development](#development)
8+
1. [Configuration Options](#configuration-options)
9+
2. [Use Kubernetes Operator with Service Account](#use-kubernetes-operator-with-service-account)
10+
- [Create a Service Account](#1-create-a-service-account)
11+
- [Create a Kubernetes secret](#2-create-a-kubernetes-secret-for-the-service-account)
12+
- [Deploy the Operator](#3-deploy-the-operator)
13+
3. [Use Kubernetes Operator with Connect](#use-kubernetes-operator-with-connect)
14+
- [Deploy with Helm](#1-deploy-with-helm)
15+
- [Deploy manually](#2-deploy-manually)
16+
4. [Logging level](#logging-level)
17+
5. [Usage examples](#usage-examples)
18+
6. [How 1Password Items Map to Kubernetes Secrets](#how-1password-items-map-to-kubernetes-secrets)
19+
7. [Configuring Automatic Rolling Restarts of Deployments](#configuring-automatic-rolling-restarts-of-deployments)
20+
8. [Development](#development)
1421

15-
## Prerequisites
1622

17-
- [1Password Command Line Tool Installed](https://1password.com/downloads/command-line/)
18-
- [`kubectl` installed](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
19-
- [`docker` installed](https://docs.docker.com/get-docker/)
20-
- [A `1password-credentials.json` file generated and a 1Password Connect API Token issued for the K8s Operator integration](https://developer.1password.com/docs/connect/get-started/#step-1-set-up-a-secrets-automation-workflow)
21-
22-
## Deploying 1Password Connect to Kubernetes
23-
24-
If 1Password Connect is already running, you can skip this step.
25-
26-
There are options to deploy 1Password Connect:
27-
28-
- [Deploy with Helm](#deploy-with-helm)
29-
- [Deploy using the Connect Operator](#deploy-using-the-connect-operator)
30-
31-
### Deploy with Helm
32-
33-
The 1Password Connect Helm Chart helps to simplify the deployment of 1Password Connect and the 1Password Connect Kubernetes Operator to Kubernetes.
34-
35-
[The 1Password Connect Helm Chart can be found here.](https://github.com/1Password/connect-helm-charts)
36-
37-
### Deploy using the Connect Operator
23+
---
3824

39-
This guide will provide a quickstart option for deploying a default configuration of 1Password Connect via starting the deploying the 1Password Connect Operator, however, it is recommended that you instead deploy your own manifest file if customization of the 1Password Connect deployment is desired.
25+
## Configuration options
26+
There are 2 ways 1Password Operator can talk to 1Password servers:
27+
- [1Password Service Accounts](https://developer.1password.com/docs/service-accounts)
28+
- [1Password Connect](https://developer.1password.com/docs/connect/)
4029

41-
Encode the `1password-credentials.json` file you generated in the prerequisite steps and save it to a file named `op-session`:
30+
---
4231

43-
```bash
44-
cat 1password-credentials.json | base64 | \
45-
tr '/+' '_-' | tr -d '=' | tr -d '\n' > op-session
46-
```
32+
## Use Kubernetes Operator with Service Account
4733

48-
Create a Kubernetes secret from the op-session file:
34+
### 1. [Create a service account](https://developer.1password.com/docs/service-accounts/get-started#create-a-service-account)
35+
### 2. Create a Kubernetes secret for the Service Account
36+
- Set `OP_SERVICE_ACCOUNT_TOKEN` environment variable to the service account token you created in the previous step. This token will be used by the operator to access 1Password items.
37+
- Create Kubernetes secret:
4938

5039
```bash
51-
kubectl create secret generic op-credentials --from-file=op-session
40+
kubectl create secret generic onepassword-service-account-token --from-literal=token="$OP_SERVICE_ACCOUNT_TOKEN"
5241
```
5342

54-
Add the following environment variable to the onepassword-connect-operator container in `/config/manager/manager.yaml`:
43+
### 3. Deploy the Operator
5544

56-
```yaml
57-
- name: MANAGE_CONNECT
58-
value: "true"
59-
```
60-
61-
Adding this environment variable will have the operator automatically deploy a default configuration of 1Password Connect to the current namespace.
45+
An sample Deployment yaml can be found at `/config/manager/manager.yaml`.
46+
To use Operator with Service Account, you need to set the `OP_SERVICE_ACCOUNT_TOKEN` environment variable in the `/config/manager/manager.yaml`. And remove `OP_CONNECT_TOKEN` and `OP_CONNECT_HOST` environment variables.
6247

63-
### Kubernetes Operator Deployment
48+
To further configure the 1Password Kubernetes Operator the following Environment variables can be set in the operator yaml:
6449

65-
#### Create Kubernetes Secret for OP_CONNECT_TOKEN ####
50+
- **OP_SERVICE_ACCOUNT_TOKEN** *(required)*: Specifies Service Account token within Kubernetes to access the 1Password items.
51+
- **WATCH_NAMESPACE:** *(default: watch all namespaces)*: Comma separated list of what Namespaces to watch for changes.
52+
- **POLLING_INTERVAL** *(default: 600)*: The number of seconds the 1Password Kubernetes Operator will wait before checking for updates from 1Password.
53+
- **AUTO_RESTART** (default: false): If set to true, the operator will restart any deployment using a secret from 1Password. This can be overwritten by namespace, deployment, or individual secret. More details on AUTO_RESTART can be found in the ["Configuring Automatic Rolling Restarts of Deployments"](#configuring-automatic-rolling-restarts-of-deployments) section.
6654

67-
Create a Connect token for the operator and save it as a Kubernetes Secret:
55+
To deploy the operator, simply run the following command:
6856

69-
```bash
70-
kubectl create secret generic onepassword-token --from-literal=token="<OP_CONNECT_TOKEN>"
57+
```shell
58+
make deploy
7159
```
7260

73-
If you do not have a token for the operator, you can generate a token and save it to Kubernetes with the following command:
61+
**Undeploy Operator**
7462

75-
```bash
76-
kubectl create secret generic onepassword-token --from-literal=token=$(op create connect token <server> op-k8s-operator --vault <vault>)
63+
```
64+
make undeploy
7765
```
7866

79-
**Deploying the Operator**
67+
---
8068

81-
An sample Deployment yaml can be found at `/config/manager/manager.yaml`.
69+
## Use Kubernetes Operator with Connect
70+
71+
### 1. [Deploy with Helm](https://developer.1password.com/docs/k8s/operator/?deployment-type=helm#helm-step-1)
72+
### 2. [Deploy manually](https://developer.1password.com/docs/k8s/operator/?deployment-type=manual#manual-step-1)
8273

8374
To further configure the 1Password Kubernetes Operator the following Environment variables can be set in the operator yaml:
8475

@@ -88,89 +79,42 @@ To further configure the 1Password Kubernetes Operator the following Environment
8879
- **MANAGE_CONNECT** *(default: false)*: If set to true, on deployment of the operator, a default configuration of the OnePassword Connect Service will be deployed to the current namespace.
8980
- **AUTO_RESTART** (default: false): If set to true, the operator will restart any deployment using a secret from 1Password Connect. This can be overwritten by namespace, deployment, or individual secret. More details on AUTO_RESTART can be found in the ["Configuring Automatic Rolling Restarts of Deployments"](#configuring-automatic-rolling-restarts-of-deployments) section.
9081

91-
You can also set the logging level by setting `--zap-log-level` as an arg on the containers to either `debug`, `info` or `error`. (Note: the default value is `debug`.)
82+
---
83+
84+
## Logging level
85+
You can set the logging level by setting `--zap-log-level` as an arg on the containers to either `debug`, `info` or `error`. The default value is `debug`.
9286

9387
Example:
9488
```yaml
95-
.
96-
.
97-
.
89+
....
9890
containers:
9991
- command:
10092
- /manager
10193
args:
10294
- --leader-elect
10395
- --zap-log-level=info
10496
image: 1password/onepassword-operator:latest
105-
.
106-
.
107-
.
97+
....
10898
```
109-
To deploy the operator, simply run the following command:
11099

111-
```shell
112-
make deploy
113-
```
114-
115-
**Undeploy Operator**
116-
117-
```
118-
make undeploy
119-
```
120-
121-
## Usage
122-
123-
To create a Kubernetes Secret from a 1Password item, create a yaml file with the following
124-
125-
```yaml
126-
apiVersion: onepassword.com/v1
127-
kind: OnePasswordItem
128-
metadata:
129-
name: <item_name> #this name will also be used for naming the generated kubernetes secret
130-
spec:
131-
itemPath: "vaults/<vault_id_or_title>/items/<item_id_or_title>"
132-
```
133-
134-
Deploy the OnePasswordItem to Kubernetes:
135-
136-
```bash
137-
kubectl apply -f <your_item>.yaml
138-
```
139-
140-
To test that the Kubernetes Secret check that the following command returns a secret:
141-
142-
```bash
143-
kubectl get secret <secret_name>
144-
```
145-
146-
**Note:** Deleting the `OnePasswordItem` that you've created will automatically delete the created Kubernetes Secret.
100+
---
147101

148-
To create a single Kubernetes Secret for a deployment, add the following annotations to the deployment metadata:
102+
## Usage examples
103+
Find usage [examples](https://developer.1password.com/docs/k8s/operator/?deployment-type=manual#usage-examples) on 1Password developer documentation.
149104

150-
```yaml
151-
apiVersion: apps/v1
152-
kind: Deployment
153-
metadata:
154-
name: deployment-example
155-
annotations:
156-
operator.1password.io/item-path: "vaults/<vault_id_or_title>/items/<item_id_or_title>"
157-
operator.1password.io/item-name: "<secret_name>"
158-
```
105+
---
159106

160-
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.
107+
## How 1Password Items Map to Kubernetes Secrets
161108

162109
The contents of the Kubernetes secret will be key-value pairs in which the keys are the fields of the 1Password item and the values are the corresponding values stored in 1Password.
163110
In case of fields that store files, the file's contents will be used as the value.
164111

165112
Within an item, if both a field storing a file and a field of another type have the same name, the file field will be ignored and the other field will take precedence.
166113

167-
**Note:** Deleting the Deployment that you've created will automatically delete the created Kubernetes Secret only if the deployment is still annotated with `operator.1password.io/item-path` and `operator.1password.io/item-name` and no other deployment is using the secret.
114+
Deleting the Deployment that you've created will automatically delete the created Kubernetes Secret only if the deployment is still annotated with `operator.1password.io/item-path` and `operator.1password.io/item-name` and no other deployment is using the secret.
168115

169116
If a 1Password Item that is linked to a Kubernetes Secret is updated within the POLLING_INTERVAL the associated Kubernetes Secret will be updated. However, if you do not want a specific secret to be updated you can add the tag `operator.1password.io:ignore-secret` to the item stored in 1Password. While this tag is in place, any updates made to an item will not trigger an update to the associated secret in Kubernetes.
170117

171-
---
172-
173-
**NOTE**
174118

175119
If multiple 1Password vaults/items have the same `title` when using a title in the access path, the desired action will be performed on the oldest vault/item.
176120

@@ -237,6 +181,8 @@ metadata:
237181

238182
If the value is not set, the auto restart settings on the deployment will be used.
239183

184+
---
185+
240186
## Development
241187

242188
### How it works

0 commit comments

Comments
 (0)