diff --git a/apis/installer/v1alpha1/aceshifter_types.go b/apis/installer/v1alpha1/aceshifter_types.go new file mode 100644 index 000000000..e0de712b6 --- /dev/null +++ b/apis/installer/v1alpha1/aceshifter_types.go @@ -0,0 +1,85 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the AppsCode Community License 1.0.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://github.com/appscode/licenses/raw/1.0.0/AppsCode-Community-1.0.0.md + +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. +*/ + +package v1alpha1 + +import ( + core "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + ResourceKindAceshifter = "Aceshifter" + ResourceAceshifter = "aceshifter" + ResourceAceshifters = "aceshifters" +) + +// Aceshifter defines the schama for Aceshifter operator installer. + +// +genclient +// +genclient:skipVerbs=updateStatus +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=aceshifters,singular=aceshifter,categories={kubeops,appscode} +type Aceshifter struct { + metav1.TypeMeta `json:",inline,omitempty"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec AceshifterSpec `json:"spec,omitempty"` +} + +// AceshifterSpec is the schema for Identity Server values file +type AceshifterSpec struct { + //+optional + NameOverride string `json:"nameOverride"` + //+optional + FullnameOverride string `json:"fullnameOverride"` + //+optional + RegistryFQDN string `json:"registryFQDN"` + Image ImageReference `json:"image"` + //+optional + ImagePullSecrets []string `json:"imagePullSecrets"` + Args []string `json:"args"` + //+optional + PodAnnotations map[string]string `json:"podAnnotations"` + // PodSecurityContext holds pod-level security attributes and common container settings. + // Optional: Defaults to empty. See type description for default values of each field. + // +optional + PodSecurityContext *core.PodSecurityContext `json:"podSecurityContext"` + //+optional + SecurityContext *core.SecurityContext `json:"securityContext"` + //+optional + Resources core.ResourceRequirements `json:"resources"` + //+optional + NodeSelector map[string]string `json:"nodeSelector"` + // If specified, the pod's tolerations. + // +optional + Tolerations []core.Toleration `json:"tolerations"` + // If specified, the pod's scheduling constraints + // +optional + Affinity *core.Affinity `json:"affinity"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AceshifterList is a list of Aceshifters +type AceshifterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + // Items is a list of Aceshifter CRD objects + Items []Aceshifter `json:"items,omitempty"` +} diff --git a/apis/installer/v1alpha1/register.go b/apis/installer/v1alpha1/register.go index fa42630c4..a6f45d2da 100644 --- a/apis/installer/v1alpha1/register.go +++ b/apis/installer/v1alpha1/register.go @@ -60,6 +60,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &AceList{}, &AceInstaller{}, &AceInstallerList{}, + &Aceshifter{}, + &AceshifterList{}, &Billing{}, &BillingList{}, &BillingUi{}, diff --git a/apis/installer/v1alpha1/zz_generated.deepcopy.go b/apis/installer/v1alpha1/zz_generated.deepcopy.go index 95e30c64f..5462ec3ae 100644 --- a/apis/installer/v1alpha1/zz_generated.deepcopy.go +++ b/apis/installer/v1alpha1/zz_generated.deepcopy.go @@ -1391,6 +1391,127 @@ func (in *AceTrickster) DeepCopy() *AceTrickster { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Aceshifter) DeepCopyInto(out *Aceshifter) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Aceshifter. +func (in *Aceshifter) DeepCopy() *Aceshifter { + if in == nil { + return nil + } + out := new(Aceshifter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Aceshifter) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AceshifterList) DeepCopyInto(out *AceshifterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Aceshifter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AceshifterList. +func (in *AceshifterList) DeepCopy() *AceshifterList { + if in == nil { + return nil + } + out := new(AceshifterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AceshifterList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AceshifterSpec) DeepCopyInto(out *AceshifterSpec) { + *out = *in + out.Image = in.Image + if in.ImagePullSecrets != nil { + in, out := &in.ImagePullSecrets, &out.ImagePullSecrets + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PodAnnotations != nil { + in, out := &in.PodAnnotations, &out.PodAnnotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.PodSecurityContext != nil { + in, out := &in.PodSecurityContext, &out.PodSecurityContext + *out = new(v1.PodSecurityContext) + (*in).DeepCopyInto(*out) + } + if in.SecurityContext != nil { + in, out := &in.SecurityContext, &out.SecurityContext + *out = new(v1.SecurityContext) + (*in).DeepCopyInto(*out) + } + in.Resources.DeepCopyInto(&out.Resources) + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(v1.Affinity) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AceshifterSpec. +func (in *AceshifterSpec) DeepCopy() *AceshifterSpec { + if in == nil { + return nil + } + out := new(AceshifterSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AppIngress) DeepCopyInto(out *AppIngress) { *out = *in diff --git a/charts/aceshifter/.helmignore b/charts/aceshifter/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/charts/aceshifter/.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/charts/aceshifter/Chart.yaml b/charts/aceshifter/Chart.yaml new file mode 100644 index 000000000..647d5190d --- /dev/null +++ b/charts/aceshifter/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v2 +name: aceshifter +description: A Helm chart for OpenShift +type: application +version: v2024.10.24 +appVersion: v0.0.1 +home: https://github.com/appscode-cloud +icon: https://cdn.appscode.com/images/products/bytebuilders/icons/android-icon-192x192.png +sources: +- https://github.com/appscode-cloud +maintainers: +- name: appscode + email: support@appscode.com diff --git a/charts/aceshifter/README.md b/charts/aceshifter/README.md new file mode 100644 index 000000000..b1ee8d98f --- /dev/null +++ b/charts/aceshifter/README.md @@ -0,0 +1,95 @@ +# Aceshifter + +[Aceshifter by AppsCode](https://github.com/appscode-cloud) - Aceshifter + +## TL;DR; + +```bash +$ helm repo add appscode https://charts.appscode.com/stable +$ helm repo update +$ helm search repo appscode/aceshifter --version=v2024.10.24 +$ helm upgrade -i aceshifter appscode/aceshifter -n ace --create-namespace --version=v2024.10.24 +``` + +## Introduction + +This chart deploys a Aceshifter on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.21+ + +## Installing the Chart + +To install/upgrade the chart with the release name `aceshifter`: + +```bash +$ helm upgrade -i aceshifter appscode/aceshifter -n ace --create-namespace --version=v2024.10.24 +``` + +The command deploys a Aceshifter on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall the `aceshifter`: + +```bash +$ helm uninstall aceshifter -n ace +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following table lists the configurable parameters of the `aceshifter` chart and their default values. + +| Parameter | Description | Default | +|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| replicaCount | | 1 | +| registryFQDN | Docker registry fqdn used to pull app related images. Set this to use docker registry hosted at ${registryFQDN}/${registry}/${image} | ghcr.io | +| image.registry | Docker registry used to pull app container image | appscode | +| image.repository | | aceshifter | +| image.pullPolicy | | IfNotPresent | +| image.tag | Overrides the image tag whose default is the chart appVersion. | "" | +| imagePullSecrets | | [] | +| nameOverride | | "" | +| fullnameOverride | | "" | +| serviceAccount.create | Specifies whether a service account should be created | true | +| serviceAccount.annotations | Annotations to add to the service account | {} | +| serviceAccount.name | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | "" | +| podAnnotations | | {} | +| podLabels | | {} | +| podSecurityContext | | {} | +| securityContext | | {"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true,"runAsNonRoot":true,"runAsUser":65534,"seccompProfile":{"type":"RuntimeDefault"}} | +| service.type | | ClusterIP | +| service.port | | 8081 | +| resources | | {} | +| livenessProbe.httpGet.path | | /healthz | +| livenessProbe.httpGet.port | | http | +| livenessProbe.initialDelaySeconds | | 15 | +| livenessProbe.periodSeconds | | 20 | +| readinessProbe.httpGet.path | | /readyz | +| readinessProbe.httpGet.port | | http | +| readinessProbe.initialDelaySeconds | | 5 | +| readinessProbe.periodSeconds | | 10 | +| volumes | Additional volumes on the output Deployment definition. | [] | +| volumeMounts | Additional volumeMounts on the output Deployment definition. | [] | +| nodeSelector | | {} | +| tolerations | | [] | +| affinity | | {} | + + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade -i`. For example: + +```bash +$ helm upgrade -i aceshifter appscode/aceshifter -n ace --create-namespace --version=v2024.10.24 --set replicaCount=1 +``` + +Alternatively, a YAML file that specifies the values for the parameters can be provided while +installing the chart. For example: + +```bash +$ helm upgrade -i aceshifter appscode/aceshifter -n ace --create-namespace --version=v2024.10.24 --values values.yaml +``` diff --git a/charts/aceshifter/crds/ui.k8s.appscode.com_features.yaml b/charts/aceshifter/crds/ui.k8s.appscode.com_features.yaml new file mode 100644 index 000000000..3a781029f --- /dev/null +++ b/charts/aceshifter/crds/ui.k8s.appscode.com_features.yaml @@ -0,0 +1,276 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: features.ui.k8s.appscode.com +spec: + group: ui.k8s.appscode.com + names: + kind: Feature + listKind: FeatureList + plural: features + singular: feature + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.enabled + name: Enabled + type: boolean + - jsonPath: .status.managed + name: Managed + type: boolean + - jsonPath: .status.ready + name: Ready + type: boolean + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + chart: + description: Chart specifies the chart information that will be used + by the FluxCD to install the respective feature + properties: + createNamespace: + type: boolean + name: + description: Name specifies the name of the chart + type: string + namespace: + description: Namespace where the respective feature resources + will be deployed. + type: string + sourceRef: + description: SourceRef specifies the source of the chart + properties: + apiGroup: + type: string + kind: + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + required: + - name + type: object + valuesFiles: + description: Alternative list of values files to use as the chart + values (values.yaml is not included by default), expected to + be a relative path in the SourceRef. Values files are merged + in the order of this list with the last file overriding the + first. Ignored when omitted. + items: + type: string + type: array + version: + description: Version specifies the version of the chart. + type: string + required: + - name + - sourceRef + type: object + description: + description: Description specifies a short description of the service + this feature provides. + type: string + disabled: + description: Disabled specify whether this feature set is disabled. + type: boolean + featureBlock: + description: FeatureBlock specifies the ui block name of this feature. + type: string + featureSet: + description: FeatureSet specifies the name of the FeatureSet where + this feature belong to. + type: string + icons: + description: Icons is an optional list of icons for an application. + Icon information includes the source, size, and mime type. These + icons will be used in UI. + items: + description: ImageSpec contains information about an image used + as an icon. + properties: + size: + description: (optional) The size of the image in pixels (e.g., + 25x25). + type: string + src: + description: The source for image represented as either an absolute + URL to the image or a Data URL containing the image. Data + URLs are defined in RFC 2397. + type: string + type: + description: (optional) The mine type of the image (e.g., "image/png"). + type: string + required: + - src + type: object + type: array + readinessChecks: + description: ReadinessChecks specifies the conditions for this feature + to be considered enabled. + properties: + resources: + description: Resources specifies the resources that should be + registered to consider this feature as enabled. + items: + description: GroupVersionKind unambiguously identifies a kind. It + doesn't anonymously include GroupVersion to avoid automatic + coercion. It doesn't use a GroupVersion to avoid custom marshalling + properties: + group: + type: string + kind: + type: string + version: + type: string + required: + - group + - kind + - version + type: object + type: array + workloads: + description: Workloads specifies the workloads that should exist + to consider this feature as enabled. + items: + properties: + group: + type: string + kind: + type: string + optional: + type: string + selector: + additionalProperties: + type: string + description: Selector specifies label selector that should + be used to select this workload + type: object + version: + type: string + required: + - group + - kind + - selector + - version + type: object + type: array + type: object + recommended: + description: Required specifies whether this feature is mandatory + or not for enabling the respecting FeatureSet. + type: boolean + requirements: + description: Requirements specifies the requirements to enable this + feature. + properties: + features: + description: Features specifies a list of Feature names that must + be enabled for using this feature. + items: + type: string + type: array + type: object + title: + description: Title specifies the title of this feature. + type: string + values: + description: Values holds the values for this Helm release. + x-kubernetes-preserve-unknown-fields: true + valuesFrom: + description: ValuesFrom holds references to resources containing Helm + values for this HelmRelease, and information about how they should + be merged. + items: + description: 'copied from: https://github.com/fluxcd/helm-controller/blob/v0.37.4/api/v2beta2/reference_types.go#L45-L80 + ValuesReference contains a reference to a resource containing + Helm values, and optionally the key they can be found at.' + properties: + kind: + description: Kind of the values referent, valid values are ('Secret', + 'ConfigMap'). + enum: + - Secret + - ConfigMap + type: string + name: + description: Name of the values referent. Should reside in the + same namespace as the referring resource. + maxLength: 253 + minLength: 1 + type: string + optional: + description: Optional marks this ValuesReference as optional. + When set, a not found error for the values reference is ignored, + but any ValuesKey, TargetPath or transient error will still + result in a reconciliation failure. + type: boolean + targetPath: + description: TargetPath is the YAML dot notation path the value + should be merged at. When set, the ValuesKey is expected to + be a single flat value. Defaults to 'None', which results + in the values getting merged at the root. + maxLength: 250 + pattern: ^([a-zA-Z0-9_\-.\\\/]|\[[0-9]{1,5}\])+$ + type: string + valuesKey: + description: ValuesKey is the data key where the values.yaml + or a specific value can be found at. Defaults to 'values.yaml'. + maxLength: 253 + pattern: ^[\-._a-zA-Z0-9]+$ + type: string + required: + - kind + - name + type: object + type: array + required: + - description + - featureSet + - title + type: object + status: + properties: + enabled: + description: Enabled specifies whether this feature is enabled or + not. + type: boolean + managed: + description: Managed specifies whether this feature is managed by + AppsCode Inc. or not. + type: boolean + note: + description: Note specifies the respective reason if the feature does + not meet the requirements or is not ready. + type: string + ready: + description: Ready specifies whether this feature is ready to user + or not. This field will be present only for the features that are + managed by AppsCode Inc. + type: boolean + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/charts/aceshifter/doc.yaml b/charts/aceshifter/doc.yaml new file mode 100644 index 000000000..050b90995 --- /dev/null +++ b/charts/aceshifter/doc.yaml @@ -0,0 +1,18 @@ +project: + name: Aceshifter by AppsCode + shortName: Aceshifter + url: https://github.com/appscode-cloud + description: Aceshifter + app: a Aceshifter +repository: + url: https://charts.appscode.com/stable + name: appscode +chart: + name: aceshifter + values: -- generate from values file -- + valuesExample: -- generate from values file -- +prerequisites: +- Kubernetes 1.21+ +release: + name: aceshifter + namespace: ace diff --git a/charts/aceshifter/templates/NOTES.txt b/charts/aceshifter/templates/NOTES.txt new file mode 100644 index 000000000..f25675068 --- /dev/null +++ b/charts/aceshifter/templates/NOTES.txt @@ -0,0 +1,3 @@ +Application deployed. Find pods by running the following command: + +kubectl get pods -n {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "aceshifter.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" diff --git a/charts/aceshifter/templates/_helpers.tpl b/charts/aceshifter/templates/_helpers.tpl new file mode 100644 index 000000000..48bba0690 --- /dev/null +++ b/charts/aceshifter/templates/_helpers.tpl @@ -0,0 +1,76 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "aceshifter.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "aceshifter.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "aceshifter.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "aceshifter.labels" -}} +helm.sh/chart: {{ include "aceshifter.chart" . }} +{{ include "aceshifter.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "aceshifter.selectorLabels" -}} +app.kubernetes.io/name: {{ include "aceshifter.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "aceshifter.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "aceshifter.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Returns the registry used for image docker image +*/}} +{{- define "image.registry" -}} +{{- list .Values.registryFQDN .Values.image.registry | compact | join "/" }} +{{- end }} + +{{- define "appscode.imagePullSecrets" -}} +{{- with .Values.imagePullSecrets -}} +imagePullSecrets: +{{- toYaml . | nindent 2 }} +{{- end }} +{{- end }} diff --git a/charts/aceshifter/templates/deployment.yaml b/charts/aceshifter/templates/deployment.yaml new file mode 100644 index 000000000..eb5a37a1d --- /dev/null +++ b/charts/aceshifter/templates/deployment.yaml @@ -0,0 +1,69 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "aceshifter.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "aceshifter.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "aceshifter.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "aceshifter.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- include "appscode.imagePullSecrets" . | nindent 6 }} + serviceAccountName: {{ include "aceshifter.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ include "image.registry" . }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - run + - --metrics-bind-address=:8443 + - --leader-elect + - --health-probe-bind-address=:{{ .Values.service.port }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/aceshifter/templates/rbac.yaml b/charts/aceshifter/templates/rbac.yaml new file mode 100644 index 000000000..be36c9f88 --- /dev/null +++ b/charts/aceshifter/templates/rbac.yaml @@ -0,0 +1,189 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ include "aceshifter.fullname" . }}:leader-election + namespace: {{ .Release.Namespace }} + labels: + {{- include "aceshifter.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "aceshifter.fullname" . }}:manager + labels: + {{- include "aceshifter.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - create + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - namespaces + verbs: + - get + - list + - watch +- apiGroups: + - cluster.open-cluster-management.io + resources: + - clusterclaims + verbs: + - create + - get + - list + - patch + - update + - watch +- apiGroups: + - operator.open-cluster-management.io + resources: + - klusterlets + verbs: + - get + - list + - watch +- apiGroups: + - ui.k8s.appscode.com + resources: + - features + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - ui.k8s.appscode.com + resources: + - features/finalizers + verbs: + - update +- apiGroups: + - ui.k8s.appscode.com + resources: + - features/status + verbs: + - get + - patch + - update +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "aceshifter.fullname" . }}:metrics-auth + labels: + {{- include "aceshifter.labels" . | nindent 4 }} +rules: +- apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + verbs: + - create +- apiGroups: + - authorization.k8s.io + resources: + - subjectaccessreviews + verbs: + - create +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "aceshifter.fullname" . }}:metrics-reader + labels: + {{- include "aceshifter.labels" . | nindent 4 }} +rules: +- nonResourceURLs: + - /metrics + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ include "aceshifter.fullname" . }}:leader-election + namespace: {{ .Release.Namespace }} + labels: + {{- include "aceshifter.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ include "aceshifter.fullname" . }}:leader-election +subjects: +- kind: ServiceAccount + name: {{ include "aceshifter.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "aceshifter.fullname" . }}:manager + labels: + {{- include "aceshifter.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "aceshifter.fullname" . }}:manager +subjects: +- kind: ServiceAccount + name: {{ include "aceshifter.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "aceshifter.fullname" . }}:metrics-auth + labels: + {{- include "aceshifter.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "aceshifter.fullname" . }}:metrics-auth +subjects: +- kind: ServiceAccount + name: {{ include "aceshifter.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} diff --git a/charts/aceshifter/templates/service.yaml b/charts/aceshifter/templates/service.yaml new file mode 100644 index 000000000..a160e5eb4 --- /dev/null +++ b/charts/aceshifter/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "aceshifter.fullname" . }}-stats + namespace: {{ .Release.Namespace }} + labels: + {{- include "aceshifter.labels" . | nindent 4 }} +spec: + ports: + - name: https + port: 8443 + protocol: TCP + targetPort: 8443 + selector: + {{- include "aceshifter.labels" . | nindent 4 }} diff --git a/charts/aceshifter/templates/serviceaccount.yaml b/charts/aceshifter/templates/serviceaccount.yaml new file mode 100644 index 000000000..2523328e9 --- /dev/null +++ b/charts/aceshifter/templates/serviceaccount.yaml @@ -0,0 +1,14 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "aceshifter.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "aceshifter.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: true +{{- end }} diff --git a/charts/aceshifter/values.openapiv3_schema.yaml b/charts/aceshifter/values.openapiv3_schema.yaml new file mode 100644 index 000000000..54b40db6d --- /dev/null +++ b/charts/aceshifter/values.openapiv3_schema.yaml @@ -0,0 +1,676 @@ +properties: + affinity: + properties: + nodeAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + preference: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + type: object + x-kubernetes-map-type: atomic + weight: + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + properties: + nodeSelectorTerms: + items: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + type: object + x-kubernetes-map-type: atomic + type: array + x-kubernetes-list-type: atomic + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-type: atomic + type: object + podAntiAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: object + args: + items: + type: string + type: array + fullnameOverride: + type: string + image: + properties: + pullPolicy: + type: string + registry: + type: string + repository: + type: string + tag: + type: string + required: + - pullPolicy + - registry + - repository + - tag + type: object + imagePullSecrets: + items: + type: string + type: array + nameOverride: + type: string + nodeSelector: + additionalProperties: + type: string + type: object + podAnnotations: + additionalProperties: + type: string + type: object + podSecurityContext: + properties: + appArmorProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + supplementalGroups: + items: + format: int64 + type: integer + type: array + x-kubernetes-list-type: atomic + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + x-kubernetes-list-type: atomic + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + registryFQDN: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + appArmorProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + capabilities: + properties: + add: + items: + type: string + type: array + x-kubernetes-list-type: atomic + drop: + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + tolerations: + items: + properties: + effect: + type: string + key: + type: string + operator: + type: string + tolerationSeconds: + format: int64 + type: integer + value: + type: string + type: object + type: array +required: +- args +- image +type: object diff --git a/charts/aceshifter/values.yaml b/charts/aceshifter/values.yaml new file mode 100644 index 000000000..15e7ed7fe --- /dev/null +++ b/charts/aceshifter/values.yaml @@ -0,0 +1,94 @@ +# Default values for aceshifter. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +# Docker registry fqdn used to pull app related images. +# Set this to use docker registry hosted at ${registryFQDN}/${registry}/${image} +registryFQDN: ghcr.io + +image: + # Docker registry used to pull app container image + registry: appscode + repository: aceshifter + 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: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: # +doc-gen:break + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 65534 + seccompProfile: + type: RuntimeDefault + +service: + type: ClusterIP + port: 8081 + +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 + +livenessProbe: + httpGet: + path: /healthz + port: http + initialDelaySeconds: 15 + periodSeconds: 20 +readinessProbe: + httpGet: + path: /readyz + port: http + initialDelaySeconds: 5 + periodSeconds: 10 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/hack/scripts/import-crds.sh b/hack/scripts/import-crds.sh index cbc605eef..1bf77d567 100755 --- a/hack/scripts/import-crds.sh +++ b/hack/scripts/import-crds.sh @@ -44,6 +44,10 @@ crd-importer \ --input=https://github.com/x-helm/apimachinery/raw/${X_HELM_APIMACHINERY_TAG}/crds/charts.x-helm.dev_clusterchartpresets.yaml \ --out=./charts/ace-installer/crds +crd-importer \ + --input=https://github.com/kmodules/resource-metadata/raw/${KMODULES_RESOURCE_METADATA_TAG}/crds/ui.k8s.appscode.com_features.yaml \ + --out=./charts/aceshifter/crds + crd-importer \ --input=https://github.com/appscode-cloud/catalog/raw/${APPSCODE_CLOUD_CATALOG_TAG}/crds/catalog.appscode.com_druidbindings.yaml \ --input=https://github.com/appscode-cloud/catalog/raw/${APPSCODE_CLOUD_CATALOG_TAG}/crds/catalog.appscode.com_elasticsearchbindings.yaml \