diff --git a/charts/yurthub/templates/yurthub-cloud-yurtstaticset.yaml b/charts/yurthub/templates/yurthub-cloud-yurtstaticset.yaml index 40a3abdddcc..a287fac1aa0 100644 --- a/charts/yurthub/templates/yurthub-cloud-yurtstaticset.yaml +++ b/charts/yurthub/templates/yurthub-cloud-yurtstaticset.yaml @@ -11,8 +11,6 @@ spec: metadata: labels: k8s-app: yurt-hub-cloud - name: yurt-hub-cloud - namespace: {{ .Release.Namespace }} spec: volumes: - name: hub-dir diff --git a/charts/yurthub/templates/yurthub-yurtstaticset.yaml b/charts/yurthub/templates/yurthub-yurtstaticset.yaml index e62c0083fbc..172dc91576e 100644 --- a/charts/yurthub/templates/yurthub-yurtstaticset.yaml +++ b/charts/yurthub/templates/yurthub-yurtstaticset.yaml @@ -11,8 +11,6 @@ spec: metadata: labels: k8s-app: yurt-hub - name: yurt-hub - namespace: {{ .Release.Namespace }} spec: volumes: - name: hub-dir diff --git a/pkg/apis/apps/v1alpha1/default.go b/pkg/apis/apps/v1alpha1/default.go index bf7c18d917e..8069f55e412 100644 --- a/pkg/apis/apps/v1alpha1/default.go +++ b/pkg/apis/apps/v1alpha1/default.go @@ -227,6 +227,10 @@ func SetDefaultsYurtStaticSet(obj *YurtStaticSet) { if podSpec != nil { SetDefaultPodSpec(podSpec) } + + // use YurtStaticSet name and namespace to replace name and namespace in template metadata + obj.Spec.Template.Name = obj.Name + obj.Spec.Template.Namespace = obj.Namespace } // SetDefaultsYurtAppDaemon set default values for YurtAppDaemon.