-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CAPD: add DockerClusterTemplate type
- Loading branch information
Yuvaraj Kakaraparthi
committed
Jul 8, 2021
1 parent
37c862b
commit b202ff0
Showing
9 changed files
with
323 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
55 changes: 55 additions & 0 deletions
55
test/infrastructure/docker/api/v1alpha4/dockerclustertemplate_types.go
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,55 @@ | ||
/* | ||
Copyright 2021 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 v1alpha4 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// DockerClusterTemplateSpec defines the desired state of DockerClusterTemplate. | ||
type DockerClusterTemplateSpec struct { | ||
Template DockerClusterTemplateResource `json:"template"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// DockerClusterTemplate is the Schema for the dockerclustertemplates API. | ||
type DockerClusterTemplate struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec DockerClusterTemplateSpec `json:"spec,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=dockerclustertemplates,scope=Namespaced,categories=cluster-api | ||
|
||
// DockerClusterTemplateList contains a list of DockerClusterTemplate. | ||
type DockerClusterTemplateList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []DockerClusterTemplate `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&DockerClusterTemplate{}, &DockerClusterTemplateList{}) | ||
} | ||
|
||
// DockerClusterTemplateResource describes the data needed to create a DockerCluster from a template. | ||
type DockerClusterTemplateResource struct { | ||
Spec DockerClusterSpec `json:"spec"` | ||
} |
90 changes: 90 additions & 0 deletions
90
test/infrastructure/docker/api/v1alpha4/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
103 changes: 103 additions & 0 deletions
103
...cture/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclustertemplates.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,103 @@ | ||
|
||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.6.1 | ||
creationTimestamp: null | ||
name: dockerclustertemplates.infrastructure.cluster.x-k8s.io | ||
spec: | ||
group: infrastructure.cluster.x-k8s.io | ||
names: | ||
kind: DockerClusterTemplate | ||
listKind: DockerClusterTemplateList | ||
plural: dockerclustertemplates | ||
singular: dockerclustertemplate | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha4 | ||
schema: | ||
openAPIV3Schema: | ||
description: DockerClusterTemplate is the Schema for the dockerclustertemplates | ||
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: DockerClusterTemplateSpec defines the desired state of DockerClusterTemplate. | ||
properties: | ||
template: | ||
description: DockerClusterTemplateResource describes the data needed | ||
to create a DockerCluster from a template. | ||
properties: | ||
spec: | ||
description: DockerClusterSpec defines the desired state of DockerCluster. | ||
properties: | ||
controlPlaneEndpoint: | ||
description: ControlPlaneEndpoint represents the endpoint | ||
used to communicate with the control plane. | ||
properties: | ||
host: | ||
description: Host is the hostname on which the API server | ||
is serving. | ||
type: string | ||
port: | ||
description: Port is the port on which the API server | ||
is serving. | ||
type: integer | ||
required: | ||
- host | ||
- port | ||
type: object | ||
failureDomains: | ||
additionalProperties: | ||
description: FailureDomainSpec is the Schema for Cluster | ||
API failure domains. It allows controllers to understand | ||
how many failure domains a cluster can optionally span | ||
across. | ||
properties: | ||
attributes: | ||
additionalProperties: | ||
type: string | ||
description: Attributes is a free form map of attributes | ||
an infrastructure provider might use or require. | ||
type: object | ||
controlPlane: | ||
description: ControlPlane determines if this failure | ||
domain is suitable for use by control plane machines. | ||
type: boolean | ||
type: object | ||
description: FailureDomains are not usulaly defined on the | ||
spec. The docker provider is special since failure domains | ||
don't mean anything in a local docker environment. Instead, | ||
the docker cluster controller will simply copy these into | ||
the Status and allow the Cluster API controllers to do what | ||
they will with the defined failure domains. | ||
type: object | ||
type: object | ||
required: | ||
- spec | ||
type: object | ||
required: | ||
- template | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
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
test/infrastructure/docker/config/crd/patches/cainjection_in_dockerclustertemplates.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: dockerclustertemplates.infrastructure.cluster.x-k8s.io |
17 changes: 17 additions & 0 deletions
17
test/infrastructure/docker/config/crd/patches/webhook_in_dockerclustertemplates.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: dockerclustertemplates.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 |
24 changes: 24 additions & 0 deletions
24
test/infrastructure/docker/config/rbac/dockerclustertemplate_editor_role.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,24 @@ | ||
# permissions for end users to edit dockerclustertemplates. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: dockerclustertemplate-editor-role | ||
rules: | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- dockerclustertemplates | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- dockerclustertemplates/status | ||
verbs: | ||
- get |
20 changes: 20 additions & 0 deletions
20
test/infrastructure/docker/config/rbac/dockerclustertemplate_viewer_role.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,20 @@ | ||
# permissions for end users to view dockerclustertemplates. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: dockerclustertemplate-viewer-role | ||
rules: | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- dockerclustertemplates | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- infrastructure.cluster.x-k8s.io | ||
resources: | ||
- dockerclustertemplates/status | ||
verbs: | ||
- get |