Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions fleetconfig-controller/api/v1alpha1/fleetconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type FleetConfigSpec struct {
Hub Hub `json:"hub"`
Spokes []Spoke `json:"spokes"`
RegistrationAuth *RegistrationAuth `json:"registrationAuth,omitempty"`
AddOnConfigs []*AddOnConfig `json:"addOnConfigs,omitempty"`
}

// FleetConfigStatus defines the observed state of FleetConfig.
Expand Down Expand Up @@ -306,6 +307,21 @@ type Spoke struct {
// ClusterARN is the ARN of the spoke cluster.
// This field is optionally used for AWS IRSA registration authentication.
ClusterARN string `json:"clusterARN,omitempty"`

// AddOns are the add-ons to enable for the spoke cluster.
AddOns []AddOn `json:"addOns,omitempty"`
}

// AddOn enables add-on installation on the cluster.
type AddOn struct {
// The name of the add-on being enabled. Must match one of the default or manually configured add-on names.
ConfigName string `json:"configName"`

// The namespace to install the add-on in. If left empty, installs into the "open-cluster-management-addon" namespace.
InstallNamespace string `json:"installNamespace,omitempty"`

// Optional annotations to apply to the add-on.
Annotations map[string]string `json:"annotations,omitempty"`
}

// JoinType returns a status condition type indicating that a particular Spoke cluster has joined the Hub.
Expand Down Expand Up @@ -450,6 +466,31 @@ type RegistrationAuth struct {
AutoApprovedARNPatterns []string `json:"autoApprovedARNPatterns,omitempty"`
}

// AddOnConfig is the configuration of a custom AddOn that can be installed on a cluster.
type AddOnConfig struct {
// The name of the add-on.
Name string `json:"name"`

// The add-on version. Optional, defaults to "v0.0.1"
// +optional
// +kubebuilder:default:="v0.0.1"
Version string `json:"version,omitempty"`

// The rolebinding to the clusterrole in the cluster namespace for the addon agent
// +optional
ClusterRoleBinding string `json:"clusterRoleBinding,omitempty"`

// Enable the agent to register to the hub cluster. Optional, defaults to false.
// +optional
// +kubebuilder:default:=false
HubRegistration bool `json:"hubRegistration,omitempty"`

// Whether to overwrite the add-on if it already exists. Optional, defaults to false.
// +optional
// +kubebuilder:default:=false
Overwrite bool `json:"overwrite,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.phase`
Expand Down
55 changes: 55 additions & 0 deletions fleetconfig-controller/api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,36 @@ spec:
spec:
description: FleetConfigSpec defines the desired state of FleetConfig.
properties:
addOnConfigs:
items:
description: AddOnConfig is the configuration of a custom AddOn
that can be installed on a cluster.
properties:
clusterRoleBinding:
description: The rolebinding to the clusterrole in the cluster
namespace for the addon agent
type: string
hubRegistration:
default: false
description: Enable the agent to register to the hub cluster.
Optional, defaults to false.
type: boolean
name:
description: The name of the add-on.
type: string
overwrite:
default: false
description: Whether to overwrite the add-on if it already exists.
Optional, defaults to false.
type: boolean
version:
default: v0.0.1
description: The add-on version. Optional, defaults to "v0.0.1"
type: string
required:
- name
type: object
type: array
hub:
description: Hub provides specifications for an OCM hub cluster.
properties:
Expand Down Expand Up @@ -281,6 +311,31 @@ spec:
description: Spoke provides specifications for joining and potentially
upgrading spokes.
properties:
addOns:
description: AddOns are the add-ons to enable for the spoke
cluster.
items:
description: AddOn enables add-on installation on the cluster.
properties:
annotations:
additionalProperties:
type: string
description: Optional annotations to apply to the add-on.
type: object
configName:
description: The name of the add-on being enabled. Must
match one of the default or manually configured add-on
names.
type: string
installNamespace:
description: The namespace to install the add-on in. If
left empty, installs into the "open-cluster-management-addon"
namespace.
type: string
required:
- configName
type: object
type: array
ca:
description: Hub cluster CA certificate, optional
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,7 @@ spec:
source:
bundleVersion: {{ $.Values.fleetConfig.source.bundleVersion }}
registry: {{ $.Values.fleetConfig.source.registry }}
addOns: {{- toYaml .addOns | nindent 8 }}
{{- end }}
addOnConfigs: {{- toYaml .Values.fleetConfig.addOnConfigs | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.fleetConfig.addOns }}
{{ $addOns := .Values.fleetConfig.addOns }}
apiVersion: v1
kind: ConfigMap
metadata:
name: fleet-add-ons
namespace: {{ .Release.Namespace }}
data:
{{- range $addOns }}
{{- if or (hasPrefix "http://" .manifests) (hasPrefix "https://" .manifests) (hasPrefix "oci://" .manifests) }}
{{ .name }}: {{ .manifests }}
{{- else }}
{{ .name }}: |-
{{- .manifests | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
23 changes: 23 additions & 0 deletions fleetconfig-controller/charts/fleetconfig-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,29 @@ fleetConfig:
# # Options: [ Default | BestEffort | ResourceRequirement ].
# qosClass: "Default"
singleton: false
# Add-on configuration for the spoke cluster.
# ## @param fleetConfig.spokes[0].addOns[0].name Name of the add-on.
# ## @param fleetConfig.spokes[0].addOns[0].installNamespace Namespace to install the add-on.
# ## @param fleetConfig.spokes[0].addOns[0].annotations Annotations to apply to the add-on.
# addOns:
# - name: ""
# installNamespace: ""
# annotations: {}

# Global add-on configuration for the hub cluster.
# ## @param fleetConfig.addOnConfigs[0].name Name of the add-on.
# ## @param fleetConfig.addOnConfigs[0].manifests Manifests to install. Can either be inline or a URL.
# ## @param fleetConfig.addOnConfigs[0].version Version of the add-on.
# ## @param fleetConfig.addOnConfigs[0].clusterRoleBinding Cluster role binding to apply to the add-on.
# ## @param fleetConfig.addOnConfigs[0].hubRegistration Enable the agent to register to the hub cluster.
# ## @param fleetConfig.addOnConfigs[0].overwrite Whether to overwrite the add-on if it already exists.
# addOnConfigs:
# - name: ""
# manifests: ""
# version: "v0.0.1"
# clusterRoleBinding: ""
# hubRegistration: false
# overwrite: false

## @section Topology Resources

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,36 @@ spec:
spec:
description: FleetConfigSpec defines the desired state of FleetConfig.
properties:
addOnConfigs:
items:
description: AddOnConfig is the configuration of a custom AddOn
that can be installed on a cluster.
properties:
clusterRoleBinding:
description: The rolebinding to the clusterrole in the cluster
namespace for the addon agent
type: string
hubRegistration:
default: false
description: Enable the agent to register to the hub cluster.
Optional, defaults to false.
type: boolean
name:
description: The name of the add-on.
type: string
overwrite:
default: false
description: Whether to overwrite the add-on if it already exists.
Optional, defaults to false.
type: boolean
version:
default: v0.0.1
description: The add-on version. Optional, defaults to "v0.0.1"
type: string
required:
- name
type: object
type: array
hub:
description: Hub provides specifications for an OCM hub cluster.
properties:
Expand Down Expand Up @@ -271,6 +301,31 @@ spec:
description: Spoke provides specifications for joining and potentially
upgrading spokes.
properties:
addOns:
description: AddOns are the add-ons to enable for the spoke
cluster.
items:
description: AddOn enables add-on installation on the cluster.
properties:
annotations:
additionalProperties:
type: string
description: Optional annotations to apply to the add-on.
type: object
configName:
description: The name of the add-on being enabled. Must
match one of the default or manually configured add-on
names.
type: string
installNamespace:
description: The namespace to install the add-on in. If
left empty, installs into the "open-cluster-management-addon"
namespace.
type: string
required:
- configName
type: object
type: array
ca:
description: Hub cluster CA certificate, optional
type: string
Expand Down
Loading