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

Feat/switch to operator toolkit #1

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
workflow_dispatch:
inputs:
image_tag:
type: string
description: "image_tag"
required: true
default: ""

push:

permissions:
contents: read
packages: write

jobs:
build-image:
runs-on: ubuntu-latest
name: plugin/helm-charts image
steps:
- uses: actions/checkout@v4

- uses: kloudlite/actions/setup-cache-go@v1
with:
cache_key: "run-${{ matrix.platform }}-${{ matrix.arch }}"
working_directory: .

- uses: kloudlite/actions/generate-image-tag@v1

- uses: kloudlite/actions/setup-nix-cachix@v1
with:
flake_lock: "./flake.lock"
nix_develop_arguments: ".#default"
cachix_cache_name: ${{ secrets.CACHIX_CACHE_NAME }}
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}

- uses: kloudlite/actions/setup-docker@v1
with:
docker_registry: "ghcr.io"
docker_username: ${{ github.actor }}
docker_password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Binary
shell: bash
env:
IMAGE: "ghcr.io/${{ github.repository }}:$IMAGE_TAG"
run: |+
run build image=$IMAGE
7 changes: 4 additions & 3 deletions Runfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ tasks:
env:
CGO_ENABLED: 0
GOARCH:
required: true
default:
sh: "go env GOARCH"
cmd:
- go build -ldflags='-s -w' -o ./bin/plugin-helm-controller-$GOARCH ./cmd

Expand All @@ -69,8 +70,8 @@ tasks:
image:
required: true
cmd:
- GOARCH=amd64 run2 go:build || echo "hi"
- GOARCH=arm64 run2 go:build || echo "hello"
- GOARCH=amd64 run go:build || echo "hi"
- GOARCH=arm64 run go:build || echo "hello"
- docker buildx build -t "$image" --output=type=image,compression=zstd,force-compression=true,compression-level=12,push=true --platform linux/amd64,linux/arm64 --build-arg BINARY=./bin/plugin-helm-controller .


10 changes: 5 additions & 5 deletions api/v1/helmchart_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ limitations under the License.
package v1

import (
ct "github.com/kloudlite/operator/apis/common-types"
rApi "github.com/kloudlite/operator/pkg/operator"
"github.com/kloudlite/operator/pkg/plugin"
"github.com/kloudlite/operator/toolkit/plugin"
rApi "github.com/kloudlite/operator/toolkit/reconciler"
types "github.com/kloudlite/operator/toolkit/types"
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -36,7 +36,7 @@ type HelmJobVars struct {
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`

Resources ct.Resources `json:"resources"`
Resource types.Resource `json:"resource"`
}

// HelmChartSpec defines the desired state of HelmChart.
Expand Down Expand Up @@ -73,7 +73,7 @@ type HelmChart struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec HelmChartSpec `json:"spec,omitempty"`
Spec HelmChartSpec `json:"spec,omitempty"`

Export plugin.Export `json:"export,omitempty"`
Status HelmChartStatus `json:"status,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ spec:
additionalProperties:
type: string
type: object
resources:
resource:
properties:
cpu:
properties:
Expand All @@ -1036,19 +1036,6 @@ spec:
- max
- min
type: object
storage:
properties:
size:
pattern: '[\d]+(M|G)i$'
type: string
storageClass:
type: string
required:
- size
type: object
required:
- cpu
- memory
type: object
tolerations:
items:
Expand Down Expand Up @@ -1089,7 +1076,7 @@ spec:
type: object
type: array
required:
- resources
- resource
type: object
postInstall:
type: string
Expand Down Expand Up @@ -1157,9 +1144,6 @@ spec:
lastReconcileTime:
format: date-time
type: string
message:
type: object
x-kubernetes-preserve-unknown-fields: true
releaseNotes:
type: string
releaseStatus:
Expand Down
4 changes: 4 additions & 0 deletions constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ package constants
const (
ProjectDomain string = "plugin-helm-charts.kloudlite.github.com"
)

const (
ForceReconcile string = "plugin-helm-chart.kloudlite.github.com/force-reconcile"
)
4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
name = "run";
pname = "run";
src = fetchurl {
url = "https://github.com/nxtcoder17/Runfile/releases/download/nightly/run-linux-amd64";
sha256 = "sha256-H6On0hZrPjm679mSb2gdcj++aQjLPo9Z7F1m/PDsBTo=";
url = "https://github.com/nxtcoder17/Runfile/releases/download/v1.1.2/run-linux-amd64";
sha256 = "sha256-vAnENb2BhIKHSkx19pTytlv03RIOzUxoxn2nRrk6Zd8=";
};
unpackPhase = ":";
buildInputs = [ curl ];
Expand Down
25 changes: 11 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ go 1.23.0

require (
github.com/codingconcepts/env v0.0.0-20200821220118-a8fbf8d84482
github.com/kloudlite/operator v1.1.1
github.com/kloudlite/operator/toolkit v0.0.0-20241213022814-9012d5473c3d
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/valyala/fasttemplate v1.2.2
k8s.io/api v0.31.0
k8s.io/api v0.31.3
k8s.io/apiextensions-apiserver v0.31.0
k8s.io/apimachinery v0.31.0
k8s.io/apimachinery v0.31.3
k8s.io/client-go v0.31.0
sigs.k8s.io/controller-runtime v0.19.0
sigs.k8s.io/controller-runtime v0.19.2
sigs.k8s.io/yaml v1.4.0
)

Expand All @@ -27,12 +26,13 @@ require (
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charmbracelet/lipgloss v0.10.0 // indirect
github.com/charmbracelet/lipgloss v1.0.0 // indirect
github.com/charmbracelet/log v0.4.0 // indirect
github.com/charmbracelet/x/ansi v0.4.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
Expand Down Expand Up @@ -60,6 +60,7 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kloudlite/operator v1.1.2-0.20241202071018-cd50cb6011cd // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matoous/go-nanoid/v2 v2.0.0 // indirect
Expand All @@ -70,7 +71,6 @@ require (
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand All @@ -84,7 +84,6 @@ require (
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/yext/yerrors v0.0.0-20230716030415-7ebf68e23868 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
Expand All @@ -96,18 +95,18 @@ require (
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
Expand All @@ -125,5 +124,3 @@ require (
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)

// replace github.com/kloudlite/operator => /home/nxtcoder17/workspace/kloudlite/operator
Loading
Loading