Init kubebuilder tutorial

This commit is contained in:
Nicolas CARON
2024-06-07 13:44:17 +02:00
parent 795d6f256c
commit 1da5f03e8e
21 changed files with 6 additions and 652 deletions

View File

@@ -1,24 +0,0 @@
# This kustomization.yaml is not intended to be run by itself,
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/webapp.localhost_operator-tests.yaml
- bases/webapp.localhost_operators.yaml
# +kubebuilder:scaffold:crdkustomizeresource
patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
# +kubebuilder:scaffold:crdkustomizewebhookpatch
# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- path: patches/cainjection_in_operator-tests.yaml
#- path: patches/cainjection_in_operators.yaml
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
# [WEBHOOK] To enable webhook, uncomment the following section
# the following config is for teaching kustomize how to do kustomization for CRDs.
#configurations:
#- kustomizeconfig.yaml

View File

@@ -1,19 +0,0 @@
# This file is for teaching kustomize how to substitute name and namespace reference in CRD
nameReference:
- kind: Service
version: v1
fieldSpecs:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/name
namespace:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/namespace
create: false
varReference:
- path: metadata/annotations

View File

@@ -15,7 +15,7 @@ namePrefix: operator-test-
# someName: someValue
resources:
- ../crd
#- ../crd
- ../rbac
- ../manager
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in

View File

@@ -9,12 +9,3 @@ resources:
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml
# For each CRD, "Editor" and "Viewer" roles are scaffolded by
# default, aiding admins in cluster management. Those roles are
# not used by the Project itself. You can comment the following lines
# if you do not want those helpers be installed with your Project.
- operator_editor_role.yaml
- operator_viewer_role.yaml
- operator-test_editor_role.yaml
- operator-test_viewer_role.yaml

View File

@@ -1,27 +0,0 @@
# permissions for end users to edit operator-tests.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: operator-test
app.kubernetes.io/managed-by: kustomize
name: operator-test-editor-role
rules:
- apiGroups:
- webapp.localhost
resources:
- operator-tests
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- webapp.localhost
resources:
- operator-tests/status
verbs:
- get

View File

@@ -1,23 +0,0 @@
# permissions for end users to view operator-tests.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: operator-test
app.kubernetes.io/managed-by: kustomize
name: operator-test-viewer-role
rules:
- apiGroups:
- webapp.localhost
resources:
- operator-tests
verbs:
- get
- list
- watch
- apiGroups:
- webapp.localhost
resources:
- operator-tests/status
verbs:
- get

View File

@@ -1,27 +0,0 @@
# permissions for end users to edit operators.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: operator-test
app.kubernetes.io/managed-by: kustomize
name: operator-editor-role
rules:
- apiGroups:
- webapp.localhost
resources:
- operators
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- webapp.localhost
resources:
- operators/status
verbs:
- get

View File

@@ -1,23 +0,0 @@
# permissions for end users to view operators.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: operator-test
app.kubernetes.io/managed-by: kustomize
name: operator-viewer-role
rules:
- apiGroups:
- webapp.localhost
resources:
- operators
verbs:
- get
- list
- watch
- apiGroups:
- webapp.localhost
resources:
- operators/status
verbs:
- get

View File

@@ -1,5 +0,0 @@
## Append samples of your project ##
resources:
- webapp_v1_operator-test.yaml
- webapp_v1_operator.yaml
# +kubebuilder:scaffold:manifestskustomizesamples

View File

@@ -1,9 +0,0 @@
apiVersion: webapp.localhost/v1
kind: Operator-test
metadata:
labels:
app.kubernetes.io/name: operator-test
app.kubernetes.io/managed-by: kustomize
name: operator-test-sample
spec:
# TODO(user): Add fields here

View File

@@ -1,9 +0,0 @@
apiVersion: webapp.localhost/v1
kind: Operator
metadata:
labels:
app.kubernetes.io/name: operator-test
app.kubernetes.io/managed-by: kustomize
name: operator-sample
spec:
# TODO(user): Add fields here