-
Notifications
You must be signed in to change notification settings - Fork 111
[OSJC-240] Set deploymentconfig env vars #115
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
src/main/java/com/openshift/internal/restclient/model/EnvironmentVariable.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 Red Hat, Inc. | ||
* Distributed under license by Red Hat, Inc. All rights reserved. | ||
* This program is made available under the terms of the | ||
* Eclipse Public License v1.0 which accompanies this distribution, | ||
* and is available at http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
******************************************************************************/ | ||
package com.openshift.internal.restclient.model; | ||
|
||
import static com.openshift.internal.util.JBossDmrExtentions.*; | ||
|
||
import java.util.Map; | ||
|
||
import org.jboss.dmr.ModelNode; | ||
|
||
import com.openshift.internal.restclient.model.properties.ResourcePropertyKeys; | ||
import com.openshift.restclient.model.IConfigMapKeySelector; | ||
import com.openshift.restclient.model.IEnvironmentVariable; | ||
import com.openshift.restclient.model.IObjectFieldSelector; | ||
import com.openshift.restclient.model.ISecretKeySelector; | ||
|
||
public class EnvironmentVariable extends ModelNodeAdapter implements IEnvironmentVariable, ResourcePropertyKeys { | ||
|
||
public EnvironmentVariable(ModelNode node, Map<String, String[]> propertyKeys) { | ||
super(node, propertyKeys); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return asString(getNode(), getPropertyKeys(), NAME); | ||
} | ||
|
||
@Override | ||
public String getValue() { | ||
return asString(getNode(), getPropertyKeys(), VALUE); | ||
} | ||
|
||
@Override | ||
public IEnvVarSource getValueFrom() { | ||
if(getNode().hasDefined("fieldRef")) { | ||
return new IObjectFieldSelector(){ | ||
@Override | ||
public String getApiVersion() { | ||
return asString(getNode(), getPropertyKeys(), "fieldRef.apiVersion"); | ||
} | ||
|
||
@Override | ||
public String getFieldPath() { | ||
return asString(getNode(), getPropertyKeys(), "fieldRef.fieldPath"); | ||
} | ||
|
||
}; | ||
}else if(getNode().hasDefined("configMapKeyRef")) { | ||
return new IConfigMapKeySelector() { | ||
|
||
@Override | ||
public String getName() { | ||
return asString(getNode(), getPropertyKeys(), "configMapKeyRef.name"); | ||
} | ||
|
||
@Override | ||
public String getKey() { | ||
return asString(getNode(), getPropertyKeys(), "configMapKeyRef.key"); | ||
} | ||
}; | ||
|
||
}else if(getNode().hasDefined("secretKeyRef")) { | ||
return new ISecretKeySelector() { | ||
|
||
@Override | ||
public String getName() { | ||
return asString(getNode(), getPropertyKeys(), "secretKeyRef.name"); | ||
} | ||
|
||
@Override | ||
public String getKey() { | ||
return asString(getNode(), getPropertyKeys(), "secretKeyRef.key"); | ||
} | ||
}; | ||
} | ||
return null; | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/openshift/restclient/model/IConfigMapKeySelector.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 Red Hat, Inc. | ||
* Distributed under license by Red Hat, Inc. All rights reserved. | ||
* This program is made available under the terms of the | ||
* Eclipse Public License v1.0 which accompanies this distribution, | ||
* and is available at http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
******************************************************************************/ | ||
package com.openshift.restclient.model; | ||
|
||
import com.openshift.restclient.model.IEnvironmentVariable.IEnvVarSource; | ||
|
||
public interface IConfigMapKeySelector extends IEnvVarSource { | ||
|
||
String getName(); | ||
|
||
String getKey(); | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/com/openshift/restclient/model/IEnvironmentVariable.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 Red Hat, Inc. | ||
* Distributed under license by Red Hat, Inc. All rights reserved. | ||
* This program is made available under the terms of the | ||
* Eclipse Public License v1.0 which accompanies this distribution, | ||
* and is available at http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
******************************************************************************/ | ||
package com.openshift.restclient.model; | ||
|
||
/** | ||
* Environment variable representation to | ||
* allow more complex values then | ||
* name/value pairs. An environmentVariable | ||
* will have either a value or valueFrom | ||
* but not both. | ||
* | ||
* @author jeff.cantrill | ||
* | ||
*/ | ||
public interface IEnvironmentVariable { | ||
|
||
/** | ||
* The name of the env var | ||
* @return | ||
*/ | ||
String getName(); | ||
|
||
/** | ||
* The value of the environment variable or null if not | ||
* defined. | ||
* @return | ||
*/ | ||
String getValue(); | ||
|
||
/** | ||
* The ref value or null if not defined | ||
* @return | ||
*/ | ||
IEnvVarSource getValueFrom(); | ||
|
||
/** | ||
* Marker interface for sources of environment variables | ||
* @author jeff.cantrill | ||
* | ||
*/ | ||
static interface IEnvVarSource{ | ||
|
||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/openshift/restclient/model/IObjectFieldSelector.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 Red Hat, Inc. | ||
* Distributed under license by Red Hat, Inc. All rights reserved. | ||
* This program is made available under the terms of the | ||
* Eclipse Public License v1.0 which accompanies this distribution, | ||
* and is available at http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
******************************************************************************/ | ||
package com.openshift.restclient.model; | ||
|
||
import com.openshift.restclient.model.IEnvironmentVariable.IEnvVarSource; | ||
|
||
public interface IObjectFieldSelector extends IEnvVarSource { | ||
|
||
String getApiVersion(); | ||
|
||
String getFieldPath(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/openshift/restclient/model/ISecretKeySelector.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 Red Hat, Inc. | ||
* Distributed under license by Red Hat, Inc. All rights reserved. | ||
* This program is made available under the terms of the | ||
* Eclipse Public License v1.0 which accompanies this distribution, | ||
* and is available at http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
******************************************************************************/ | ||
package com.openshift.restclient.model; | ||
|
||
import com.openshift.restclient.model.IEnvironmentVariable.IEnvVarSource; | ||
|
||
public interface ISecretKeySelector extends IEnvVarSource { | ||
|
||
String getName(); | ||
|
||
String getKey(); | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's correct, looking at a pod, I can see