Skip to content

Commit

Permalink
Merge pull request #36 from alperencelik/upgrade-controller-gen
Browse files Browse the repository at this point in the history
feat: Bump up the controller-gen version & update CRD metadata
  • Loading branch information
alperencelik authored Jun 8, 2024
2 parents db70047 + a5eb642 commit 198fb1e
Show file tree
Hide file tree
Showing 22 changed files with 461 additions and 61 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest

## Tool Versions
KUSTOMIZE_VERSION ?= v5.0.1
CONTROLLER_TOOLS_VERSION ?= v0.12.0
KUSTOMIZE_VERSION ?= v5.2.1
CONTROLLER_TOOLS_VERSION ?= v0.13.0

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
Expand Down
8 changes: 8 additions & 0 deletions api/proxmox/v1alpha1/container_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ type ContainerStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:shortName=lxc
//+kubebuilder:printcolumn:name="Node",type="string",JSONPath=".spec.nodeName",description="The name of the target node of Proxmox"
//+kubebuilder:printcolumn:name="ID",type="string",JSONPath=".status.status.id",description="The ID of the container"
//+kubebuilder:printcolumn:name="Cores",type="string",JSONPath=".spec.template.cores",description="The number of CPU cores"
//+kubebuilder:printcolumn:name="Memory",type="string",JSONPath=".spec.template.memory",description="The amount of memory in MB"
//+kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.status.state",description="The state of the VM"
//+kubebuilder:printcolumn:name="Uptime",type="string",JSONPath=".status.status.uptime",description="The uptime of the VM"
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

// Container is the Schema for the containers API
type Container struct {
Expand Down
8 changes: 8 additions & 0 deletions api/proxmox/v1alpha1/managedvirtualmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ type ManagedVirtualMachineSpec struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:shortName="mvm"
//+kubebuilder:printcolumn:name="Node",type="string",JSONPath=".spec.nodeName",description="The node name"
//+kubebuilder:printcolumn:name="ID",type="integer",JSONPath=".status.status.id",description="The ID of the VM"
//+kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.status.state",description="The state of the VM"
//+kubebuilder:printcolumn:name="Uptime",type="string",JSONPath=".status.status.uptime",description="The uptime of the VM"
//+kubebuilder:printcolumn:name="IP Address",type="string",JSONPath=".status.status.IPAddress",description="The IP address of the VM"
//+kubebuilder:printcolumn:name="OS Info",type="string",JSONPath=".status.status.OSInfo",description="The OS information of the VM"
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

// ManagedVirtualMachine is the Schema for the managedvirtualmachines API
type ManagedVirtualMachine struct {
Expand Down
8 changes: 8 additions & 0 deletions api/proxmox/v1alpha1/virtualmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ type VirtualMachineStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:shortName="vm"
//+kubebuilder:printcolumn:name="Node",type="string",JSONPath=".spec.nodeName",description="The node name"
//+kubebuilder:printcolumn:name="ID",type="integer",JSONPath=".status.status.id",description="The ID of the VM"
//+kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.status.state",description="The state of the VM"
//+kubebuilder:printcolumn:name="Uptime",type="string",JSONPath=".status.status.uptime",description="The uptime of the VM"
//+kubebuilder:printcolumn:name="IP Address",type="string",JSONPath=".status.status.IPAddress",description="The IP address of the VM"
//+kubebuilder:printcolumn:name="OS Info",type="string",JSONPath=".status.status.OSInfo",description="The OS information of the VM"
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

// VirtualMachine is the Schema for the virtualmachines API
type VirtualMachine struct {
Expand Down
7 changes: 7 additions & 0 deletions api/proxmox/v1alpha1/virtualmachineset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ type VirtualMachineSetStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:shortName=vmset
//+kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="The number of VMs"
//+kubebuilder:printcolumn:name="Node",type="string",JSONPath=".spec.nodeName",description="The name of the target node of Proxmox"
//+kubebuilder:printcolumn:name="Cores",type="string",JSONPath=".spec.template.cores",description="The number of CPU cores"
//+kubebuilder:printcolumn:name="Memory",type="string",JSONPath=".spec.template.memory",description="The amount of memory in MB"
//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].type",description="The status of the VM"
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

// VirtualMachineSet is the Schema for the virtualmachinesets API
type VirtualMachineSet struct {
Expand Down
1 change: 0 additions & 1 deletion api/proxmox/v1alpha1/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions charts/kubemox/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ 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
version: 0.3.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.2"
appVersion: "0.1.0"
70 changes: 70 additions & 0 deletions charts/kubemox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# kubemox

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2](https://img.shields.io/badge/AppVersion-0.2-informational?style=flat-square)

A Helm chart for Kubernetes

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| Alp Eren Celik | <[email protected]> | |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| autoscaling.enabled | bool | `false` | |
| autoscaling.maxReplicas | int | `100` | |
| autoscaling.minReplicas | int | `1` | |
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"Always"` | Image pull policy for Kubemox |
| image.repository | string | `"alperencelik/kubemox"` | Kubemox image repository |
| image.tag | string | `"latest"` | Kubemox image tag, see https://github.com/alperencelik/kubemox/releases for the tags |
| imagePullSecrets | list | `[]` | |
| ingress.annotations | object | `{}` | |
| ingress.className | string | `""` | |
| ingress.enabled | bool | `false` | |
| ingress.hosts[0].host | string | `"chart-example.local"` | |
| ingress.hosts[0].paths[0].path | string | `"/"` | |
| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
| ingress.tls | list | `[]` | |
| metrics.serviceMonitor.additionalLabels | object | `{}` | Prometheus ServiceMonitor labels |
| metrics.serviceMonitor.annotations | object | `{}` | Prometheus ServiceMonitor annotations |
| metrics.serviceMonitor.enabled | bool | `false` | Prometheus ServiceMonitor enabled |
| metrics.serviceMonitor.interval | string | `"30s"` | Prometheus ServiceMonitor interval |
| metrics.serviceMonitor.metricRelabelings | list | `[]` | Prometheus [MetricRelabelConfigs] to apply to samples before ingestion |
| metrics.serviceMonitor.namespace | string | `""` | Prometheus ServiceMonitor namespace |
| metrics.serviceMonitor.relabelings | list | `[]` | Prometheus [MetricRelabelConfigs] to apply to samples before ingestion |
| metrics.serviceMonitor.scheme | string | `""` | Prometheus ServiceMonitor scheme |
| metrics.serviceMonitor.selector | object | `{}` | Prometheus ServiceMonitor selector |
| metrics.serviceMonitor.tlsConfig | object | `{}` | Prometheus ServiceMonitor tlsConfig |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podSecurityContext | object | `{}` | |
| proxmox.endpoint | string | `"10.0.0.99"` | Proxmox VE endpoint |
| proxmox.insecureSkipTLSVerify | bool | `true` | Proxmox VE skip hostname verification for SSL |
| proxmox.password | string | `"PROXMOX_PASSWORD"` | Proxmox VE password |
| proxmox.secret | string | `""` | Proxmox VE token secret |
| proxmox.tokenID | string | `""` | Proxmox VE token ID |
| proxmox.username | string | `"root@pam"` | Proxmox VE username |
| replicaCount | int | `1` | Define how many replicas of the Kubemox to run |
| resources.limits.cpu | string | `"500m"` | |
| resources.limits.memory | string | `"512Mi"` | |
| resources.requests.cpu | string | `"100m"` | |
| resources.requests.memory | string | `"128Mi"` | |
| securityContext | object | `{}` | |
| service.port | int | `8080` | |
| service.portName | string | `"http"` | |
| service.targetPort | int | `8080` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | If not set and create is true, a name is generated using the fullname template |
| tolerations | list | `[]` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1)
138 changes: 127 additions & 11 deletions charts/kubemox/templates/crds/containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,40 @@ spec:
kind: Container
listKind: ContainerList
plural: containers
shortNames:
- lxc
singular: container
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- description: The name of the target node of Proxmox
jsonPath: .spec.nodeName
name: Node
type: string
- description: The ID of the container
jsonPath: .status.status.id
name: ID
type: string
- description: The number of CPU cores
jsonPath: .spec.template.cores
name: Cores
type: string
- description: The amount of memory in MB
jsonPath: .spec.template.memory
name: Memory
type: string
- description: The state of the VM
jsonPath: .status.status.state
name: State
type: string
- description: The uptime of the VM
jsonPath: .status.status.uptime
name: Uptime
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Container is the Schema for the containers API
Expand Down Expand Up @@ -86,19 +116,105 @@ spec:
status:
description: ContainerStatus defines the observed state of Container
properties:
id:
type: integer
name:
type: string
node:
type: string
state:
conditions:
description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
of cluster Important: Run "make" to regenerate code after modifying
this file'
type: string
uptime:
type: string
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
status:
properties:
IPAddress:
description: IPAddress is the IP address of the VM
type: string
OSInfo:
description: OSInfo is the OS information of the VM
type: string
id:
description: ID is the ID of the VM
type: integer
node:
description: Node is the name of the node
type: string
state:
description: State is the state of the VM
type: string
uptime:
description: Uptime is the uptime of the VM
type: string
required:
- IPAddress
- OSInfo
- id
- node
- state
- uptime
type: object
type: object
type: object
served: true
Expand Down
34 changes: 32 additions & 2 deletions charts/kubemox/templates/crds/virtualmachines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,48 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.13.0
name: virtualmachines.proxmox.alperen.cloud
spec:
group: proxmox.alperen.cloud
names:
kind: VirtualMachine
listKind: VirtualMachineList
plural: virtualmachines
shortNames:
- vm
singular: virtualmachine
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- description: The node name
jsonPath: .spec.nodeName
name: Node
type: string
- description: The ID of the VM
jsonPath: .status.status.id
name: ID
type: integer
- description: The state of the VM
jsonPath: .status.status.state
name: State
type: string
- description: The uptime of the VM
jsonPath: .status.status.uptime
name: Uptime
type: string
- description: The IP address of the VM
jsonPath: .status.status.IPAddress
name: IP Address
type: string
- description: The OS information of the VM
jsonPath: .status.status.OSInfo
name: OS Info
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: VirtualMachine is the Schema for the virtualmachines API
Expand Down
Loading

0 comments on commit 198fb1e

Please sign in to comment.