diff --git a/cmd/controller-manager/main.go b/cmd/controller-manager/main.go
index eb2af239..a72d3ab9 100644
--- a/cmd/controller-manager/main.go
+++ b/cmd/controller-manager/main.go
@@ -115,6 +115,7 @@ MIT 2023 cosmo-workspace/cosmo
Client: mgr.GetClient(),
Recorder: mgr.GetEventRecorderFor(instController),
Scheme: mgr.GetScheme(),
+ Domain: o.TraefikIngressRouteCfg.Domain,
}).SetupWithManager(mgr, controllerFieldManager); err != nil {
setupLog.Error(err, "unable to create controller", "controller", instController)
os.Exit(1)
@@ -132,6 +133,7 @@ MIT 2023 cosmo-workspace/cosmo
Client: mgr.GetClient(),
Recorder: mgr.GetEventRecorderFor(clusterInstController),
Scheme: mgr.GetScheme(),
+ Domain: o.TraefikIngressRouteCfg.Domain,
}).SetupWithManager(mgr, controllerFieldManager); err != nil {
setupLog.Error(err, "unable to create controller", "controller", clusterInstController)
os.Exit(1)
diff --git a/internal/cmd/template/validate.go b/internal/cmd/template/validate.go
index de81618d..00953d98 100644
--- a/internal/cmd/template/validate.go
+++ b/internal/cmd/template/validate.go
@@ -169,7 +169,7 @@ func (o *validateOption) RunE(cmd *cobra.Command, args []string) error {
o.Logr.Info("smoke test: create dummy instance to apply each resources", "instance", dummyInst.GetName())
o.Logr.Debug().DumpObject(o.KosmoClient.Scheme(), &dummyInst, "test instance")
- builts, err := template.BuildObjects(o.tmpl.Spec, &dummyInst)
+ builts, err := template.BuildObjects(o.tmpl.Spec, &dummyInst, "dummy.example.com")
if err != nil {
return fmt.Errorf("failed to build test instance: %w", err)
}
diff --git a/internal/controllers/cluster_instance_controller.go b/internal/controllers/cluster_instance_controller.go
index a651f763..a129895b 100644
--- a/internal/controllers/cluster_instance_controller.go
+++ b/internal/controllers/cluster_instance_controller.go
@@ -24,6 +24,7 @@ type ClusterInstanceReconciler struct {
client.Client
Recorder record.EventRecorder
Scheme *runtime.Scheme
+ Domain string
impl instanceReconciler
}
@@ -53,7 +54,7 @@ func (r *ClusterInstanceReconciler) Reconcile(ctx context.Context, req ctrl.Requ
inst.Status.TemplateResourceVersion = tmpl.ResourceVersion
// 1. Build Unstructured objects
- objects, err := template.BuildObjects(tmpl.Spec, &inst)
+ objects, err := template.BuildObjects(tmpl.Spec, &inst, r.Domain)
if err != nil {
kosmo.InstanceEventf(r.Recorder, &inst, corev1.EventTypeWarning, "BuildFailed", "Failed to build manifests from Template: %v", err)
return ctrl.Result{}, err
diff --git a/internal/controllers/instance_controller.go b/internal/controllers/instance_controller.go
index 52a5c2bb..4a805ba9 100644
--- a/internal/controllers/instance_controller.go
+++ b/internal/controllers/instance_controller.go
@@ -29,6 +29,7 @@ type InstanceReconciler struct {
client.Client
Recorder record.EventRecorder
Scheme *runtime.Scheme
+ Domain string
impl instanceReconciler
}
@@ -63,7 +64,7 @@ func (r *InstanceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
inst.Status.TemplateResourceVersion = tmpl.ResourceVersion
// 1. Build Unstructured objects
- objects, err := template.BuildObjects(tmpl.Spec, &inst)
+ objects, err := template.BuildObjects(tmpl.Spec, &inst, r.Domain)
if err != nil {
kosmo.InstanceEventf(r.Recorder, &inst, corev1.EventTypeWarning, "BuildFailed", "Failed to build manifests from Template: %v", err)
return ctrl.Result{}, err
diff --git a/internal/webhooks/instance_webhook.go b/internal/webhooks/instance_webhook.go
index 612f5ef1..27ab3ff9 100644
--- a/internal/webhooks/instance_webhook.go
+++ b/internal/webhooks/instance_webhook.go
@@ -203,7 +203,7 @@ func (h *InstanceValidationWebhookHandler) Handle(ctx context.Context, req admis
func dryrunReconcile(ctx context.Context, c client.Client, fieldManager string, inst cosmov1alpha1.InstanceObject, tmpl cosmov1alpha1.TemplateObject) []error {
log := clog.FromContext(ctx).WithCaller()
- objects, err := template.BuildObjects(*tmpl.GetSpec(), inst)
+ objects, err := template.BuildObjects(*tmpl.GetSpec(), inst, "dummy.example.com")
if err != nil {
return []error{err}
}
diff --git a/pkg/template/builder.go b/pkg/template/builder.go
index 8e0ff39c..58bc9876 100644
--- a/pkg/template/builder.go
+++ b/pkg/template/builder.go
@@ -15,10 +15,10 @@ type Builder interface {
Build() ([]unstructured.Unstructured, error)
}
-func BuildObjects(tmplSpec cosmov1alpha1.TemplateSpec, inst cosmov1alpha1.InstanceObject) (objects []unstructured.Unstructured, err error) {
+func BuildObjects(tmplSpec cosmov1alpha1.TemplateSpec, inst cosmov1alpha1.InstanceObject, domain string) (objects []unstructured.Unstructured, err error) {
if tmplSpec.RawYaml != "" {
objects, err = NewRawYAMLBuilder(tmplSpec.RawYaml).
- ReplaceDefaultVars(inst).
+ ReplaceDefaultVars(inst, domain).
ReplaceCustomVars(inst).
Build()
if err != nil {
diff --git a/pkg/template/builder_test.go b/pkg/template/builder_test.go
index 0734972c..df7eba4b 100644
--- a/pkg/template/builder_test.go
+++ b/pkg/template/builder_test.go
@@ -122,7 +122,7 @@ spec:
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- gotObjects, err := BuildObjects(tt.args.tmplSpec, tt.args.inst)
+ gotObjects, err := BuildObjects(tt.args.tmplSpec, tt.args.inst, "dummy.example.com")
if (err != nil) != tt.wantErr {
t.Errorf("BuildObjects() error = %v, wantErr %v", err, tt.wantErr)
return
diff --git a/pkg/template/rawyaml.go b/pkg/template/rawyaml.go
index 4aab3ac1..efafa9c2 100644
--- a/pkg/template/rawyaml.go
+++ b/pkg/template/rawyaml.go
@@ -15,6 +15,7 @@ const (
DefaultVarsInstance = "{{INSTANCE}}"
DefaultVarsNamespace = "{{NAMESPACE}}"
DefaultVarsTemplate = "{{TEMPLATE}}"
+ DefaultVarsDomain = "{{DOMAIN}}"
)
var (
@@ -47,9 +48,10 @@ func (t *RawYAMLBuilder) Build() ([]unstructured.Unstructured, error) {
return resources, nil
}
-func (t *RawYAMLBuilder) ReplaceDefaultVars(inst cosmov1alpha1.InstanceObject) *RawYAMLBuilder {
+func (t *RawYAMLBuilder) ReplaceDefaultVars(inst cosmov1alpha1.InstanceObject, domain string) *RawYAMLBuilder {
t.rawYaml = strings.ReplaceAll(t.rawYaml, DefaultVarsInstance, inst.GetName())
t.rawYaml = strings.ReplaceAll(t.rawYaml, DefaultVarsTemplate, inst.GetSpec().Template.Name)
+ t.rawYaml = strings.ReplaceAll(t.rawYaml, DefaultVarsDomain, domain)
if inst.GetScope() == meta.RESTScopeNamespace {
t.rawYaml = strings.ReplaceAll(t.rawYaml, DefaultVarsNamespace, inst.GetNamespace())
diff --git a/pkg/template/rawyaml_test.go b/pkg/template/rawyaml_test.go
index 9ae33f08..2f87426d 100644
--- a/pkg/template/rawyaml_test.go
+++ b/pkg/template/rawyaml_test.go
@@ -375,7 +375,7 @@ func TestRawYAMLBuilder_ReplaceDefaultVars(t *testing.T) {
tr := &RawYAMLBuilder{
rawYaml: tt.fields.rawYaml,
}
- if got := tr.ReplaceDefaultVars(tt.fields.inst); !reflect.DeepEqual(got, tt.want) {
+ if got := tr.ReplaceDefaultVars(tt.fields.inst, "dummy.example.com"); !reflect.DeepEqual(got, tt.want) {
t.Errorf("RawYAMLBuilder.ReplaceDefaultVars() = %v, want %v", got, tt.want)
}
})
diff --git a/web/dashboard-ui/src/App.tsx b/web/dashboard-ui/src/App.tsx
index 357974e6..acfde39e 100644
--- a/web/dashboard-ui/src/App.tsx
+++ b/web/dashboard-ui/src/App.tsx
@@ -11,7 +11,6 @@ import { ProgressProvider } from "./components/ProgressProvider";
import { AuthenticatorManageDialogContext } from "./views/organisms/AuthenticatorManageDialog";
import { EventDetailDialogContext } from "./views/organisms/EventDetailDialog";
import { PasswordChangeDialogContext } from "./views/organisms/PasswordChangeDialog";
-import { UserAddonChangeDialogContext } from "./views/organisms/UserAddonsChangeDialog";
import { UserInfoDialogContext } from "./views/organisms/UserInfoDialog";
import { UserContext } from "./views/organisms/UserModule";
import { UserNameChangeDialogContext } from "./views/organisms/UserNameChangeDialog";
@@ -102,11 +101,9 @@ function App() {
-
-
-
-
-
+
+
+
diff --git a/web/dashboard-ui/src/views/pages/UserPage.tsx b/web/dashboard-ui/src/views/pages/UserPage.tsx
index e37cfcab..9d07fe27 100644
--- a/web/dashboard-ui/src/views/pages/UserPage.tsx
+++ b/web/dashboard-ui/src/views/pages/UserPage.tsx
@@ -102,7 +102,6 @@ const UserMenu: React.VFC<{ user: User }> = ({ user: us }) => {
setAnchorEl(e.currentTarget)}
>
diff --git a/web/dashboard-ui/src/views/templates/PageTemplate.tsx b/web/dashboard-ui/src/views/templates/PageTemplate.tsx
index 616348e0..ca1df016 100644
--- a/web/dashboard-ui/src/views/templates/PageTemplate.tsx
+++ b/web/dashboard-ui/src/views/templates/PageTemplate.tsx
@@ -9,7 +9,6 @@ import {
Menu as MenuIcon,
Notifications,
ReportProblem,
- Settings,
SupervisorAccountTwoTone,
VpnKey,
Warning,
@@ -51,7 +50,6 @@ import { AuthenticatorManageDialogContext } from "../organisms/AuthenticatorMana
import { EventDetailDialogContext } from "../organisms/EventDetailDialog";
import { latestTime } from "../organisms/EventModule";
import { PasswordChangeDialogContext } from "../organisms/PasswordChangeDialog";
-import { UserAddonChangeDialogContext } from "../organisms/UserAddonsChangeDialog";
import { UserInfoDialogContext } from "../organisms/UserInfoDialog";
import {
isAdminRole,
@@ -101,8 +99,6 @@ export const PageTemplate: React.FC<
AuthenticatorManageDialogContext.useDispatch();
const passwordChangeDialogDispach = PasswordChangeDialogContext.useDispatch();
const userNameChangeDialogDispach = UserNameChangeDialogContext.useDispatch();
- const userAddonChangeDialogDispatch =
- UserAddonChangeDialogContext.useDispatch();
const userInfoDialogDispatch = UserInfoDialogContext.useDispatch();
const isAdmin = isAdminUser(loginUser);
const isSignIn = Boolean(loginUser);
@@ -132,12 +128,6 @@ export const PageTemplate: React.FC<
setAnchorEl(null);
};
- const changeAddons = () => {
- console.log("changeAddons");
- userAddonChangeDialogDispatch(true, { user: loginUser! });
- setAnchorEl(null);
- };
-
const openUserInfoDialog = () => {
console.log("openUserInfoDialog");
userInfoDialogDispatch(true, {
@@ -443,14 +433,6 @@ export const PageTemplate: React.FC<
Change DisplayName...
)}
- {isSignIn && isAdmin && (
-
- )}
{isSignIn && (