This commit is contained in:
2025-03-25 23:39:38 +02:00
parent 567935bf7f
commit ae058f92e6
23 changed files with 1395 additions and 44 deletions

View File

@@ -0,0 +1,131 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.1
name: servermanagers.server-manager.acooldomain.co
spec:
group: server-manager.acooldomain.co
names:
kind: ServerManager
listKind: ServerManagerList
plural: servermanagers
singular: servermanager
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: ServerManager is the Schema for the servermanagers 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: ServerManagerSpec defines the desired state of ServerManager
properties:
browser:
properties:
image:
type: string
"on":
type: boolean
port:
properties:
port:
format: int32
type: integer
protocol:
description: Protocol defines network protocols supported
for things like container ports.
type: string
type: object
type: object
id:
type: string
server:
description: |-
INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Important: Run "make" to regenerate code after modifying this file
properties:
args:
items:
type: string
type: array
command:
items:
type: string
type: array
image:
type: string
"on":
type: boolean
ports:
items:
properties:
port:
format: int32
type: integer
protocol:
description: Protocol defines network protocols supported
for things like container ports.
type: string
type: object
type: array
working_dir:
type: string
type: object
type: object
status:
description: ServerManagerStatus defines the observed state of ServerManager
properties:
browser:
properties:
running:
type: boolean
url:
type: string
type: object
server:
description: |-
INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
Important: Run "make" to regenerate code after modifying this file
properties:
domain:
type: string
host_ports:
items:
properties:
port:
format: int32
type: integer
protocol:
description: Protocol defines network protocols supported
for things like container ports.
type: string
type: object
type: array
running:
type: boolean
type: object
type: object
type: object
served: true
storage: true
subresources:
status: {}

View File

@@ -0,0 +1,22 @@
# 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/server-manager.acooldomain.co_servermanagers.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_servermanagers.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

@@ -0,0 +1,19 @@
# 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: kubernetes-operator-
# someName: someValue
resources:
#- ../crd
- ../crd
- ../rbac
- ../manager
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in

View File

@@ -18,3 +18,10 @@ resources:
- metrics_auth_role.yaml
- metrics_auth_role_binding.yaml
- metrics_reader_role.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.
- servermanager_editor_role.yaml
- servermanager_viewer_role.yaml

View File

@@ -1,11 +1,32 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: kubernetes-operator
app.kubernetes.io/managed-by: kustomize
name: manager-role
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
- apiGroups:
- server-manager.acooldomain.co
resources:
- servermanagers
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- server-manager.acooldomain.co
resources:
- servermanagers/finalizers
verbs:
- update
- apiGroups:
- server-manager.acooldomain.co
resources:
- servermanagers/status
verbs:
- get
- patch
- update

View File

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

View File

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

View File

@@ -0,0 +1,4 @@
## Append samples of your project ##
resources:
- server-manager_v1alpha1_servermanager.yaml
# +kubebuilder:scaffold:manifestskustomizesamples

View File

@@ -0,0 +1,9 @@
apiVersion: server-manager.acooldomain.co/v1alpha1
kind: ServerManager
metadata:
labels:
app.kubernetes.io/name: kubernetes-operator
app.kubernetes.io/managed-by: kustomize
name: servermanager-sample
spec:
# TODO(user): Add fields here