@@ -77,17 +77,9 @@ func (o *InitOptions) Complete(ctx context.Context) error {
7777}
7878
7979func (o * InitOptions ) Run (ctx context.Context ) error {
80- if err := o .PlatformCluster .InitializeClient (install .InstallCRDAPIs (runtime .NewScheme ())); err != nil {
80+ if err := o .PlatformCluster .InitializeClient (install .InstallOperatorAPIsPlatform ( install . InstallCRDAPIs (runtime .NewScheme () ))); err != nil {
8181 return err
8282 }
83- podName := os .Getenv (apiconst .EnvVariablePodName )
84- if podName == "" {
85- return fmt .Errorf ("environment variable %s is not set" , apiconst .EnvVariablePodNamespace )
86- }
87- podNamespace := os .Getenv (apiconst .EnvVariablePodNamespace )
88- if podNamespace == "" {
89- return fmt .Errorf ("environment variable %s is not set" , apiconst .EnvVariablePodNamespace )
90- }
9183
9284 log := o .Log .WithName ("main" )
9385 log .Info ("Environment" , "value" , o .Environment )
@@ -106,6 +98,14 @@ func (o *InitOptions) Run(ctx context.Context) error {
10698 log .Info ("Skipping creation/update of PlatformService for ManagedControlPlane controller" )
10799 } else {
108100 log .Info ("Creating/updating PlatformService for ManagedControlPlane controller" )
101+ podName := os .Getenv (apiconst .EnvVariablePodName )
102+ if podName == "" {
103+ return fmt .Errorf ("environment variable %s is not set" , apiconst .EnvVariablePodName )
104+ }
105+ podNamespace := os .Getenv (apiconst .EnvVariablePodNamespace )
106+ if podNamespace == "" {
107+ return fmt .Errorf ("environment variable %s is not set" , apiconst .EnvVariablePodNamespace )
108+ }
109109
110110 log .Info ("Fetching own pod to determine image" , "name" , podName , "namespace" , podNamespace )
111111 pod := & corev1.Pod {}
0 commit comments