Skip to content

Commit

Permalink
modify the name and fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
yxxchange committed Jul 4, 2023
1 parent 0950989 commit 970bcc4
Show file tree
Hide file tree
Showing 25 changed files with 273 additions and 191 deletions.
2 changes: 1 addition & 1 deletion controllers/cloud/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gcr.dockerproxy.com/distroless/static:nonroot
FROM gcr.io/distroless/static:nonroot
ARG TARGETARCH

WORKDIR /
Expand Down
2 changes: 1 addition & 1 deletion controllers/cloud/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ resources:
controller: true
domain: sealos.io
group: cloud
kind: CloudClient
kind: Launcher
path: github.com/labring/sealos/controllers/cloud/api/v1
version: v1
version: "3"
24 changes: 12 additions & 12 deletions controllers/cloud/api/v1/cloudclient_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,39 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// CloudClientSpec defines the desired state of CloudClient
type CloudClientSpec struct {
// LauncherSpec defines the desired state of Launcher
type LauncherSpec struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
}

// CloudClientStatus defines the observed state of CloudClient
type CloudClientStatus struct {
// LauncherStatus defines the observed state of Launcher
type LauncherStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// CloudClient is the Schema for the cloudclients API
type CloudClient struct {
// Launcher is the Schema for the launchers API
type Launcher struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CloudClientSpec `json:"spec,omitempty"`
Status CloudClientStatus `json:"status,omitempty"`
Spec LauncherSpec `json:"spec,omitempty"`
Status LauncherStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// CloudClientList contains a list of CloudClient
type CloudClientList struct {
// LauncherList contains a list of Launcher
type LauncherList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CloudClient `json:"items"`
Items []Launcher `json:"items"`
}

func init() {
SchemeBuilder.Register(&CloudClient{}, &CloudClientList{})
SchemeBuilder.Register(&Launcher{}, &LauncherList{})
}
38 changes: 19 additions & 19 deletions controllers/cloud/api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions controllers/cloud/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "License")
os.Exit(1)
}
if err = (&controller.CloudClientReconciler{
if err = (&controller.LauncherReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "CloudClient")
setupLog.Error(err, "unable to create controller", "controller", "Launcher")
os.Exit(1)
}
//+kubebuilder:scaffold:builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: cloudclients.cloud.sealos.io
name: launchers.cloud.sealos.io
spec:
group: cloud.sealos.io
names:
kind: CloudClient
listKind: CloudClientList
plural: cloudclients
singular: cloudclient
kind: Launcher
listKind: LauncherList
plural: launchers
singular: launcher
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: CloudClient is the Schema for the cloudclients API
description: Launcher is the Schema for the launchers API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -33,15 +33,15 @@ spec:
metadata:
type: object
spec:
description: CloudClientSpec defines the desired state of CloudClient
description: LauncherSpec defines the desired state of Launcher
properties:
description:
type: string
name:
type: string
type: object
status:
description: CloudClientStatus defines the observed state of CloudClient
description: LauncherStatus defines the observed state of Launcher
type: object
type: object
served: true
Expand Down
56 changes: 56 additions & 0 deletions controllers/cloud/config/crd/bases/cloud.sealos.io_launchers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: launchers.cloud.sealos.io
spec:
group: cloud.sealos.io
names:
kind: Launcher
listKind: LauncherList
plural: launchers
singular: launcher
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: Launcher is the Schema for the launchers 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: LauncherSpec defines the desired state of Launcher
properties:
description:
type: string
name:
type: string
type: object
status:
description: LauncherStatus defines the observed state of Launcher
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
6 changes: 3 additions & 3 deletions controllers/cloud/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
# It should be run by config/default
resources:
- bases/cloud.sealos.io_licenses.yaml
- bases/cloud.sealos.io_cloudclients.yaml
- bases/cloud.sealos.io_launchers.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_licenses.yaml
#- patches/webhook_in_cloudclients.yaml
#- patches/webhook_in_launchers.yaml
#+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
#- patches/cainjection_in_licenses.yaml
#- patches/cainjection_in_cloudclients.yaml
#- patches/cainjection_in_launchers.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
name: cloudclients.cloud.sealos.io
name: launchers.cloud.sealos.io
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: cloudclients.cloud.sealos.io
name: launchers.cloud.sealos.io
spec:
conversion:
strategy: Webhook
Expand Down
2 changes: 1 addition & 1 deletion controllers/cloud/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ data:
}
---
apiVersion: cloud.sealos.io/v1
kind: CloudClient
kind: Launcher
metadata:
name: start
namespace: cloud-system
Expand Down
10 changes: 5 additions & 5 deletions controllers/cloud/config/rbac/cloudclient_editor_role.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# permissions for end users to edit cloudclients.
# permissions for end users to edit launchers.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: cloudclient-editor-role
app.kubernetes.io/instance: launcher-editor-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: cloud-controller
app.kubernetes.io/part-of: cloud-controller
app.kubernetes.io/managed-by: kustomize
name: cloudclient-editor-role
name: launcher-editor-role
rules:
- apiGroups:
- cloud.sealos.io
resources:
- cloudclients
- launchers
verbs:
- create
- delete
Expand All @@ -26,6 +26,6 @@ rules:
- apiGroups:
- cloud.sealos.io
resources:
- cloudclients/status
- launchers/status
verbs:
- get
Loading

0 comments on commit 970bcc4

Please sign in to comment.