Skip to content

Commit

Permalink
chore: rename to ezdeploy
Browse files Browse the repository at this point in the history
  • Loading branch information
yankeguo committed Aug 16, 2024
1 parent 6df83f9 commit 3676680
Show file tree
Hide file tree
Showing 25 changed files with 146 additions and 132 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"cSpell.words": [
"ezdeploy",
"jsonnet",
"kubeconfig"
]
}
24 changes: 12 additions & 12 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand All @@ -60,7 +60,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
hi@guoyk.xyz.
hi@yankeguo.com.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.22 AS builder
ENV CGO_ENABLED 0
WORKDIR /go/src/app
ADD . .
RUN go build -o /ezops ./cmd/ezops
RUN go build -o /ezdeploy ./cmd/ezdeploy

FROM alpine:3.19

Expand All @@ -15,8 +15,8 @@ RUN apk add --no-cache ca-certificates tzdata curl && \
mv helm/helm /usr/local/bin/helm && \
rm -rf helm.tar.gz helm

COPY --from=builder /ezops /usr/local/bin/ezops
COPY --from=builder /ezdeploy /usr/local/bin/ezdeploy

ENTRYPOINT ["ezops"]
ENTRYPOINT ["ezdeploy"]

WORKDIR /data
24 changes: 9 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# ezops
# ezdeploy

[![Go Reference](https://pkg.go.dev/badge/github.com/yankeguo/ezops.svg)](https://pkg.go.dev/github.com/yankeguo/ezops)

A simple GitOps tool, based on one-off run, easy to integrate with existing CI/CD routine
A simple tool to deploy various Kubernetes resources

NO DAEMON, NO SERVICE, JUST ONE-OFF EXECUTION

## 中文使用说明

[ezops - 简易 GitOps 工具](https://mp.weixin.qq.com/s/TI2ZozyA5xWltTEwIF46ag)

## Features

- Support `yaml`, `json`, `jsonnet` and `Helm`
Expand All @@ -22,20 +16,20 @@ You can either build binary from source, or just download pre-built binary.
- Build from source

```shell
git clone https://github.com/yankeguo/ezops.git
cd ezops
go build -o ezops ./cmd/ezops
git clone https://github.com/yankeguo/ezdeploy.git
cd ezdeploy
go build -o ezdeploy ./cmd/ezdeploy
```

- Download pre-built binaries

View <https://github.com/yankeguo/ezops/releases>
View <https://github.com/yankeguo/ezdeploy/releases>

## Usage

1. Ensure `kubectl` and `helm` are available in `$PATH`
2. Prepare a **manifests directory**, see below
3. Run `ezops`
3. Run `ezdeploy`

## Options

Expand Down Expand Up @@ -79,10 +73,10 @@ kube-system/
main.ingress-nginx.helm.yaml
```

`ezops` will create or update a **release** named `main`, using **chart** `_helm/ingress-nginx`, and **values file**
`ezdeploy` will create or update a **release** named `main`, using **chart** `_helm/ingress-nginx`, and **values file**
`kube-system/primary.ingress-nginx.helm.yaml`

`ezops` also support `Helm` values file in `JSONNet`
`ezdeploy` also support values file in `jsonnet`

## Credits

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

## Reporting a Vulnerability

Send an encrypted mail to hi@guoyk.xyz, with [this GPG public key](https://guoyk.xyz/gpg/133641b2.asc.txt)
Send an encrypted mail to hi@yankeguo.com, with [this GPG public key](https://keys.openpgp.org/search?q=hi%40yankeguo.com)
2 changes: 1 addition & 1 deletion checksum.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ezops
package ezdeploy

import (
"crypto/md5"
Expand Down
2 changes: 1 addition & 1 deletion checksum_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ezops
package ezdeploy

import (
"crypto/md5"
Expand Down
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ezops
package ezdeploy

import (
"encoding/base64"
Expand Down Expand Up @@ -81,7 +81,7 @@ func ResolveKubernetesClient(optKubeconfig string) (source KubernetesClientSourc
if buf, err = base64.StdEncoding.DecodeString(envKubeconfigBase64); err != nil {
return
}
if source.TemporaryDir, err = os.MkdirTemp("", "ezops-kubeconfig-*"); err != nil {
if source.TemporaryDir, err = os.MkdirTemp("", "ezdeploy-kubeconfig-*"); err != nil {
return
}
source.KubeconfigPath = filepath.Join(source.TemporaryDir, "kubeconfig")
Expand Down
2 changes: 1 addition & 1 deletion client_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ezops
package ezdeploy

import (
"encoding/base64"
Expand Down
32 changes: 16 additions & 16 deletions cmd/ezops/main.go → cmd/ezdeploy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
"os/exec"
"strings"

"github.com/yankeguo/ezops"
"github.com/yankeguo/ezops/pkg/ezkv"
"github.com/yankeguo/ezops/pkg/ezlog"
"github.com/yankeguo/ezops/pkg/ezsync"
"github.com/yankeguo/ezops/pkg/eztmp"
"github.com/yankeguo/ezdeploy"
"github.com/yankeguo/ezdeploy/pkg/ezkv"
"github.com/yankeguo/ezdeploy/pkg/ezlog"
"github.com/yankeguo/ezdeploy/pkg/ezsync"
"github.com/yankeguo/ezdeploy/pkg/eztmp"
"github.com/yankeguo/rg"
)

Expand All @@ -23,7 +23,7 @@ type syncNamespaceOptions struct {
Kubeconfig string
Root string
Namespace string
Charts map[string]ezops.Chart
Charts map[string]ezdeploy.Chart
DryRun bool
}

Expand All @@ -33,7 +33,7 @@ func syncNamespace(ctx context.Context, opts syncNamespaceOptions) (err error) {
title := "[" + opts.Namespace + "]"
log.Println(title, "scanning")

res := rg.Must(ezops.Load(opts.Root, opts.Namespace, ezops.LoadOptions{Charts: opts.Charts}))
res := rg.Must(ezdeploy.Load(opts.Root, opts.Namespace, ezdeploy.LoadOptions{Charts: opts.Charts}))

rg.Must0(syncResources(ctx, syncResourcesOptions{
DB: opts.DB,
Expand Down Expand Up @@ -69,7 +69,7 @@ func syncNamespace(ctx context.Context, opts syncNamespaceOptions) (err error) {

type syncResourcesOptions struct {
DB *ezkv.Database
Resources []ezops.Resource
Resources []ezdeploy.Resource
Title string
Namespace string
Kubeconfig string
Expand All @@ -79,7 +79,7 @@ type syncResourcesOptions struct {
func syncResources(ctx context.Context, opts syncResourcesOptions) (err error) {
defer rg.Guard(&err)

var resources []ezops.Resource
var resources []ezdeploy.Resource

for _, res := range opts.Resources {
if opts.DB.Get(res.ID) == res.Checksum {
Expand All @@ -97,7 +97,7 @@ func syncResources(ctx context.Context, opts syncResourcesOptions) (err error) {
raws = append(raws, res.Raw)
}

buf := rg.Must(json.Marshal(ezops.NewList(raws)))
buf := rg.Must(json.Marshal(ezdeploy.NewList(raws)))

args := []string{"apply", "-f", "-"}

Expand Down Expand Up @@ -136,7 +136,7 @@ func syncResources(ctx context.Context, opts syncResourcesOptions) (err error) {

type syncReleaseOptions struct {
DB *ezkv.Database
Release ezops.Release
Release ezdeploy.Release
Title string
Namespace string
Kubeconfig string
Expand All @@ -153,8 +153,8 @@ func syncRelease(ctx context.Context, opts syncReleaseOptions) (err error) {
valuesFile := opts.Release.ValuesFile

// convert jsonnet file to yaml file
if strings.HasSuffix(opts.Release.ValuesFile, ezops.SuffixHelmValuesJSONNet) {
if valuesFile, err = ezops.ConvertJSONNetFileToYAML(valuesFile, opts.Namespace); err != nil {
if strings.HasSuffix(opts.Release.ValuesFile, ezdeploy.SuffixHelmValuesJSONNet) {
if valuesFile, err = ezdeploy.ConvertJSONNetFileToYAML(valuesFile, opts.Namespace); err != nil {
return
}
}
Expand Down Expand Up @@ -218,7 +218,7 @@ func main() {
ctx := context.Background()

// kubernetes client source
cs := rg.Must(ezops.ResolveKubernetesClient(optKubeconfig))
cs := rg.Must(ezdeploy.ResolveKubernetesClient(optKubeconfig))
defer cs.CleanUp()

if cs.InCluster {
Expand All @@ -234,14 +234,14 @@ func main() {
db := rg.Must(ezkv.Open(ctx, ezkv.Options{
Client: client,
Namespace: "default",
Name: "ezopsdb",
Name: "ezdeploydb",
}))
defer func() {
_ = db.Save(ctx)
}()

// scan
result := rg.Must(ezops.Scan("."))
result := rg.Must(ezdeploy.Scan("."))

// sync namespaces
err = ezsync.DoPara(ctx, result.Namespaces, 5, func(ctx context.Context, namespace string) (err error) {
Expand Down
2 changes: 1 addition & 1 deletion collect_helm.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ezops
package ezdeploy

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion collect_resource.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ezops
package ezdeploy

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cd "$(dirname "${0}")"

rm -rf dist && mkdir dist

EXECUTABLE_NAME="ezops"
EXECUTABLE_NAME="ezdeploy"

build() {
rm -rf build && mkdir build
Expand Down
45 changes: 25 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
module github.com/yankeguo/ezops
module github.com/yankeguo/ezdeploy

go 1.21
go 1.22.0

toolchain go1.22.4

retract v1.0.0

require (
github.com/google/go-jsonnet v0.20.0
github.com/karrick/godirwalk v1.17.0
github.com/stretchr/testify v1.9.0
github.com/yankeguo/rg v1.1.0
github.com/yankeguo/rg v1.3.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.29.3
k8s.io/apimachinery v0.29.3
k8s.io/client-go v0.29.3
k8s.io/api v0.31.0
k8s.io/apimachinery v0.31.0
k8s.io/client-go v0.31.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
Expand All @@ -34,20 +38,21 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/oauth2 v0.19.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.6.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240403164606-bc84c2ddaf99 // indirect
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240812233141-91dab695df6f // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
Expand Down
Loading

0 comments on commit 3676680

Please sign in to comment.