-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(kubernetes): Convert all V2 code in clouddriver-kubernetes t…
…o Java (#3947) * fix(appengine): Fix package name of MutableCacheData At some point the MutableCacheData class was moved to the appengine provider, but the package name still references kubernetes. Update the package name in the class, and all of the references. * refactor(kubernetes): Move shared logic out of V1 provider KubernetesAtomicOperationConverterHelper is used by both the V1 and V2 providers, so should not live in the V1 directory tree; move it up to the base level. KubernetesApiClientConfig is only used by the V1 provider, so it should be moved into the v1 directory tree. * refactor(kubernetes): Convert ConfigurationProperties to Java Also, move the top-level classes in that file to their own files as part of the Java conversion. In order to make this work better with Lombok-generated accessors, change calls to the accessors: booleans should use isXXX instead of getXXX, and change the capialization of getoAuthScopes. * refactor(kubernetes): Convert a few more classes to Java Also, as part of this conversion update KubernetesAtomicOperationConverterHelper to use generics, which avoids a lot of necessary casting and provides extra type safety. This extra type safety surfaced a bug in the resize server group converter where we were incorrectly converting the description to a deploy manifest description which compiled before but no longer does. * refactor(kubernetes): Convert KubernetesCloudProvider to Java Also standardize static access to the ID to just use the public static final field instead of mixing use of the field and the auto-generated static accessor. * refactor(kubernetes): Convert configuration to Java This is the last non-test class in clouddriver-kubernetes that is still in groovy (excluding classes used exclusively by the V1 provider). * refactor(kubernetes): Remove unused Getter annotation
- Loading branch information
Showing
70 changed files
with
536 additions
and
503 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
33 changes: 0 additions & 33 deletions
33
...c/main/groovy/com/netflix/spinnaker/clouddriver/kubernetes/KubernetesCloudProvider.groovy
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...src/main/groovy/com/netflix/spinnaker/clouddriver/kubernetes/KubernetesCloudProvider.java
This file contains 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,41 @@ | ||
/* | ||
* Copyright 2015 Google, 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; | ||
|
||
import com.netflix.spinnaker.clouddriver.core.CloudProvider; | ||
import java.lang.annotation.Annotation; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** Kubernetes declaration as a {@link CloudProvider}. */ | ||
@Component | ||
public class KubernetesCloudProvider implements CloudProvider { | ||
public static final String ID = "kubernetes"; | ||
|
||
@Override | ||
public String getId() { | ||
return ID; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Kubernetes"; | ||
} | ||
|
||
@Override | ||
public Class<? extends Annotation> getOperationAnnotationType() { | ||
return KubernetesOperation.class; | ||
} | ||
} |
This file contains 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
28 changes: 28 additions & 0 deletions
28
.../groovy/com/netflix/spinnaker/clouddriver/kubernetes/config/CustomKubernetesResource.java
This file contains 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,28 @@ | ||
/* | ||
* Copyright 2019 Google, 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.config; | ||
|
||
import com.netflix.spinnaker.clouddriver.kubernetes.v2.description.KubernetesSpinnakerKindMap; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class CustomKubernetesResource { | ||
private String kubernetesKind; | ||
private String spinnakerKind = KubernetesSpinnakerKindMap.SpinnakerKind.UNCLASSIFIED.toString(); | ||
private String deployPriority = "100"; | ||
private boolean versioned = false; | ||
private boolean namespaced = true; | ||
} |
24 changes: 24 additions & 0 deletions
24
...n/groovy/com/netflix/spinnaker/clouddriver/kubernetes/config/KubernetesCachingPolicy.java
This file contains 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,24 @@ | ||
/* | ||
* Copyright 2019 Google, 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.config; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class KubernetesCachingPolicy { | ||
private String kubernetesKind; | ||
private int maxEntriesPerAgent; | ||
} |
94 changes: 0 additions & 94 deletions
94
.../netflix/spinnaker/clouddriver/kubernetes/config/KubernetesConfigurationProperties.groovy
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
...om/netflix/spinnaker/clouddriver/kubernetes/config/KubernetesConfigurationProperties.java
This file contains 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,65 @@ | ||
/* | ||
* Copyright 2019 Google, 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.config; | ||
|
||
import com.netflix.spinnaker.clouddriver.security.ProviderVersion; | ||
import com.netflix.spinnaker.fiat.model.resources.Permissions; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class KubernetesConfigurationProperties { | ||
private static final int DEFAULT_CACHE_THREADS = 1; | ||
private List<ManagedAccount> accounts = new ArrayList<>(); | ||
|
||
@Data | ||
public static class ManagedAccount { | ||
private String name; | ||
private ProviderVersion providerVersion = ProviderVersion.v1; | ||
private String environment; | ||
private String accountType; | ||
private String context; | ||
private String cluster; | ||
private String oAuthServiceAccount; | ||
private List<String> oAuthScopes; | ||
private String user; | ||
private String kubeconfigFile; | ||
private String kubeconfigContents; | ||
private String kubectlExecutable; | ||
private Integer kubectlRequestTimeoutSeconds; | ||
private boolean serviceAccount = false; | ||
private boolean configureImagePullSecrets = true; | ||
private List<String> namespaces = new ArrayList<>(); | ||
private List<String> omitNamespaces = new ArrayList<>(); | ||
private String skin; | ||
private int cacheThreads = DEFAULT_CACHE_THREADS; | ||
private List<LinkedDockerRegistryConfiguration> dockerRegistries; | ||
private List<String> requiredGroupMembership = new ArrayList<>(); | ||
private Permissions.Builder permissions = new Permissions.Builder(); | ||
private String namingStrategy = "kubernetesAnnotations"; | ||
private boolean debug = false; | ||
private boolean metrics = true; | ||
private boolean checkPermissionsOnStartup = true; | ||
private List<CustomKubernetesResource> customResources = new ArrayList<>(); | ||
private List<KubernetesCachingPolicy> cachingPolicies = new ArrayList<>(); | ||
private List<String> kinds = new ArrayList<>(); | ||
private List<String> omitKinds = new ArrayList<>(); | ||
private boolean onlySpinnakerManaged = false; | ||
private boolean liveManifestCalls = false; | ||
private Long cacheIntervalSeconds; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...om/netflix/spinnaker/clouddriver/kubernetes/config/LinkedDockerRegistryConfiguration.java
This file contains 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,26 @@ | ||
/* | ||
* Copyright 2019 Google, 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.config; | ||
|
||
import java.util.List; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class LinkedDockerRegistryConfiguration { | ||
private String accountName; | ||
private List<String> namespaces; | ||
} |
Oops, something went wrong.