Skip to content

Commit

Permalink
Merge pull request crossplane#399 from negz/lafarge
Browse files Browse the repository at this point in the history
Proposed design and API resources for Complex Workloads
  • Loading branch information
negz authored Apr 26, 2019
2 parents 021a62d + a65d7f1 commit 622173b
Show file tree
Hide file tree
Showing 24 changed files with 2,193 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
labels:
controller-tools.k8s.io: "1.0"
name: kubernetesapplications.workload.crossplane.io
spec:
additionalPrinterColumns:
- JSONPath: .status.clusterRef.name
name: CLUSTER
type: string
- JSONPath: .status.state
name: STATUS
type: string
- JSONPath: .status.desiredResources
name: DESIRED
type: integer
- JSONPath: .status.submittedResources
name: SUBMITTED
type: integer
group: workload.crossplane.io
names:
kind: KubernetesApplication
plural: kubernetesapplications
scope: Namespaced
validation:
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/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/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
clusterSelector:
description: ClusterSelector selects the clusters to which this application
may be scheduled.
type: object
resourceTemplates:
description: ResourceTemplates specifies a set of Kubernetes application
resources managed by this application.
items:
properties:
metadata:
type: object
spec:
properties:
secrets:
description: Secrets upon which this application resource
depends. These secrets will be propagated to the Kubernetes
cluster to which this application is scheduled.
items:
type: object
type: array
template:
description: A Template for a Kubernetes resource to be submitted
to the KubernetesCluster to which this application resource
is scheduled. The resource must be understood by the KubernetesCluster.
Crossplane requires only that the resource contains standard
Kubernetes type and object metadata.
type: object
required:
- template
type: object
type: object
type: array
required:
- resourceTemplates
type: object
status:
properties:
clusterRef:
description: Cluster to which this application has been scheduled.
type: object
desiredResources:
description: Desired resources of this application, i.e. the number
of resources that match this application's resource selector.
format: int64
type: integer
state:
description: State of the application.
type: string
submittedResources:
description: Submitted resources of this workload, i.e. the subset of
desired resources that have been successfully submitted to their scheduled
Kubernetes cluster.
format: int64
type: integer
type: object
version: v1alpha1
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
labels:
controller-tools.k8s.io: "1.0"
name: kubernetesapplicationresources.workload.crossplane.io
spec:
additionalPrinterColumns:
- JSONPath: .spec.template.kind
name: TEMPLATE-KIND
type: string
- JSONPath: .spec.template.metadata.name
name: TEMPLATE-NAME
type: string
- JSONPath: .status.clusterRef.name
name: CLUSTER
type: string
- JSONPath: .status.state
name: STATUS
type: string
group: workload.crossplane.io
names:
kind: KubernetesApplicationResource
plural: kubernetesapplicationresources
scope: Namespaced
validation:
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/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/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
secrets:
description: Secrets upon which this application resource depends. These
secrets will be propagated to the Kubernetes cluster to which this
application is scheduled.
items:
type: object
type: array
template:
description: A Template for a Kubernetes resource to be submitted to
the KubernetesCluster to which this application resource is scheduled.
The resource must be understood by the KubernetesCluster. Crossplane
requires only that the resource contains standard Kubernetes type
and object metadata.
type: object
required:
- template
type: object
status:
properties:
clusterRef:
description: Cluster to which this application has been scheduled.
type: object
remote:
description: Remote status of the resource templated by this application
resource.
type: object
state:
description: State of the application.
type: string
type: object
version: v1alpha1
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
1 change: 1 addition & 0 deletions cluster/charts/crossplane/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ rules:
- compute.gcp.crossplane.io
- database.gcp.crossplane.io
- storage.gcp.crossplane.io
- workload.crossplane.io
resources:
- "*"
verbs:
Expand Down
113 changes: 113 additions & 0 deletions cluster/examples/workloads/kubernetes/wordpress-gcp/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
apiVersion: compute.crossplane.io/v1alpha1
kind: KubernetesCluster
metadata:
name: wordpress-demo-cluster
namespace: complex
labels:
app: wordpress-demo
spec:
classReference:
name: standard-cluster
namespace: crossplane-system
---
apiVersion: storage.crossplane.io/v1alpha1
kind: MySQLInstance
metadata:
name: sql
namespace: complex
spec:
classReference:
name: standard-mysql
namespace: crossplane-system
engineVersion: "5.7"
---
apiVersion: workload.crossplane.io/v1alpha1
kind: KubernetesApplication
metadata:
name: wordpress-demo
namespace: complex
labels:
app: wordpress-demo
spec:
clusterSelector:
matchLabels:
app: wordpress-demo
resourceTemplates:
- metadata:
name: wordpress-demo-namespace
labels:
app: wordpress-demo
spec:
template:
apiVersion: v1
kind: Namespace
metadata:
name: wordpress
labels:
app: wordpress
- metadata:
name: wordpress-demo-deployment
labels:
app: wordpress-demo
spec:
secrets:
- name: sql # Resource claim secret name is derived from claim name
template:
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: wordpress
name: wordpress
labels:
app: wordpress
morelabels: arebetter
spec:
selector:
matchLabels:
app: wordpress
template:
metadata:
labels:
app: wordpress
spec:
containers:
- name: wordpress
image: wordpress:4.6.1-apache
env:
- name: WORDPRESS_DB_HOST
valueFrom:
secretKeyRef:
name: wordpress-demo-deployment-sql
key: endpoint
- name: WORDPRESS_DB_USER
valueFrom:
secretKeyRef:
name: wordpress-demo-deployment-sql
key: username
- name: WORDPRESS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: wordpress-demo-deployment-sql
key: password
ports:
- containerPort: 80
name: wordpress
- metadata:
name: wordpress-demo-service
labels:
app: wordpress-demo
spec:
template:
apiVersion: v1
kind: Service
metadata:
namespace: wordpress
name: wordpress
labels:
app: wordpress
spec:
ports:
- port: 80
selector:
app: wordpress
type: LoadBalancer
Loading

0 comments on commit 622173b

Please sign in to comment.