Skip to content

Commit

Permalink
Update Services Status for ManagedCluster & MultiClusterService
Browse files Browse the repository at this point in the history
  • Loading branch information
wahabmk committed Oct 25, 2024
1 parent d00fe40 commit 566a97a
Show file tree
Hide file tree
Showing 11 changed files with 601 additions and 66 deletions.
2 changes: 2 additions & 0 deletions api/v1alpha1/managedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ type ManagedClusterSpec struct {

// ManagedClusterStatus defines the observed state of ManagedCluster
type ManagedClusterStatus struct {
// Services contains details for the state of services.
Services []ServiceStatus `json:"services,omitempty"`
// Currently compatible exact Kubernetes version of the cluster. Being set only if
// provided by the corresponding ClusterTemplate.
KubernetesVersion string `json:"k8sVersion,omitempty"`
Expand Down
32 changes: 25 additions & 7 deletions api/v1alpha1/multiclusterservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ const (
MultiClusterServiceFinalizer = "hmc.mirantis.com/multicluster-service"
// MultiClusterServiceKind is the string representation of a MultiClusterServiceKind.
MultiClusterServiceKind = "MultiClusterService"

// SveltosProfileReadyCondition indicates if the Sveltos Profile is ready.
SveltosProfileReadyCondition = "SveltosProfileReady"
// SveltosClusterProfileReadyCondition indicates if the Sveltos ClusterProfile is ready.
SveltosClusterProfileReadyCondition = "SveltosClusterProfileReady"
// SveltosHelmReleaseReadyCondition indicates if the HelmRelease
// managed by a Sveltos Profile/ClusterProfile is ready.
SveltosHelmReleaseReadyCondition = "SveltosHelmReleaseReady"
)

// ServiceSpec represents a Service to be managed
Expand Down Expand Up @@ -74,14 +82,24 @@ type MultiClusterServiceSpec struct {
StopOnConflict bool `json:"stopOnConflict,omitempty"`
}

// MultiClusterServiceStatus defines the observed state of MultiClusterService
//
// TODO(https://github.com/Mirantis/hmc/issues/460):
// If this status ends up being common with ManagedClusterStatus,
// then make a common status struct that can be shared by both.
// ServiceStatus contains details for the state of services.
type ServiceStatus struct {
// ClusterName is the name of the associated cluster.
ClusterName string `json:"clusterName"`
// ClusterNamespace is the namespace of the associated cluster.
ClusterNamespace string `json:"clusterNamespace,omitempty"`
// Conditions contains details for the current state of managed services.
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// MultiClusterServiceStatus defines the observed state of MultiClusterService.
type MultiClusterServiceStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Services contains details for the state of services.
Services []ServiceStatus `json:"services,omitempty"`
// Conditions contains details for the current state of the ManagedCluster
Conditions []metav1.Condition `json:"conditions,omitempty"`
// ObservedGeneration is the last observed generation.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
45 changes: 44 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

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

11 changes: 10 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/onsi/gomega v1.34.2
github.com/opencontainers/go-digest v1.0.1-0.20231025023718-d50d2fec9c98
github.com/projectsveltos/addon-controller v0.40.0
github.com/projectsveltos/libsveltos v0.40.0
github.com/projectsveltos/libsveltos v0.40.1-0.20241021121909-261d0f1307b6
github.com/segmentio/analytics-go v3.1.0+incompatible
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -56,6 +56,7 @@ require (
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cyphar/filepath-securejoin v0.3.3 // indirect
github.com/dariubs/percent v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v27.3.1+incompatible // indirect
Expand All @@ -72,8 +73,11 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fluxcd/pkg/apis/acl v0.3.0 // indirect
github.com/fluxcd/pkg/apis/kustomize v1.6.1 // indirect
github.com/fluxcd/pkg/http/fetch v0.12.1 // indirect
github.com/fluxcd/pkg/tar v0.8.1 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/gdexlab/go-render v1.0.1 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
Expand Down Expand Up @@ -108,6 +112,7 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.10 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/lib/pq v1.10.9 // indirect
Expand All @@ -127,6 +132,7 @@ require (
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/opencontainers/go-digest/blake3 v0.0.0-20240426182413-22b78e47854a // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand All @@ -151,6 +157,8 @@ require (
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect
github.com/yuin/gopher-lua v1.1.1 // indirect
github.com/zeebo/blake3 v0.2.4 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
Expand All @@ -177,6 +185,7 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/apiserver v0.31.1 // indirect
k8s.io/cli-runtime v0.31.1 // indirect
k8s.io/cluster-bootstrap v0.31.1 // indirect
k8s.io/component-base v0.31.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 // indirect
Expand Down
Loading

0 comments on commit 566a97a

Please sign in to comment.