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

✨ add helm charts for cso and cspo #185

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions charts/cso/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: cso
description: A Helm chart for Cluster Stack Operator
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0"
62 changes: 62 additions & 0 deletions charts/cso/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cso.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 "cso.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 "cso.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cso.labels" -}}
helm.sh/chart: {{ include "cso.chart" . }}
{{ include "cso.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cso.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cso.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cso.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cso.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
27 changes: 27 additions & 0 deletions charts/cso/templates/cluster-stack-variables.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "cso.fullname" . }}-cluster-stack-variables
labels:
cluster.x-k8s.io/provider: cluster-stack-operator
{{- include "cso.labels" . | nindent 4 }}
data:
{{- if eq .Values.controllerManager.manager.source "github" }}
git-access-token: {{ required "clusterStackVariables.gitAccessToken is required"
.Values.clusterStackVariables.gitAccessToken | b64enc | quote }}
git-org-name: {{ required "clusterStackVariables.gitOrgName is required" .Values.clusterStackVariables.gitOrgName
| b64enc | quote }}
git-provider: {{ required "clusterStackVariables.gitProvider is required" .Values.clusterStackVariables.gitProvider
| b64enc | quote }}
git-repo-name: {{ required "clusterStackVariables.gitRepoName is required" .Values.clusterStackVariables.gitRepoName
| b64enc | quote }}
{{- else}}
oci-registry: {{ required "clusterStackVariables.ociRegistry is required" .Values.clusterStackVariables.ociRegistry
| b64enc | quote }}
oci-repository: {{ required "clusterStackVariables.ociRepository is required" .Values.clusterStackVariables.ociRepository
| b64enc | quote }}
oci-username: {{ .Values.clusterStackVariables.ociUsername | b64enc | quote }}
oci-access-token: {{ .Values.clusterStackVariables.ociAccessToken | b64enc | quote }}
oci-password: {{ .Values.clusterStackVariables.ociPassword | b64enc | quote }}
{{- end }}
type: Opaque
240 changes: 240 additions & 0 deletions charts/cso/templates/clusteraddon-crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clusteraddons.clusterstack.x-k8s.io
annotations:
controller-gen.kubebuilder.io/version: v0.16.2
labels:
cluster.x-k8s.io/provider: cluster-stack-operator
cluster.x-k8s.io/v1beta1: v1beta1
{{- include "cso.labels" . | nindent 4 }}
spec:
group: clusterstack.x-k8s.io
names:
kind: ClusterAddon
listKind: ClusterAddonList
plural: clusteraddons
shortNames:
- caddon
singular: clusteraddon
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .metadata.ownerReferences[?(@.kind=="Cluster")].name
name: Cluster
type: string
- description: Present running hook
jsonPath: .spec.hook
name: Hook
type: string
- jsonPath: .status.ready
name: Ready
type: boolean
- description: Time duration since creation of Cluster Addon
jsonPath: .metadata.creationTimestamp
name: Age
type: date
- jsonPath: .status.conditions[?(@.type=='Ready')].reason
name: Reason
type: string
- jsonPath: .status.conditions[?(@.type=='Ready')].message
name: Message
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: ClusterAddon is the schema for the clusteraddons API.
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:
description: ClusterAddonSpec defines the desired state of a ClusterAddon
object.
properties:
clusterRef:
description: |-
ClusterRef is the reference to the clusterv1.Cluster object that corresponds to the workload cluster where this
controller applies the cluster addons.
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: |-
If referring to a piece of an object instead of an entire object, this string
should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within a pod, this would take on a value like:
"spec.containers{name}" (where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]" (container with
index 2 in this pod). This syntax is chosen only to have some well-defined way of
referencing a part of an object.
type: string
kind:
description: |-
Kind of the referent.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
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
resourceVersion:
description: |-
Specific resourceVersion to which this reference is made, if any.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
type: string
uid:
description: |-
UID of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
type: string
type: object
x-kubernetes-map-type: atomic
clusterStack:
description: |-
ClusterStack is the full string <provider>-<name>-<Kubernetes version>-<version> that will be filled with the cluster stack that
the respective cluster uses currently. It always matches cluster.spec.topology.class if the work of this controller is done.
type: string
hook:
description: Hook specifies the runtime hook for the Cluster event.
type: string
version:
description: Version is the version of the cluster addons that have
been applied in the workload cluster.
type: string
required:
- clusterRef
type: object
status:
description: ClusterAddonStatus defines the observed state of ClusterAddon.
properties:
conditions:
description: Conditions define the current service state of the ClusterAddon.
items:
description: Condition defines an observation of a Cluster API resource
operational state.
properties:
lastTransitionTime:
description: |-
Last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when
the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
A human readable message indicating details about the transition.
This field may be empty.
type: string
reason:
description: |-
The reason for the condition's last transition in CamelCase.
The specific API may choose whether or not this field is considered a guaranteed API.
This field may not be empty.
type: string
severity:
description: |-
Severity provides an explicit classification of Reason code, so the users or machines can immediately
understand the current situation and act accordingly.
The Severity field MUST be set only when Status=False.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: |-
Type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
can be useful (see .node.status.conditions), the ability to deconflict is important.
type: string
required:
- lastTransitionTime
- status
- type
type: object
type: array
ready:
default: false
type: boolean
resources:
description: Resources specifies the status of the resources that this
object administrates.
items:
description: Resource defines the status of a resource.
properties:
error:
description: Error specifies the error of the last time this object
has been applied.
type: string
group:
description: Group specifies the group of the object.
type: string
kind:
description: Kind specifies the kind of the object.
type: string
name:
description: Name specifies the name of the object.
type: string
namespace:
description: Namespace specifies the namespace of the object.
type: string
status:
description: Status specifies the status of the object being applied.
type: string
version:
description: Version specifies the version of the object.
type: string
type: object
type: array
stages:
description: Stages shows the state of all stages in the current running
hook.
items:
description: StageStatus represents the helm charts of the hook and
it's phases.
properties:
action:
description: Action is the action of the helm chart. e.g. - apply
and delete.
type: string
name:
description: Name represent name of the helm chart
type: string
phase:
description: Phase is the current phase of the helm chart.
type: string
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading
Loading