Skip to content

Commit

Permalink
feat: harness-ccm-cluster-orchestrator (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
rssnyder authored Aug 26, 2024
1 parent 770654d commit e28ff6f
Show file tree
Hide file tree
Showing 16 changed files with 2,176 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/harness-ccm-cluster-orchestrator/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
24 changes: 24 additions & 0 deletions charts/harness-ccm-cluster-orchestrator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: harness-ccm-cluster-orchestrator
description: A Helm chart for Kubernetes

# 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.0

# 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: "beta-0.0.1"
39 changes: 39 additions & 0 deletions charts/harness-ccm-cluster-orchestrator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# harness-ccm-cluster-orchestrator

helm chart for the ccm cluster orchestrator

## usage

> :warning: You must have the target cluster set up in Harness with a K8s and CCM K8s connector before you deploy this chart
install repo
`helm repo add rssnyder https://rssnyder.github.io/charts`

update repo
`helm repo update rssnyder`

deploy chart (you must set your namespace to `harness-ccm`)

```
helm upgrade -i harness-cluster-orch --namespace harness-ccm --create-namespace \
rssnyder/harness-ccm-cluster-orchestrator \
--set clusterName=rileysnyder \
--set clusterRegion=us-west-2 \
--set remoteAccountID=AM8HCbDiTXGQNrTIhNl7qQ \
--set connectorID=rileysnyder_temp_infraCostaccess \
--set clusterID=orch-cr68d03saq0vrda3njs0 \
--set "harnessAPI=https://app.harness.io/gratis/lw/api" \
--set "clusterEndpoint=https://xxx.gr7.us-west-2.eks.amazonaws.com" \
--set awsDefaultInstanceProfile=eks-92c8bfe4-4afb-bbc4-2965-8f07280fdc31 \
--set "awsNodeRoleARN=arn:aws:iam::759984737373:role/default-eks-node-group-20240823145811164700000003" \
--set "controllerRoleArn=arn:aws:iam::759984737373:role/ccm_comm_orch_controller" \
--set "apiToken=sat.AM8HCbDiTXGQNrTIhNl7qQ.xxx"
```

all values are described in `values.yaml`

## development notes

things that must be hard-coded:

namespace: `harness-ccm`
87 changes: 87 additions & 0 deletions charts/harness-ccm-cluster-orchestrator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "harness-ccm-cluster-orchestrator.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 "harness-ccm-cluster-orchestrator.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 "harness-ccm-cluster-orchestrator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Operator Selector labels
*/}}
{{- define "harness-ccm-cluster-orchestrator.operator.selectorLabels" -}}
{{ include "harness-ccm-cluster-orchestrator.labels" . }}
app.kubernetes.io/instance: cluster-orch-operator
app.kubernetes.io/name: cluster-orch-operator
{{- end }}

{{/*
Telemetry Selector labels
*/}}
{{- define "harness-ccm-cluster-orchestrator.telemetry.selectorLabels" -}}
{{ include "harness-ccm-cluster-orchestrator.labels" . }}
app.kubernetes.io/instance: cluster-telemetry-collector
app.kubernetes.io/name: cluster-telemetry-collector
{{- end }}

{{/*
Interrupt Selector labels
*/}}
{{- define "harness-ccm-cluster-orchestrator.interrupt.selectorLabels" -}}
{{ include "harness-ccm-cluster-orchestrator.labels" . }}
app.kubernetes.io/name: cluster-orch-interrupt-listener
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "harness-ccm-cluster-orchestrator.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "harness-ccm-cluster-orchestrator.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "harness-ccm-cluster-orchestrator.serviceAccountName" . }}-cluster-admin
subjects:
- kind: ServiceAccount
name: {{ include "harness-ccm-cluster-orchestrator.serviceAccountName" . }}
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
Loading

0 comments on commit e28ff6f

Please sign in to comment.