-
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.
- Loading branch information
Showing
10 changed files
with
774 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 v1beta2 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" | ||
) | ||
|
||
// IBMVPCClusterTemplateSpec defines the desired state of IBMVPCClusterTemplate. | ||
type IBMVPCClusterTemplateSpec struct { | ||
Template IBMVPCClusterTemplateResource `json:"template,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=ibmvpcclustertemplates,scope=Namespaced,categories=cluster-api,shortName=ibmvpcct | ||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of IBMVPCClusterTemplate" | ||
|
||
// IBMVPCClusterTemplate is the Schema for the ibmvpcclustertemplates API. | ||
type IBMVPCClusterTemplate struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec IBMVPCClusterTemplateSpec `json:"spec,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// IBMVPCClusterTemplateList contains a list of IBMVPCClusterTemplate. | ||
type IBMVPCClusterTemplateList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []IBMVPCClusterTemplate `json:"items"` | ||
} | ||
|
||
// IBMVPCClusterTemplateResource describes the data needed to create an IBMVPCCluster from a template. | ||
type IBMVPCClusterTemplateResource 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 IBMVPCClusterSpec `json:"spec"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&IBMVPCClusterTemplate{}, &IBMVPCClusterTemplateList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
124 changes: 124 additions & 0 deletions
124
config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclustertemplates.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,124 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.13.0 | ||
name: ibmvpcclustertemplates.infrastructure.cluster.x-k8s.io | ||
spec: | ||
group: infrastructure.cluster.x-k8s.io | ||
names: | ||
categories: | ||
- cluster-api | ||
kind: IBMVPCClusterTemplate | ||
listKind: IBMVPCClusterTemplateList | ||
plural: ibmvpcclustertemplates | ||
shortNames: | ||
- ibmvpcct | ||
singular: ibmvpcclustertemplate | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- description: Time duration since creation of IBMVPCClusterTemplate | ||
jsonPath: .metadata.creationTimestamp | ||
name: Age | ||
type: date | ||
name: v1beta2 | ||
schema: | ||
openAPIV3Schema: | ||
description: IBMVPCClusterTemplate is the Schema for the ibmvpcclustertemplates | ||
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: IBMVPCClusterTemplateSpec defines the desired state of IBMVPCClusterTemplate. | ||
properties: | ||
template: | ||
description: IBMVPCClusterTemplateResource describes the data needed | ||
to create an IBMVPCCluster 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: IBMVPCClusterSpec defines the desired state of IBMVPCCluster. | ||
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 | ||
controlPlaneLoadBalancer: | ||
description: ControlPlaneLoadBalancer is optional configuration | ||
for customizing control plane behavior. | ||
properties: | ||
name: | ||
description: Name sets the name of the VPC load balancer. | ||
maxLength: 63 | ||
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$ | ||
type: string | ||
type: object | ||
region: | ||
description: The IBM Cloud Region the cluster lives in. | ||
type: string | ||
resourceGroup: | ||
description: The VPC resources should be created under the | ||
resource group. | ||
type: string | ||
vpc: | ||
description: The Name of VPC. | ||
type: string | ||
zone: | ||
description: The Name of availability zone. | ||
type: string | ||
required: | ||
- region | ||
- resourceGroup | ||
type: object | ||
required: | ||
- spec | ||
type: object | ||
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_ibmvpcclustertemplates.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: ibmvpcclustertemplates.infrastructure.cluster.x-k8s.io |
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: ibmvpcclustertemplates.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 ibmvpcclustertemplates. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: ibmvpcclustertemplate-editor-role | ||
rules: | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- ibmvpcclustertemplates | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- ibmvpcclustertemplates/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 ibmvpcclustertemplates. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: ibmvpcclustertemplate-viewer-role | ||
rules: | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- ibmvpcclustertemplates | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- ibmvpcclustertemplates/status | ||
verbs: | ||
- get |
Oops, something went wrong.