Skip to content

Commit

Permalink
Add new CRD for managing Compatibility Matrix (#153)
Browse files Browse the repository at this point in the history
* Add new CRD and Controller for Updating the Compatibility-matrix

* Update Makefile

* Update vdo-spec

* Add the usage guide for new CRD

* use latest go version
  • Loading branch information
asifdxtreme authored Mar 13, 2023
1 parent b4240e3 commit c4fca2b
Show file tree
Hide file tree
Showing 12 changed files with 405 additions and 7 deletions.
33 changes: 33 additions & 0 deletions api/v1alpha1/compatibilityconfig_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// CompatibilityConfig is the Schema for the Compatibility Matrix Configuration
type CompatibilityConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec CompatibilitySpec `json:"spec,omitempty"`
}

// CompatibilitySpec is the Schema to get MatrixURL
type CompatibilitySpec struct {
MatrixURL string `json:"matrixURL,omitempty"`
}

//+kubebuilder:object:root=true

// CompatibilityConfigList contains a list of CompatibilityConfig
type CompatibilityConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CompatibilityConfig `json:"items"`
}

func init() {
SchemeBuilder.Register(&CompatibilityConfig{}, &CompatibilityConfigList{})
}
73 changes: 73 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

81 changes: 78 additions & 3 deletions artifacts/vanilla/vdo-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,55 @@ metadata:
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
labels:
vdo.vmware.com/managed-by: vdo
name: compatibilityconfigs.vdo.vmware.com
spec:
group: vdo.vmware.com
names:
kind: CompatibilityConfig
listKind: CompatibilityConfigList
plural: compatibilityconfigs
singular: compatibilityconfig
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: CompatibilityConfig is the Schema for the Compatibility Matrix Configuration
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: CompatibilitySpec is the Schema to get MatrixURL
properties:
matrixURL:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
Expand Down Expand Up @@ -445,6 +494,32 @@ rules:
- get
- list
- watch
- apiGroups:
- vdo.vmware.com
resources:
- compatibilityconfigs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- vdo.vmware.com
resources:
- compatibilityconfigs/finalizers
verbs:
- update
- apiGroups:
- vdo.vmware.com
resources:
- compatibilityconfigs/status
verbs:
- get
- patch
- update
- apiGroups:
- vdo.vmware.com
resources:
Expand Down Expand Up @@ -593,7 +668,7 @@ data:
health:
healthProbeBindAddress: :8081
metrics:
bindAddress: 127.0.0.1:8080
bindAddress: 127.0.0.1:8089
webhook:
port: 9443
leaderElection:
Expand Down Expand Up @@ -661,7 +736,7 @@ spec:
name: https
- args:
- --health-probe-bind-address=:8081
- --metrics-bind-address=127.0.0.1:8080
- --metrics-bind-address=127.0.0.1:8089
- --leader-elect
command:
- /manager
Expand All @@ -687,7 +762,7 @@ spec:
configMapKeyRef:
key: auto-upgrade
name: compat-matrix-config
image: projects.registry.vmware.com/vsphere_kubernetes_driver_operator/vdo@sha256:a89deecd215d19f40ddd140a12bc34416e24839fab72ebf8b11d855a30e05fce
image: vmware.com/vdo:0.2.0-6-g6bea2be
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
Expand Down
53 changes: 53 additions & 0 deletions config/crd/bases/vdo.vmware.com_compatibilityconfigs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: compatibilityconfigs.vdo.vmware.com
spec:
group: vdo.vmware.com
names:
kind: CompatibilityConfig
listKind: CompatibilityConfigList
plural: compatibilityconfigs
singular: compatibilityconfig
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: CompatibilityConfig is the Schema for the Compatibility Matrix
Configuration
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: CompatibilitySpec is the Schema to get MatrixURL
properties:
matrixURL:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
2 changes: 2 additions & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ commonLabels:
resources:
- bases/vdo.vmware.com_vspherecloudconfigs.yaml
- bases/vdo.vmware.com_vdoconfigs.yaml
- bases/vdo.vmware.com_compatibilityconfigs.yaml

#+kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
Expand Down
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ kind: Kustomization
images:
- name: controller
newName: vmware.com/vdo
newTag: b1fe3ba
newTag: 0.2.0-6-g6bea2be
26 changes: 26 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,32 @@ rules:
- get
- list
- watch
- apiGroups:
- vdo.vmware.com
resources:
- compatibilityconfigs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- vdo.vmware.com
resources:
- compatibilityconfigs/finalizers
verbs:
- update
- apiGroups:
- vdo.vmware.com
resources:
- compatibilityconfigs/status
verbs:
- get
- patch
- update
- apiGroups:
- vdo.vmware.com
resources:
Expand Down
Loading

0 comments on commit c4fca2b

Please sign in to comment.