Skip to content
Merged
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
8 changes: 8 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,21 @@ if 'templates-controller' in to_edit:
docker_build('ghcr.io/weaveworks/templates-controller', '../templates-controller/')
templates_controller_labels = ["local"]

gitopssets_controller_labels = ["remote-images"]
if 'gitopssets-controller' in to_edit:
if not os.path.exists("../gitopssets-controller"):
fail("You need to git clone https://github.com/weaveworks/gitopssets-controller to a directory next to this")
docker_build('ghcr.io/weaveworks/gitopssets-controller', '../gitopssets-controller/')
templates_controller_labels = ["local"]

# --- rename chart resources to human readable

k8s_resource('chart-mccp-cluster-service', new_name='cluster-service', labels=["local"], port_forwards='8000')
k8s_resource('chart-pipeline-controller', new_name='pipeline-controller', labels=["remote-images"])
k8s_resource('chart-mccp-cluster-bootstrap-controller', new_name='cluster-bootstrap-controller', labels=cluster_bootstrap_controller_labels)
k8s_resource('chart-cluster-controller', new_name='cluster-controller', labels=cluster_controller_labels)
k8s_resource('templates-controller-controller-manager', new_name='templates-controller', labels=templates_controller_labels)
k8s_resource('gitopssets-controller-manager', new_name='gitopssets-controller', labels=gitopssets_controller_labels)
k8s_resource('policy-agent', labels=["remote-images"])

# Install resources I couldn't find elsewhere
Expand Down
23 changes: 23 additions & 0 deletions charts/gitopssets-controller/.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/
21 changes: 21 additions & 0 deletions charts/gitopssets-controller/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: gitopssets-controller
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: "0.1.0"
208 changes: 208 additions & 0 deletions charts/gitopssets-controller/crds/gitopsset-crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: gitopssets.templates.weave.works
spec:
group: templates.weave.works
names:
kind: GitOpsSet
listKind: GitOpsSetList
plural: gitopssets
singular: gitopsset
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- jsonPath: .status.conditions[?(@.type=="Ready")].status
name: Ready
type: string
- jsonPath: .status.conditions[?(@.type=="Ready")].message
name: Status
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: GitOpsSet is the Schema for the gitopssets 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: GitOpsSetSpec defines the desired state of GitOpsSet
properties:
generators:
description: Generators generate the data to be inserted into the
provided templates.
items:
description: GitOpsSet describes the configured generators.
properties:
gitRepository:
description: GitRepositoryGenerator generates from files in
a Flux GitRepository resource.
properties:
directories:
description: Directories is a set of rules for identifying
directories to be parsed.
items:
description: GitRepositoryGeneratorDirectoryItem defines
a path to be parsed (or excluded from) for files.
properties:
exclude:
type: boolean
path:
type: string
required:
- path
type: object
type: array
repositoryRef:
description: RepositoryRef is the name of a GitRepository
resource to be generated from.
type: string
required:
- repositoryRef
type: object
list:
description: ListGenerator generates from a hard-coded list.
properties:
elements:
items:
x-kubernetes-preserve-unknown-fields: true
type: array
required:
- elements
type: object
type: object
type: array
templates:
description: Templates are a set of YAML templates that are rendered
into resources from the data supplied by the generators.
items:
description: // ©itOpsSetTemplate describes a resource to create
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
type: object
status:
description: GitOpsSetStatus defines the observed state of GitOpsSet
properties:
conditions:
description: Conditions holds the conditions for the GitOpsSet
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the 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: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "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. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
inventory:
description: Inventory contains the list of Kubernetes resource object
references that have been successfully applied
properties:
entries:
description: Entries of Kubernetes resource object references.
items:
description: ResourceRef contains the information necessary
to locate a resource within a cluster.
properties:
id:
description: ID is the string representation of the Kubernetes
resource object's metadata, in the format '<namespace>_<name>_<group>_<kind>'.
type: string
v:
description: Version is the API version of the Kubernetes
resource object's kind.
type: string
required:
- id
- v
type: object
type: array
required:
- entries
type: object
observedGeneration:
description: ObservedGeneration is the last observed generation of
the HelmRepository object.
format: int64
type: integer
type: object
type: object
served: true
storage: true
subresources:
status: {}
62 changes: 62 additions & 0 deletions charts/gitopssets-controller/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "gitopssets-controller.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 "gitopssets-controller.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 "gitopssets-controller.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "gitopssets-controller.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "gitopssets-controller.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading