-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add clusterclass support for Power VS
- Loading branch information
1 parent
bd2090a
commit 848d42b
Showing
11 changed files
with
882 additions
and
0 deletions.
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
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,62 @@ | ||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1beta1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" | ||
) | ||
|
||
// IBMPowerVSClusterTemplateSpec defines the desired state of IBMPowerVSClusterTemplate. | ||
type IBMPowerVSClusterTemplateSpec struct { | ||
Template IBMPowerVSClusterTemplateResource `json:"template"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=ibmpowervsclustertemplates,scope=Namespaced,categories=cluster-api,shortName=ibmpowervsct | ||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of IBMPowerVSClusterTemplate" | ||
|
||
// IBMPowerVSClusterTemplate is the schema for IBM Power VS Kubernetes Cluster Templates. | ||
type IBMPowerVSClusterTemplate struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec IBMPowerVSClusterTemplateSpec `json:"spec,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// IBMPowerVSClusterTemplateList contains a list of IBMPowerVSClusterTemplate. | ||
type IBMPowerVSClusterTemplateList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []IBMPowerVSClusterTemplate `json:"items"` | ||
} | ||
|
||
// IBMPowerVSClusterTemplateResource describes the data needed to create an IBMPowerVSCluster from a template. | ||
type IBMPowerVSClusterTemplateResource struct { | ||
// Standard object's metadata. | ||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata | ||
// +optional | ||
ObjectMeta capiv1beta1.ObjectMeta `json:"metadata,omitempty"` | ||
Spec IBMPowerVSClusterSpec `json:"spec"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&IBMPowerVSClusterTemplate{}, &IBMPowerVSClusterTemplateList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
130 changes: 130 additions & 0 deletions
130
config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclustertemplates.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,130 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.9.2 | ||
creationTimestamp: null | ||
name: ibmpowervsclustertemplates.infrastructure.cluster.x-k8s.io | ||
spec: | ||
group: infrastructure.cluster.x-k8s.io | ||
names: | ||
categories: | ||
- cluster-api | ||
kind: IBMPowerVSClusterTemplate | ||
listKind: IBMPowerVSClusterTemplateList | ||
plural: ibmpowervsclustertemplates | ||
shortNames: | ||
- ibmpowervsct | ||
singular: ibmpowervsclustertemplate | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- description: Time duration since creation of IBMPowerVSClusterTemplate | ||
jsonPath: .metadata.creationTimestamp | ||
name: Age | ||
type: date | ||
name: v1beta1 | ||
schema: | ||
openAPIV3Schema: | ||
description: IBMPowerVSClusterTemplate is the schema for IBM Power VS Kubernetes | ||
Cluster Templates. | ||
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: IBMPowerVSClusterTemplateSpec defines the desired state of | ||
IBMPowerVSClusterTemplate. | ||
properties: | ||
template: | ||
description: IBMPowerVSClusterTemplateResource describes the data | ||
needed to create an IBMPowerVSCluster from a template. | ||
properties: | ||
metadata: | ||
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata' | ||
properties: | ||
annotations: | ||
additionalProperties: | ||
type: string | ||
description: 'Annotations is an unstructured key value map | ||
stored with a resource that may be set by external tools | ||
to store and retrieve arbitrary metadata. They are not queryable | ||
and should be preserved when modifying objects. More info: | ||
http://kubernetes.io/docs/user-guide/annotations' | ||
type: object | ||
labels: | ||
additionalProperties: | ||
type: string | ||
description: 'Map of string keys and values that can be used | ||
to organize and categorize (scope and select) objects. May | ||
match selectors of replication controllers and services. | ||
More info: http://kubernetes.io/docs/user-guide/labels' | ||
type: object | ||
type: object | ||
spec: | ||
description: IBMPowerVSClusterSpec defines the desired state of | ||
IBMPowerVSCluster. | ||
properties: | ||
controlPlaneEndpoint: | ||
description: ControlPlaneEndpoint represents the endpoint | ||
used to communicate with the control plane. | ||
properties: | ||
host: | ||
description: The hostname on which the API server is serving. | ||
type: string | ||
port: | ||
description: The port on which the API server is serving. | ||
format: int32 | ||
type: integer | ||
required: | ||
- host | ||
- port | ||
type: object | ||
network: | ||
description: Network is the reference to the Network to use | ||
for this cluster. | ||
properties: | ||
id: | ||
description: ID of resource | ||
minLength: 1 | ||
type: string | ||
name: | ||
description: Name of resource | ||
minLength: 1 | ||
type: string | ||
regex: | ||
description: Regular expression to match resource, In | ||
case of multiple resources matches the provided regular | ||
expression the first matched resource will be selected | ||
minLength: 1 | ||
type: string | ||
type: object | ||
serviceInstanceID: | ||
description: ServiceInstanceID is the id of the power cloud | ||
instance where the vsi instance will get deployed. | ||
minLength: 1 | ||
type: string | ||
required: | ||
- network | ||
- serviceInstanceID | ||
type: object | ||
required: | ||
- spec | ||
type: object | ||
required: | ||
- template | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: {} |
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
8 changes: 8 additions & 0 deletions
8
config/crd/patches/cainjection_in_ibmpowervsclustertemplates.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,8 @@ | ||
# The following patch adds a directive for certmanager to inject CA into the CRD | ||
# CRD conversion requires k8s 1.13 or later. | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) | ||
name: ibmpowervsclustertemplates.infrastructure.cluster.x-k8s.io |
17 changes: 17 additions & 0 deletions
17
config/crd/patches/webhook_in_ibmpowervsclustertemplates.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,17 @@ | ||
# The following patch enables conversion webhook for CRD | ||
# CRD conversion requires k8s 1.13 or later. | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: ibmpowervsclustertemplates.infrastructure.cluster.x-k8s.io | ||
spec: | ||
conversion: | ||
strategy: Webhook | ||
webhookClientConfig: | ||
# this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, | ||
# but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) | ||
caBundle: Cg== | ||
service: | ||
namespace: system | ||
name: webhook-service | ||
path: /convert |
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,24 @@ | ||
# permissions for end users to edit ibmpowervsclustertemplates. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: ibmpowervsclustertemplate-editor-role | ||
rules: | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- ibmpowervsclustertemplates | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- ibmpowervsclustertemplates/status | ||
verbs: | ||
- get |
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,20 @@ | ||
# permissions for end users to view ibmpowervsclustertemplates. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: ibmpowervsclustertemplate-viewer-role | ||
rules: | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- ibmpowervsclustertemplates | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- ibmpowervsclustertemplates/status | ||
verbs: | ||
- get |
Oops, something went wrong.