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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
65 changes: 65 additions & 0 deletions fleetconfig-controller/api/v1alpha1/fleetconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ package v1alpha1

import (
"fmt"
"maps"
"reflect"
"sort"
"time"

"open-cluster-management.io/ocm/pkg/operator/helpers/chart"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -540,6 +545,66 @@ type Klusterlet struct {
// +kubebuilder:default:={}
// +optional
Source OCMSource `json:"source,omitzero"`

// Values for the klusterlet Helm chart.
// +optional
Values *KlusterletChartConfig `json:"values,omitempty"`
}

// KlusterletChartConfig is a wrapper around the external chart.KlusterletChartConfig
// to provide the required DeepCopy methods for code generation.
type KlusterletChartConfig struct {
chart.KlusterletChartConfig `json:",inline"`
}

// DeepCopy returns a deep copy of the KlusterletChartConfig.
func (k *KlusterletChartConfig) DeepCopy() *KlusterletChartConfig {
if k == nil {
return nil
}
out := new(KlusterletChartConfig)
k.DeepCopyInto(out)
return out
}

// DeepCopyInto copies all properties of this object into another object of the
// same type that is provided as a pointer.
func (k *KlusterletChartConfig) DeepCopyInto(out *KlusterletChartConfig) {
*out = *k

out.KlusterletChartConfig = k.KlusterletChartConfig

if k.NodeSelector != nil {
k, out := &k.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*k))
maps.Copy(*out, *k)
}
if k.Tolerations != nil {
k, out := &k.Tolerations, &out.Tolerations
*out = make([]corev1.Toleration, len(*k))
for i := range *k {
(*k)[i].DeepCopyInto(&(*out)[i])
}
}

k.Affinity.DeepCopyInto(&out.Affinity)
k.Resources.DeepCopyInto(&out.Resources)
k.PodSecurityContext.DeepCopyInto(&out.PodSecurityContext)
k.SecurityContext.DeepCopyInto(&out.SecurityContext)

out.Images = k.Images
out.Klusterlet = k.Klusterlet

if k.MultiHubBootstrapHubKubeConfigs != nil {
k, out := &k.MultiHubBootstrapHubKubeConfigs, &out.MultiHubBootstrapHubKubeConfigs
*out = make([]chart.BootStrapKubeConfig, len(*k))
copy(*out, *k)
}
}

// IsEmpty checks if the KlusterletChartConfig is empty/default/zero-valued
func (k *KlusterletChartConfig) IsEmpty() bool {
return reflect.DeepEqual(*k, KlusterletChartConfig{})
}

// ResourceSpec defines resource limits and requests for all managed clusters.
Expand Down
6 changes: 6 additions & 0 deletions fleetconfig-controller/api/v1alpha1/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import (
// - spec.addOnConfig
// - spec.registrationAuth.*
// - spec.hub.clusterManager.source.*
// - spec.spokes[*].klusterlet.annotations
// - spec.spokes[*].klusterlet.source.*
// - spec.spokes[*].klusterlet.values
// - spec.spokes[*].addOns
func allowFleetConfigUpdate(newObject *FleetConfig, oldObject *FleetConfig) error {

Expand Down Expand Up @@ -57,8 +59,12 @@ func allowFleetConfigUpdate(newObject *FleetConfig, oldObject *FleetConfig) erro
if oldSpoke, exists := oldSpokes[newSpoke.Name]; exists {
oldSpokeCopy := oldSpoke
newSpokeCopy := newSpoke
newSpokeCopy.Klusterlet.Annotations = nil
oldSpokeCopy.Klusterlet.Annotations = nil
oldSpokeCopy.Klusterlet.Source = (OCMSource{})
newSpokeCopy.Klusterlet.Source = (OCMSource{})
oldSpokeCopy.Klusterlet.Values = nil
newSpokeCopy.Klusterlet.Values = nil
newSpokeCopy.AddOns = []AddOn{}
oldSpokeCopy.AddOns = []AddOn{}

Expand Down
4 changes: 4 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.

2 changes: 1 addition & 1 deletion fleetconfig-controller/build/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ARG ARCH
RUN apk update && apk add --no-cache bash curl

# Install clusteradm
ARG CLUSTERADM_VERSION=1.0.0
ARG CLUSTERADM_VERSION=1.0.1
RUN curl -L https://raw.githubusercontent.com/open-cluster-management-io/clusteradm/main/install.sh | bash -s -- ${CLUSTERADM_VERSION}

## Stage 3: Compress binaries with upx to reduce image size
Expand Down
2 changes: 1 addition & 1 deletion fleetconfig-controller/build/Dockerfile.eks
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ARG ARCH
RUN apk update && apk add --no-cache bash curl

# Install clusteradm
ARG CLUSTERADM_VERSION=1.0.0
ARG CLUSTERADM_VERSION=1.0.1
RUN curl -L https://raw.githubusercontent.com/open-cluster-management-io/clusteradm/main/install.sh | bash -s -- ${CLUSTERADM_VERSION}

# Install aws-iam-authenticator
Expand Down
2 changes: 1 addition & 1 deletion fleetconfig-controller/build/Dockerfile.gke
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ARG ARCH
RUN apk update && apk add --no-cache bash curl

# Install clusteradm
ARG CLUSTERADM_VERSION=1.0.0
ARG CLUSTERADM_VERSION=1.0.1
RUN curl -L https://raw.githubusercontent.com/open-cluster-management-io/clusteradm/main/install.sh | bash -s -- ${CLUSTERADM_VERSION}

## Stage 3: Compress binaries with upx to reduce image size
Expand Down
Loading
Loading