From a6fb0b977f7f2339fd9b7d1f44367abb5c414ed3 Mon Sep 17 00:00:00 2001 From: Alex Jones Date: Mon, 24 Apr 2023 14:14:42 +0200 Subject: [PATCH] feat: created chart Signed-off-by: Alex Jones --- .gitignore | 2 +- .helmignore | 23 +++++++++ Makefile | 29 ++++++++--- README.md | 20 ++------ charts/k8sgpt-operator-v0.0.1.tgz | Bin 0 -> 2528 bytes config/manager/kustomization.yaml | 6 +++ hack/get-os.sh | 28 ++++++++++ index.yaml | 14 +++++ values.yaml | 82 ++++++++++++++++++++++++++++++ 9 files changed, 181 insertions(+), 23 deletions(-) create mode 100644 .helmignore create mode 100644 charts/k8sgpt-operator-v0.0.1.tgz create mode 100755 hack/get-os.sh create mode 100644 index.yaml create mode 100644 values.yaml diff --git a/.gitignore b/.gitignore index 40b1504b..d799f29c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ k8sgpt-operator bin testbin/* Dockerfile.cross - +config/rendered # Test binary, build with `go test -c` *.test diff --git a/.helmignore b/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/Makefile b/Makefile index ae7e8648..76a36cab 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ IMG ?= ghcr.io/k8sgpt-ai/k8sgpt:latest # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.26.0 - +CHART_VERSION=v0.0.1# x-release-please-version # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) GOBIN=$(shell go env GOPATH)/bin @@ -73,11 +73,8 @@ run: manifests generate fmt vet ## Run a controller from your host. # More info: https://docs.docker.com/develop/develop-images/build_enhancements/ .PHONY: docker-build docker-build: test ## Build docker image with the manager. - docker build -t ${IMG} . - -.PHONY: docker-push -docker-push: ## Push docker image with the manager. - docker push ${IMG} + @echo "===========> Building docker image" + docker buildx build --build-arg=VERSION="$$(git describe --tags --abbrev=0)" --build-arg=COMMIT="$$(git rev-parse --short HEAD)" --build-arg DATE="$$(date +%FT%TZ)" --platform="linux/amd64,linux/arm64" -t ${IMG} -f container/Dockerfile . --push # PLATFORMS defines the target platforms for the manager image be build to provide support to multiple # architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to: @@ -119,6 +116,26 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. $(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f - +OSARCH=$(shell ./hack/get-os.sh) +HELM = $(shell pwd)/bin/$(OSARCH)/helm +HELM_INSTALLER ?= "https://get.helm.sh/helm-v3.10.1-$(OSARCH).tar.gz" +.PHONY: helm +helm: $(HELM) ## Download helm locally if necessary. +$(HELM): $(LOCALBIN) + [ -e "$(HELM)" ] && rm -rf "$(HELM)" || true + cd $(LOCALBIN) && curl -s $(HELM_INSTALLER) | tar -xzf - -C $(LOCALBIN) + +.PHONY: release-manifests +release-manifests: manifests kustomize + cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) && cd ../../ + mkdir -p chart/k8sgpt-operator/templates/ + $(KUSTOMIZE) build config/default > chart/k8sgpt-operator/templates/rendered.yaml + +helm-package: generate release-manifests helm + $(HELM) package --version $(CHART_VERSION) chart/k8sgpt-operator + mkdir -p charts && mv k8sgpt-operator-*.tgz charts + $(HELM) repo index --url https://charts.k8sgpt.ai/charts charts + mv charts/index.yaml index.yaml ##@ Build Dependencies ## Location to install dependencies to diff --git a/README.md b/README.md index 33df2136..9dd8413b 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,9 @@ UnDeploy the controller from the cluster: make undeploy ``` +
+ Contributing + ## Contributing // TODO(user): Add detailed information on how you would like others to contribute to this project @@ -90,19 +93,4 @@ make manifests More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html) -## License - -Copyright 2023 K8sGPT Contributors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - +
diff --git a/charts/k8sgpt-operator-v0.0.1.tgz b/charts/k8sgpt-operator-v0.0.1.tgz new file mode 100644 index 0000000000000000000000000000000000000000..fd74e2663f2c3fa1f00199b5044b4be76184ac57 GIT binary patch literal 2528 zcmV<62_NDc zVQyr3R8em|NM&qo0PI^!bKAQ0&sv`Xlm8-{KPA#u9G5d$xVD>m;+yNS-MfdtBMCJK zum_-GrPJ@;0YFlGiIyEXPI`?jEP}wndHl|U0CIP%7nuoE21t#<$?1}!8Lw$7-t4V~ zVHh4wr|xeUhV8%ML3sEknobX*>CuPi!_k{CnjXB5-jHyAENpMNHWc54-@R5_xL>5v zjQ;_sxsowi9gJv}Rgcj)IvR(g1T;gQ8P|70{thA~%%X(M6_U^S3{ZjrJ(4tqn6v;j zGV2UtLbFV8MlF%is#-4`hvR7U(kl2QqNHakV=m~;M03rGQU@+|ehtbi8gO>k) z2&3t%|Nn^A@c(FZ$7K?eFEj<6Q3j(F3{9w^@rV#XXCSowMXW!M?<&_Hb2VWq&6EUb zVv?}v{!tl4 z6R3GVpG--EN(7mp65{ev00tZRdqZMSND&0VsIGpRakw`i?UNqg9Xl2(o18j{u0g9D z8JxkKOYXvH-9%JMWn7dk>{R1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`R~{C#dsd$5O(;8qOsI7VPu=)@ zzB`Z4xc8ZCgnnUUJqk$(?lQTKNz}nXYCrTZYgXHh&+^)HL8NsS*|`&8o7EIEqNT9} z<}??^iAcEwY(k@ns9m{h9(dBZySP!ilOt6EC!OBSNy=G{TrO_d5|UhSxwu$JRdt`= z1Itb4DuJbWQ>gY9uzji+cuk+*X9!w1HB*kbgSC&t8}(3hdo#^e+Bqf{?F&n!xD(Jl zJ_-m;lcQ;0Kc>C?S;mg00(#!)!@q?0yRfhHzL*zW=Jz##I;>P9tq_aaynqCO29_fP zf@=dZph;pC|1li9e{mH&%i(#Z4FXL++ISgHCegtMH#CZm!{cz$7%SAmC~Xoz{8$|$ zl`mHx!|Iu*?x<W)RqV zvqG4~OVk)!RsoG+O?)-sRr{o_#l1A8^~3RiOq!8$1Gi;?H=hb3Qx+Sz4&VSvU?>& q+*K7!i?h5>NEuvpjP=t0bLh3bw%7KnxBmtJ0RR7#g(&s_J^%n}0?@bs literal 0 HcmV?d00001 diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 5c5f0b84..3d0276c1 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -1,2 +1,8 @@ resources: - manager.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +images: +- name: controller + newName: ghcr.io/k8sgpt-ai/k8sgpt + newTag: latest diff --git a/hack/get-os.sh b/hack/get-os.sh new file mode 100755 index 00000000..2d1ef81a --- /dev/null +++ b/hack/get-os.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# initArch discovers the architecture for this system. +initArch() { + ARCH=$(uname -m) + case $ARCH in + armv5*) ARCH="armv5";; + armv6*) ARCH="armv6";; + armv7*) ARCH="arm";; + aarch64) ARCH="arm64";; + x86) ARCH="386";; + x86_64) ARCH="amd64";; + i686) ARCH="386";; + i386) ARCH="386";; + esac +} + +# initOS discovers the operating system for this system. +initOS() { + OS=$(echo `uname`|tr '[:upper:]' '[:lower:]') + + case "$OS" in + # Minimalist GNU for Windows + mingw*|cygwin*) OS='windows';; + esac +} +initArch +initOS +echo "${OS}-${ARCH}" diff --git a/index.yaml b/index.yaml new file mode 100644 index 00000000..95afbb9e --- /dev/null +++ b/index.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +entries: + k8sgpt-operator: + - apiVersion: v2 + appVersion: 1.16.0 + created: "2023-04-24T13:56:45.649926+02:00" + description: A Helm chart for Kubernetes + digest: 7ac79873d450f5edb6a60b280940159a83ff4e9195afac86a9866fe61960cc3c + name: k8sgpt-operator + type: application + urls: + - https://k8sgpt-ai.github.io/k8sgpt-operator/charts/k8sgpt-operator-v0.0.1.tgz + version: v0.0.1 +generated: "2023-04-24T13:56:45.649593+02:00" diff --git a/values.yaml b/values.yaml new file mode 100644 index 00000000..e498bb7a --- /dev/null +++ b/values.yaml @@ -0,0 +1,82 @@ +# Default values for k8sgpt-operator. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {}