Skip to content

Commit

Permalink
feat(provider/k8s): Prepare these new fileds or files for the statefu… (
Browse files Browse the repository at this point in the history
#1853)

* feat(provider/k8s): Prepare these new fileds or files for the statefulset.

* feat(provider/k8s): Fixed change field name issue.

* feat(provider/k8s): Fixed code duplication.

* feat(provider/k8s): Added back replicaSetAnnotations field.
  • Loading branch information
chlung authored and lwander committed Aug 29, 2017
1 parent 98ec60e commit f648c17
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class KubernetesClientApiConverter {
deployDescription.namespace = statefulSet?.metadata?.namespace
deployDescription.targetSize = statefulSet?.spec?.replicas
deployDescription.securityGroups = []
deployDescription.replicaSetAnnotations = statefulSet?.metadata?.annotations
deployDescription.controllerAnnotations = statefulSet?.metadata?.annotations
deployDescription.podAnnotations = statefulSet?.spec?.template?.metadata?.annotations
deployDescription.volumeClaims = statefulSet?.spec?.getVolumeClaimTemplates()
deployDescription.volumeSources = statefulSet?.spec?.template?.spec?.volumes?.collect {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class KubernetesUtil {
static String DEPRECATED_SERVER_GROUP_KIND = "ReplicationController"
static String SERVER_GROUP_KIND = "ReplicaSet"
static String DEPLOYMENT_KIND = "Deployment"
static String CONTROLLERS_STATEFULSET_KIND = "StatefulSet"
static String CONTROLLERS_DAEMONSET_KIND = "DaemonSet"
static String JOB_LABEL = "job"
@Value("kubernetes.defaultRegistry:gcr.io")
static String DEFAULT_REGISTRY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ import groovy.transform.Canonical
class KubernetesAtomicOperationDescription implements DeployDescription, CredentialsNameable {
String account
KubernetesNamedAccountCredentials credentials
String kind
String apiVersion
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class DeployKubernetesAtomicOperationDescription extends KubernetesAtomicOperati
Capacity capacity
KubernetesScalingPolicy scalingPolicy
Map<String, String> replicaSetAnnotations
Map<String, String> controllerAnnotations
Map<String, String> podAnnotations
Map<String, String> volumeAnnotations
Map<String, String> nodeSelector
KubernetesSecurityContext securityContext
KubernetesDeployment deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.netflix.spinnaker.clouddriver.kubernetes.deploy.exception

/**
* Created by chlung on 8/29/17.
*/
class KubernetesClientOperationException {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright 2017 Cisco, Inc.
*
* Licensed 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 com.netflix.spinnaker.clouddriver.kubernetes.model

import io.fabric8.kubernetes.api.model.HasMetadata
import io.fabric8.kubernetes.api.model.ObjectMeta
import io.kubernetes.client.models.V1ObjectMeta

class KubernetesControllerConverter implements HasMetadata {
String kind
String apiVersion
ObjectMeta metadata

KubernetesControllerConverter(String kind, String apiVersion, V1ObjectMeta metadata) {
this.kind = kind
this.apiVersion = apiVersion

this.metadata = new ObjectMeta()
this.metadata.name = metadata.name
this.metadata.namespace = metadata.namespace
setMetadata(this.metadata)
}

@Override
ObjectMeta getMetadata() {
return this.metadata
}

@Override
void setMetadata(ObjectMeta metadata) {
this.metadata = metadata
}

@Override
String getKind() {
return this.kind
}

@Override
String getApiVersion() {
return this.apiVersion
}
}

0 comments on commit f648c17

Please sign in to comment.