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

Vec 210 acl #3

Merged
merged 26 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/create-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ on:

push:
branches:
- "VEC-189-tls" # remove before merge into main
- "VEC-210-acl" # remove before merge into main
jobs:
build-and-release:
runs-on: macos-13
steps:
- name: "Git checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Install Homebrew"
run: /bin/bash -c "NONINTERACTIVE=1 $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: "Install Dependencies"
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ jobs:
FEATURES_CONF : ${{secrets.FEATURES_CONF}}

run: |
echo "$FEATURES_CONF" > docker/config/features.conf
echo "$FEATURES_CONF" > docker/vanilla/config/features.conf
echo "$FEATURES_CONF" > docker/tls/config/features.conf
echo "$FEATURES_CONF" > docker/mtls/config/features.conf
echo "$FEATURES_CONF" > docker/auth/config/features.conf
- name: Run tests
run: |
make coverage
Expand Down
25 changes: 13 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ clean:
OS := $(shell uname -o)
CPU := $(shell uname -m)
ver:=$(shell V=$$(git branch --show-current); if [[ $$V == v* ]]; then printf $${V:1} > ./VERSION.md; fi; cat ./VERSION.md)
# GO_LDFLAGS="-X 'asvec/cmd.Version=$(ver)' -s -w"
dwelch-spike marked this conversation as resolved.
Show resolved Hide resolved
define _amddebscript
ver=$(cat ./VERSION.md)
cat <<EOF > ./bin/deb/DEBIAN/control
Expand Down Expand Up @@ -241,68 +242,68 @@ prep:

.PHONY: compile_linux_wip_amd64
compile_linux_wip_amd64:
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o asvec-linux-amd64-wip
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-linux-amd64-wip
ifneq (, $(shell which upx))
upx asvec-linux-amd64-wip
endif

.PHONY: compile_linux_wip_arm64
compile_linux_wip_arm64:
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o asvec-linux-arm64-wip
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-linux-arm64-wip
ifneq (, $(shell which upx))
upx asvec-linux-arm64-wip
endif

.PHONY: compile_linux_amd64
compile_linux_amd64:
printf "package main\n\nimport _ \"embed\"\n\nvar nLinuxBinaryX64 []byte\n\n//go:embed asvec-linux-arm64-wip\nvar nLinuxBinaryArm64 []byte\n" > embed_linux.go
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o asvec-linux-amd64
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-linux-amd64
mv asvec-linux-amd64 $(BIN_DIR)/

.PHONY: compile_linux_arm64
compile_linux_arm64:
printf "package main\n\nimport _ \"embed\"\n\n//go:embed asvec-linux-amd64-wip\nvar nLinuxBinaryX64 []byte\n\nvar nLinuxBinaryArm64 []byte\n" > embed_linux.go
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o asvec-linux-arm64
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-linux-arm64
mv asvec-linux-arm64 $(BIN_DIR)/

.PHONY: compile_darwin
compile_darwin:
printf "package main\n\nimport _ \"embed\"\n\n//go:embed asvec-linux-amd64-wip\nvar nLinuxBinaryX64 []byte\n\n//go:embed asvec-linux-arm64-wip\nvar nLinuxBinaryArm64 []byte" > embed_darwin.go
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o asvec-macos-amd64
env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o asvec-macos-arm64
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-macos-amd64
env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-macos-arm64
mv asvec-macos-amd64 $(BIN_DIR)/
mv asvec-macos-arm64 $(BIN_DIR)/

.PHONY: compile_darwin_amd64
compile_darwin_amd64:
printf "package main\n\nimport _ \"embed\"\n\n//go:embed asvec-linux-amd64-wip\nvar nLinuxBinaryX64 []byte\n\n//go:embed asvec-linux-arm64-wip\nvar nLinuxBinaryArm64 []byte" > embed_darwin.go
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o asvec-macos-amd64
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-macos-amd64
mv asvec-macos-amd64 $(BIN_DIR)/

.PHONY: compile_darwin_arm64
compile_darwin_arm64:
printf "package main\n\nimport _ \"embed\"\n\n//go:embed asvec-linux-amd64-wip\nvar nLinuxBinaryX64 []byte\n\n//go:embed asvec-linux-arm64-wip\nvar nLinuxBinaryArm64 []byte" > embed_darwin.go
env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o asvec-macos-arm64
env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-macos-arm64
mv asvec-macos-arm64 $(BIN_DIR)/

.PHONY: compile_windows
compile_windows:
printf "package main\n\nimport _ \"embed\"\n\n//go:embed asvec-linux-amd64-wip\nvar nLinuxBinaryX64 []byte\n\n//go:embed asvec-linux-arm64-wip\nvar nLinuxBinaryArm64 []byte" > embed_windows.go
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o asvec-windows-amd64.exe
env CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o asvec-windows-arm64.exe
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-windows-amd64.exe
env CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-windows-arm64.exe
mv asvec-windows-amd64.exe $(BIN_DIR)/
mv asvec-windows-arm64.exe $(BIN_DIR)/

.PHONY: compile_windows_amd64
compile_windows_amd64:
printf "package main\n\nimport _ \"embed\"\n\n//go:embed asvec-linux-amd64-wip\nvar nLinuxBinaryX64 []byte\n\n//go:embed asvec-linux-arm64-wip\nvar nLinuxBinaryArm64 []byte" > embed_windows.go
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o asvec-windows-amd64.exe
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-windows-amd64.exe
mv asvec-windows-amd64.exe $(BIN_DIR)/

.PHONY: compile_windows_arm64
compile_windows_arm64:
printf "package main\n\nimport _ \"embed\"\n\n//go:embed asvec-linux-amd64-wip\nvar nLinuxBinaryX64 []byte\n\n//go:embed asvec-linux-arm64-wip\nvar nLinuxBinaryArm64 []byte" > embed_windows.go
env CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o asvec-windows-arm64.exe
env CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -trimpath -ldflags=$(GO_LDFLAGS) -o asvec-windows-arm64.exe
mv asvec-windows-arm64.exe $(BIN_DIR)/

.PHONY: official
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ efficiency and productivity for users getting started with vector search.

Ensure you have an AVS instance up and running for `asvec` to connect to.
Checkout out the [AVS documentation](https://aerospike.com/docs/vector) for
options on getting started.
instructions on getting started.

### Installation

Expand Down
5 changes: 5 additions & 0 deletions cmd/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package cmd

const (
HelpTxtSetupEnv = "export ASVEC_HOST=<avs-ip>:5000 ASVEC_USER=<user> ASVEC_PASSWORD=<password>"
)
23 changes: 0 additions & 23 deletions cmd/create.go

This file was deleted.

23 changes: 0 additions & 23 deletions cmd/drop.go

This file was deleted.

118 changes: 0 additions & 118 deletions cmd/dropIndex.go

This file was deleted.

18 changes: 14 additions & 4 deletions cmd/flags/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ package flags
import (
"fmt"
"log/slog"
"time"

commonFlags "github.com/aerospike/tools-common-go/flags"
"github.com/spf13/pflag"
)

//nolint:govet // Padding not a concern for a CLI
type ClientFlags struct {
Host *HostPortFlag
Seeds *SeedsSliceFlag
ListenerName StringOptionalFlag
User StringOptionalFlag
Password commonFlags.PasswordFlag
Timeout time.Duration
TLSFlags
}

Expand All @@ -30,23 +33,30 @@ func (cf *ClientFlags) NewClientFlagSet() *pflag.FlagSet {
flagSet.VarP(cf.Host, Host, "h", commonFlags.DefaultWrapHelpString(fmt.Sprintf("The AVS host to connect to. If cluster discovery is needed use --%s", Seeds))) //nolint:lll // For readability
flagSet.Var(cf.Seeds, Seeds, commonFlags.DefaultWrapHelpString(fmt.Sprintf("The AVS seeds to use for cluster discovery. If no cluster discovery is needed (i.e. load-balancer) then use --%s", Host))) //nolint:lll // For readability
flagSet.VarP(&cf.ListenerName, ListenerName, "l", commonFlags.DefaultWrapHelpString("The listener to ask the AVS server for as configured in the AVS server. Likely required for cloud deployments.")) //nolint:lll // For readability
flagSet.VarP(&cf.User, User, "U", commonFlags.DefaultWrapHelpString("The AVS user to authenticate with.")) //nolint:lll // For readability
flagSet.VarP(&cf.Password, Password, "P", commonFlags.DefaultWrapHelpString("The AVS password for the specified user.")) //nolint:lll // For readability
flagSet.VarP(&cf.User, AuthUser, "U", commonFlags.DefaultWrapHelpString("The AVS user to authenticate with.")) //nolint:lll // For readability
flagSet.VarP(&cf.Password, AuthPassword, "P", commonFlags.DefaultWrapHelpString("The AVS password for the specified user.")) //nolint:lll // For readability
flagSet.DurationVar(&cf.Timeout, Timeout, time.Second*5, commonFlags.DefaultWrapHelpString("The timeout to use for each request to AVS")) //nolint:lll // For readability
flagSet.AddFlagSet(cf.NewTLSFlagSet(commonFlags.DefaultWrapHelpString))

return flagSet
}

func (cf *ClientFlags) NewSLogAttr() []any {
logPass := ""
if cf.Password.String() != "" {
logPass = "*"
}

return []any{slog.String(Host, cf.Host.String()),
slog.String(Seeds, cf.Seeds.String()),
slog.String(ListenerName, cf.ListenerName.String()),
slog.String(User, cf.User.String()),
slog.String(Password, cf.Password.String()),
slog.String(AuthUser, cf.User.String()),
slog.String(AuthPassword, logPass),
slog.Bool(TLSCaFile, cf.TLSRootCAFile != nil),
slog.Bool(TLSCaPath, cf.TLSRootCAPath != nil),
slog.Bool(TLSCertFile, cf.TLSCertFile != nil),
slog.Bool(TLSKeyFile, cf.TLSKeyFile != nil),
slog.Bool(TLSKeyFilePass, cf.TLSKeyFilePass != nil),
slog.Duration(Timeout, cf.Timeout),
}
}
10 changes: 7 additions & 3 deletions cmd/flags/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ const (
Seeds = "seeds"
Host = "host"
ListenerName = "listener-name"
User = "user"
Password = "password"
AuthUser = "user"
AuthPassword = "password"
Name = "name"
NewPassword = "new-password"
Roles = "roles"
Namespace = "namespace"
Sets = "sets"
Yes = "yes"
IndexName = "index-name"
VectorField = "vector-field"
Dimension = "dimension"
Expand All @@ -29,5 +33,5 @@ const (
TLSCaPath = "tls-capath"
TLSCertFile = "tls-certfile"
TLSKeyFile = "tls-keyfile"
TLSKeyFilePass = "tls-keyfile-password"
TLSKeyFilePass = "tls-keyfile-password" //nolint:gosec // Not a credential
)
1 change: 1 addition & 0 deletions cmd/flags/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/spf13/pflag"
)

//nolint:govet // Padding not a concern for a CLI
type TLSFlags struct {
TLSProtocols commonFlags.TLSProtocolsFlag
TLSRootCAFile commonFlags.CertFlag
Expand Down
Loading
Loading