Skip to content

Commit

Permalink
clusteradm join support resource-qos-class parameter
Browse files Browse the repository at this point in the history
Signed-off-by: haolin <[email protected]>
  • Loading branch information
haolin authored and haowells committed Dec 2, 2023
1 parent 907d161 commit 5f653c4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/cmd/join/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func NewCmd(clusteradmFlags *genericclioptionsclusteradm.ClusteradmFlags, stream
cmd.Flags().BoolVar(&o.singleton, "singleton", false, "If true, deploy singleton mode of klusterlet to have registration and work agents run in a single pod. This is an alpha stage flag.")
cmd.Flags().StringVar(&o.proxyURL, "proxy-url", "", "the URL of a forward proxy server that will be used by agents to connect to the hub cluster.")
cmd.Flags().StringVar(&o.proxyCAFile, "proxy-ca-file", "", "the file path to proxy ca, optional")
cmd.Flags().StringVar(&o.resourceQosClass, "resource-qos-class", "default", "the resource QoS class of the klusterlet pod. Can be one of default or besteffort")

return cmd
}
3 changes: 3 additions & 0 deletions pkg/cmd/join/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ func (o *Options) complete(cmd *cobra.Command, args []string) (err error) {
Name: klusterletName,
KlusterletNamespace: klusterletNamespace,
}
o.values.ResourceRequirement = ResourceRequirement{
Type: o.resourceQosClass,
}
o.values.ManagedKubeconfig = o.managedKubeconfigFile
o.values.RegistrationFeatures = genericclioptionsclusteradm.ConvertToFeatureGateAPI(genericclioptionsclusteradm.SpokeMutableFeatureGate, ocmfeature.DefaultSpokeRegistrationFeatureGates)
o.values.WorkFeatures = genericclioptionsclusteradm.ConvertToFeatureGateAPI(genericclioptionsclusteradm.SpokeMutableFeatureGate, ocmfeature.DefaultSpokeWorkFeatureGates)
Expand Down
10 changes: 10 additions & 0 deletions pkg/cmd/join/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ type Options struct {
//The proxy server ca-file(optional)
proxyCAFile string

// Resource requirement
resourceQosClass string

//Values below are used to fill in yaml files
values Values

Expand All @@ -81,6 +84,8 @@ type Values struct {
Hub Hub
//Klusterlet is the klusterlet related configuration
Klusterlet Klusterlet
//ResourceRequirement is the resource requirement
ResourceRequirement ResourceRequirement
//Registry is the image registry related configuration
Registry string
//bundle version
Expand Down Expand Up @@ -112,6 +117,11 @@ type Klusterlet struct {
KlusterletNamespace string
}

// ResourceRequirement is for templating resource requirement
type ResourceRequirement struct {
Type string
}

type BundleVersion struct {
// registration image version
RegistrationImageVersion string
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/join/scenario/join/klusterlets.cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
{{ if .Klusterlet.APIServer }}
- url: {{ .Klusterlet.APIServer }}
{{ end }}
resourceRequirement:
type: {{ .ResourceRequirement.Type }}
{{if .RegistrationFeatures}}
registrationConfiguration:
featureGates:
Expand Down

0 comments on commit 5f653c4

Please sign in to comment.