/*
 * Copyright 2005-2014 Red Hat, Inc.                                    
 *                                                                      
 * Red Hat licenses this file to you under the Apache License, version  
 * 2.0 (the "License"); you may not use this file except in compliance  
 * with the License.  You may obtain a copy of the License at           
 *                                                                      
 *    http://www.apache.org/licenses/LICENSE-2.0                        
 *                                                                      
 * Unless required by applicable law or agreed to in writing, software  
 * distributed under the License is distributed on an "AS IS" BASIS,    
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or      
 * implied.  See the License for the specific language governing        
 * permissions and limitations under the License.
 */

package io.fabric8.spring.boot.condition;

import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class OnKubernetesAvailableCondition extends SpringBootCondition {

    private final String KUBERNETES_MASTER = "KUBERNETES_MASTER";

    @Override
    public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
        if (System.getenv().containsKey(KUBERNETES_MASTER)) {
            return ConditionOutcome.match();
        } else if (System.getProperties().containsKey(KUBERNETES_MASTER)) {
            return ConditionOutcome.match();
        }
        return ConditionOutcome.noMatch("Url to kubernetes master, not found in environment variables or system properties.");
    }
}

@@ -970,16 +970,68 @@
 ition;%0A%0A
+import io.fabric8.kubernetes.api.KubernetesFactory;%0A
 import o
@@ -1377,74 +1377,8 @@
  %7B%0A%0A
-    private final String KUBERNETES_MASTER = %22KUBERNETES_MASTER%22;%0A
 %0A   
@@ -1524,32 +1524,50 @@
 v().containsKey(
+KubernetesFactory.
 KUBERNETES_MASTE
@@ -1559,32 +1559,40 @@
 UBERNETES_MASTER
+_ENV_VAR
 )) %7B%0A           
@@ -1680,32 +1680,66 @@
 insKey(K
-UBERNETES_MASTER
+ubernetesFactory.KUBERNETES_MASTER_SYSTEM_PROPERTY
 )) %7B%0A   

Fix broken OnKubernetesAvailableCondition.