Skip to content

Commit

Permalink
Add HMCTemplate API fields
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Pavlov <[email protected]>
  • Loading branch information
Kshatrix committed May 29, 2024
1 parent 3966197 commit 614ef64
Show file tree
Hide file tree
Showing 6 changed files with 359 additions and 16 deletions.
25 changes: 15 additions & 10 deletions api/v1alpha1/hmctemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,27 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// HMCTemplateSpec defines the desired state of HMCTemplate
type HMCTemplateSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of HMCTemplate. Edit hmctemplate_types.go to remove/update
Foo string `json:"foo,omitempty"`
// Provider specifies a CAPI provider associated with the template.
// +kubebuilder:validation:Enum=aws
// +kubebuilder:validation:Required
Provider string `json:"provider"`
// HelmChartURL is a URL of the helm chart representing the template.
// +kubebuilder:validation:Required
HelmChartURL string `json:"helmChartURL"`
}

// HMCTemplateStatus defines the observed state of HMCTemplate
type HMCTemplateStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Descriptions contains information about the template.
// +optional
Description string `json:"description"`
// Valid indicates whether the template passed validation or not.
Valid bool `json:"valid"`
// ValidationError provides information regarding issues encountered during template validation.
// +optional
ValidationError string `json:"validationError"`
}

//+kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: hmcdeployments.hmc.mirantis.com.hmc.mirantis.com
spec:
group: hmc.mirantis.com.hmc.mirantis.com
names:
kind: HMCDeployment
listKind: HMCDeploymentList
plural: hmcdeployments
singular: hmcdeployment
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: HMCDeployment is the Schema for the hmcdeployments API
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: HMCDeploymentSpec defines the desired state of HMCDeployment
properties:
foo:
description: Foo is an example field of HMCDeployment. Edit hmcdeployment_types.go
to remove/update
type: string
type: object
status:
description: HMCDeploymentStatus defines the observed state of HMCDeployment
type: object
type: object
served: true
storage: true
subresources:
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: hmcmanagements.hmc.mirantis.com.hmc.mirantis.com
spec:
group: hmc.mirantis.com.hmc.mirantis.com
names:
kind: HMCManagement
listKind: HMCManagementList
plural: hmcmanagements
singular: hmcmanagement
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: HMCManagement is the Schema for the hmcmanagements API
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: HMCManagementSpec defines the desired state of HMCManagement
properties:
foo:
description: Foo is an example field of HMCManagement. Edit hmcmanagement_types.go
to remove/update
type: string
type: object
status:
description: HMCManagementStatus defines the observed state of HMCManagement
type: object
type: object
served: true
storage: true
subresources:
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: hmcproviderawses.hmc.mirantis.com.hmc.mirantis.com
spec:
group: hmc.mirantis.com.hmc.mirantis.com
names:
kind: HMCProviderAWS
listKind: HMCProviderAWSList
plural: hmcproviderawses
singular: hmcprovideraws
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: HMCProviderAWS is the Schema for the hmcprovideraws API
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: HMCProviderAWSSpec defines the desired state of HMCProviderAWS
properties:
foo:
description: Foo is an example field of HMCProviderAWS. Edit hmcprovideraws_types.go
to remove/update
type: string
type: object
status:
description: HMCProviderAWSStatus defines the observed state of HMCProviderAWS
type: object
type: object
served: true
storage: true
subresources:
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: hmctemplates.hmc.mirantis.com.hmc.mirantis.com
spec:
group: hmc.mirantis.com.hmc.mirantis.com
names:
kind: HMCTemplate
listKind: HMCTemplateList
plural: hmctemplates
singular: hmctemplate
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: HMCTemplate is the Schema for the hmctemplates API
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: HMCTemplateSpec defines the desired state of HMCTemplate
properties:
helmChartURL:
description: HelmChartURL is a URL of the helm chart representing
the template.
type: string
provider:
description: Provider specifies a CAPI provider associated with the
template.
enum:
- aws
type: string
required:
- helmChartURL
- provider
type: object
status:
description: HMCTemplateStatus defines the observed state of HMCTemplate
properties:
description:
description: Descriptions contains information about the template.
type: string
valid:
description: Valid indicates whether the template passed validation
or not.
type: boolean
validationError:
description: ValidationError provides information regarding issues
encountered during template validation.
type: string
required:
- valid
type: object
type: object
served: true
storage: true
subresources:
status: {}
111 changes: 105 additions & 6 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,110 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: hmc
app.kubernetes.io/managed-by: kustomize
name: manager-role
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmcdeployments
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmcdeployments/finalizers
verbs:
- update
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmcdeployments/status
verbs:
- get
- patch
- update
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmcmanagements
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmcmanagements/finalizers
verbs:
- update
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmcmanagements/status
verbs:
- get
- patch
- update
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmcprovideraws
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmcprovideraws/finalizers
verbs:
- update
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmcprovideraws/status
verbs:
- get
- patch
- update
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmctemplates
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmctemplates/finalizers
verbs:
- update
- apiGroups:
- hmc.mirantis.com.hmc.mirantis.com
resources:
- hmctemplates/status
verbs:
- get
- patch
- update

0 comments on commit 614ef64

Please sign in to comment.