Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update image limit #55

Merged
merged 1 commit into from
Aug 31, 2021
Merged
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
update image limit
  • Loading branch information
MegaByte875 committed Aug 31, 2021
commit b5791a1edd6cc47b415c15ea7130b2a28afa87f5
10 changes: 10 additions & 0 deletions pkg/controller/component/graphd_cluster.go
Original file line number Diff line number Diff line change
@@ -93,6 +93,16 @@ func (c *graphdCluster) syncGraphdWorkload(nc *v1alpha1.NebulaCluster) error {
return err
}

if nc.Status.Graphd.Version != "" {
oldImage := nc.Spec.Graphd.Image + ":" + nc.Status.Graphd.Version
if err := extender.SetContainerImage(
newWorkload,
nc.GraphdComponent().Type().String(),
oldImage); err != nil {
return err
}
}

if err := extender.SetTemplateAnnotations(
newWorkload,
map[string]string{annotation.AnnPodConfigMapHash: cmHash}); err != nil {
10 changes: 10 additions & 0 deletions pkg/controller/component/metad_cluster.go
Original file line number Diff line number Diff line change
@@ -99,6 +99,16 @@ func (c *metadCluster) syncMetadWorkload(nc *v1alpha1.NebulaCluster) error {
return err
}

if nc.Status.Metad.Version != "" {
oldImage := nc.Spec.Metad.Image + ":" + nc.Status.Metad.Version
if err := extender.SetContainerImage(
newWorkload,
nc.MetadComponent().Type().String(),
oldImage); err != nil {
return err
}
}

if err := extender.SetTemplateAnnotations(
newWorkload,
map[string]string{annotation.AnnPodConfigMapHash: cmHash}); err != nil {
10 changes: 10 additions & 0 deletions pkg/controller/component/storaged_cluster.go
Original file line number Diff line number Diff line change
@@ -102,6 +102,16 @@ func (c *storagedCluster) syncStoragedWorkload(nc *v1alpha1.NebulaCluster) error
return err
}

if nc.Status.Storaged.Version != "" {
oldImage := nc.Spec.Storaged.Image + ":" + nc.Status.Storaged.Version
if err := extender.SetContainerImage(
newWorkload,
nc.StoragedComponent().Type().String(),
oldImage); err != nil {
return err
}
}

if err := extender.SetTemplateAnnotations(
newWorkload,
map[string]string{annotation.AnnPodConfigMapHash: cmHash}); err != nil {
17 changes: 17 additions & 0 deletions pkg/controller/nebulacluster/nebula_cluster_control.go
Original file line number Diff line number Diff line change
@@ -65,6 +65,11 @@ func (c *defaultNebulaClusterControl) UpdateNebulaCluster(nc *v1alpha1.NebulaClu
var errs []error
oldStatus := nc.Status.DeepCopy()

c.resetImage(nc)
if err := c.nebulaClient.UpdateNebulaCluster(nc.DeepCopy()); err != nil {
errs = append(errs, err)
}

if err := c.updateNebulaCluster(nc); err != nil {
errs = append(errs, err)
}
@@ -112,6 +117,18 @@ func (c *defaultNebulaClusterControl) updateNebulaCluster(nc *v1alpha1.NebulaClu
return nil
}

func (c *defaultNebulaClusterControl) resetImage(nc *v1alpha1.NebulaCluster) {
if nc.Status.Graphd.Version != "" {
nc.Spec.Graphd.Version = nc.Status.Graphd.Version
}
if nc.Status.Metad.Version != "" {
nc.Spec.Metad.Version = nc.Status.Metad.Version
}
if nc.Status.Storaged.Version != "" {
nc.Spec.Storaged.Version = nc.Status.Storaged.Version
}
}

type FakeClusterControl struct {
err error
}