Skip to content

Commit

Permalink
feat(gitops): add gitops configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Haar <christopher.haar@upbound.io>
  • Loading branch information
haarchri committed Nov 4, 2023
1 parent 49d67e5 commit 874b21e
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 141 deletions.
48 changes: 41 additions & 7 deletions apis/cluster/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ spec:
apiVersion: aws.platformref.upbound.io/v1alpha1
kind: XCluster
resources:
- base:
- name: XNetwork
base:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XNetwork
patches:
Expand All @@ -27,13 +28,13 @@ spec:
toFieldPath: status.subnetIds
policy:
fromFieldPath: Required
name: compositeNetworkEKS
- base:

- name: XEKS
base:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XEKS
connectionDetails:
- fromConnectionSecretKey: kubeconfig
name: compositeClusterEKS
patches:
- fromFieldPath: spec.parameters.id
toFieldPath: metadata.labels[xeks.aws.platform.upbound.io/cluster-id]
Expand Down Expand Up @@ -65,18 +66,51 @@ spec:
toFieldPath: spec.parameters.iam.roleArn
- fromFieldPath: spec.parameters.iam.userArn
toFieldPath: spec.parameters.iam.userArn
- base:

- name: XOss
base:
apiVersion: observe.platform.upbound.io/v1alpha1
kind: XOss
name: compositeObservability
patches:
- fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.parameters.deletionPolicy
- fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.id
- fromFieldPath: spec.parameters.services.operators.prometheus.version
- fromFieldPath: spec.parameters.operators.prometheus.version
toFieldPath: spec.parameters.operators.prometheus.version

- name: XFlux
base:
apiVersion: gitops.platform.upbound.io/v1alpha1
kind: XFlux
patches:
- fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.parameters.deletionPolicy
- fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.providerConfigName
- fromFieldPath: spec.parameters.operators.flux.version
toFieldPath: spec.parameters.operators.flux.version
- fromFieldPath: spec.parameters.operators.flux-sync.version
toFieldPath: spec.parameters.operators.flux-sync.version
- fromFieldPath: spec.parameters.gitops
toFieldPath: spec.parameters.source

- name: usageXEksByXFlux
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
of:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XEKS
resourceSelector:
matchControllerRef: true
by:
apiVersion: gitops.platform.upbound.io/v1alpha1
kind: XFlux
resourceSelector:
matchControllerRef: true

- name: usageXEksByXOss
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
Expand Down
310 changes: 176 additions & 134 deletions apis/cluster/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,139 +12,181 @@ spec:
kind: Cluster
plural: clusters
connectionSecretKeys:
- kubeconfig
- kubeconfig
versions:
- name: v1alpha1
served: true
referenceable: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
parameters:
type: object
description: Cluster configuration parameters.
properties:
id:
- name: v1alpha1
served: true
referenceable: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
parameters:
type: object
description: Cluster configuration parameters.
properties:
id:
type: string
description: ID of this Cluster that other objects will use to refer to it.
region:
type: string
description: Region is the region you'd like your resource to be created in.
iam:
type: object
description: IAM configuration to connect as ClusterAdmin.
properties:
roleArn:
description: The IAM Role ARN to connect as ClusterAdmin.
type: string
userArn:
description: The IAM User ARN to connect as ClusterAdmin.
type: string
networkSelector:
type: string
description: NetworkSelector employs a specific type of network architecture.
enum:
- basic
default: basic
deletionPolicy:
description: Delete the external resources when the Claim/XR is deleted. Defaults to Delete
enum:
- Delete
- Orphan
type: string
default: Delete
providerConfigName:
description: Crossplane ProviderConfig to use for provisioning this resources
type: string
default: default
version:
type: string
description: Kubernetes version of the Cluster
enum:
- "1.28"
- "1.27"
- "1.26"
- "1.25"
default: "1.27"
nodes:
type: object
description: Cluster node configuration parameters.
properties:
count:
type: integer
description: Desired node count, from 1 to 100.
instanceType:
type: string
description: instance types associated with the Node Group.
default: t3.small
required:
- count
- instanceType
operators:
description: Configuration for operators.
type: object
default:
flux:
version: "2.10.6"
flux-sync:
version: "1.7.2"
prometheus:
version: "52.1.0"
properties:
flux:
description: Configuration for the Flux GitOps operator.
type: object
properties:
version:
description: flux helm-chart version to run.
type: string
default: "2.10.6"
required:
- version
flux-sync:
description: Configuration for the Flux Sync Helm-Chart.
type: object
properties:
version:
description: flux sync helm-chart version to run.
type: string
default: "1.7.2"
required:
- version
prometheus:
description: Configuration for the Prometheus Helm-Chart.
type: object
properties:
version:
description: prometheus helm-chart version to run.
type: string
default: "52.1.0"
required:
- version
gitops:
description: GitOps configure gitops system
type: object
properties:
git:
type: object
properties:
interval:
default: "5m0s"
description: Interval at which the GitRepository URL is checked for
updates. This interval is approximate and may be subject to jitter
to ensure efficient use of resources.
pattern: ^([0-9]+(\.[0-9]+)?(ms|s|m|h))+$
type: string
timeout:
default: "60s"
description: Timeout for Git operations like cloning, defaults to
60s.
pattern: ^([0-9]+(\.[0-9]+)?(ms|s|m))+$
type: string
url:
description: URL specifies the Git repository URL, it can be an HTTP/S
or SSH address.
pattern: ^(http|https|ssh)://.*$
type: string
path:
type: string
default: "/"
ref:
description: Reference specifies the Git reference to resolve and
monitor for changes.
type: object
properties:
name:
description: "Name of the reference to check out; takes precedence
over Branch, Tag and SemVer. \n It must be a valid Git reference:
https://git-scm.com/docs/git-check-ref-format#_description Examples:
\"refs/heads/main\", \"refs/tags/v0.1.0\", \"refs/pull/420/head\",
\"refs/merge-requests/1/head\""
type: string
required:
- interval
- timeout
- url
- path
- ref
required:
- git
required:
- deletionPolicy
- gitops
- id
- nodes
- operators
- providerConfigName
- region
required:
- parameters
status:
type: object
properties:
subnetIds:
type: array
items:
type: string
description: ID of this Cluster that other objects will use to refer to it.
region:
type: string
description: Region is the region you'd like your resource to be created in.
iam:
type: object
description: IAM configuration to connect as ClusterAdmin.
properties:
roleArn:
description: The IAM Role ARN to connect as ClusterAdmin.
type: string
userArn:
description: The IAM User ARN to connect as ClusterAdmin.
type: string
networkSelector:
type: string
description: NetworkSelector employs a specific type of network architecture.
enum:
- basic
default: basic
deletionPolicy:
description: Delete the external resources when the Claim/XR is deleted. Defaults to Delete
enum:
- Delete
- Orphan
type: string
default: Delete
providerConfigName:
description: Crossplane ProviderConfig to use for provisioning this resources
type: string
default: default
version:
type: string
description: Kubernetes version of the Cluster
enum:
- "1.28"
- "1.27"
- "1.26"
- "1.25"
default: "1.27"
nodes:
type: object
description: Cluster node configuration parameters.
properties:
count:
type: integer
description: Desired node count, from 1 to 100.
instanceType:
type: string
description: instance types associated with the Node Group.
default: t3.small
required:
- count
- instanceType
gitops:
type: object
description: GitOps configure gitops system
properties:
url:
type: string
description: Url for GitOps Sync.
path:
type: string
description: path in Repo for GitOps Sync.
kubeConfigSecretRef:
type: object
description: location for kubeconfig
properties:
name:
type: string
description: Name of the secret.
namespace:
type: string
description: Namespace of the secret.
required:
- name
- namespace
required:
- url
services:
type: object
description: Services configuration parameters.
properties:
operators:
type: object
description: Configuration for operators.
properties:
flux:
type: object
description: Configuration for the Flux GitOps operator.
properties:
version:
type: string
description: Flux operator version to run.
default: "2.9.2"
prometheus:
type: object
description: Configuration for the Prometheus operator.
properties:
version:
type: string
description: Prometheus operator version to run.
default: "52.1.0"
required:
- nodes
- id
- region
- deletionPolicy
- providerConfigName
required:
- parameters
status:
type: object
properties:
subnetIds:
type: array
items:
type: string
Loading

0 comments on commit 874b21e

Please sign in to comment.