🎨 style: auto format

This commit is contained in:
2026-01-16 12:32:36 +07:00
parent 5a6d3da26d
commit 98b685fe1b
18 changed files with 743 additions and 703 deletions
+56 -56
View File
@@ -1,11 +1,11 @@
import { NAMESPACE } from '../config/constants';
import { NAMESPACE } from "../config/constants";
/**
* Namespace definition
*/
export const minikuraNamespace = {
apiVersion: 'v1',
kind: 'Namespace',
apiVersion: "v1",
kind: "Namespace",
metadata: {
name: NAMESPACE,
},
@@ -15,10 +15,10 @@ export const minikuraNamespace = {
* Service account
*/
export const minikuraServiceAccount = {
apiVersion: 'v1',
kind: 'ServiceAccount',
apiVersion: "v1",
kind: "ServiceAccount",
metadata: {
name: 'minikura-operator',
name: "minikura-operator",
namespace: NAMESPACE,
},
};
@@ -27,41 +27,41 @@ export const minikuraServiceAccount = {
* Cluster role
*/
export const minikuraClusterRole = {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRole',
apiVersion: "rbac.authorization.k8s.io/v1",
kind: "ClusterRole",
metadata: {
name: 'minikura-operator-role',
name: "minikura-operator-role",
},
rules: [
{
apiGroups: [''],
resources: ['configmaps', 'services', 'secrets'],
verbs: ['get', 'list', 'watch', 'create', 'update', 'patch', 'delete'],
apiGroups: [""],
resources: ["configmaps", "services", "secrets"],
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"],
},
{
apiGroups: ['apps'],
resources: ['deployments', 'statefulsets'],
verbs: ['get', 'list', 'watch', 'create', 'update', 'patch', 'delete'],
apiGroups: ["apps"],
resources: ["deployments", "statefulsets"],
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"],
},
{
apiGroups: ['networking.k8s.io'],
resources: ['ingresses'],
verbs: ['get', 'list', 'watch', 'create', 'update', 'patch', 'delete'],
apiGroups: ["networking.k8s.io"],
resources: ["ingresses"],
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"],
},
{
apiGroups: ['apiextensions.k8s.io'],
resources: ['customresourcedefinitions'],
verbs: ['get', 'list', 'watch', 'create', 'update', 'patch', 'delete'],
apiGroups: ["apiextensions.k8s.io"],
resources: ["customresourcedefinitions"],
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"],
},
{
apiGroups: ['minikura.kirameki.cafe'],
resources: ['minecraftservers', 'velocityproxies'],
verbs: ['get', 'list', 'watch', 'create', 'update', 'patch', 'delete'],
apiGroups: ["minikura.kirameki.cafe"],
resources: ["minecraftservers", "velocityproxies"],
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"],
},
{
apiGroups: ['minikura.kirameki.cafe'],
resources: ['minecraftservers/status', 'velocityproxies/status'],
verbs: ['get', 'update', 'patch'],
apiGroups: ["minikura.kirameki.cafe"],
resources: ["minecraftservers/status", "velocityproxies/status"],
verbs: ["get", "update", "patch"],
},
],
};
@@ -70,22 +70,22 @@ export const minikuraClusterRole = {
* Cluster role binding
*/
export const minikuraClusterRoleBinding = {
apiVersion: 'rbac.authorization.k8s.io/v1',
kind: 'ClusterRoleBinding',
apiVersion: "rbac.authorization.k8s.io/v1",
kind: "ClusterRoleBinding",
metadata: {
name: 'minikura-operator-role-binding',
name: "minikura-operator-role-binding",
},
subjects: [
{
kind: 'ServiceAccount',
name: 'minikura-operator',
kind: "ServiceAccount",
name: "minikura-operator",
namespace: NAMESPACE,
},
],
roleRef: {
kind: 'ClusterRole',
name: 'minikura-operator-role',
apiGroup: 'rbac.authorization.k8s.io',
kind: "ClusterRole",
name: "minikura-operator-role",
apiGroup: "rbac.authorization.k8s.io",
},
};
@@ -93,70 +93,70 @@ export const minikuraClusterRoleBinding = {
* Deployment for the Minikura operator
*/
export const minikuraOperatorDeployment = {
apiVersion: 'apps/v1',
kind: 'Deployment',
apiVersion: "apps/v1",
kind: "Deployment",
metadata: {
name: 'minikura-operator',
name: "minikura-operator",
namespace: NAMESPACE,
},
spec: {
replicas: 1,
selector: {
matchLabels: {
app: 'minikura-operator',
app: "minikura-operator",
},
},
template: {
metadata: {
labels: {
app: 'minikura-operator',
app: "minikura-operator",
},
},
spec: {
serviceAccountName: 'minikura-operator',
serviceAccountName: "minikura-operator",
containers: [
{
name: 'operator',
image: '${REGISTRY_URL}/minikura-operator:latest',
name: "operator",
image: "${REGISTRY_URL}/minikura-operator:latest",
env: [
{
name: 'DATABASE_URL',
name: "DATABASE_URL",
valueFrom: {
secretKeyRef: {
name: 'minikura-operator-secrets',
key: 'DATABASE_URL',
name: "minikura-operator-secrets",
key: "DATABASE_URL",
},
},
},
{
name: 'KUBERNETES_NAMESPACE',
name: "KUBERNETES_NAMESPACE",
value: NAMESPACE,
},
{
name: 'USE_CRDS',
value: 'true',
name: "USE_CRDS",
value: "true",
},
],
resources: {
requests: {
memory: '256Mi',
cpu: '200m',
memory: "256Mi",
cpu: "200m",
},
limits: {
memory: '512Mi',
cpu: '500m',
memory: "512Mi",
cpu: "500m",
},
},
livenessProbe: {
exec: {
command: ['bun', '-e', "console.log('Health check')"],
command: ["bun", "-e", "console.log('Health check')"],
},
initialDelaySeconds: 30,
periodSeconds: 30,
},
readinessProbe: {
exec: {
command: ['bun', '-e', "console.log('Ready check')"],
command: ["bun", "-e", "console.log('Ready check')"],
},
initialDelaySeconds: 5,
periodSeconds: 10,
@@ -166,4 +166,4 @@ export const minikuraOperatorDeployment = {
},
},
},
};
};
+60 -60
View File
@@ -1,8 +1,8 @@
import { API_GROUP, API_VERSION, RESOURCE_TYPES } from '../config/constants';
import { API_GROUP, API_VERSION, RESOURCE_TYPES } from "../config/constants";
export const REVERSE_PROXY_SERVER_CRD = {
apiVersion: 'apiextensions.k8s.io/v1',
kind: 'CustomResourceDefinition',
apiVersion: "apiextensions.k8s.io/v1",
kind: "CustomResourceDefinition",
metadata: {
name: `${RESOURCE_TYPES.REVERSE_PROXY_SERVER.plural}.${API_GROUP}`,
},
@@ -15,67 +15,67 @@ export const REVERSE_PROXY_SERVER_CRD = {
storage: true,
schema: {
openAPIV3Schema: {
type: 'object',
type: "object",
properties: {
spec: {
type: 'object',
required: ['id', 'external_address', 'external_port'],
type: "object",
required: ["id", "external_address", "external_port"],
properties: {
id: {
type: 'string',
pattern: '^[a-zA-Z0-9-_]+$',
description: 'ID of the reverse proxy server',
type: "string",
pattern: "^[a-zA-Z0-9-_]+$",
description: "ID of the reverse proxy server",
},
description: {
type: 'string',
type: "string",
nullable: true,
description: 'Optional description of the server',
description: "Optional description of the server",
},
external_address: {
type: 'string',
description: 'External address of the proxy server',
type: "string",
description: "External address of the proxy server",
},
external_port: {
type: 'integer',
type: "integer",
minimum: 1,
maximum: 65535,
description: 'External port of the proxy server',
description: "External port of the proxy server",
},
listen_port: {
type: 'integer',
type: "integer",
minimum: 1,
maximum: 65535,
default: 25565,
nullable: true,
description: 'Port the proxy server listens on internally',
description: "Port the proxy server listens on internally",
},
type: {
type: 'string',
enum: ['VELOCITY', 'BUNGEECORD'],
default: 'VELOCITY',
type: "string",
enum: ["VELOCITY", "BUNGEECORD"],
default: "VELOCITY",
nullable: true,
description: 'Type of the reverse proxy server',
description: "Type of the reverse proxy server",
},
memory: {
type: 'string',
default: '512M',
type: "string",
default: "512M",
nullable: true,
description: 'Memory allocation for the server',
description: "Memory allocation for the server",
},
environmentVariables: {
type: 'array',
type: "array",
nullable: true,
items: {
type: 'object',
required: ['key', 'value'],
type: "object",
required: ["key", "value"],
properties: {
key: {
type: 'string',
description: 'Environment variable key',
type: "string",
description: "Environment variable key",
},
value: {
type: 'string',
description: 'Environment variable value',
type: "string",
description: "Environment variable value",
},
},
},
@@ -83,33 +83,33 @@ export const REVERSE_PROXY_SERVER_CRD = {
},
},
status: {
type: 'object',
type: "object",
nullable: true,
properties: {
phase: {
type: 'string',
enum: ['Pending', 'Running', 'Failed'],
description: 'Current phase of the server',
type: "string",
enum: ["Pending", "Running", "Failed"],
description: "Current phase of the server",
},
message: {
type: 'string',
type: "string",
nullable: true,
description: 'Detailed message about the current status',
description: "Detailed message about the current status",
},
apiKey: {
type: 'string',
type: "string",
nullable: true,
description: 'API key for server communication',
description: "API key for server communication",
},
internalId: {
type: 'string',
type: "string",
nullable: true,
description: 'Internal ID assigned by Minikura',
description: "Internal ID assigned by Minikura",
},
lastSyncedAt: {
type: 'string',
type: "string",
nullable: true,
description: 'Last time the server was synced with Kubernetes',
description: "Last time the server was synced with Kubernetes",
},
},
},
@@ -118,34 +118,34 @@ export const REVERSE_PROXY_SERVER_CRD = {
},
additionalPrinterColumns: [
{
name: 'Type',
type: 'string',
jsonPath: '.spec.type',
name: "Type",
type: "string",
jsonPath: ".spec.type",
},
{
name: 'External Address',
type: 'string',
jsonPath: '.spec.external_address',
name: "External Address",
type: "string",
jsonPath: ".spec.external_address",
},
{
name: 'External Port',
type: 'integer',
jsonPath: '.spec.external_port',
name: "External Port",
type: "integer",
jsonPath: ".spec.external_port",
},
{
name: 'Status',
type: 'string',
jsonPath: '.status.phase',
name: "Status",
type: "string",
jsonPath: ".status.phase",
},
{
name: 'Age',
type: 'date',
jsonPath: '.metadata.creationTimestamp',
name: "Age",
type: "date",
jsonPath: ".metadata.creationTimestamp",
},
],
},
],
scope: 'Namespaced',
scope: "Namespaced",
names: {
singular: RESOURCE_TYPES.REVERSE_PROXY_SERVER.singular,
plural: RESOURCE_TYPES.REVERSE_PROXY_SERVER.plural,
@@ -153,4 +153,4 @@ export const REVERSE_PROXY_SERVER_CRD = {
shortNames: RESOURCE_TYPES.REVERSE_PROXY_SERVER.shortNames,
},
},
};
};
+49 -49
View File
@@ -1,8 +1,8 @@
import { API_GROUP, API_VERSION, RESOURCE_TYPES } from '../config/constants';
import { API_GROUP, API_VERSION, RESOURCE_TYPES } from "../config/constants";
export const MINECRAFT_SERVER_CRD = {
apiVersion: 'apiextensions.k8s.io/v1',
kind: 'CustomResourceDefinition',
apiVersion: "apiextensions.k8s.io/v1",
kind: "CustomResourceDefinition",
metadata: {
name: `${RESOURCE_TYPES.MINECRAFT_SERVER.plural}.${API_GROUP}`,
},
@@ -15,53 +15,53 @@ export const MINECRAFT_SERVER_CRD = {
storage: true,
schema: {
openAPIV3Schema: {
type: 'object',
type: "object",
properties: {
spec: {
type: 'object',
required: ['id', 'type', 'listen_port'],
type: "object",
required: ["id", "type", "listen_port"],
properties: {
id: {
type: 'string',
pattern: '^[a-zA-Z0-9-_]+$',
description: 'ID of the Minecraft server',
type: "string",
pattern: "^[a-zA-Z0-9-_]+$",
description: "ID of the Minecraft server",
},
description: {
type: 'string',
type: "string",
nullable: true,
description: 'Optional description of the server',
description: "Optional description of the server",
},
listen_port: {
type: 'integer',
type: "integer",
minimum: 1,
maximum: 65535,
description: 'Port the server listens on',
description: "Port the server listens on",
},
type: {
type: 'string',
enum: ['STATEFUL', 'STATELESS'],
description: 'Type of the server',
type: "string",
enum: ["STATEFUL", "STATELESS"],
description: "Type of the server",
},
memory: {
type: 'string',
type: "string",
nullable: true,
default: '1G',
description: 'Memory allocation for the server',
default: "1G",
description: "Memory allocation for the server",
},
environmentVariables: {
type: 'array',
type: "array",
nullable: true,
items: {
type: 'object',
required: ['key', 'value'],
type: "object",
required: ["key", "value"],
properties: {
key: {
type: 'string',
description: 'Environment variable key',
type: "string",
description: "Environment variable key",
},
value: {
type: 'string',
description: 'Environment variable value',
type: "string",
description: "Environment variable value",
},
},
},
@@ -69,33 +69,33 @@ export const MINECRAFT_SERVER_CRD = {
},
},
status: {
type: 'object',
type: "object",
nullable: true,
properties: {
phase: {
type: 'string',
enum: ['Pending', 'Running', 'Failed'],
description: 'Current phase of the server',
type: "string",
enum: ["Pending", "Running", "Failed"],
description: "Current phase of the server",
},
message: {
type: 'string',
type: "string",
nullable: true,
description: 'Detailed message about the current status',
description: "Detailed message about the current status",
},
apiKey: {
type: 'string',
type: "string",
nullable: true,
description: 'API key for server communication',
description: "API key for server communication",
},
internalId: {
type: 'string',
type: "string",
nullable: true,
description: 'Internal ID assigned by Minikura',
description: "Internal ID assigned by Minikura",
},
lastSyncedAt: {
type: 'string',
type: "string",
nullable: true,
description: 'Last time the server was synced with Kubernetes',
description: "Last time the server was synced with Kubernetes",
},
},
},
@@ -104,24 +104,24 @@ export const MINECRAFT_SERVER_CRD = {
},
additionalPrinterColumns: [
{
name: 'Type',
type: 'string',
jsonPath: '.spec.type',
name: "Type",
type: "string",
jsonPath: ".spec.type",
},
{
name: 'Status',
type: 'string',
jsonPath: '.status.phase',
name: "Status",
type: "string",
jsonPath: ".status.phase",
},
{
name: 'Age',
type: 'date',
jsonPath: '.metadata.creationTimestamp',
name: "Age",
type: "date",
jsonPath: ".metadata.creationTimestamp",
},
],
},
],
scope: 'Namespaced',
scope: "Namespaced",
names: {
singular: RESOURCE_TYPES.MINECRAFT_SERVER.singular,
plural: RESOURCE_TYPES.MINECRAFT_SERVER.plural,
@@ -129,4 +129,4 @@ export const MINECRAFT_SERVER_CRD = {
shortNames: RESOURCE_TYPES.MINECRAFT_SERVER.shortNames,
},
},
};
};