-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds in a MVP server CRD, and all the necessary controller scaffolding.
- Loading branch information
1 parent
985973b
commit eb9f10f
Showing
20 changed files
with
1,106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
charts/region/crds/region.unikorn-cloud.org_openstackservers.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.16.1 | ||
name: openstackservers.region.unikorn-cloud.org | ||
spec: | ||
group: region.unikorn-cloud.org | ||
names: | ||
categories: | ||
- unikorn | ||
kind: OpenstackServer | ||
listKind: OpenstackServerList | ||
plural: openstackservers | ||
singular: openstackserver | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .metadata.creationTimestamp | ||
name: age | ||
type: date | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: OpenstackServer has no controller, its a database record of state. | ||
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: | ||
properties: | ||
publicIPAllocationId: | ||
description: PublicIPAllocationId is the public ip allocation id. | ||
type: string | ||
serverID: | ||
description: ServerID is the server ID. | ||
type: string | ||
type: object | ||
status: | ||
type: object | ||
required: | ||
- spec | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: {} |
206 changes: 206 additions & 0 deletions
206
charts/region/crds/region.unikorn-cloud.org_servers.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.16.1 | ||
name: servers.region.unikorn-cloud.org | ||
spec: | ||
group: region.unikorn-cloud.org | ||
names: | ||
categories: | ||
- unikorn | ||
kind: Server | ||
listKind: ServerList | ||
plural: servers | ||
singular: server | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .status.conditions[?(@.type=="Available")].reason | ||
name: status | ||
type: string | ||
- jsonPath: .metadata.creationTimestamp | ||
name: age | ||
type: date | ||
- jsonPath: .status.publicIP | ||
name: publicIP | ||
type: string | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: Server defines a server beloning to an identity. | ||
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: | ||
properties: | ||
flavorID: | ||
description: FlavorID is the flavor ID. | ||
type: string | ||
image: | ||
description: Image defines a set of rules to lookup for the server | ||
image. | ||
properties: | ||
id: | ||
description: ID is the image ID. If specified, it has priority | ||
over the selector. | ||
type: string | ||
selector: | ||
description: Selector defines a set of rules to lookup images. | ||
properties: | ||
os: | ||
description: OS is the operating system of the image. | ||
type: string | ||
version: | ||
description: Version is the version of the image. | ||
type: string | ||
required: | ||
- os | ||
- version | ||
type: object | ||
type: object | ||
x-kubernetes-validations: | ||
- message: at least one of id or selector must be defined | ||
rule: (has(self.id) || has(self.selector)) | ||
networks: | ||
description: Networks is the server network configuration. | ||
items: | ||
properties: | ||
physicalNetwork: | ||
properties: | ||
id: | ||
description: ID is the physical network ID. | ||
type: string | ||
required: | ||
- id | ||
type: object | ||
type: object | ||
type: array | ||
pause: | ||
description: Pause, if true, will inhibit reconciliation. | ||
type: boolean | ||
provider: | ||
description: Provider defines the provider type. | ||
enum: | ||
- openstack | ||
type: string | ||
publicIPAllocation: | ||
description: PublicIPAllocation is the server public IP allocation | ||
configuration. | ||
properties: | ||
enabled: | ||
description: Enabled is a flag to enable public IP allocation. | ||
type: boolean | ||
type: object | ||
securityGroups: | ||
description: SecurityGroups is the server security groups. | ||
items: | ||
properties: | ||
id: | ||
description: ID is the security group ID. | ||
type: string | ||
required: | ||
- id | ||
type: object | ||
type: array | ||
tags: | ||
description: |- | ||
Tags are an abitrary list of key/value pairs that a client | ||
may populate to store metadata for the resource. | ||
items: | ||
description: Tag is an arbirary key/value. | ||
properties: | ||
name: | ||
description: Name of the tag. | ||
type: string | ||
value: | ||
description: Value of the tag. | ||
type: string | ||
required: | ||
- name | ||
- value | ||
type: object | ||
type: array | ||
required: | ||
- flavorID | ||
- image | ||
- provider | ||
type: object | ||
status: | ||
properties: | ||
conditions: | ||
description: Current service state of a cluster manager. | ||
items: | ||
description: |- | ||
Condition is a generic condition type for use across all resource types. | ||
It's generic so that the underlying controller-manager functionality can | ||
be shared across all resources. | ||
properties: | ||
lastTransitionTime: | ||
description: Last time the condition transitioned from one status | ||
to another. | ||
format: date-time | ||
type: string | ||
message: | ||
description: Human-readable message indicating details about | ||
last transition. | ||
type: string | ||
reason: | ||
description: Unique, one-word, CamelCase reason for the condition's | ||
last transition. | ||
enum: | ||
- Provisioning | ||
- Provisioned | ||
- Cancelled | ||
- Errored | ||
- Deprovisioning | ||
- Deprovisioned | ||
type: string | ||
status: | ||
description: |- | ||
Status is the status of the condition. | ||
Can be True, False, Unknown. | ||
type: string | ||
type: | ||
description: Type is the type of the condition. | ||
enum: | ||
- Available | ||
type: string | ||
required: | ||
- lastTransitionTime | ||
- message | ||
- reason | ||
- status | ||
- type | ||
type: object | ||
type: array | ||
privateIP: | ||
description: PrivateIP is the private IP address of the server. | ||
type: string | ||
publicIP: | ||
description: PublicIP is the public IP address of the server. | ||
type: string | ||
type: object | ||
required: | ||
- spec | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
charts/region/templates/server-controller/clusterrole.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: unikorn-server-controller | ||
labels: | ||
{{- include "unikorn.labels" . | nindent 4 }} | ||
rules: | ||
# Orchestrate Unikorn resources (my job). | ||
- apiGroups: | ||
- region.unikorn-cloud.org | ||
resources: | ||
- regions | ||
- identities | ||
- openstackidentities | ||
- physicalnetworks | ||
- openstackphysicalnetworks | ||
- securitygroups | ||
- openstacksecuritygroups | ||
verbs: | ||
- list | ||
- watch | ||
- apiGroups: | ||
- region.unikorn-cloud.org | ||
resources: | ||
- servers | ||
verbs: | ||
- list | ||
- watch | ||
- update | ||
- patch | ||
- apiGroups: | ||
- region.unikorn-cloud.org | ||
resources: | ||
- servers/status | ||
verbs: | ||
- update | ||
- apiGroups: | ||
- region.unikorn-cloud.org | ||
resources: | ||
- openstackservers | ||
verbs: | ||
- list | ||
- watch | ||
- create | ||
- update | ||
- delete | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- secrets | ||
verbs: | ||
- list | ||
- watch |
14 changes: 14 additions & 0 deletions
14
charts/region/templates/server-controller/clusterrolebinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: unikorn-server-controller | ||
labels: | ||
{{- include "unikorn.labels" . | nindent 4 }} | ||
subjects: | ||
- kind: ServiceAccount | ||
namespace: {{ .Release.Namespace }} | ||
name: unikorn-server-controller | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: unikorn-server-controller |
Oops, something went wrong.