Skip to content

Commit

Permalink
add karmada operator init workflow
Browse files Browse the repository at this point in the history
Signed-off-by: calvin <[email protected]>
  • Loading branch information
calvin committed Feb 14, 2023
1 parent c9886a0 commit 854a6cb
Show file tree
Hide file tree
Showing 43 changed files with 4,516 additions and 13 deletions.
1 change: 1 addition & 0 deletions operator/cmd/operator/app/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func init() {

func startKarmadaController(ctx ctrlctx.Context) (bool, error) {
ctrl := &karmada.Controller{
Config: ctx.Manager.GetConfig(),
Client: ctx.Manager.GetClient(),
EventRecorder: ctx.Manager.GetEventRecorderFor(karmada.ControllerName),
}
Expand Down
8 changes: 4 additions & 4 deletions operator/config/crds/operator.karmada.io_karmadas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,10 @@ spec:
description: ServiceSubnet is the subnet used by k8s services.
Defaults to "10.96.0.0/12".
type: string
serviceType:
description: ServiceType represents the service type of karmada
apiserver. it is Nodeport by default.
type: string
type: object
karmadaAggregratedAPIServer:
description: KarmadaAggregratedAPIServer holds settings to karmada-aggregated-apiserver
Expand Down Expand Up @@ -774,10 +778,6 @@ spec:
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
serviceType:
description: ServiceType represents the service type of karmada
apiserver. it is Nodeport by default.
type: string
type: object
karmadaControllerManager:
description: KarmadaControllerManager holds settings to karmada-controller-manager
Expand Down
33 changes: 33 additions & 0 deletions operator/config/deploy/karmada-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: karmada-operator
namespace: karmada-system
labels:
karmada-app: karmada-operator
spec:
replicas: 1
selector:
matchLabels:
karmada-app: karmada-operator
template:
metadata:
labels:
karmada-app: karmada-operator
spec:
containers:
- name: karmada-operator
image: release.daocloud.io/karmada/karmada-operator:v0.0.1-rc
imagePullPolicy: IfNotPresent
command:
- /bin/karmada-operator
- --kubeconfig=/etc/config
- --v=4
volumeMounts:
- name: kubeconfig
mountPath: /etc/config
subPath: config
volumes:
- name: kubeconfig
secret:
secretName: my-kubeconfig
5 changes: 5 additions & 0 deletions operator/config/samples/karmada.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: operator.karmada.io/v1alpha1
kind: Karmada
metadata:
namespace: test
name: karmada-demo
18 changes: 18 additions & 0 deletions operator/pkg/apis/operator/v1alpha1/helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v1alpha1

import (
"fmt"
)

// CreateImage return image object. the component is represents karmada components name.
func CreateImage(repository, component, tag string) Image {
return Image{
ImageRepository: fmt.Sprintf("%s/%s", repository, component),
ImageTag: tag,
}
}

// String retrun the image name.
func (image *Image) String() string {
return fmt.Sprintf("%s:%s", image.ImageRepository, image.ImageTag)
}
10 changes: 5 additions & 5 deletions operator/pkg/apis/operator/v1alpha1/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ type KarmadaAPIServer struct {
// +optional
ServiceSubnet *string `json:"serviceSubnet,omitempty"`

// ServiceType represents the service type of karmada apiserver.
// it is Nodeport by default.
// +optional
ServiceType corev1.ServiceType `json:"serviceType,omitempty"`

// ExtraArgs is an extra set of flags to pass to the kube-apiserver component or
// override. A key in this map is the flag name as it appears on the command line except
// without leading dash(es).
Expand Down Expand Up @@ -270,11 +275,6 @@ type KarmadaAggregratedAPIServer struct {
// +optional
CertSANs []string `json:"certSANs,omitempty"`

// ServiceType represents the service type of karmada apiserver.
// it is Nodeport by default.
// +optional
ServiceType corev1.ServiceType `json:"serviceType,omitempty"`

// FeatureGates enabled by the user.
// - CustomizedClusterResourceModeling: https://karmada.io/docs/userguide/scheduling/cluster-resources#start-to-use-cluster-resource-models
// More info: https://github.com/karmada-io/karmada/blob/master/pkg/features/features.go
Expand Down
Loading

0 comments on commit 854a6cb

Please sign in to comment.