Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate operator to the latest operator-sdk #124

Merged
merged 52 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
1aa1a3f
Clear repo
edif2008 Sep 13, 2022
a0460ce
Initialize operator project
edif2008 Sep 13, 2022
a3de05f
Create OnePasswordItem API and controller
edif2008 Sep 13, 2022
20b7a2c
Implement API and generate manifests
edif2008 Sep 13, 2022
96b7879
Implement the OnePasswordItem Controller
edif2008 Sep 13, 2022
622fcd6
Add packages
edif2008 Sep 13, 2022
be7b63c
Update Connect mock client to reflect the latest version of Connect c…
edif2008 Sep 13, 2022
e276ca1
Clean test code
edif2008 Sep 13, 2022
250785f
Migrate Deployment Controller
edif2008 Sep 13, 2022
946e986
Migrate main.go
edif2008 Sep 13, 2022
28c3ffa
Add yaml files for deploying Connect
edif2008 Sep 13, 2022
75501e5
Add missing packages
edif2008 Sep 13, 2022
f1da40a
Migrate yaml files.
edif2008 Sep 13, 2022
e8c3804
Update license in README
edif2008 Sep 13, 2022
23b66f7
Update Dockerfile and Makefile
edif2008 Sep 13, 2022
1d75f78
Update packages and add vendor directory
edif2008 Sep 13, 2022
5e496d2
Upgrade to GinkGo v2
edif2008 Sep 13, 2022
87ff93d
Add some tests for both the API Resource Controller and the Deploymen…
edif2008 Sep 13, 2022
e582d33
Migrate remaining files from the old version of the repo
edif2008 Sep 13, 2022
c3094db
Migrate README
edif2008 Sep 13, 2022
91eb658
Add TODOs for missing tests that need to be migrated
edif2008 Sep 13, 2022
108cdac
add "Should not update K8s secret testcase"
volodymyrZotov Sep 15, 2022
11b1eae
cover onepassworditem_controller with tests
volodymyrZotov Sep 19, 2022
256b1e0
added tests for deployment_controller
volodymyrZotov Sep 21, 2022
1a8bd75
refactor tests
volodymyrZotov Sep 21, 2022
16d2101
use current kubectl namespace to deploy operator
volodymyrZotov Oct 19, 2022
916015c
use controller image name to build the manager
volodymyrZotov Oct 19, 2022
c4fdcc6
update README.md
volodymyrZotov Oct 19, 2022
c802233
improve README.md
volodymyrZotov Oct 19, 2022
20f81f5
update tests
volodymyrZotov Oct 20, 2022
2712e9c
Use custom image name for the manager controller
volodymyrZotov Oct 24, 2022
47922b0
Merge pull request #133 from 1Password/migrate-operator-updates
volodymyrZotov Oct 24, 2022
1d1d824
Adjust context
edif2008 Oct 24, 2022
d8bfa31
Adjust code
edif2008 Oct 24, 2022
a132741
Merge pull request #126 from 1Password/feature/controllers_tests
volodymyrZotov Oct 24, 2022
d75b029
Update operator based on latest operator-sdk
edif2008 Oct 24, 2022
c6c03ca
Adjust README
edif2008 Oct 24, 2022
fc1044a
Remove namespace resource
edif2008 Oct 24, 2022
5ced1c4
Merge pull request #135 from 1Password/eddy/update-operator-sdk-version
edif2008 Oct 24, 2022
ef40618
Update actions versions
edif2008 Oct 24, 2022
be3fdaa
Merge pull request #136 from 1Password/eddy/update-pipelines
edif2008 Oct 24, 2022
c72174f
Add license
edif2008 Oct 24, 2022
245ec1b
Adjust syntax based on latest action version
edif2008 Oct 25, 2022
30a1c13
generate random version each time calling mock onepassword item
volodymyrZotov Oct 25, 2022
cc26230
Merge pull request #137 from 1Password/eddy/fix-pipeline
edif2008 Oct 25, 2022
d99abbd
use unique onepassword name in each spec
volodymyrZotov Oct 26, 2022
710de1b
Adjust OnePasswordItem test resource names
edif2008 Oct 26, 2022
24ac4fd
Merge pull request #138 from 1Password/fix/version-generation-in-tests
volodymyrZotov Oct 26, 2022
67330ce
change default controller name
volodymyrZotov Oct 31, 2022
b05c066
changed label
volodymyrZotov Oct 31, 2022
cb48c9c
remove imagePullPolicy from manager.yaml
volodymyrZotov Oct 31, 2022
08baab7
Merge pull request #139 from 1Password/feature/migrate-operator-renam…
volodymyrZotov Nov 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
testbin/
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ^1.15
go-version: ^1.19

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./... -cover
run: make test
9 changes: 5 additions & 4 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ jobs:
outputs:
result: ${{ steps.is_release_branch_without_pr.outputs.result }}
steps:
- id: is_release_branch_without_pr
-
id: is_release_branch_without_pr
name: Find matching PR
uses: actions/github-script@v3
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand All @@ -27,7 +28,7 @@ jobs:

if(!releaseBranchName) { return false }

const {data: prs} = await github.pulls.list({
const {data: prs} = await github.rest.pulls.list({
...context.repo,
state: 'open',
head: `1Password:${releaseBranchName}`,
Expand All @@ -42,7 +43,7 @@ jobs:
name: Create Release Pull Request
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Parse release version
id: get_version
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ jobs:
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
-
name: Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Docker meta

- name: Docker meta
id: meta
uses: crazy-max/ghaction-docker-meta@v2
uses: docker/metadata-action@v4
with:
images: |
1password/onepassword-operator
Expand All @@ -28,24 +27,25 @@ jobs:
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
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Docker Login
uses: docker/login-action@v1

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
Expand Down
87 changes: 16 additions & 71 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,80 +1,25 @@
# Temporary Build Files
build/_output
build/_test
# Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
projectile-bookmarks.eld
# directory configuration
.dir-locals.el
# saveplace
places
# url cache
url/cache/
# cedet
ede-projects.el
# smex
smex-items
# company-statistics
company-statistics-cache.el
# anaconda-mode
anaconda-mode/
### Go ###

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, build with 'go test -c'
bin
testbin/*

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
### Vim ###
# swap
.sw[a-p]
.*.sw[a-p]
# session
Session.vim
# temporary
.netrwhist
# auto-generated tag files
tags
### VisualStudioCode ###
.vscode/*
.history
.DS_Store
op-ss-client/
.idea/
# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode

# Kubernetes Generated files - skip generated files, except for vendored files

!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
*.swp
*.swo
*~
23 changes: 17 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
# Build the manager binary
FROM golang:1.13 as builder
FROM golang:1.19 as builder
ARG TARGETOS
ARG TARGETARCH

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY cmd/manager/main.go main.go
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY pkg/ pkg/
COPY version/ version/
COPY vendor/ vendor/

# Build
ARG operator_version=dev
# the GOARCH has not a default value to allow the binary be built according to the host where the command
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 \
GO111MODULE=on \
GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} \
go build \
-ldflags "-X \"github.com/1Password/onepassword-operator/version.Version=$operator_version\"" \
-mod vendor \
Expand All @@ -25,7 +36,7 @@ RUN CGO_ENABLED=0 \
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
USER nonroot:nonroot
COPY deploy/connect/ deploy/connect/
USER 65532:65532
COPY config/connect/ config/connect/

ENTRYPOINT ["/manager"]
Loading